# 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 := \tuple {0, 0}$
- $B := \tuple {a, 0}$

Thus by definition of sine and cosine:

- $A = \tuple {b \cos C, b \sin C}$

By the Distance Formula:

- $c = \sqrt {\paren {b \cos C - a}^2 + \paren {b \sin C - 0}^2}$

Hence:

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

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

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

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

$\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\) | |||||||||||

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

Next:

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

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

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

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}\) | |||||||||||

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

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

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

$\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\) | Secant Secant Theorem | ||||||||||

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

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

Next:

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

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

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

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}\) | |||||||||||

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

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

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

$\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\) | Pythagoras's Theorem | ||||||||||

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

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

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

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

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\) | $(1)$ | ||||||||||

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

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

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

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

$\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\) | $(1)$ | ||||||||||

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

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

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

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

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

$\blacksquare$

## Also known as

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.

## Also see

## Historical Note

The **Law of Cosines** is believed to have been discovered by Jamshīd al-Kāshī.

## Sources

- 1968: Murray R. Spiegel:
*Mathematical Handbook of Formulas and Tables*... (previous) ... (next): $\S 5$: Trigonometric Functions: $5.93$ - 2008: David Nelson:
*The Penguin Dictionary of Mathematics*(4th ed.) ... (previous) ... (next): Entry:**cosine rule (law of cosines)**:**1.** - 2008: Ian Stewart:
*Taming the Infinite*... (previous) ... (next): Chapter $5$: Eternal Triangles: Logarithms