Trigonometry5 min read

Law of Cosines

c² = a² + b² − 2ab·cos(C)

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

a, b
Two known sidesThe sides forming the angle C.
C
Included angleThe angle between sides a and b.
c
Unknown sideThe side opposite angle C, which the formula solves for.

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
Advertisement

Step-by-Step Example

Problem: A triangle has sides a = 5, b = 7, and included angle C = 60°. Find side c.

1
Write the formula

Start from the Law of Cosines.

c² = a² + b² − 2ab·cos(C)
2
Substitute the known values

Plug in a, b, and C.

c² = 25 + 49 − 2(5)(7)·cos(60°)
3
Evaluate cos(60°) = 0.5

Simplify the expression.

c² = 74 − 70(0.5) = 74 − 35 = 39
Answer: c = √39 ≈ 6.24

Interactive Calculator

Result will appear here

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

  1. A triangle has sides a = 8, b = 10, and included angle C = 45°. Find side c.

    Hint: c² = 64 + 100 − 160·cos(45°).

  2. 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.