Ad Space — Top Banner

Law of Cosines

The Law of Cosines c² = a² + b² - 2ab·cos(C) solves any triangle when you know three sides or two sides and the included angle.

The Formula

c² = a² + b² - 2ab × cos(C)

The Law of Cosines is a generalization of the Pythagorean theorem.

When angle C is 90°, cos(90°) = 0, and the formula simplifies to c² = a² + b².

Variables

SymbolMeaning
a, bTwo known sides of the triangle
cThe side opposite angle C (the side you are solving for)
CThe angle between sides a and b (the included angle)
cosThe cosine function

Finding an Angle

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

Rearrange the formula to find an angle when you know all three sides.

Example 1

Find side c when a = 7, b = 10, and C = 50°

c² = a² + b² - 2ab × cos(C)

c² = 7² + 10² - 2(7)(10) × cos(50°)

c² = 49 + 100 - 140 × 0.6428

c² = 149 - 89.99 = 59.01

c = √59.01 ≈ 7.68

Example 2

Find angle C when a = 5, b = 8, and c = 9

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

cos(C) = (25 + 64 - 81) / (2 × 5 × 8)

cos(C) = 8 / 80 = 0.1

C = arccos(0.1) ≈ 84.26°

When to Use It

Use the Law of Cosines when:

  • You know two sides and the included angle (SAS) and need the third side
  • You know all three sides (SSS) and need to find an angle
  • The Law of Sines cannot be applied (no opposite side-angle pair known)
  • Solving real-world problems like navigation, surveying, or physics

Key Notes

  • Formula: c² = a² + b² − 2ab cosC: Where C is the angle opposite side c. Equivalent forms: a² = b² + c² − 2bc cosA; b² = a² + c² − 2ac cosB. Use the form where the unknown side or angle is isolated.
  • Generalization of the Pythagorean theorem: When C = 90°, cosC = 0 and the formula reduces to c² = a² + b². The Law of Cosines is therefore the Pythagorean theorem extended to any triangle — acute, right, or obtuse.
  • Two use cases: SAS (two sides + included angle) → find the third side directly. SSS (all three sides) → find an angle using cosC = (a² + b² − c²) / (2ab). Use the Law of Cosines first when you know two sides and the angle between them.
  • Avoids the ambiguous case: Unlike the Law of Sines (SSA), the Law of Cosines for SAS and SSS configurations always produces a unique answer — no ambiguity about which triangle is intended.
  • Applications: The Law of Cosines is used in surveying (computing distances from angle and two measured lengths), navigation (course correction calculations), physics (vector addition: the resultant's magnitude uses the law of cosines), and structural engineering for non-right-angle force analysis.

Ad Space — Bottom Banner

Embed This Calculator

Copy the code below and paste it into your website or blog.
The calculator will work directly on your page.