A Pythagorean theorem for every triangle
The cosine law works in any triangle:
c² = a² + b² − 2ab cos C
Similarly:
- a² = b² + c² − 2bc cos A
- b² = a² + c² − 2ac cos B
When C = 90°, cos C = 0, and it becomes the Pythagorean theorem: c² = a² + b².
When to use it
| Given | Use cosine law to |
|---|---|
| SAS (two sides and the included angle) | find the third side |
| SSS (three sides) | find an angle |
Once you have a side–angle pair, you can switch to the sine law (carefully) or use the cosine law again.
Finding a side (SAS)
Example: a = 8, b = 11, C = 37°. Find c.
- c² = 64 + 121 − 2(8)(11) cos 37°
- c² = 185 − 176(0.7986) ≈ 185 − 140.6 = 44.4
- c ≈ 6.66
Finding an angle (SSS)
Rearrange:
cos C = (a² + b² − c²) / (2ab)
Example: a = 7, b = 9, c = 12. Find C.
- cos C = (49 + 81 − 144)/(2 × 7 × 9) = −14/126 ≈ −0.111
- C ≈ 96.4°
A negative cosine means an obtuse angle. Unlike the sine law, the cosine law never gives an ambiguous answer.
Tip: find the largest angle first
In an SSS problem, find the angle opposite the longest side first using the cosine law. If you then use the sine law for another angle, it’s guaranteed to be acute, so there’s no ambiguity.
Real-world example
A boat sails 15 km east, then turns and sails 9 km on a bearing that makes a 130° angle with its first path. How far is it from the start?
- d² = 15² + 9² − 2(15)(9) cos 130°
- d² = 225 + 81 − 270(−0.6428) ≈ 306 + 173.6 = 479.6
- d ≈ 21.9 km
Checking triangle validity
For SSS, the triangle inequality must hold: the sum of any two sides must exceed the third. If not, cos C will come out outside −1 to 1, and the calculator will give an error.
Worked examples
Example 1: b = 5, c = 7, A = 60°. Find a. a² = 25 + 49 − 70(0.5) = 39 → a ≈ 6.24.
Example 2: Sides 5, 6, 7. Find the largest angle. cos C = (25 + 36 − 49)/60 = 0.2 → 78.5°.
Example 3: Is a triangle with sides 4, 5, 8 acute or obtuse? cos C = (16 + 25 − 64)/40 < 0 → obtuse.
Common mistakes
- Using an angle that isn’t between the two sides for SAS.
- Order of operations: compute 2ab cos C before subtracting from a² + b².
- Calculator in radians.
Try it yourself
- a = 10, b = 14, C = 50°. Find c.
- Sides 8, 10, 13. Find the angle opposite 13.
- b = 6, c = 9, A = 120°. Find a.
- Sides 3, 4, 5: use the cosine law to find the largest angle.
Answers: 1) ≈ 10.8 2) ≈ 91.8° 3) ≈ 13.1 4) 90°
Quick recap
- Cosine law: c² = a² + b² − 2ab cos C.
- Use for SAS (find a side) and SSS (find an angle).
- A negative cosine means an obtuse angle.