Using the generalized Pythagorean theorem for any triangle
Reserve & Extensions • K-12
The Law of Cosines is the all-purpose tool for solving triangles. It works when the Law of Sines cannot (SAS and SSS cases), and it generalizes the Pythagorean theorem to all triangles -- not just right triangles.
Here c is the side opposite angle C, and a, b are the other two sides. The formula can be rewritten for any side:
When C = 90 degrees, cos(90) = 0, so the −2ab cos(C) term vanishes:
The Pythagorean theorem is just a special case of the Law of Cosines.
In triangle ABC, a = 8, b = 11, C = 37 degrees. Find side c.
When you know all three sides, rearrange the formula to solve for an angle:
A triangle has sides a = 5, b = 7, c = 9. Find angle C.
The negative cosine tells us angle C is obtuse (greater than 90 degrees).
| Situation | Best Tool |
|---|---|
| AAS or ASA | Law of Sines |
| SSA (ambiguous) | Law of Sines (check for two solutions) |
| SAS | Law of Cosines |
| SSS | Law of Cosines |
Two boats leave a dock. Boat A travels 12 km on a bearing of 040 degrees, and Boat B travels 18 km on a bearing of 100 degrees. How far apart are the boats?
The angle between their paths is 100 − 40 = 60 degrees. We have SAS: a = 12, b = 18, C = 60 degrees.
c2 = 122 + 182 − 2(12)(18) cos(60)
c2 = 144 + 324 − 432(0.5) = 468 − 216 = 252
c = √252 = 15.87 km
When finding an angle using cos(C) = (a2 + b2 − c2)/(2ab), make sure c is the side opposite angle C. The side you are "solving against" must be the one across from the angle. Mixing up which side is opposite which angle is the most frequent error.
After finding all angles, verify they sum to 180 degrees. After finding all sides, check that the largest side is opposite the largest angle. These quick checks catch most errors.
1. Find side c: a = 6, b = 10, C = 50 degrees.
c2 = 36 + 100 − 120 cos(50) = 136 − 120(0.6428) = 136 − 77.14 = 58.86. c = √58.86 = 7.67.
2. Find angle A: a = 13, b = 8, c = 9.
cos(A) = (64 + 81 − 169)/(2 · 8 · 9) = −24/144 = −1/6. A = arccos(−1/6) = 99.59 degrees.
3. A triangle has sides 4, 5, and 6. Find the largest angle.
The largest angle is opposite the longest side (6). cos(C) = (16 + 25 − 36)/(2 · 4 · 5) = 5/40 = 0.125. C = arccos(0.125) = 82.82 degrees.
4. Two hikers leave a trailhead. One walks 3 miles due north, the other walks 4 miles on a bearing of N 60 degrees E. How far apart are they?
The angle between them is 60 degrees. d2 = 9 + 16 − 24 cos(60) = 25 − 12 = 13. d = √13 = 3.61 miles.
5. Verify: if a = 3, b = 4, C = 90 degrees, use the Law of Cosines to find c.
c2 = 9 + 16 − 24 cos(90) = 25 − 0 = 25. c = 5. This matches the 3-4-5 right triangle -- confirming the Law of Cosines reduces to the Pythagorean theorem when C = 90 degrees.