# The Law of Cosines Given any triangle $ABC$ such that the side $a$ is opposite point $A$, the side $b$ is opposite point $B$, the side $c$ is opposite point $C$, and that the angles of $ABC$ are $\alpha$, $\beta$ and $\gamma$ respectively, the following holds true: $ \begin {align} a^2 = b^2 + c^2 - 2bc\cos \alpha \\ b^2 = a^2 + c^2 - 2ab\cos \beta \\ c^2 = a^2 + b^2 - 2ab\cos \gamma \end {align} $ Put differently: **the squared length of a side of a triangle is equal to the sum of the squares of the lengths of the other two sides, minus $2ab\cos \gamma$ where $a$ and $b$ are the lengths of the other two sides and $\gamma$ the angle between them.** Pythagoras' theorem is a simplification of this law: $\cos (90 \degree) = 0$. ## Proof ![[Law of Cosines.png|400]] Given a generic triangle $ABC$ drop a height $h$ from $C$. The height divides side $c$ into two parts $|AD|$ and $|DB|$. If we designate part $|AD|$ as $x$, the length of the $|DB|$ part is equal to $c-x$. The following can then be said of side $a$: $ \begin{align} a^2 &= h^2 + (c-x)^2 && \text{Pythagorean theorem applied to triangle $BCD$} \\ a^2 &= h^2 + c^2 - 2cx + x^2 \\ a^2 &= b^2 - x^2 + c^2 - 2cx + x^2 && \text{Pythagorean theorem applied to triangle $ACD$} \\ a^2 &= b^2 + c^2 -2cx \\ a^2 &= b^2 + c^2 - 2bc\cos \alpha && \text{per definition of $\cos$} \end{align} $