# The Law of Cosines

For any triangle ...

**a**, **b** and **c** are sides.

**C** is the angle opposite side c

... **the Law of Cosines** (also called the **Cosine Rule**) says:

c^{2} = a^{2} + b^{2} − 2ab cos(C)

It helps us solve some triangles. Let's see how to use it.

### Example: How long is side "c" ... ?

We know angle C = 37º, and sides a = 8 and b = 11

**The Law of Cosines**says:c

^{2}= a

^{2}+ b

^{2}− 2ab cos(C)

^{2}= 8

^{2}+ 11

^{2}− 2 × 8 × 11 × cos(37º)

^{2}= 64 + 121 − 176 × 0.798…

^{2}= 44.44...

**6.67**to 2 decimal places

Answer: c = 6.67

## How to Remember

How can you remember the formula?

Well, it helps to know it's the Pythagoras Theorem with something extra so it works for all triangles:

(only for Right-Angled Triangles)a

^{2}+ b

^{2}= c

^{2}

(for all triangles)a

^{2}+ b

^{2}− 2ab cos(C) = c

^{2}

So, to remember it:

- think "
**abc**":**a**^{2}+**b**^{2}=**c**^{2}, - then a
**2**nd "**abc**":**2ab**cos(**C**), - and put them together:
**a**^{2}+ b^{2}− 2ab cos(C) = c^{2}

## When to Use

The Law of Cosines is useful for finding:

- the third side of a triangle when we know
**two sides and the angle between**them (like the example above) - the angles of a triangle when we know
**all three sides**(as in the following example)

### Example: What is Angle "C" ...?

The side of length "8" is opposite angle * C*, so it is side

**c**. The other two sides are

**a**and

**b**.

Now let us put what we know into **The Law of Cosines**:

^{2}= a

^{2}+ b

^{2}− 2ab cos(C)

^{2}= 9

^{2}+ 5

^{2 }− 2 × 9 × 5 × cos(C)

Now we use our algebra skills to rearrange and solve:

^{-1}(42/90)

**62.2°**(to 1 decimal place)

## In Other Forms

### Easier Version For Angles

We just saw how to find an angle when we know three sides. It took quite a few steps, so it is easier to use the "direct" formula (which is just a rearrangement of the c^{2} = a^{2} + b^{2} − 2ab cos(C) formula). It can be in either of these forms:

cos(C) = \frac{a^{2} + b^{2} − c^{2}}{2ab}

cos(A) = \frac{b^{2} + c^{2} − a^{2}}{2bc}

cos(B) = \frac{c^{2} + a^{2} − b^{2}}{2ca}

### Example: Find Angle "C" Using The Law of Cosines (angle version)

In this triangle we know the three sides:

- a = 8,
- b = 6 and
- c = 7.

Use The Law of Cosines (angle version) to find angle **C** :

^{2}+ b

^{2}− c

^{2})/2ab

^{2}+ 6

^{2}− 7

^{2})/2×8×6

^{-1}(0.53125)

**57.9°**to one decimal place

### Versions for a, b and c

Also, we can rewrite the c^{2} = a^{2} + b^{2} − 2ab cos(C) formula into a^{2}= and b^{2}= form.

Here are all three:

a^{2} = b^{2} + c^{2} − 2bc cos(A)

b^{2} = a^{2} + c^{2} − 2ac cos(B)

c^{2} = a^{2} + b^{2} − 2ab cos(C)

But it is easier to remember the "**c ^{2}**=" form and change the letters as needed.

As in this example:

### Example: Find the distance "z"

The letters are different! But that doesn't matter. We can easily substitute x for a, y for b and z for c

^{2}= a

^{2}+ b

^{2}− 2ab cos(C)

^{2}= x

^{2}+ y

^{2}− 2xy cos(Z)

^{2}= 9.4

^{2}+ 6.5

^{2}− 2×9.4×6.5×cos(131º)

^{2}= 88.36 + 42.25 − 122.2 × (−0.656...)

^{2}= 130.61 + 80.17...

^{2}= 210.78...

**14.5**to 1 decimal place.

Answer: z = 14.5

Did you notice that cos(131º) is negative and so the last term ends up positive (+ 80.17...)

The cosine of an obtuse angle is always negative (see Unit Circle).