Law of Cosines Calculator

Law of cosines calculator: third side of a triangle from two sides and the included angle, or an angle from three sides.

c² = a² + b² − 2ab · cos γ

How to use this calculator

  1. Choose the quantity you want under “Solve for”.
  2. Type the known values and pick their units: any combination works.
  3. The result updates as you type. Open “Show the steps” to see the substitution.

c² = a² + b² − 2ab cos γ generalises Pythagoras to any triangle; with γ = 90° it becomes c² = a² + b².

Formula

c² = a² + b² − 2ab · cos γ

SymbolQuantityUnits
aSide am, km, cm, mm, µm, nm, pm, Å, in, ft, yd, mi, nmi, au, ly
bSide bm, km, cm, mm, µm, nm, pm, Å, in, ft, yd, mi, nmi, au, ly
γAngle γ (between a and b)°, rad, gon, turn, ′, ″, mrad
cSide c (opposite γ)m, km, cm, mm, µm, nm, pm, Å, in, ft, yd, mi, nmi, au, ly

Worked example

Given: a = 8 cm · b = 5 cm · γ = 60 °

c = √(a² + b² − 2ab cos γ)

Result: c = 7 cm

Frequently asked questions

Third side with a = 8, b = 5 and γ = 60°?

c = √(64 + 25 − 40) = 7.

Related calculators

Report an error