# Law of Cosines

## Contents

## Theorem

Let $\triangle ABC$ be a triangle whose sides $a, b, c$ are such that $a$ is opposite $A$, $b$ is opposite $B$ and $c$ is opposite $C$.

Then:

- $c^2 = a^2 + b^2 - 2 a b \cos C$

## Proof 1

Let $\triangle ABC$ be embedded in a Cartesian coordinate system by identifying:

- $C := \left({0, 0}\right)$
- $B := \left({a, 0}\right)$

Thus by definition of sine and cosine:

- $A = \left({b \cos C , b \sin C}\right)$

By the Distance Formula:

- $c = \sqrt{\left({b \cos C - a}\right)^2 + \left({b \sin C - 0}\right)^2}$

Hence:

\(\displaystyle c^2\) | \(=\) | \(\displaystyle \left({b \cos C - a}\right)^2 + \left({b \sin C - 0}\right)^2\) | $\quad$ squaring both sides of Distance Formula | $\quad$ | |||||||||

\(\displaystyle \) | \(=\) | \(\displaystyle b^2 \cos^2 C - 2 a b \cos C + a^2 + b^2 \sin^2 C\) | $\quad$ Square of Difference | $\quad$ | |||||||||

\(\displaystyle \) | \(=\) | \(\displaystyle a^2 + b^2 \left({\sin^2 C + \cos^2 C}\right) - 2 a b \cos C\) | $\quad$ Real Multiplication Distributes over Addition | $\quad$ | |||||||||

\(\displaystyle \) | \(=\) | \(\displaystyle a^2 + b^2 - 2 a b \cos C\) | $\quad$ Sum of Squares of Sine and Cosine | $\quad$ |

$\blacksquare$

## Proof 2

Let $\triangle ABC$ be a triangle.

### Case 1: $AC$ greater than $AB$

Using $AC$ as the radius, we construct a circle whose center is $A$.

Now we extend:

- $CB$ to $D$
- $AB$ to $F$
- $BA$ to $G$
- $CA$ to $E$.

$D$ is joined with $E$, thus:

Using the Intersecting Chord Theorem we have:

- $GB \cdot BF = CB \cdot BD$

$AF$ is a radius, so $AF = AC = b = GA$ and thus:

- $GB = GA + AB = b + c$
- $BF = AF - AB = b - c$

Thus:

\(\displaystyle \left({b + c}\right) \left({b - c}\right)\) | \(=\) | \(\displaystyle a \cdot BD\) | $\quad$ | $\quad$ | |||||||||

\(\displaystyle \implies \ \ \) | \(\displaystyle \frac {b^2 - c^2} a\) | \(=\) | \(\displaystyle BD\) | $\quad$ | $\quad$ |

Next:

\(\displaystyle CD\) | \(=\) | \(\displaystyle CB + BD\) | $\quad$ | $\quad$ | |||||||||

\(\displaystyle \) | \(=\) | \(\displaystyle a + \frac {b^2 - c^2} a\) | $\quad$ | $\quad$ | |||||||||

\(\displaystyle \) | \(=\) | \(\displaystyle \frac {a^2 + b^2 - c^2} a\) | $\quad$ | $\quad$ |

As $CA$ is a radius, $CE$ is a diameter.

By Thales' Theorem, it follows that $\angle CDE$ is a right angle.

Then using the definition of cosine, we have

\(\displaystyle \cos C\) | \(=\) | \(\displaystyle \frac {CD} {CE}\) | $\quad$ | $\quad$ | |||||||||

\(\displaystyle \) | \(=\) | \(\displaystyle \frac {\left({\dfrac{a^2 + b^2 - c^2} a}\right)} {2 b}\) | $\quad$ | $\quad$ | |||||||||

\(\displaystyle \) | \(=\) | \(\displaystyle \frac {a^2 + b^2 - c^2} {2 a b}\) | $\quad$ | $\quad$ | |||||||||

\(\displaystyle \implies \ \ \) | \(\displaystyle c^2\) | \(=\) | \(\displaystyle a^2 + b^2 - 2 a b \cos C\) | $\quad$ | $\quad$ |

$\Box$

### Case 2: $AC$ less than $AB$

When $AC$ is less than $AB$, the point $B$ lies outside the circle and so the diagram needs to be modified accordingly:

Now we extend:

- $BA$ to $G$
- $CA$ to $E$.

Then we construct:

- $D$ as the point at which $CB$ intersects the circle
- $F$ as the point at which $AB$ intersects the circle.

Finally $D$ is joined to $E$.

Using the Secant Secant Theorem we have:

- $GB \cdot BF = CB \cdot BD$

$AF$ is a radius, so $AF = AC = b = GA$ and thus:

- $GB = GA + AB = b + c$
- $BF = AB - AF = b - c$

Thus:

\(\displaystyle \left({b + c}\right) \left({b - c}\right)\) | \(=\) | \(\displaystyle CB \cdot BD\) | $\quad$ Secant Secant Theorem | $\quad$ | |||||||||

\(\displaystyle \left({b + c}\right) \left({b - c}\right)\) | \(=\) | \(\displaystyle a \cdot BD\) | $\quad$ | $\quad$ | |||||||||

\(\displaystyle \implies \ \ \) | \(\displaystyle \frac {b^2 - c^2} a\) | \(=\) | \(\displaystyle BD\) | $\quad$ | $\quad$ |

Next:

\(\displaystyle CD\) | \(=\) | \(\displaystyle CB - BD\) | $\quad$ | $\quad$ | |||||||||

\(\displaystyle \) | \(=\) | \(\displaystyle a - \frac {b^2 - c^2} a\) | $\quad$ | $\quad$ | |||||||||

\(\displaystyle \) | \(=\) | \(\displaystyle \frac {a^2 - b^2 + c^2} a\) | $\quad$ | $\quad$ |

As $CA$ is a radius, $CE$ is a diameter.

By Thales' Theorem, it follows that $\angle CDE$ is a right angle.

Then using the definition of cosine, we have

\(\displaystyle \cos C\) | \(=\) | \(\displaystyle \frac {CD} {CE}\) | $\quad$ | $\quad$ | |||||||||

\(\displaystyle \) | \(=\) | \(\displaystyle \frac {\left({\dfrac {a^2 - b^2 + c^2} a}\right)} {2 b}\) | $\quad$ | $\quad$ | |||||||||

\(\displaystyle \) | \(=\) | \(\displaystyle \frac {a^2 - b^2 + c^2} {2 a b}\) | $\quad$ | $\quad$ | |||||||||

\(\displaystyle \implies \ \ \) | \(\displaystyle c^2\) | \(=\) | \(\displaystyle a^2 + b^2 - 2 a b \cos C\) | $\quad$ | $\quad$ |

$\Box$

### Case 3: $AC = AB$

When $AC = AB$ the points $B$, $D$ and $F$ coincide on the circumference of the circle:

We extend:

- $BA$ to $G$
- $CA$ to $E$

and immediately:

- $GB = CB$

$\blacksquare$

## Proof 3

### Lemma: Right Triangle

Let $\triangle ABC$ be a right triangle such that $\angle A$ is right.

\(\displaystyle a^2\) | \(=\) | \(\displaystyle b^2 + c^2\) | $\quad$ Pythagoras's Theorem | $\quad$ | |||||||||

\(\displaystyle c^2\) | \(=\) | \(\displaystyle a^2 - b^2\) | $\quad$ adding $-b^2$ to both sides and rearranging | $\quad$ | |||||||||

\(\displaystyle \) | \(=\) | \(\displaystyle a^2 - 2 b^2 + b^2\) | $\quad$ adding $0 = b^2 - b^2$ to the right hand side | $\quad$ | |||||||||

\(\displaystyle \) | \(=\) | \(\displaystyle a^2 - 2 a b \left({\frac b a}\right) + b^2\) | $\quad$ multiplying $2 b^2$ by $\dfrac a a$ | $\quad$ | |||||||||

\(\displaystyle \) | \(=\) | \(\displaystyle a^2 + b^2 - 2 a b \cos C\) | $\quad$ Definition of Cosine: $\cos C = \dfrac b a$ | $\quad$ |

Hence the result.

$\blacksquare$

### Acute Triangle

Let $\triangle ABC$ be an acute triangle.

Let $BD$ be dropped perpendicular to $AC$, and let us define $h = BD$, $e = CD$ and $f = AD$.

Then $\triangle CDB$ and $\triangle ADB$ are right triangles.

So we have both :

- $(1):\quad c^2 = h^2 + f^2 \quad$ Pythagoras's Theorem
- $(2):\quad a^2 = h^2 + e^2 \quad$ Pythagoras's Theorem

and also :

- $(3):\quad b^2 = (e + f)^2 = e^2 + f^2 + 2ef$
- $(4):\quad e = a \cos C \quad$ Definition:Cosine of Angle

We'll start with the first equation and use the rest of them to get the desired result :

\(\displaystyle c^2\) | \(=\) | \(\displaystyle h^2 + f^2\) | $\quad$ $(1)$ | $\quad$ | |||||||||

\(\displaystyle \) | \(=\) | \(\displaystyle a^2 - e^2 + f^2\) | $\quad$ $(2)$ | $\quad$ | |||||||||

\(\displaystyle \) | \(=\) | \(\displaystyle a^2 - e^2 + f^2 + 2e^2 - 2e^2 + 2ef - 2ef\) | $\quad$ adding and subtracting $2e^2$ and $2ef$ | $\quad$ | |||||||||

\(\displaystyle \) | \(=\) | \(\displaystyle a^2 + (e^2 + f^2 + 2ef) - 2e(e + f)\) | $\quad$ rearanging | $\quad$ | |||||||||

\(\displaystyle \) | \(=\) | \(\displaystyle a^2 + b^2 - 2 a b \cos C\) | $\quad$ using $(3)$ to substitute both parentheses for $b^2$ and $b$ respectively, and $(4)$ to subst. e for $a \cos C$ | $\quad$ |

$\blacksquare$

### Obtuse Triangle

Let $\triangle ABC$ be an obtuse triangle.

Let $AC$ be extended and $BD$ be dropped perpendicular to $AC$, and let us define $h = BD$, $e = CD$ and $f = AD$.

Then $\triangle CDB$ and $\triangle ADB$ are right triangles.

So we have both :

- $(1):\quad c^2 = h^2 + f^2 \quad$ Pythagoras's Theorem
- $(2):\quad a^2 = h^2 + e^2 \quad$ Pythagoras's Theorem

and also :

- $(3):\quad e^2 = (b + f)^2 = b^2 + f^2 + 2bf$
- $(4):\quad e = a \cos C \quad$ Definition:Cosine of Angle

We'll start with the first equation and use the rest of them to get the desired result :

\(\displaystyle c^2\) | \(=\) | \(\displaystyle h^2 + f^2\) | $\quad$ $(1)$ | $\quad$ | |||||||||

\(\displaystyle \) | \(=\) | \(\displaystyle a^2 - e^2 + f^2\) | $\quad$ $(2)$ | $\quad$ | |||||||||

\(\displaystyle \) | \(=\) | \(\displaystyle a^2 - b^2 - f^2 - 2bf + f^2\) | $\quad$ $(3)$ | $\quad$ | |||||||||

\(\displaystyle \) | \(=\) | \(\displaystyle a^2 - b^2 - 2bf + 2b^2 - 2b^2\) | $\quad$ canceling out $f^2 - f^2$ and adding and subtracting $2b^2$ | $\quad$ | |||||||||

\(\displaystyle \) | \(=\) | \(\displaystyle a^2 + b^2 - 2b(b + f)\) | $\quad$ rearanging | $\quad$ | |||||||||

\(\displaystyle \) | \(=\) | \(\displaystyle a^2 + b^2 - 2 a b \cos C\) | $\quad$ using $(4)$ to substitute $b + f = e$ with $a \cos C$ | $\quad$ |

$\blacksquare$

## Historical Note

This result is known in France as *Théorème d'Al-Kashi* (Al-Kashi's Theorem) after Jamshīd al-Kāshī, who is believed to have first discovered it.

## Sources

- 1968: Murray R. Spiegel:
*Mathematical Handbook of Formulas and Tables*... (previous) ... (next): $\S 5$: Trigonometric Functions: $5.93$ - 2008: Ian Stewart:
*Taming the Infinite*... (previous) ... (next): Chapter $5$: Eternal Triangles