MathorynMathematical Formula Database

Trigonometry

Law of Cosines

The law of cosines generalises the Pythagorean theorem to any triangle. It is used to find the third side from two sides and the included angle, or an angle from three sides.

c2=a2+b2−2abcos⁡Cc^2=a^2+b^2-2ab\cos C
LaTeXc^2=a^2+b^2-2ab\cos C

Variables

a, b, ca,\ b,\ c
side lengths
CC
angle opposite side c (between a and b)

Example

a=5, b=7, C=60∘a=5,\ b=7,\ C=60^\circ. Find cc.

  1. c2=25+49−2⋅5⋅7⋅12=39c^2=25+49-2\cdot5\cdot7\cdot\frac12=39.
  2. c=39c=\sqrt{39}.

Answer: c≈6.24c\approx6.24.

Related formulas