Law of Cosines
What is the Law of Cosines?
The Law of Cosines generalizes the Pythagorean theorem to work for any triangle, not just right triangles. When angle C = 90°, cos(90°) = 0, and the formula reduces exactly to c² = a² + b² — the familiar Pythagorean theorem is just the special case where the included angle happens to be a right angle.
It's the go-to formula when a triangle doesn't have a right angle to exploit, and you know either two sides plus the angle between them (SAS), or all three sides (SSS, to solve for an angle instead).
What Each Variable Means
When to Use It
- SAS — two sides and the included angle between them are known
- SSS — all three sides are known and you need to find an angle
- Any non-right triangle where the Pythagorean theorem alone doesn't apply
Step-by-Step Example
Problem: A triangle has sides a = 5, b = 7, and included angle C = 60°. Find side c.
Start from the Law of Cosines.
c² = a² + b² − 2ab·cos(C)Plug in a, b, and C.
c² = 25 + 49 − 2(5)(7)·cos(60°)Simplify the expression.
c² = 74 − 70(0.5) = 74 − 35 = 39Interactive Calculator
Common Mistakes
Mistake: Using the Law of Cosines when the Law of Sines would be simpler.
Fix: If you have an angle-side opposite pair (like AAS or ASA), the Law of Sines is more direct. Reach for the Law of Cosines specifically for SAS or SSS.
Mistake: Forgetting to take the square root at the end when solving for a side.
Fix: The formula gives c², not c directly — the final step is always to take the square root of the result.
Practice Questions
A triangle has sides a = 8, b = 10, and included angle C = 45°. Find side c.
Hint: c² = 64 + 100 − 160·cos(45°).
A triangle has sides a = 6, b = 6, and included angle C = 90°. Find side c.
Hint: This reduces to the Pythagorean theorem since cos(90°) = 0.
Frequently Asked Questions
How does the Law of Cosines relate to the Pythagorean theorem?
When the included angle C is 90°, cos(90°) = 0, and the formula reduces exactly to c² = a² + b² — the Pythagorean theorem is a special case of the Law of Cosines.
Can it be used to find an angle instead of a side?
Yes — rearrange to cos(C) = (a² + b² − c²) / 2ab, then take the inverse cosine, useful when all three sides (SSS) are known.
Related Formulas
Pythagorean Theorem
Relates the three sides of a right triangle, letting you find any one side from the other two.
Learn more →Law of Sines
Relates the sides of any triangle to the sines of their opposite angles — not just right triangles.
Learn more →Sine, Cosine & Tangent
The three fundamental trigonometric ratios for right triangles, remembered with SOH-CAH-TOA.
Learn more →