MathBored

Essential Math Primer
← Back to Primer Overview
R69 • Lesson 99 of 105

Law of Cosines

Using the generalized Pythagorean theorem for any triangle

Reserve & Extensions • K-12

Prerequisites: H43, R68

Key Concepts

  • Law of Cosines
  • non-right triangles
  • SAS
  • SSS
  • triangle solving

Law of Cosines

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.

The Formula

c2 = a2 + b2 − 2ab cos(C)

Here c is the side opposite angle C, and a, b are the other two sides. The formula can be rewritten for any side:

a2 = b2 + c2 − 2bc cos(A)
b2 = a2 + c2 − 2ac cos(B)

Connection to the Pythagorean Theorem

When C = 90 degrees, cos(90) = 0, so the −2ab cos(C) term vanishes:

c2 = a2 + b2 − 2ab(0) = a2 + b2

The Pythagorean theorem is just a special case of the Law of Cosines.

Worked Example 1: SAS -- Finding a Side

In triangle ABC, a = 8, b = 11, C = 37 degrees. Find side c.

  1. Apply the formula: c2 = 82 + 112 − 2(8)(11) cos(37)
  2. c2 = 64 + 121 − 176(0.7986)
  3. c2 = 185 − 140.55 = 44.45
  4. c = √44.45 = 6.67

Finding an Angle (SSS Case)

When you know all three sides, rearrange the formula to solve for an angle:

cos(C) = (a2 + b2 − c2) / (2ab)

Worked Example 2: SSS -- Finding an Angle

A triangle has sides a = 5, b = 7, c = 9. Find angle C.

  1. cos(C) = (52 + 72 − 92) / (2 · 5 · 7)
  2. cos(C) = (25 + 49 − 81) / 70 = −7/70 = −0.1
  3. C = arccos(−0.1) = 95.74 degrees

The negative cosine tells us angle C is obtuse (greater than 90 degrees).

Law of Sines vs. Law of Cosines

SituationBest Tool
AAS or ASALaw of Sines
SSA (ambiguous)Law of Sines (check for two solutions)
SASLaw of Cosines
SSSLaw of Cosines

Worked Example 3: Real-World Application

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

Common Mistake

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.

Checking Your Work

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.

Practice Problems

1. Find side c: a = 6, b = 10, C = 50 degrees.

Solution

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.

Solution

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.

Solution

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?

Solution

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.

Solution

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.

Summary

Overview