# Trigonometry » Law of cosines

Note: The length `a` and the angle size `α` (alpha) are used both, look closely at the difference between the two letters.

## Contents

What is the law of cosines?How do you calculate with the law of cosines?

Proof of the law of cosines

## What is the law of cosines?

The law(s) of cosines for triangle `ABC` in which `α` = `A`, `β` = `B`, `γ` = `C`, `a` = `BC`, `b` = `AC` and `c` = `AB` is:

`a`^{2} = `b`^{2} + `c`^{2} – 2`bc` `cos`

(`α`)

`b`^{2} = `a`^{2} + `c`^{2} – 2`ac` `cos`

(`β`)

`c`^{2} = `a`^{2} + `b`^{2} – 2`ab` `cos`

(`γ`)

## How do you calculate with the law of cosines?

With the law of cosines you can calculate the third side when you know two sides and the angle in between. You can also calculate the angles when you only know the three sides.

*Example 1*

Given is the following triangle. Calculate the unknown length.

Answer:

We have to calculate `a` so we use `a`^{2} = `b`^{2} + `c`^{2} – 2`bc` `cos`

(`α`)

Filling in the equation and solving it gives:

`a`^{2} = 18^{2} + 22^{2} – 2 × 18 × 22 `cos`

(40°) ≈ 201.29...

`a` = `BC` = ≈ 14.2

*Example 2*

Given is the following triangle. Calculate `β`.

Answer:

We have to calculate `β` so we use `b`^{2} = `a`^{2} + `c`^{2} – 2`ac` `cos`

(`β`)

Filling in the equation and solving it gives:

13^{2} = | 17^{2} + 15^{2} – 2 × 17 × 15 × `cos` (β) |

169 = | 514 – 510 `cos` (β) |

510 `cos` (β) = | 345 |

`cos` (β) = | 345510 |

β = | 47.4° |

## Proof of the law of cosines

To prove the law of cosines, we use an altitude.

The length of `x` can be calculated as follows:

`x` = `b` `cos`

(`α`)

Because of Pythagoras' theorem the following is also true:

`h`^{2} = `b`^{2} – `x`^{2}

`h`^{2} = `a`^{2} – (`c` – `x`)^{2}

Therefore:

b^{2} – x^{2} = | a^{2} – (c – x)^{2} |

b^{2} – x^{2} = | a^{2} – (c^{2} – 2cx + x^{2}) |

b^{2} – x^{2} = | a^{2} – c^{2} + 2cx – x^{2} |

b^{2} = | a^{2} – c^{2} + 2cx |

b^{2} – a = ^{2} | –c^{2} + 2cx |

–a^{2} = | –b^{2} – c^{2} + 2cx |

a^{2} = | b^{2} + c^{2} – 2cx |

When we substite `x` for `b` `cos`

(`α`) we will get:

`a`^{2} = `b`^{2} + `c`^{2} – 2`bc` `cos`

(`α`)