Triangle calculators

Law of Cosines Triangle Calculator

Apply the law of cosines to common oblique triangle cases.

Missing sidesAnglesArea & perimeterStep-by-step formula path

Calculate triangle values

Enter the known values for this triangle case. Results are educational estimates for geometry and measurement problems.

Result

What this calculator does

The law of cosines is useful when you know two sides and the included angle, or when all three sides are known and you need the angles.

SASFind a missing side from two sides and the included angle.
SSSFind angles from three sides.
Formulac² = a² + b² − 2ab cos(C).
For classroom work, check the required rounding rules and whether angles are in degrees or radians. This page uses degrees.

When to use the Law of Cosines

The law of cosines is most useful for two common triangle cases: SAS and SSS. Use it when you know two sides and the included angle and need the third side, or when you know three sides and need the angles.

CaseKnown informationWhat to calculate first
SASTwo sides and the included angleThe missing third side
SSSThree sidesOne angle at a time
Right triangleTwo sides and a 90° anglePythagorean theorem may be simpler

Formula reference

For side c opposite angle C, the law of cosines is:

c² = a² + b² − 2ab cos(C)

To find angle C from three sides, rearrange it as:

cos(C) = (a² + b² − c²) / (2ab)

The calculator uses degrees for the included angle.

Step-by-step SAS example

Suppose side a = 8, side b = 11, and included angle C = 40°. The missing side c is found by substituting into c² = a² + b² − 2ab cos(C). After side c is known, the remaining angles can be solved from the completed side lengths.

  1. Square the two known sides.
  2. Multiply 2 × a × b × cos(C).
  3. Subtract that product from a² + b².
  4. Take the square root to get the missing side.

Common Law of Cosines mistakes

  • The angle must be the included angle between the two known sides for SAS.
  • Use degree mode if your angle is in degrees.
  • Do not use the law of sines first for an SSS case; there is no known angle yet.
  • Check whether the three sides form a valid triangle before calculating angles.

Related triangle calculators

More triangle calculators