Law of Cosines: The Complete Guide to Solving Any Triangle (With Step-by-Step Examples)

You’ve got a triangle. You know two sides and the angle wedged between them. Or maybe you know all three sides and need to figure out an angle. Either way, the Pythagorean theorem is useless — it only works for right triangles — and you’re stuck.

That’s exactly the problem the Law of Cosines was built to solve.

This guide covers everything: the formula and its three forms, a proper proof, step-by-step worked examples for both SAS and SSS cases, how it compares to the Law of Sines, real-world applications, and the most common mistakes students make. Whether you’re powering through a precalculus assignment or prepping for a standardized test, this is the only resource you need.

What Is the Law of Cosines?

The Law of Cosines is a trigonometric identity that relates the three sides of any triangle to the cosine of one of its angles. It’s the generalized version of the Pythagorean theorem — and the Pythagorean theorem is actually just a special case of it.

The standard form of the formula is:

c² = a² + b² − 2ab·cos(C)

Where:

  • a, b, and c are the side lengths of the triangle
  • C is the angle opposite side c

Because the formula is symmetric, it can be rearranged for any side:

Solving for side c: c² = a² + b² − 2ab·cos(C) Solving for side a: a² = b² + c² − 2bc·cos(A) Solving for side b: b² = a² + c² − 2ac·cos(B)

And when you need an angle instead of a side:

cos(C) = (a² + b² − c²) / 2ab

When to Use the Law of Cosines

Use the Law of Cosines when you have:

  • SAS — Two sides and the included angle (the angle between them)
  • SSS — All three sides, and you need to find an angle

If you have ASA, AAS, or SSA, use the Law of Sines instead.

Step-by-Step Worked Examples

Example 1: Finding a Missing Side (SAS Case)

Problem: In triangle ABC, a = 8, b = 11, and angle C = 37°. Find side c.

Step 1: Write the formula. c² = a² + b² − 2ab·cos(C)

Step 2: Substitute the known values. c² = 8² + 11² − 2(8)(11)·cos(37°)

Step 3: Calculate each part. c² = 64 + 121 − 176 × 0.7986 c² = 185 − 140.55 c² = 44.45

Step 4: Take the square root. c = √44.45 ≈ 6.67

Answer: c ≈ 6.67

Example 2: Finding a Missing Angle (SSS Case)

Problem: A triangle has sides a = 9, b = 5, and c = 8. Find angle C.

Step 1: Use the angle-finding form. cos(C) = (a² + b² − c²) / 2ab

Step 2: Substitute. cos(C) = (81 + 25 − 64) / (2 × 9 × 5) cos(C) = 42 / 90 cos(C) = 0.4667

Step 3: Apply the inverse cosine. C = cos⁻¹(0.4667) ≈ 62.2°

Answer: C ≈ 62.2°

Example 3: Obtuse Triangle

Problem: In triangle PQR, p = 5, q = 7, and angle R = 120°. Find r.

Step 1: Write the formula. r² = p² + q² − 2pq·cos(R)

Step 2: Substitute. Note that cos(120°) = −0.5 r² = 25 + 49 − 2(5)(7)(−0.5) r² = 74 + 35 r² = 109

Step 3: Square root. r = √109 ≈ 10.44

Answer: r ≈ 10.44

Key insight: When your angle is obtuse (greater than 90°), the cosine is negative, which means the 2ab·cos(C) term gets added rather than subtracted.

Proof of the Law of Cosines

Take any triangle ABC. Drop a perpendicular from vertex A to side BC, creating height h and splitting BC into two segments. Let BD = x, so DC = a − x.

From right triangle ABD: h² = c² − x² and x = c·cos(B)

From right triangle ACD: h² + (a − x)² = b²

Substitute h² = c² − x²: c² − x² + a² − 2ax + x² = b² c² + a² − 2ax = b²

Substitute x = c·cos(B): b² = a² + c² − 2ac·cos(B)

This works for all triangle types — acute, right, and obtuse.

Law of Cosines vs. Law of Sines

Use Law of Cosines when you have:

  • Two sides + included angle (SAS) → find the third side
  • All three sides (SSS) → find any angle

Use Law of Sines when you have:

  • Two angles + any side (ASA or AAS) → find a missing side
  • Two sides + non-included angle (SSA) → find a missing angle

Use Pythagorean Theorem when you have:

  • A right triangle with two known sides

Connection to the Pythagorean Theorem

When angle C = 90°, cos(90°) = 0. Plug that into the Law of Cosines:

c² = a² + b² − 2ab·(0) c² = a² + b²

That’s the Pythagorean theorem. The Law of Cosines is its parent formula. Every right-triangle problem you’ve ever solved was a special case of the Law of Cosines all along.

Real-World Applications

  • Surveying and navigation: Finding distances between points when direct measurement isn’t possible
  • Engineering and architecture: Calculating structural forces in non-right-angle frameworks
  • GPS and triangulation: Modern positioning systems use cosine-based triangulation
  • Astronomy: Computing angular distances between celestial bodies
  • Computer graphics: 3D rendering engines use cosine calculations for lighting and shading

Myth vs. Fact

Myth: The Law of Cosines only works for acute triangles. Fact: It works for all triangles — acute, right, and obtuse. The formula handles negative cosine values automatically.

Myth: The Law of Cosines replaces the Law of Sines. Fact: They handle different cases. You need both tools.

Myth: If I have two sides and an angle, I always use the Law of Cosines. Fact: Only if the angle is between the two sides (SAS). Otherwise, start with the Law of Sines.

Myth: The Pythagorean Theorem is separate from the Law of Cosines. Fact: The Pythagorean Theorem is a special case of the Law of Cosines when C = 90°.

Myth: Rearranging the formula to find an angle is a different formula. Fact: It’s just algebra applied to the same equation. There is only one Law of Cosines.

How to Check Your Work

After solving, always verify:

  1. The sum of all three angles equals exactly 180°
  2. The longest side is opposite the largest angle
  3. All sides are positive numbers

Pro tip: Find one angle using the Law of Cosines, find the second using the Law of Sines (it’s faster), then get the third by subtracting from 180°.

Frequently Asked Questions

What is the Law of Cosines formula?

The Law of Cosines states that c² = a² + b² − 2ab·cos(C), where a, b, and c are the sides of a triangle and C is the angle opposite side c. It can be rearranged to find an angle: cos(C) = (a² + b² − c²) / 2ab. This applies to any triangle regardless of angle type.

When should I use the Law of Cosines instead of the Law of Sines?

Use the Law of Cosines when you know two sides and their included angle (SAS) or all three sides (SSS). Use the Law of Sines when you know two angles and a side (AAS/ASA) or two sides and a non-included angle (SSA).

Does the Law of Cosines work for obtuse triangles?

Yes. When the angle involved is obtuse, its cosine is negative, which means the −2ab·cos(C) term becomes addition. The formula handles this automatically with no changes needed.

Is the Pythagorean theorem a special case of the Law of Cosines?

Exactly. When one angle equals 90°, cos(90°) = 0, and the Law of Cosines simplifies directly to a² + b² = c².

How do I find an angle using the Law of Cosines?

Rearrange to: cos(C) = (a² + b² − c²) / 2ab. Compute the right side, then apply cos⁻¹ to get angle C. Make sure your calculator is in degree mode.

What is the spherical Law of Cosines?

It extends the formula to the surface of a sphere: cos(c) = cos(a)·cos(b) + sin(a)·sin(b)·cos(C). It is used in navigation and astronomy to calculate great-circle distances.

Conclusion

The Law of Cosines is one of those concepts that looks intimidating until the moment it clicks — and then you realize it is just the Pythagorean theorem with one extra term. It handles every triangle case that Pythagoras cannot touch.

Key things to remember: the formula c² = a² + b² − 2ab·cos(C), use it for SAS and SSS cases, watch for the negative cosine in obtuse triangles, and always verify your answer by checking that angles sum to 180°.

What to study next:

  • Law of Sines — to complete your triangle-solving toolkit
  • Heron’s Formula — for finding triangle area when you know all three sides
  • Dot Product of Vectors — the Law of Cosines in disguise, used throughout calculus and physics

You Might Also Enjoy:

Caffeine and Mental Health

Caffeine Toxicity: Dosage Risks

Caffeine Intoxication: 5 Symptoms

Leave a Comment