Law of Cosines
Measurements, material estimation, cutting calculations
Voltage drop, wire sizing, load balancing
The law of cosines is the generalized Pythagorean theorem. It works for any triangle — not just right triangles — and it handles the cases where the law of sines cannot: when you know two sides and the included angle (SAS), or when you know all three sides (SSS).
The Formula
For any triangle with sides , , opposite angles , , :
This looks like the Pythagorean theorem with an extra term. When , , and the formula reduces to — exactly the Pythagorean theorem.
The formula can be rearranged to solve for any side:
To find an angle when all three sides are known, rearrange:
Law of Cosines — The Generalized Pythagorean Theorem
When to Use the Law of Cosines
| Given Information | Case | What You Can Find |
|---|---|---|
| Two sides and the included angle | SAS | The third side |
| All three sides | SSS | Any angle |
Memory aid: If you don’t have a matched side-angle pair (a side and the angle directly opposite it), use the law of cosines. If you do have a matched pair, the law of sines is usually simpler.
Common workflow for SSS: Use the law of cosines to find the largest angle first (opposite the longest side), then switch to the law of sines (which is simpler) for the second angle, and subtract to find the third. Finding the largest angle first matters — if the triangle has an obtuse angle, it will always be the largest, and on a calculator cannot distinguish obtuse from acute angles (it always returns the acute one).
Worked Examples
Example 1: Finding a Side (SAS)
In triangle : , , and . Find side .
Answer:
Example 2: Finding an Angle (SSS)
A triangle has sides , , and . Find angle (the angle opposite the longest side).
Answer:
This is an obtuse angle, which makes sense — the longest side is always opposite the largest angle.
Example 3: Complete SSS Solution
A triangle has sides 12, 9, and 7. Find all three angles.
Step 1 — Find the largest angle (opposite the longest side, 12):
Step 2 — Use the law of sines to find a second angle (simpler than law of cosines again):
Step 3 — Subtract for the third angle:
Answer: , ,
Verification: The largest angle (96.38°) is opposite the longest side (12) ✓. The smallest angle (35.43°) is opposite the shortest side (7) ✓.
Why the Extra Term Matters
The term is what adjusts the Pythagorean theorem for non-right angles:
- When : , so the term disappears → Pythagorean theorem
- When (acute): , so you subtract → side is shorter than in a right triangle
- When (obtuse): , so you add → side is longer than in a right triangle
This is why a triangle with an obtuse angle has a longer side opposite it.
Real-World Application: Carpentry — Triangular Brace
A carpenter is building a triangular brace. Two beams meet at a 110-degree angle. One beam is 3 feet and the other is 4 feet. How long is the brace that connects their endpoints?
Answer: The brace is approximately 5.76 feet long.
Notice: if the angle were 90° instead of 110°, the Pythagorean theorem gives . The obtuse angle pushes the brace length to 5.76 — the law of cosines captures this difference exactly.
Common Mistakes
- Forgetting the negative sign. When the angle is obtuse, is negative, so becomes positive (adding to ). Don’t drop the negative.
- Using the wrong angle. In , angle must be the angle between sides and (the included angle).
- Forgetting to take the square root. The formula gives , not . Remember the final step.
- Using the law of cosines when the law of sines is simpler. If you have a matched side-angle pair, the law of sines requires less computation.
Practice Problems
Test your understanding with these problems. Click to reveal each answer.
Problem 1: Two sides of a triangle are 12 and 9, and the angle between them is 40°. Find the third side.
Answer: The third side is approximately 7.72.
Problem 2: A triangle has sides 6, 8, and 11. Find the largest angle.
The largest angle is opposite the longest side (11). Let , , .
Answer: The largest angle is approximately 102.63°.
Problem 3: An engineer needs a cable from point to point . She knows m, m, and angle . How long is the cable?
Answer: The cable is approximately 51.41 meters long.
Problem 4: A triangle has sides 7, 7, and 10. Find the angle between the two equal sides.
Let and . Angle is between the equal sides.
Answer: The angle is approximately 91.17° — just barely obtuse.
Problem 5: Verify: if , show that the law of cosines becomes the Pythagorean theorem.
Since :
This is exactly the Pythagorean theorem: .
Answer: When , the term vanishes, reducing the law of cosines to the Pythagorean theorem. ✓
Key Takeaways
- The law of cosines states — it’s the Pythagorean theorem with a correction for non-right angles
- Use it when you have SAS (two sides + included angle) or SSS (all three sides)
- When , it reduces to the Pythagorean theorem
- For SSS: find the largest angle first with law of cosines, then use the law of sines for the second (it’s simpler and safe once the obtuse angle is resolved)
- An obtuse angle makes negative, which increases the opposite side length
- If you have a matched side-angle pair, the law of sines is usually faster
Return to Trigonometry for more topics in this section.
Next Up in Trigonometry
Last updated: March 28, 2026