Law of Cosines
Also known as cosine rule
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.
- = Side a
- = Side b
- = Side c (opposite angle C)
- = Angle C (between a and b)
- Side a — Law of Sines, Triangle Area (Two Sides and Included Angle)
- Side b — Law of Sines, Triangle Area (Two Sides and Included Angle)
- Side c (opposite angle C) — Right-Triangle Sine Ratio (SOH), Right-Triangle Tangent Ratio (TOA)
- Angle C (between a and b) — Dot Product from Magnitudes and Included Angle, Angle Between Two 2D Vectors (Components)