Understanding the Law of Cosines
The law of cosines states a fundamental relationship in triangle geometry: when you know two sides of a triangle and the angle sandwiched between them, the third side follows a specific mathematical pattern. Unlike the Pythagorean theorem, which only applies to right triangles, the law of cosines works for any triangle—acute, obtuse, or right-angled.
At its core, the law of cosines is an extension of the Pythagorean theorem. For a right triangle where one angle is exactly 90°, the cosine of that angle equals zero, and the law of cosines collapses into the familiar a² = b² + c². For non-right triangles, the cosine term accounts for how the angle's size affects the relationship between the sides.
This makes the law of cosines invaluable whenever you encounter a triangle problem where:
- You have two sides and need to find the third (SAS: side-angle-side)
- You have all three sides and need the angles (SSS: side-side-side)
- You know two sides and an angle opposite one of them (SSA: side-side-angle)
Law of Cosines Formulas
Three equivalent forms express the law of cosines, each solving for a different side or angle:
c² = a² + b² − 2ab × cos(γ)
b² = a² + c² − 2ac × cos(β)
a² = b² + c² − 2bc × cos(α)
To find angles when all three sides are known, rearrange to solve for cosine:
cos(α) = (b² + c² − a²) ÷ (2bc)
cos(β) = (a² + c² − b²) ÷ (2ac)
cos(γ) = (a² + b² − c²) ÷ (2ab)
a, b, c— The three sides of the triangleα, β, γ— The angles opposite to sides a, b, and c respectivelycos(α), cos(β), cos(γ)— The cosine values of each angle
Solving Triangles: Side-Angle-Side (SAS)
When you know two sides and the angle between them, finding the third side is straightforward. Suppose you have sides a = 5 and b = 6, with the included angle γ = 30°. Plug these into the formula:
c² = 5² + 6² − 2(5)(6) × cos(30°)
c² = 25 + 36 − 60 × 0.866
c² ≈ 9.04
c ≈ 3.01
The key is ensuring you use the included angle—the one between your two known sides. Using an opposite angle will give you incorrect results. Always label your triangle carefully before substituting numbers into the formula.
Solving Triangles: All Sides Known (SSS)
Finding angles when you have all three sides requires the inverse cosine function. With sides a = 4, b = 5, and c = 6, you can find angle α:
cos(α) = (5² + 6² − 4²) ÷ (2 × 5 × 6)
cos(α) = (25 + 36 − 16) ÷ 60
cos(α) = 45 ÷ 60 = 0.75
α = arccos(0.75) ≈ 41.41°
Repeat this process for the other two angles. The sum of all angles in any triangle must equal 180°, which provides a useful check on your calculations. If your three angles don't sum to 180°, you've made an arithmetic error.
Common Pitfalls and Practical Tips
Avoid these frequent mistakes when applying the law of cosines:
- Mixing up angle positions — The angle in SAS must be between the two known sides. If you accidentally use an angle opposite one of your known sides, you'll solve the wrong problem. Always sketch your triangle and label clearly before substituting into the formula.
- Forgetting units or precision loss — Carry sufficient decimal places through intermediate steps; rounding too early introduces error. If your original measurements have units (metres, feet, etc.), propagate those units through and state them in your final answer.
- Inverse cosine domain issues — When solving for angles using arccos, ensure your intermediate value stays between −1 and 1. Values outside this range indicate either an arithmetic mistake or that the three sides cannot form a valid triangle (triangle inequality violated).
- Right triangle shortcuts — If you suspect one angle is 90°, verify using the law of cosines before defaulting to the Pythagorean theorem. While both methods work for right triangles, the law of cosines provides a unified approach for all triangle types, reducing the need to check special cases.