info prev up next book cdrom email home

Law of Cosines


Let $a$, $b$, and $c$ be the lengths of the legs of a Triangle opposite Angles $A$, $B$, and $C$. Then the law of cosines states

c^2=a^2+b^2-2ab\cos C.
\end{displaymath} (1)

This law can be derived in a number of ways. The definition of the Dot Product incorporates the law of cosines, so that the length of the Vector from ${\bf X}$ to ${\bf Y}$ is given by
$\displaystyle \vert{\bf X}-{\bf Y}\vert^2$ $\textstyle =$ $\displaystyle ({\bf X}-{\bf Y})\cdot({\bf X}-{\bf Y})$ (2)
  $\textstyle =$ $\displaystyle {\bf X}\cdot{\bf X}-2{\bf X}\cdot{\bf Y}+{\bf Y}\cdot{\bf Y}$ (3)
  $\textstyle =$ $\displaystyle \vert{\bf X}\vert^2+\vert{\bf Y}\vert^2-2\vert{\bf X}\vert\,\vert{\bf Y}\vert\cos\theta,$ (4)

where $\theta$ is the Angle between ${\bf X}$ and ${\bf Y}$.

\begin{figure}\begin{center}\BoxedEPSF{LawOfCosinesTriangles.epsf scaled 900}\end{center}\end{figure}

The formula can also be derived using a little geometry and simple algebra. From the above diagram,

$\displaystyle c^2$ $\textstyle =$ $\displaystyle (a\sin C)^2+(b-a\cos C)^2$  
  $\textstyle =$ $\displaystyle a^2\sin^2 c+b^2-2ab\cos C+a^2\cos^2 C$  
  $\textstyle =$ $\displaystyle a^2+b^2-2ab\cos C.$ (5)

The law of cosines for the sides of a Spherical Triangle states that

$\displaystyle \cos a$ $\textstyle =$ $\displaystyle \cos b\cos c+\sin b\sin c\cos A$ (6)
$\displaystyle \cos b$ $\textstyle =$ $\displaystyle \cos c\cos a+\sin c\sin a\cos B$ (7)
$\displaystyle \cos c$ $\textstyle =$ $\displaystyle \cos a\cos b+\sin a\sin b\cos C$ (8)

(Beyer 1987). The law of cosines for the angles of a Spherical Triangle states that
$\displaystyle \cos A$ $\textstyle =$ $\displaystyle -\cos B\cos C+\sin B\sin C\cos a$ (9)
$\displaystyle \cos B$ $\textstyle =$ $\displaystyle -\cos C\cos A+\sin C\sin A\cos b$ (10)
$\displaystyle \cos C$ $\textstyle =$ $\displaystyle -\cos A\cos B+\sin A\sin B\cos c$ (11)

(Beyer 1987).

See also Law of Sines, Law of Tangents


Abramowitz, M. and Stegun, C. A. (Eds.). Handbook of Mathematical Functions with Formulas, Graphs, and Mathematical Tables, 9th printing. New York: Dover, p. 79, 1972.

Beyer, W. H. CRC Standard Mathematical Tables, 28th ed. Boca Raton, FL: CRC Press, pp. 148-149, 1987.

info prev up next book cdrom email home

© 1996-9 Eric W. Weisstein