Introduction
The Law of Cosines is one of the most powerful tools in trigonometry for solving triangles. Unlike the Law of Sines, which works best with certain triangle configurations, the Law of Cosines handles virtually any triangle scenario—making it essential for homework, tests, and real-world applications.
Yet many students struggle with the Law of Cosines. They forget which formula to use, struggle with algebraic manipulation, or don’t understand when this law applies versus other methods. This frustration often stems from memorizing formulas without understanding the underlying concepts.
This comprehensive guide breaks down the Law of Cosines into manageable pieces. You’ll understand what it is, when to use it, how to apply it step-by-step, and how to solve various problem types. Whether you’re completing homework, preparing for a test, or simply trying to understand this important concept, this guide provides everything you need.
What Is the Law of Cosines?
Definition
The Law of Cosines relates the lengths of sides of a triangle to the cosine of one of its angles.
For any triangle with sides a, b, c and angles A, B, C (where angle A is opposite side a, etc.):
c² = a² + b² – 2ab cos(C)
Or rearranged to solve for an angle:
cos(C) = (a² + b² – c²) / (2ab)
Why Three Formulas?
Because any angle can be the subject, there are three versions:
To find side c (opposite angle C):
c² = a² + b² – 2ab cos(C)
To find side a (opposite angle A):
a² = b² + c² – 2bc cos(A)
To find side b (opposite angle B):
b² = a² + c² – 2ac cos(B)
To find angle C:
cos(C) = (a² + b² – c²) / (2ab)
To find angle A:
cos(A) = (b² + c² – a²) / (2bc)
To find angle B:
cos(B) = (a² + c² – b²) / (2ac)
Connection to Pythagorean Theorem
The Law of Cosines is a generalization of the Pythagorean Theorem.
When angle C = 90°:
cos(90°) = 0
So: c² = a² + b² – 2ab(0) = a² + b²
This is the Pythagorean Theorem! The Law of Cosines extends this to any angle.
When to Use the Law of Cosines
Understanding when to apply the Law of Cosines prevents wasted time and incorrect approach selection.
Use Law of Cosines When You Have:
1. Two sides and the included angle (SAS – Side-Angle-Side)
Given: Two sides and the angle between them
Find: The third side
Example: You know sides a and b, and angle C between them. Find side c.
2. Three sides (SSS – Side-Side-Side)
Given: All three sides
Find: Any or all angles
Example: You know a, b, and c. Find angles A, B, and C.
3. Two sides and a non-included angle (SSA – Side-Side-Angle)
Given: Two sides and an angle not between them
Find: Unknown side or angle
Note: This is the ambiguous case; Law of Cosines or Law of Sines works.
Do NOT Use Law of Cosines When You Have:
Angle-Side-Angle (ASA): Use Law of Sines instead
- More efficient
- Directly gives you what you need
Angle-Angle-Side (AAS): Use Law of Sines instead
- Better suited to this configuration
Right triangles with a known right angle: Use basic trigonometry (SOH-CAH-TOA)
- Much simpler
- Faster calculation
One side and two angles: Use Law of Sines
- More direct
The Three Core Formulas
Formula 1: Finding a Side (SAS Configuration)
Given: Two sides and the included angle
Find: The third side
Formula:
c² = a² + b² – 2ab cos(C)
Where:
- a and b are the known sides
- C is the angle between them (included angle)
- c is the unknown side opposite angle C
Why this formula works:
- The cosine term accounts for how the angle affects the third side
- When angle is 90°, the – 2ab cos(C) term becomes 0, giving Pythagorean Theorem
- Obtuse angles increase the result; acute angles decrease it
Formula 2: Finding an Angle (SSS Configuration)
Given: All three sides
Find: Any angle
Formula:
cos(C) = (a² + b² – c²) / (2ab)
Then: C = arccos [(a² + b² – c²) / (2ab)]
Where:
- a, b, c are the three known sides
- C is the angle you’re finding
- The angle is opposite the side you’re NOT using in the numerator
Important: When finding angle C, you use the formula with sides a and b in the denominator (the sides adjacent to angle C) and c in the numerator (the side opposite angle C).
Using similar logic:
- To find angle A: cos(A) = (b² + c² – a²) / (2bc)
- To find angle B: cos(B) = (a² + c² – b²) / (2ac)
Formula 3: Rearrangements for Different Scenarios
Sometimes you need to rearrange to isolate what you’re looking for.
To find c²:
c² = a² + b² – 2ab cos(C)
To find c:
c = √[a² + b² – 2ab cos(C)]
To solve for cos(C):
cos(C) = (a² + b² – c²) / (2ab)
To solve for C:
C = arccos[(a² + b² – c²) / (2ab)]
Step-by-Step Problem-Solving Process
Universal Framework
Step 1: Identify what you have and what you’re finding
- Label all known values
- Identify what you’re solving for
- Determine the configuration (SAS, SSS, SSA)
Step 2: Select the appropriate formula
- SAS (two sides + included angle) → use c² = a² + b² – 2ab cos(C)
- SSS (three sides) → use cos(C) = (a² + b² – c²) / (2ab)
- SSA → Law of Cosines or Law of Sines
Step 3: Substitute known values into formula
- Carefully plug in numbers
- Double-check units are consistent
- Maintain precision (don’t round early)
Step 4: Solve algebraically
- Follow order of operations carefully
- Show all steps
- Don’t skip algebra steps
Step 5: Simplify and find final answer
- Calculate final numerical answer
- Round to appropriate precision
- Verify answer makes sense
Step 6: Check your work
- Does answer have correct units?
- Is answer in reasonable range?
- Can you verify using different method?
Type 1: SAS Problems (Finding a Side)
Problem Structure
Given: Two sides and the included angle
Find: The third side
Formula: c² = a² + b² – 2ab cos(C)
Example 1: Basic SAS Problem
Problem:
In triangle ABC, side a = 5 cm, side b = 7 cm, and angle C = 60°. Find side c.
Solution:
Step 1: Identify what we have
- a = 5 cm
- b = 7 cm
- C = 60° (included angle between sides a and b)
- Find: c
Step 2: Select formula
SAS configuration → use c² = a² + b² – 2ab cos(C)
Step 3: Substitute values
c² = 5² + 7² – 2(5)(7) cos(60°)
Step 4: Calculate
- 5² = 25
- 7² = 49
- 2(5)(7) = 70
- cos(60°) = 0.5
c² = 25 + 49 – 70(0.5)
c² = 25 + 49 – 35
c² = 39
Step 5: Solve for c
c = √39 ≈ 6.24 cm
Step 6: Verify
- Is it reasonable? Yes; 6.24 is between 5 and 7, which makes sense
- Closer to 7 than 5? Yes; angle is acute, so result makes sense
Answer: c ≈ 6.24 cm
Example 2: SAS with Obtuse Angle
Problem:
In triangle XYZ, side y = 10, side z = 8, and angle X = 120°. Find side x.
Solution:
Step 1: Identify
- y = 10
- z = 8
- X = 120° (included angle)
- Find: x
Step 2: Select formula
SAS → x² = y² + z² – 2yz cos(X)
Step 3: Substitute
x² = 10² + 8² – 2(10)(8) cos(120°)
Step 4: Calculate
- 10² = 100
- 8² = 64
- 2(10)(8) = 160
- cos(120°) = -0.5
x² = 100 + 64 – 160(-0.5)
x² = 100 + 64 + 80
x² = 244
Step 5: Solve for x
x = √244 ≈ 15.62
Step 6: Verify
- Obtuse angle produces longer opposite side? Yes; x ≈ 15.62 is longer than both given sides
- This makes sense because obtuse angles create longer opposite sides
Answer: x ≈ 15.62
Example 3: SAS with Right Angle
Problem:
In triangle ABC, a = 3, b = 4, and C = 90°. Find c.
Solution:
Step 1: Identify
- a = 3, b = 4
- C = 90°
- Find: c
Step 2: Select formula
SAS → c² = a² + b² – 2ab cos(90°)
Step 3: Substitute
c² = 3² + 4² – 2(3)(4) cos(90°)
Step 4: Calculate
- cos(90°) = 0
c² = 9 + 16 – 24(0)
c² = 25
Step 5: Solve
c = 5
Step 6: Verify
- This is the famous 3-4-5 right triangle
- Matches Pythagorean Theorem result
- Confirms our formula generalizes correctly
Answer: c = 5
Type 2: SSS Problems (Finding an Angle)
Problem Structure
Given: All three sides
Find: One or more angles
Formula: cos(C) = (a² + b² – c²) / (2ab)
Example 1: Finding One Angle
Problem:
A triangle has sides a = 6, b = 8, and c = 10. Find angle C.
Solution:
Step 1: Identify
- a = 6, b = 8, c = 10
- Find: angle C (opposite side c)
Step 2: Select formula
SSS → cos(C) = (a² + b² – c²) / (2ab)
Step 3: Substitute
cos(C) = (6² + 8² – 10²) / (2 × 6 × 8)
Step 4: Calculate
- 6² = 36
- 8² = 64
- 10² = 100
- 2 × 6 × 8 = 96
cos(C) = (36 + 64 – 100) / 96
cos(C) = 0 / 96
cos(C) = 0
Step 5: Solve for C
C = arccos(0) = 90°
Step 6: Verify
- This is a right triangle (6-8-10 is 3-4-5 scaled)
- Angle opposite longest side is 90°? Yes, correct
- This confirms our method
Answer: C = 90°
Example 2: Finding an Acute Angle
Problem:
A triangle has sides a = 5, b = 6, and c = 7. Find angle A.
Solution:
Step 1: Identify
- a = 5, b = 6, c = 7
- Find: angle A (opposite side a)
Step 2: Select formula
SSS → cos(A) = (b² + c² – a²) / (2bc)
Step 3: Substitute
cos(A) = (6² + 7² – 5²) / (2 × 6 × 7)
Step 4: Calculate
- 6² = 36
- 7² = 49
- 5² = 25
- 2 × 6 × 7 = 84
cos(A) = (36 + 49 – 25) / 84
cos(A) = 60 / 84
cos(A) = 5/7 ≈ 0.7143
Step 5: Solve for A
A = arccos(0.7143) ≈ 44.4°
Step 6: Verify
- Smallest side (5) opposite smallest angle? Yes, 44.4° is the smallest angle
- Angle is acute? Yes, less than 90°
- Reasonable? Yes
Answer: A ≈ 44.4°
Example 3: Finding All Angles in a Triangle
Problem:
A triangle has sides a = 7, b = 9, and c = 11. Find all three angles.
Solution:
Find angle A:
cos(A) = (b² + c² – a²) / (2bc)
cos(A) = (9² + 11² – 7²) / (2 × 9 × 11)
cos(A) = (81 + 121 – 49) / 198
cos(A) = 153 / 198 ≈ 0.7727
A = arccos(0.7727) ≈ 39.4°
Find angle B:
cos(B) = (a² + c² – b²) / (2ac)
cos(B) = (7² + 11² – 9²) / (2 × 7 × 11)
cos(B) = (49 + 121 – 81) / 154
cos(B) = 89 / 154 ≈ 0.5779
B = arccos(0.5779) ≈ 54.8°
Find angle C:
cos(C) = (a² + b² – c²) / (2ab)
cos(C) = (7² + 9² – 11²) / (2 × 7 × 9)
cos(C) = (49 + 81 – 121) / 126
cos(C) = 9 / 126 ≈ 0.0714
C = arccos(0.0714) ≈ 85.9°
Verify:
39.4° + 54.8° + 85.9° = 180.1° ✓ (rounding accounts for 0.1° difference)
Answers:
- A ≈ 39.4°
- B ≈ 54.8°
- C ≈ 85.9°
Type 3: SSA Problems (Ambiguous Case)
Understanding the Ambiguous Case
When given two sides and a non-included angle (SSA), there may be:
- One triangle
- Two triangles
- No triangle
The Law of Cosines can handle this, though the Law of Sines combined with careful analysis is sometimes clearer.
Example: SSA with One Solution
Problem:
In triangle ABC, a = 5, b = 7, and A = 30°. Find side c.
Solution:
Step 1: Identify
- a = 5, b = 7, A = 30°
- Find: c and other angles
Step 2: Decide approach
With SSA, we can use Law of Cosines to find side c by first finding angle B.
Actually, better approach: Use Law of Sines to find angle B, then find C, then find c.
Using Law of Sines:
a/sin(A) = b/sin(B)
5/sin(30°) = 7/sin(B)
5/0.5 = 7/sin(B)
10 = 7/sin(B)
sin(B) = 7/10 = 0.7
B = arcsin(0.7) ≈ 44.4°
(Note: Could also be 180° – 44.4° = 135.6°, but we check if this works)
Finding C:
C = 180° – 30° – 44.4° = 105.6°
(Alternative: C = 180° – 30° – 135.6° = 14.4°—both possible initially)
For first case (C = 105.6°):
Using Law of Cosines:
c² = a² + b² – 2ab cos(C)
c² = 5² + 7² – 2(5)(7) cos(105.6°)
c² = 25 + 49 – 70(-0.261)
c² = 74 + 18.3 = 92.3
c ≈ 9.61
For second case (C = 14.4°):
c² = 5² + 7² – 2(5)(7) cos(14.4°)
c² = 25 + 49 – 70(0.968)
c² = 74 – 67.76 = 6.24
c ≈ 2.50
Verification:
Both are mathematically valid, but checking the original problem constraints determines which applies.
Answer: Two possible solutions: c ≈ 9.61 or c ≈ 2.50
Type 4: Real-World Applications
Example 1: Navigation Problem
Problem:
A boat starts at point A and travels 15 km on a bearing of 60° to reach point B. From B, it travels 20 km on a bearing of 150° to reach point C. How far is it from A to C?
Solution:
Step 1: Set up the problem
- AB = 15 km
- BC = 20 km
- Angle at B: We need to find the angle between the two paths
- Bearing from A to B: 60°
- Bearing from B to C: 150°
- Interior angle at B = 150° – 60° = 90°
Actually, we need to be more careful with bearings. The angle ABC (interior angle) = |150° – 60°| or 180° – |150° – 60°| depending on direction.
The turn from bearing 60° to bearing 150° is 150° – 60° = 90° clockwise.
So the interior angle ABC = 180° – 90° = 90°
(Or more carefully: the direction changes by 90°, so interior angle = 90°)
Step 2: Apply Law of Cosines
We have sides AB = 15, BC = 20, and angle ABC = 90°.
We want AC (call it side b).
b² = 15² + 20² – 2(15)(20)cos(90°)
b² = 225 + 400 – 0
b² = 625
b = 25
Answer: The boat is 25 km from A to C
(Note: This turned out to be a right triangle, so Pythagorean Theorem also works)
Example 2: Surveying Problem
Problem:
A surveyor measures distances from a point P to two landmarks A and B:
- PA = 250 m
- PB = 300 m
- Angle APB = 65°
Find the distance AB.
Solution:
Step 1: Identify
- PA = 250 m
- PB = 300 m
- Angle APB = 65° (included angle)
- Find: AB
Step 2: Set up Law of Cosines
This is SAS configuration.
AB² = PA² + PB² – 2(PA)(PB)cos(∠APB)
Step 3: Substitute
AB² = 250² + 300² – 2(250)(300)cos(65°)
Step 4: Calculate
- 250² = 62,500
- 300² = 90,000
- 2(250)(300) = 150,000
- cos(65°) ≈ 0.4226
AB² = 62,500 + 90,000 – 150,000(0.4226)
AB² = 152,500 – 63,390
AB² = 89,110
Step 5: Solve
AB = √89,110 ≈ 298.5 m
Answer: AB ≈ 298.5 m
Common Mistakes and How to Avoid Them
Mistake 1: Using Wrong Angle in Formula
Problem: In c² = a² + b² – 2ab cos(C), using angle A or B instead of C
Why it happens: Confusion about which angle is which
Prevention:
- Label clearly: angle C is opposite side c
- The included angle in SAS is the one between the two known sides
- Draw a diagram
Mistake 2: Forgetting Negative Sign
Problem: Writing c² = a² + b² + 2ab cos(C) (missing the minus sign)
Why it happens: Similarity to distance formula, which uses plus
Prevention:
- Memorize: it’s MINUS 2ab cos(C)
- Remember: related to Pythagorean Theorem when angle is 90°
- Double-check before calculating
Mistake 3: Not Converting Angle to Radians
Problem: Calculator set to degrees but treating input as radians
Why it happens: Forgetting to change calculator mode
Prevention:
- Check calculator mode before starting
- Verify by testing: cos(90°) should equal 0
- If your answers seem way off, suspect mode error
Mistake 4: Rounding Too Early
Problem: Rounding intermediate results, losing precision
Example:
- cos(C) = (36 + 64 – 100) / 96 = 0 / 96
- If you round 0/96 to 0.00, you lose precision for later steps
Prevention:
- Keep full precision until final answer
- Use parentheses in calculator to maintain precision
- Only round the final result
Mistake 5: Solving for Side Instead of Side²
Problem: Stopping at c² and forgetting to take square root
Why it happens: Calculation stress or rushing
Prevention:
- Always include the square root step explicitly
- Write it out: c = √[a² + b² – 2ab cos(C)]
- Double-check that answer makes sense
Mistake 6: Using Cosine Instead of Its Inverse
Problem: When finding an angle: cos(C) = 0.5 and saying C = 0.5
Why it happens: Forgetting to use arccos (cos⁻¹)
Prevention:
- When solving for angle, use arccos, arcsin, or arctan
- Notation: C = arccos(0.5) or C = cos⁻¹(0.5)
- Check calculator has inverse trig functions available
Mistake 7: Not Checking if Answer Is Reasonable
Problem: Getting answers like c = -5 or angle = 200° and accepting them
Why it happens: Not pausing to sanity-check
Prevention:
- Sides are always positive
- Triangle angles are between 0° and 180°
- Sum of angles equals 180°
- Each side is between sum and difference of other two sides
Mistake 8: Mixing Up Sides and Angles in SSS Problems
Problem: In cos(A) = (b² + c² – a²) / (2bc), using wrong sides
Why it happens: Losing track of which side is opposite which angle
Prevention:
- Draw a labeled triangle
- Remember: angle A is opposite side a
- In numerator: sides NOT involved in angle
- In denominator: two sides that form the angle
Practice Problems With Solutions
Practice 1: Basic SAS
Problem: In triangle PQR, p = 8, q = 11, and angle R = 75°. Find r.
Solution:
r² = p² + q² – 2pq cos(R)
r² = 8² + 11² – 2(8)(11) cos(75°)
r² = 64 + 121 – 176(0.2588)
r² = 185 – 45.55
r² = 139.45
r ≈ 11.81
Practice 2: SSS to Find All Angles
Problem: A triangle has sides 4, 5, and 6. Find all angles.
Solution:
For angle opposite side 4:
cos(A) = (5² + 6² – 4²) / (2·5·6) = (25 + 36 – 16) / 60 = 45/60 = 0.75
A ≈ 41.4°
For angle opposite side 5:
cos(B) = (4² + 6² – 5²) / (2·4·6) = (16 + 36 – 25) / 48 = 27/48 ≈ 0.5625
B ≈ 55.8°
For angle opposite side 6:
cos(C) = (4² + 5² – 6²) / (2·4·5) = (16 + 25 – 36) / 40 = 5/40 = 0.125
C ≈ 82.8°
Check: 41.4° + 55.8° + 82.8° = 180° ✓
Practice 3: Real-World Application
Problem: Two trees A and B are 100 m apart. From a point C, the distance to A is 75 m and to B is 85 m. What is angle ACB?
Solution:
cos(C) = (75² + 85² – 100²) / (2·75·85)
cos(C) = (5625 + 7225 – 10000) / 12750
cos(C) = 2850 / 12750 ≈ 0.2235
C ≈ 77.1°
FAQ: Law of Cosines
Q1: Why is it called the Law of Cosines?
A: Because the law involves the cosine of an angle. It’s one of the fundamental laws in trigonometry, alongside the Law of Sines.
Q2: When should I use Law of Cosines vs. Law of Sines?
A: Law of Cosines: SAS or SSS configurations. Law of Sines: when you have an angle-side pair and need another pair. Law of Cosines is more versatile.
Q3: Can I use Law of Cosines for right triangles?
A: Yes, but basic trigonometry (SOH-CAH-TOA) is simpler. Law of Cosines works for right triangles too.
Q4: What if I get cos(C) > 1 or < -1?
A: This indicates an error. Cosine values must be between -1 and 1. Check your arithmetic.
Q5: Why do I get two possible angles in some SSA problems?
A: The ambiguous case occurs when there are two triangles possible with the same SSA data. This happens when the given angle is acute and certain conditions on side lengths hold.
Q6: Do I need to memorize all six formulas?
A: No. Learn the concept: a² = b² + c² – 2bc cos(A). Adjust based on which angle/side you’re finding.
Q7: How accurate should my answer be?
A: Follow the precision of given data. If given data has 3 significant figures, give answer to 3 significant figures.
Q8: Can sides of a triangle be any positive numbers?
A: No. They must satisfy the triangle inequality: sum of any two sides > third side.
Conclusion
The Law of Cosines is a powerful, systematic tool for solving triangles when other methods don’t apply. Mastery requires:
- Understanding the concept: It’s a generalization of the Pythagorean Theorem
- Knowing when to use it: SAS and SSS configurations primarily
- Memorizing the formula: c² = a² + b² – 2ab cos(C)
- Following systematic steps: Identify → Select Formula → Substitute → Calculate → Verify
- Avoiding common mistakes: Rounding, angle confusion, missing minus sign
- Checking your work: Does the answer make sense?
Practice with various problem types:
- SAS problems (finding sides)
- SSS problems (finding angles)
- SSA problems (recognizing ambiguity)
- Real-world applications (navigation, surveying)
The step-by-step examples in this guide provide templates for tackling any Law of Cosines problem. Use them as models, follow the framework systematically, and you’ll solve these problems confidently.
Your homework will become manageable, then routine, and finally intuitive. The Law of Cosines, once mysterious, will become a reliable tool in your mathematical toolkit.


