# Cosine Rule

## What is the Cosine Rule?

The cosine rule (or law of cosines) is an equation which relates all of a triangle's side lengths to one of the angles. It is convention to label a triangle's sides with lower case letters, and its angles with the capitalised letter of the opposite side, as shown here. The cosine rule is stated in terms of this labelling.

Below is the cosine rule: $\text{c}^2=\text{a}^2+\text{b}^2-2\text{ab}\cos(\text{C})$ Here, $$\text{a}$$ and $$\text{b}$$ are interchangable; the key thing is that the angle C is contained between sides $$\text{a}$$ and $$\text{b}$$ - as per the conventional labelling above.

The cosine rule is a more general version of Pythagoras' Theorem; holding for any triangle. It can be seen that if the angle $$\text{C}=90^o$$ (a right angle) then we would get $$\cos(\text{C})=0$$ and so have the familiar \begin{align} \text{c}^2&=\text{a}^2+\text{b}^2-2\text{ab}\cos(90) \\[6pt] \text{c}^2&=\text{a}^2+\text{b}^2-(2\text{ab}\times0) \\[6pt] \text{c}^2&=\text{a}^2+\text{b}^2\hspace{10pt}\text{[Pythag. for right angled triangles]} \end{align}
By relabelling the sides, it can be seen that the following equations are equally true: $\text{a}^2=\text{b}^2+\text{c}^2-2\text{bc}\cos(\text{A})$ $\text{b}^2=\text{a}^2+\text{c}^2-2\text{ac}\cos(\text{B})$

## When to use the Cosine Rule

There are two different rearrangements which are useful in particular situations:

When you know all three side lengths and need an angle.
$\text{C}=\cos^{-1}\left(\frac{\text{a}^2+\text{b}^2-\text{c}^2}{2\text{ab}}\right)$
When you know an angle, the two surrounding side lengths and need the third length.
$\text{c}=\sqrt{\text{a}^2+\text{b}^2-2\text{ab}\cos(\text{C})}$

The cosine rule can be used with any sort of triangle; there is no need for it to be right angled as with SOH CAH TOA.

## Example 1: finding an angle

Find angle $$\theta$$ according to the diagram
[not to scale].

The first step is to label the sides with letters (as shown in the second diagram) so that we can plug values into the formula. Then we use the formula as shown here: \begin{align} \text{C}&=\cos^{-1}\left(\frac{\text{a}^2+\text{b}^2-\text{c}^2}{2\text{ab}}\right) \\[8pt] \text{C}&=\cos^{-1}\left(\frac{7^2+12^2-14^2}{2\times7\times12}\right) \\[8pt] \text{C}&=\cos^{-1}\left(\frac{-3}{168}\right) \\[8pt] \text{C}&=\cos^{-1}\left(\frac{-1}{56}\right) \\[8pt] \text{C}&=91.02^o\hspace{12pt}\text{[2dp]} \\[16pt] \theta&=91.02^o\hspace{12pt}\text{[2dp]} \end{align}

## Example 2: finding a side length

Find length $$\text{x}$$ according to the diagram
[not to scale].

The first step is the same; label the sides and then use the formula as shown here: \begin{align} \text{c}&=\sqrt{\text{a}^2+\text{b}^2-2\text{ab}\cos(\text{C})} \\[6pt] \text{c}&=\sqrt{19^2+17^2-2\times19\times17\cos(37)} \\[6pt] \text{c}&=\sqrt{650-646\cos(37)} \\[6pt] \text{c}&=11.58\hspace{12pt}\text{[2dp]} \\[14pt] \text{x}&=11.58\hspace{12pt}\text{[2dp]} \end{align}