Law of Cosines

Also known as cosine rule

c2=a2+b2−2abcos⁡Cc^2 = a^2 + b^2 - 2ab\cos C

Worked example: Sides 5 m and 8 m at 60° → third side 7 m — press Try an example to run it live, then adjust anything.

Enter your known values, leave one input blank, and solves for the missing one. Tap a variable’s symbol to see what it means, with a typical value. Try different units for next level excitement!

Here the solver did the work — could you?

The cosine law →

Grade 11Grade 11 Math — Functions & Applications

Two forces, one resultant →

Grade 12Grade 12 Math

Test your skills in the Exam Room: new numbers every attempt — free lessons for students, no sign-up, just pure learning. Find 1 more lesson on this formula.

See your Report Card
Compete with your friends
share your results
Learning zone

Law of Cosines explained

Cbac

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\sqrt{64 + 25 - 2 \cdot 8 \cdot 5 \cdot \cos 60^\circ} = \sqrt{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 formula

c2=a2+b2−2abcos⁡Cc^2 = a^2 + b^2 - 2ab\cos C
Where
  • aa= Side a (m)
  • bb= Side b (m)
  • cc= Side c (opposite angle C) (m)
  • CC= Angle C (between a and b) (°)