Law of Cosines

c^2 = a^2 + b^2 - 2ab C — Pythagoras with a correction term.

The idea

Theorem (Law of cosines).

In any triangle with sides $a$, $b$, $c$, where $C$ is the angle opposite side $c$, $c^{2} = a^{2} + b^{2} - 2ab\cos C.$

If $C$ is a right angle, then $a$ and $b$ are the legs, $c$ is the hypotenuse, and $\cos 90^{\circ} = 0$ removes the last term, leaving the Pythagorean theorem. So the law of cosines is that theorem with a correction term, and $-2ab\cos C$ measures how far $C$ is from a right angle. Open the angle past $90^{\circ}$ and $\cos C$ turns negative, so the correction adds and $c$ comes out longer; close it below $90^{\circ}$ and the correction subtracts, so $c$ comes out shorter. Near $C = 0^{\circ}$ the formula tends to $(a - b)^{2}$, and near $180^{\circ}$ to $(a + b)^{2}$: the two flattened triangles.

The law takes two sides and the angle between them — exactly the data that determines a triangle — and returns the third side. Solved for the cosine, $\cos C = \frac{a^{2} + b^{2} - c^{2}}{2ab},$ it recovers an angle from three known sides.

Ways to work on it

Not sure where to start? Take the ten-question placement test.