Introduction to the Law of Cosines
The Law of Cosines is a fundamental trigonometric formula that relates the lengths of the sides of a triangle to the cosine of one of its angles. It's an extension of the Pythagorean Theorem that works for all triangles, not just right triangles.
Why the Law of Cosines Matters:
- Essential for solving triangles when you know two sides and the included angle (SAS)
- Critical for solving triangles when you know all three sides (SSS)
- Used in navigation, engineering, and physics calculations
- Foundation for more advanced trigonometric concepts
- Applied in computer graphics and game development
- Used in surveying and construction
In this comprehensive guide, we'll explore the Law of Cosines from basic concepts to advanced applications, with clear explanations, visual examples, and interactive practice problems to help you master this essential mathematical tool.
What is the Law of Cosines?
The Law of Cosines states that for any triangle with sides a, b, c and angles A, B, C (where angle A is opposite side a, etc.), the following relationship holds:
Alternative forms:
Key Terminology:
- Side: One of the three line segments that form a triangle
- Angle: The space between two sides meeting at a vertex
- Opposite side: The side across from a given angle
- Included angle: The angle between two given sides
- SAS: Side-Angle-Side (two sides and the included angle)
- SSS: Side-Side-Side (all three sides)
Triangle ABC with sides a, b, c and angles A, B, C
Special Case: Right Triangle
When angle C = 90°, cos(C) = 0, and the Law of Cosines simplifies to:
c² = a² + b² - 2ab·cos(90°) = a² + b² - 0 = a² + b²
This is the familiar Pythagorean Theorem!
Formula & Derivation
The Law of Cosines can be derived using coordinate geometry and the distance formula. Here's a step-by-step derivation:
Step 1: Place triangle ABC in the coordinate plane with point A at the origin (0,0) and side c along the x-axis.
Step 2: Point B is at (c, 0). Point C is at (b·cos(A), b·sin(A)).
Step 3: Use the distance formula to find the length of side a (distance between B and C):
a² = (b·cos(A) - c)² + (b·sin(A) - 0)²
Step 4: Expand and simplify:
a² = b²·cos²(A) - 2bc·cos(A) + c² + b²·sin²(A)
a² = b²(cos²(A) + sin²(A)) + c² - 2bc·cos(A)
Step 5: Apply the Pythagorean identity cos²(A) + sin²(A) = 1:
a² = b²(1) + c² - 2bc·cos(A)
a² = b² + c² - 2bc·cos(A)
This fundamental trigonometric identity is crucial for the derivation.
Law of Cosines Explorer
Solving SAS Triangles
The Law of Cosines is particularly useful for solving triangles when you know two sides and the included angle (SAS case). Here's the step-by-step process:
Step 1: Identify the known sides and the included angle.
For example, if you know sides b and c and angle A (the included angle), then side a is opposite angle A.
Step 2: Use the Law of Cosines to find the unknown side.
a² = b² + c² - 2bc·cos(A)
Then take the square root to find a.
Step 3: Use the Law of Sines to find one of the unknown angles.
sin(B)/b = sin(A)/a → B = sin⁻¹(b·sin(A)/a)
Step 4: Find the third angle using the triangle angle sum.
C = 180° - A - B
Example: Solve triangle ABC where b = 8, c = 10, and A = 40°.
Step 1: Known: b=8, c=10, A=40°
Step 2: a² = 8² + 10² - 2·8·10·cos(40°) = 64 + 100 - 160·0.7660 ≈ 164 - 122.56 = 41.44
a ≈ √41.44 ≈ 6.44
Step 3: sin(B)/8 = sin(40°)/6.44 → sin(B) = 8·sin(40°)/6.44 ≈ 8·0.6428/6.44 ≈ 0.798
B ≈ sin⁻¹(0.798) ≈ 53°
Step 4: C = 180° - 40° - 53° = 87°
Solution: a ≈ 6.44, B ≈ 53°, C ≈ 87°
SAS Triangle Solver
Solving SSS Triangles
When you know all three sides of a triangle (SSS case), you can use the Law of Cosines to find the angles. Here's the process:
Step 1: Use the Law of Cosines to find the largest angle first.
The largest angle is opposite the longest side. This ensures we don't get an ambiguous case.
Step 2: Rearrange the Law of Cosines to solve for the cosine of the angle.
cos(A) = (b² + c² - a²) / (2bc)
Then A = cos⁻¹[(b² + c² - a²) / (2bc)]
Step 3: Use the Law of Sines to find a second angle.
sin(B)/b = sin(A)/a → B = sin⁻¹(b·sin(A)/a)
Step 4: Find the third angle using the triangle angle sum.
C = 180° - A - B
Example: Solve triangle ABC where a = 7, b = 5, c = 8.
Step 1: The longest side is c=8, so we'll find angle C first.
Step 2: cos(C) = (a² + b² - c²) / (2ab) = (49 + 25 - 64) / (2·7·5) = 10/70 ≈ 0.1429
C ≈ cos⁻¹(0.1429) ≈ 81.8°
Step 3: sin(A)/7 = sin(81.8°)/8 → sin(A) = 7·sin(81.8°)/8 ≈ 7·0.989/8 ≈ 0.865
A ≈ sin⁻¹(0.865) ≈ 60°
Step 4: B = 180° - 81.8° - 60° ≈ 38.2°
Solution: A ≈ 60°, B ≈ 38.2°, C ≈ 81.8°
SSS Triangle Solver
Law of Sines vs Law of Cosines
Knowing when to use the Law of Sines versus the Law of Cosines is crucial for efficient triangle solving. Here's a comparison:
Use Law of Cosines When:
SAS Case: Two sides and the included angle are known
SSS Case: All three sides are known
Advantage: No ambiguous case
Use Law of Sines When:
AAS Case: Two angles and any side are known
ASA Case: Two angles and the included side are known
Caution: Possible ambiguous case (SSA)
Step 1: What information do you have?
Step 2: If you have SAS or SSS → Use Law of Cosines
Step 3: If you have AAS or ASA → Use Law of Sines
Step 4: If you have SSA → Use Law of Sines but check for ambiguous case
Step 5: After using one law, you can use the other to find remaining unknowns
Example: When to use which law?
Case 1: Known: a=5, b=7, C=40° (SAS) → Use Law of Cosines to find c
Case 2: Known: a=5, b=7, c=9 (SSS) → Use Law of Cosines to find angles
Case 3: Known: A=30°, B=60°, a=5 (AAS) → Use Law of Sines to find b and c
Case 4: Known: A=30°, a=5, b=7 (SSA) → Use Law of Sines but check for ambiguity
Law Selection Helper
Real-World Applications of the Law of Cosines
The Law of Cosines has numerous practical applications in various fields. Here are some common examples:
Navigation
The Law of Cosines is used in navigation to determine distances and bearings.
Example: Finding the distance between two points when you know distances to a third point and the angle between them.
If you're at point A, and you know distances to points B and C, and the angle at A, you can find the distance between B and C.
Engineering & Construction
Used in structural engineering to calculate forces and distances in trusses and frameworks.
Example: Determining the length of a diagonal brace in a triangular structure when you know the other two sides and the included angle.
Essential for ensuring structural integrity and proper load distribution.
Surveying
Surveyors use the Law of Cosines to calculate distances between inaccessible points.
Example: Measuring the distance across a river by measuring distances along the bank and the angle between them.
This allows accurate mapping without direct measurement of difficult-to-reach locations.
Computer Graphics
Used in 3D modeling and game development for calculating angles and distances between points in space.
Example: Determining if an object is within a certain field of view based on its position relative to the viewer.
Critical for rendering optimization and collision detection algorithms.
Problem: Two ships leave a port at the same time. Ship A travels 30 km at a bearing of 40°, and ship B travels 45 km at a bearing of 100°. How far apart are the ships after their journeys?
Step 1: The angle between the ships' paths is 100° - 40° = 60°.
Step 2: We have two sides (30 km and 45 km) and the included angle (60°). This is an SAS case.
Step 3: Apply the Law of Cosines:
d² = 30² + 45² - 2·30·45·cos(60°)
d² = 900 + 2025 - 2700·0.5 = 2925 - 1350 = 1575
d = √1575 ≈ 39.7 km
Answer: The ships are approximately 39.7 km apart.
Interactive Practice
Law of Cosines Practice Tool
Practice solving triangles using the Law of Cosines with randomly generated problems or create your own.
Select a problem type and click "Generate Problem"
Solution:
1. This is an SAS case: sides 8 m and 10 m with included angle 60°.
2. Apply Law of Cosines: x² = 8² + 10² - 2·8·10·cos(60°)
3. Calculate: x² = 64 + 100 - 160·0.5 = 164 - 80 = 84
4. x = √84 ≈ 9.17 m
Answer: The third side is approximately 9.17 meters.
Solution:
1. This is an SSS case with sides 7, 9, and 12.
2. The largest angle is opposite the longest side (12).
3. Apply Law of Cosines: cos(C) = (7² + 9² - 12²) / (2·7·9)
4. Calculate: cos(C) = (49 + 81 - 144) / 126 = (-14) / 126 ≈ -0.1111
5. C = cos⁻¹(-0.1111) ≈ 96.4°
Answer: The largest angle is approximately 96.4°.
Law of Cosines Summary & Cheat Sheet
| Concept | Formula | When to Use | Key Points |
|---|---|---|---|
| Law of Cosines | a² = b² + c² - 2bc·cos(A) | SAS or SSS cases | Works for all triangles, not just right triangles |
| SAS Case | Find side: a² = b² + c² - 2bc·cos(A) | Two sides and included angle known | Then use Law of Sines to find other angles |
| SSS Case | Find angle: cos(A) = (b² + c² - a²)/(2bc) | All three sides known | Find largest angle first to avoid ambiguity |
| Relation to Pythagorean Theorem | When C=90°, cos(C)=0 → c²=a²+b² | Right triangles only | Law of Cosines generalizes Pythagorean Theorem |
| Law of Sines vs Cosines | sin(A)/a = sin(B)/b = sin(C)/c | AAS, ASA, or SSA cases | Use Law of Cosines for SAS and SSS cases |
Mistake: Using degrees instead of radians
Wrong: cos(60) instead of cos(60°)
Correct: Ensure your calculator is in degree mode
Mistake: Applying to wrong case
Wrong: Using Law of Cosines for AAS case
Correct: Use Law of Cosines only for SAS or SSS
Mistake: Incorrect angle identification
Wrong: Using angle between wrong sides
Correct: The angle must be between the two known sides in SAS
Mistake: Forgetting to take square root
Wrong: a² = result, but reporting a² as the answer
Correct: Remember to take the square root for the final side length
- Always draw a diagram: Visualizing the triangle helps identify the correct sides and angles
- Label carefully: Clearly mark which sides are opposite which angles
- Check your calculator mode: Ensure it's set to degrees, not radians
- Verify with triangle sum: The three angles should always add to 180°
- Practice mental estimation: Develop intuition for what reasonable answers should be