Law of cosines calculator
Solve triangles using c² = a² + b² − 2ab·cos(C). Enter two sides and the included angle.
Side a
Side b
Angle C (°)
Law of cosines formula
c² = a² + b² − 2ab·cos(C)
This generalizes the Pythagorean theorem. When C = 90°, cos(90°) = 0, and it reduces to c² = a² + b².
When to use law of cosines
SAS (side-angle-side): Two sides and the included angle → find the third side.
SSS (side-side-side): Three sides → find all angles using cos(C) = (a² + b² − c²) / (2ab).
Example: a = 5, b = 7, C = 60°
c² = 25 + 49 − 2(5)(7)cos(60°) = 74 − 35 = 39. c ≈ 6.245.
Then use law of cosines again (or law of sines) to find angles A and B.
Related calculators