The Law of Cosines is one of the most versatile tools in trigonometry, allowing you to solve any triangle, not just right triangles. While the Pythagorean theorem is limited to right triangles, the Law of Cosines extends the power of cosine to non-right triangles, making it indispensable for geometry, physics, engineering, and navigation. This article will guide you through using the Law of Cosines to find unknown sides and angles, provide step-by-step examples, and explore its derivation and real-world applications.

Understanding the Law of Cosines: Formula and Notation

The Law of Cosines relates the side lengths of a triangle to the cosine of one of its angles. For a triangle with sides labeled a, b, and c opposite angles A, B, and C respectively, the formula is:

c2 = a2 + b2 − 2ab cos C

The equation can be written for any side. If you know sides a, b, and angle C (the included angle between a and b), you can solve for side c. Similarly, you can rearrange the formula to solve for any angle when all three sides are known:

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

The notation is symmetrical: you can rotate the letters to match your triangle. The key is to identify which angle is opposite the side you want to find.

When to Use the Law of Cosines

The Law of Cosines is the method of choice for two common triangle-solving scenarios:

  • SAS (Side-Angle-Side): You know two sides and the included angle. Use the Law of Cosines to find the third side.
  • SSS (Side-Side-Side): You know all three sides. Use the Law of Cosines to find any angle.

It can also be used for SSA (Side-Side-Angle), but the Law of Sines is usually preferred there because it has fewer steps. However, the Law of Cosines is the only direct method for SAS and SSS cases.

Step-by-Step: Solving for an Unknown Side (SAS)

Let's walk through a detailed example. Suppose you have triangle ABC where side a = 9 cm, side b = 12 cm, and angle C = 40°. You want to find side c (opposite angle C).

Step 1: Write down the Law of Cosines formula for the side you need:

c2 = a2 + b2 − 2ab cos C

Step 2: Substitute the known values:

c2 = 92 + 122 − 2 × 9 × 12 × cos 40°

Step 3: Compute the squares and product:

  • 92 = 81
  • 122 = 144
  • 2 × 9 × 12 = 216
  • cos 40° ≈ 0.7660

Step 4: Perform the multiplication:

216 × 0.7660 ≈ 165.456

Step 5: Combine the terms:

c2 = 81 + 144 − 165.456 = 59.544

Step 6: Take the square root (positive length):

c ≈ √59.544 ≈ 7.72 cm

Thus, side c is approximately 7.72 cm long.

This method works for any SAS configuration. Just make sure the angle you use is the one between the two known sides. For more practice, visit Khan Academy’s Law of Cosines tutorial.

Another SAS Example

Try a triangle with sides a = 15, b = 20, and angle C = 30°. Following the same steps:

c2 = 225 + 400 − 2×15×20×cos 30°

cos 30° = √3/2 ≈ 0.8660

2×15×20 = 600; 600×0.8660 = 519.6

c2 = 625 − 519.6 = 105.4

c ≈ √105.4 ≈ 10.27 units

Step-by-Step: Solving for an Unknown Angle (SSS)

When you know all three sides, you can find any angle by rearranging the Law of Cosines. The rearranged formula:

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

Here, c is the side opposite the angle C you want to find. Let's work an example: triangle with sides a = 8, b = 6, c = 10. Find angle C (opposite side c).

Step 1: Plug into the formula:

cos C = (82 + 62 − 102) / (2 × 8 × 6)

Step 2: Compute numerator: 64 + 36 − 100 = 0

Step 3: Compute denominator: 96

cos C = 0 / 96 = 0

Step 4: Find the angle: C = cos−1(0) = 90°

So the triangle is actually a right triangle (confirming the Pythagorean triple 6-8-10).

Now try a non-right example: sides a = 13, b = 14, c = 15. Find angle A (opposite side a). Use the formula with a as the "c" in the equation:

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

= (142 + 152 − 132) / (2×14×15)

= (196 + 225 − 169) / (420) = 252 / 420 = 0.6

A = cos−1(0.6) ≈ 53.13°

You can find the other angles similarly. This technique is especially useful when you need all angles from side lengths. For a complete set of practice problems, check Paul’s Online Math Notes on Law of Cosines.

Derivation of the Law of Cosines

Understanding where the Law of Cosines comes from can deepen your confidence. The derivation starts with any triangle placed on a coordinate plane. Suppose you place angle C at the origin, with side a along the x-axis and side b forming the angle. Then vertex at side a is at (a,0) and the vertex along side b is at (b cos C, b sin C). The side c is the distance between these two points:

c2 = (a − b cos C)2 + (0 − b sin C)2

Expand: c2 = a2 − 2ab cos C + b2 cos2 C + b2 sin2 C

Factor b2 (cos2 C + sin2 C) = b2

Thus: c2 = a2 + b2 − 2ab cos C

This elegant derivation shows the Law of Cosines as a generalization of the Pythagorean theorem (when C = 90°, cos C = 0, giving c2 = a2 + b2). For a full geometric proof, see Math is Fun’s Law of Cosines page.

Law of Cosines vs. Law of Sines

Both laws solve triangles, but they serve different situations. The Law of Sines (a / sin A = b / sin B = c / sin C) works well for AAS, ASA, and sometimes SSA, but it fails for SAS and SSS because no side‑angle pair is fully known. The Law of Cosines fills that gap. However, after using the Law of Cosines to find one side or angle, you can switch to the Law of Sines to find remaining angles or sides more efficiently.

For example, after solving side c in an SAS triangle, you can use the Law of Sines to find angles A and B (since you now have a side and its opposite angle). This hybrid approach is common in practice.

Common Mistakes and How to Avoid Them

  • Using the wrong angle: In the SAS formula, the angle must be the included angle between the two known sides. If you accidentally use a non‑included angle, the formula gives incorrect results. Always verify which sides are adjacent to the angle.
  • Forgetting to square the sides: A simple but common error. Write out each term: a2 + b2 − 2ab cos C, and double‑check you squared correctly.
  • Mixing up sides in SSS: When solving for angle A, make sure the side opposite that angle appears alone in the numerator. The formula is cos A = (b2 + c2 − a2) / (2bc). The side whose square is subtracted is opposite the angle you’re finding.
  • Rounding too early: Keep at least four decimal places during intermediate calculations to avoid rounding errors. Only round your final answer.
  • Calculator in wrong mode: Many students forget that trigonometric functions require the angle in degrees or radians. Always check your calculator mode before computing cosines or inverse cosines.

Real-World Applications

The Law of Cosines is not just a classroom exercise. It appears in many practical fields:

  • Surveying and Navigation: To compute distances between points when you can measure two distances and the angle between them (SAS). For instance, a surveyor can find the width of a river by triangulating from two points on the shore.
  • Physics and Engineering: When calculating resultant forces or velocities. If two forces act at an angle, the magnitude of their resultant can be found using the Law of Cosines.
  • Astronomy: To determine distances between celestial bodies when the angle subtended by two lines of sight is known.
  • Computer Graphics: In 3D rendering, the Law of Cosines is used in lighting calculations to determine the angle between light source and surface normal.
  • Navigation: Pilots and ship captains use it for great‑circle distance calculations on the Earth’s surface (spherical trigonometry, but based on the same principle).

For more examples of trigonometry in action, see this Exploratorium article on trigonometry in everyday life.

Practice Problems

Test your understanding with these problems. Try to solve before checking the answers.

Problem 1

In triangle XYZ, side x = 5, side y = 7, and angle Z = 55°. Find side z.

Solution: z2 = 52 + 72 − 2×5×7×cos 55° = 25 + 49 − 70×0.5736 ≈ 74 − 40.152 = 33.848 → z ≈ √33.848 ≈ 5.82 units.

Problem 2

Triangle ABC has sides a = 11, b = 9, c = 16. Find angle B (opposite side b).

Solution: cos B = (a2 + c2 − b2) / (2ac) = (121 + 256 − 81) / (2×11×16) = 296 / 352 ≈ 0.8409 → B ≈ cos−1(0.8409) ≈ 32.7°.

Problem 3

A triangular field has sides of 200 m, 250 m, and 300 m. Find the largest angle.

Solution: The largest angle is opposite the longest side (300 m). Use cos C = (2002 + 2502 − 3002) / (2×200×250) = (40000 + 62500 − 90000) / 100000 = 12500/100000 = 0.125 → C = cos−1(0.125) ≈ 82.8°.

For additional practice, check IXL’s Law of Cosines exercises.

Conclusion

The Law of Cosines is a fundamental tool for solving non‑right triangles. Whether you need to find a missing side when you know two sides and the included angle (SAS) or to determine an angle when you know all three sides (SSS), the formula provides a direct and robust method. By mastering the Law of Cosines, you build a foundation for more advanced geometry, trigonometry, and real‑world problem solving. Practice with different triangles, avoid common pitfalls, and soon you will apply it effortlessly.