Law of Cosines

Also known as cosine rule

c2=a2+b22abcosCc^2 = a^2 + b^2 - 2ab\cos C

Enter your known values, leave one input blank, and solves for the missing one. Try different units for next level excitement!

Learning zone

The law of cosines is the Pythagorean theorem with a correction term: when angle C is exactly 90°, cos C vanishes and c² = a² + b² reappears. Open the angle wider and the correction adds length; squeeze it and the correction subtracts. Euclid proved both cases geometrically around 300 BCE, and the Persian astronomer al-Kashi gave the modern trigonometric form in the 1400s — in France the result still carries his name. A surveyor's example: from one station, two landmarks lie 8 km and 5 km away with 60° between the sightlines, so their separation is √(64 + 25 − 2·8·5·cos 60°) = √49 = 7 km.

Solved for the angle, C = arccos((a² + b² − c²)/(2ab)) uses the principal branch of arccos, spanning 0° to 180° — precisely the range of a triangle's interior angle, so the answer is unique with no ambiguous case. The three sides must obey the triangle inequality, or the arccos argument escapes [−1, 1] and no triangle exists.

Law of Cosines
c2=a2+b22abcosCc^2 = a^2 + b^2 - 2ab\cos C
Where
  • aa= Side a
  • bb= Side b
  • cc= Side c (opposite angle C)
  • CC= Angle C (between a and b)