The Pythagorean theorem works beautifully for right triangles: a² + b² = c². But what happens when your triangle doesn't have a right angle? For centuries, this seemed like an insurmountable problem. Then mathematicians discovered the Law of Cosines—a powerful generalization that works for any triangle and reduces to the Pythagorean theorem as a special case.
Understanding the Law of Cosines opens up triangle solving beyond the 90-degree restriction, making it one of the most important tools in trigonometry, surveying, navigation, and engineering.
The Formula
The Law of Cosines states:
c² = a² + b² - 2ab·cos(C)
Where:
- a, b, c are the three sides
- C is the angle opposite side c
- cos(C) is the cosine of angle C
Alternative forms (depending on which side/angle you're finding):
- a² = b² + c² - 2bc·cos(A)
- b² = a² + c² - 2ac·cos(B)
All three forms express the same relationship, just solved for different sides.
Connection to the Pythagorean Theorem
The Law of Cosines is actually a generalization of the Pythagorean theorem. Here's why:
For a right triangle where C = 90°:
- cos(90°) = 0
- c² = a² + b² - 2ab·(0)
- c² = a² + b² ← The Pythagorean theorem!
The Law of Cosines reduces to the Pythagorean theorem when the angle is 90°. For other angles, the extra term (2ab·cos C) adjusts for the triangle not being right.
Geometric interpretation:
- If C < 90° (acute): cos(C) is positive, so we subtract from a² + b², making c² smaller (side c is shorter)
- If C = 90° (right): cos(C) = 0, term disappears, standard Pythagorean theorem
- If C > 90° (obtuse): cos(C) is negative, so we add to a² + b² (subtracting a negative), making c² larger (side c is longer)
When to Use the Law of Cosines
Scenario 1: Finding a side when you know two sides and the included angle (SAS)
Example: You know sides a = 7, b = 10, and angle C = 40°. Find side c.
Scenario 2: Finding an angle when you know all three sides (SSS)
Example: You know sides a = 5, b = 7, c = 9. Find angle C.
Not needed for:
- Right triangles (use Pythagorean theorem or basic trigonometric functions)
- When you have two angles and a side (use Law of Sines instead)
Finding a Side: The SAS Case
Problem: Triangle with sides a = 8, b = 11, and included angle C = 37°. Find side c.
Solution:
Step 1: Write the formula
c² = a² + b² - 2ab·cos(C)
Step 2: Substitute values
c² = 8² + 11² - 2(8)(11)·cos(37°)
Step 3: Calculate
- 8² = 64
- 11² = 121
- 2(8)(11) = 176
- cos(37°) ≈ 0.7986
- 176 × 0.7986 ≈ 140.55
Step 4: Complete the calculation
- c² = 64 + 121 - 140.55
- c² = 185 - 140.55
- c² = 44.45
- c = √44.45 ≈ 6.67
Answer: Side c ≈ 6.67 units
Verification: Does this make sense?
- If C were 90°, we'd have c² = 64 + 121 = 185, so c ≈ 13.6
- Since C = 37° < 90°, c should be less than 13.6 ✓
- If C were 0°, sides a and b would be aligned, giving c = |11 - 8| = 3
- Our answer 6.67 falls reasonably between 3 and 13.6 ✓
Finding an Angle: The SSS Case
When you know all three sides, rearrange the Law of Cosines to solve for an angle:
cos(C) = (a² + b² - c²)/(2ab)
Then use inverse cosine:
C = cos⁻¹[(a² + b² - c²)/(2ab)]
Problem: Triangle with sides a = 6, b = 8, c = 10. Find angle C.
Solution:
Step 1: Write the rearranged formula
cos(C) = (a² + b² - c²)/(2ab)
Step 2: Substitute values
cos(C) = (6² + 8² - 10²)/(2·6·8)
Step 3: Calculate
- 6² = 36
- 8² = 64
- 10² = 100
- Numerator: 36 + 64 - 100 = 0
- Denominator: 2·6·8 = 96
- cos(C) = 0/96 = 0
Step 4: Find the angle
- C = cos⁻¹(0) = 90°
Answer: Angle C = 90°
Recognition: This is the 6-8-10 triangle (3-4-5 scaled by 2), so of course it's a right triangle! The Law of Cosines correctly identifies it.
Another SSS Example
Problem: Triangle with sides a = 5, b = 7, c = 9. Find angle C.
Solution:
cos(C) = (5² + 7² - 9²)/(2·5·7)
cos(C) = (25 + 49 - 81)/70
cos(C) = -7/70
cos(C) ≈ -0.1
Key observation: The cosine is negative!
C = cos⁻¹(-0.1) ≈ 95.74°
Answer: Angle C ≈ 95.74°
Since C > 90°, this is an obtuse triangle. Understanding the three types of triangles helps you interpret what a negative cosine means. The negative cosine indicated this before we even calculated the angle.
Finding All Angles from Three Sides
Once you find one angle using the Law of Cosines, you can:
Option 1: Use Law of Cosines again for a second angle
Option 2: Use Law of Sines for remaining angles (often simpler)
Option 3: Use the angle sum property (all angles sum to 180°) for the third angle
Example continuation: For the 5-7-9 triangle where C ≈ 95.74°:
Find angle A (opposite side a = 5):
Using Law of Cosines:
cos(A) = (7² + 9² - 5²)/(2·7·9)
cos(A) = (49 + 81 - 25)/126
cos(A) = 105/126 ≈ 0.833
A = cos⁻¹(0.833) ≈ 33.56°
Find angle B:
B = 180° - C - A
B = 180° - 95.74° - 33.56°
B ≈ 50.70°
Verification: 95.74° + 33.56° + 50.70° = 180° ✓
Comparison: Law of Cosines vs. Pythagorean Theorem
Pythagorean Theorem:
- Works ONLY for right triangles
- No trigonometry needed
- Simple calculation
- Limited applicability
Law of Cosines:
- Works for ANY triangle
- Requires trigonometry (cosine function)
- More complex calculation
- Universal applicability
Which to use?
- If the triangle has a right angle → Use Pythagorean theorem (simpler)
- If the triangle doesn't have a right angle → Use Law of Cosines
- If you're not sure → Law of Cosines works for both (but extra work for right triangles)
The Ambiguous Case: Be Careful!
When using Law of Cosines to find sides (SAS case), you get a unique answer. But when finding angles from sides (SSS case), you need to be careful about which angle you're finding.
Example: Triangle with sides 8, 10, 12
Finding the angle opposite the side of 12:
This will give you the largest angle (opposite the longest side).
Finding the angle opposite the side of 8:
This will give you the smallest angle (opposite the shortest side).
Always identify which angle you're solving for clearly!
Real-World Applications
Navigation
Ships and aircraft use the Law of Cosines for course calculations:
Problem: A ship travels 50 km north, then changes course 120° (relative to north) and travels 30 km. How far is it from the starting point?
Solution:
- This creates a triangle with sides 50 and 30
- The angle between them is 180° - 120° = 60° (interior angle of the triangle)
- Distance² = 50² + 30² - 2(50)(30)·cos(60°)
- Distance² = 2500 + 900 - 3000(0.5)
- Distance² = 3400 - 1500 = 1900
- Distance ≈ 43.6 km
Surveying
Land surveyors measure property boundaries that rarely form right angles:
Problem: A property has sides of 120 feet and 150 feet meeting at an angle of 85°. What's the length of the third side?
Solution:
- c² = 120² + 150² - 2(120)(150)·cos(85°)
- c² = 14,400 + 22,500 - 36,000(0.0872)
- c² = 36,900 - 3,139
- c² = 33,761
- c ≈ 183.7 feet
Engineering
Structural engineers analyze forces in triangulated frameworks:
Problem: Two support beams of 8 feet and 10 feet meet at an angle of 110°. What length brace is needed to complete the triangle?
Solution:
- Brace² = 8² + 10² - 2(8)(10)·cos(110°)
- cos(110°) ≈ -0.342 (negative because obtuse)
- Brace² = 64 + 100 - 160(-0.342)
- Brace² = 164 + 54.7
- Brace² = 218.7
- Brace ≈ 14.8 feet
The negative cosine adds length because the angle is obtuse.
Astronomy
Calculating distances between celestial objects often involves non-right triangles:
Problem: Two stars appear at angles of 30° and 45° from Earth, with known distances to Earth of 10 and 15 light-years. How far apart are the stars?
The angle between the lines to the stars is |45° - 30°| = 15°.
Solution:
- Distance² = 10² + 15² - 2(10)(15)·cos(15°)
- cos(15°) ≈ 0.966
- Distance² = 100 + 225 - 300(0.966)
- Distance² = 325 - 289.8
- Distance² = 35.2
- Distance ≈ 5.93 light-years
Common Mistakes
Mistake 1: Using the Wrong Angle
Problem: You have sides a, b, c and angle A, trying to find side c
Wrong: c² = a² + b² - 2ab·cos(A)
Right: You need the angle opposite to c (angle C), not angle A. Either find angle C first, or use a different approach.
The angle in the formula must be opposite the side you're finding!
Mistake 2: Forgetting the Negative Sign
Problem: Writing c² = a² + b² + 2ab·cos(C) (wrong sign)
Right: c² = a² + b² - 2ab·cos(C)
It's minus, not plus! (Unless you're solving in a rearranged form)
Mistake 3: Sign Confusion with Obtuse Angles
Problem: Getting confused when cosine is negative
Understanding:
- Acute angles: cosine is positive
- Right angle: cosine is zero
- Obtuse angles: cosine is negative
When you subtract a negative number, you add:
c² = a² + b² - 2ab·(negative number) = a² + b² + positive number
This is correct! Obtuse angles make the opposite side longer.
Mistake 4: Not Checking If Triangle Is Possible
Problem: Using sides 3, 4, 10 in Law of Cosines
Issue: These violate the triangle inequality (3 + 4 < 10)
Always check: The sum of any two sides must exceed the third side!
When NOT to Use Law of Cosines
Don't use it when:
- You have a right triangle and only need sides - Use Pythagorean theorem (simpler)
- You have two angles and a side - Use Law of Sines (simpler for this case)
- You have one angle and the opposite side, plus another side - Use Law of Sines
Law of Cosines is specifically for:
- SAS (two sides and included angle)
- SSS (all three sides)
Practice Problems
Problem 1: Sides a = 12, b = 15, angle C = 65°. Find side c.
Solution: c² = 144 + 225 - 2(12)(15)cos(65°) = 369 - 152.2 = 216.8; c ≈ 14.7 units
Problem 2: Sides 7, 10, 13. Find the largest angle.
Solution: Largest angle opposite longest side (13). cos(C) = (49 + 100 - 169)/140 = -20/140 ≈ -0.143; C ≈ 98.2° (obtuse)
Problem 3: Sides 5, 12, 13. Find angle C (opposite side 13).
Solution: cos(C) = (25 + 144 - 169)/120 = 0/120 = 0; C = 90° (It's a 5-12-13 right triangle!)
Problem 4: A triangle has sides 8, 8, 12 (isosceles). Find the angle between the equal sides.
Solution: This is the angle opposite the base (12). cos(C) = (64 + 64 - 144)/128 = -16/128 = -0.125; C ≈ 97.2°
The Bigger Picture: Completing the Triangle Toolkit
Combined with other tools, the Law of Cosines completes your triangle-solving capability:
For Right Triangles:
- Pythagorean Theorem
- Basic trig (SOH-CAH-TOA)
For All Triangles:
- Law of Cosines (SAS and SSS cases)
- Law of Sines (AAS, ASA, and sometimes SSA cases)
- Angle sum property (angles sum to 180°)
With these tools, any triangle can be solved!
Conclusion: Beyond the Right Angle
The Law of Cosines liberates trigonometry from the right angle restriction. While the Pythagorean theorem is elegant and simple, it applies only to that special 90-degree case. The Law of Cosines extends the power of triangular calculation to every triangle—acute, right, and obtuse.
This universality comes at a cost: the formula is more complex, requires trigonometric functions, and involves more calculation. But the trade-off is worth it. Real-world triangles don't always contain right angles. Property boundaries, navigation paths, structural frameworks, celestial triangles—most are not right-angled.
The Law of Cosines handles them all. It reduces to the Pythagorean theorem for right triangles, confirms Pythagorean triples, and extends triangle solving to cases the ancient Greeks could only dream of.
The formula c² = a² + b² - 2ab·cos(C) might look intimidating, but it's actually a simple adjustment to the familiar Pythagorean theorem. That extra term (2ab·cos C) accounts for the triangle not being right—stretching or shrinking the result based on whether the angle is obtuse or acute.
Master the Law of Cosines, and no triangle can hide its secrets from you. Right angles are wonderful, but the real world doesn't always provide them. With this law, you don't need right angles—any three measurements (two sides and an angle, or three sides) suffice.
That's the power of generalization in mathematics: taking something that works in a special case (Pythagorean theorem for right triangles) and extending it to work everywhere (Law of Cosines for all triangles).
The right triangle was just the beginning. The Law of Cosines is where triangle geometry grows up.