Law of Cosines

Generalises the Pythagorean theorem to any triangle: c² = a² + b² − 2ab·cos(C). Essential for solving triangles without a right angle.

c² = a² + b² − 2ab cos C — drag the angle to see how c responds
a=5b=7c=6.24C=60°
c² = 5² + 7² − 35.0 = 39.0→c = 6.245
C = 60°

Acute: cos C > 0, so −2ab cos C is negative — c is shorter than the Pythagorean prediction.

Definition

The Law of Cosines generalises the Pythagorean theorem to any triangle. For a triangle with sides aa, bb, cc and angles AA, BB, CC (where angle CC is opposite side cc):

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

Similarly: a2=b2+c2−2bccos⁡Aa^2 = b^2 + c^2 - 2bc\cos A and b2=a2+c2−2accos⁡Bb^2 = a^2 + c^2 - 2ac\cos B.

When C=90°C = 90°: cos⁡90°=0\cos 90° = 0, so c2=a2+b2c^2 = a^2 + b^2 — recovering the Pythagorean theorem. The law of cosines is its generalisation.

When to use it:

  • Given two sides and the included angle (SAS)
  • Given all three sides (SSS) — to find an angle
Finding a missing side (SAS)

A triangle has a=5a = 5, b=7b = 7, and C=60°C = 60°. Find cc.

c2=52+72−2(5)(7)cos⁡60°=25+49−70⋅12=74−35=39c^2 = 5^2 + 7^2 - 2(5)(7)\cos 60° = 25 + 49 - 70 \cdot \frac{1}{2} = 74 - 35 = 39

c=39≈6.24c = \sqrt{39} \approx 6.24

Try it

A triangle has sides a=8a = 8, b=6b = 6, c=10c = 10. Find the angle CC opposite side cc.

Solution

Rearrange the law of cosines for cos⁡C\cos C:

cos⁡C=a2+b2−c22ab=64+36−1002(8)(6)=096=0\cos C = \frac{a^2 + b^2 - c^2}{2ab} = \frac{64 + 36 - 100}{2(8)(6)} = \frac{0}{96} = 0

C=arccos⁡(0)=90°C = \arccos(0) = 90°

This confirms the 66-88-1010 triangle is a right triangle (a multiple of the 33-44-55 triple).

Related concepts