The Law of Cosines is a useful tool to find the length of a triangle’s side if you know the length of the other two sides and one of the angles. It is also useful for finding the internal angles of a triangle if the length of all three sides is known.

The Law of Cosines is expressed by the formula

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

where the angle’s letter corresponds to the side across from the angle. The same is true for the other angles and their sides.

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

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

### Law of Cosines – How Does it Work?

It is easy to show how this law works. First, let’s take the triangle from above and drop a vertical line to the side marked **c**. This divides the triangle into two right triangles with one common side of length h.

For the yellow triangle,

x = b·cos A

h = b·sin A

The length of c was divided into two parts of length x and y.

c = x + y

solved for y:

y = c – x

Substitute the expression for x from above

y = c – b·cos A

Using the Pythagorean theorem for the red triangle:

a^{2} = h^{2} + y^{2}

Substitute the equations for h and y from above to get:

a^{2} = (c – b·cos A)^{2} + (b·sin A)^{2}

Expand to get

a^{2} = c^{2} – 2bc·cos A + b^{2}·cos^{2}A + b^{2}·sin^{2}A

Combine the terms containing b^{2}

a^{2} = c^{2} – 2bc·cos A + b^{2}(cos^{2}A + sin^{2}A)

Using the trig identity cos^{2}A + sin^{2}A = 1, this equation becomes

a^{2} = c^{2} – 2bc·cos A + b^{2}(1)

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

Rearrange the terms to get the Law of Cosines

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

The same technique can be used for the other sides to get the other two forms of this equation.

### Law of Cosines Example – Find the Side

Find the length of the unknown side of this right triangle using the Law of Cosines.

I chose a right triangle for this example to make it easy to check our work. To find c using the Law of Cosines, use the formula

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

On this triangle,

a = 12

b = 5 and

C = 90°

Plug in these values to get:

c^{2} = (12)^{2} + (5)^{2} – 2(12)(5)·cos 90°

c^{2} = 144 + 25 – 120·cos 90°

c^{2} = 169 – 120·(0)

c^{2} = 169 – 0

c^{2} = 169

c = 13

Let’s check this using the Pythagorean Theorem

a^{2} + b^{2} = c^{2}

(12)^{2} + (5)^{2} = c^{2}

144 + 25 = c^{2}

169 = c^{2}

13 = c

This agrees with the value we found using the Law of Cosines.

### Law of Cosines Example – Find the Angles

Use the Law of Cosines to find the missing two angles A and B on the previous example’s triangle.

a = 12

b = 5

c = 13

Find A using

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

(12)^{2} = (5)^{2} + (13)^{2} – 2(5)(13)·cos A

144 = 25 + 169 – 130·cos A

144 = 194 – 130·cos A

144 -194 = – 130·cos A

-50 = -130·cos A

0.3846 = cos A

67.38° = A

Since this is a right triangle, we can check our work using the definition of cosine:

cos θ = ^{adjacent }⁄ _{hypotenuse}

cos A = 5/13 = 0.3846

A = 67.38°

Find B using

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

(5)^{2} = (12)^{2} + (13)^{2} – 2(12)(13)·cos B

25 = 144 + 169 – 312·cos B

25 = 313 – 312·cos B

25 – 313 = – 312·cos B

-288 = – 312·cos B

0.9231 = cos B

22.62° = B

Check again using the definition of cosine:

cos B = 12/13 = 0.9231

B = 22.62°

Another means of checking our work would be to make sure all the angles add up to 180°.

A + B + C = 67.38° + 22.62° + 90° = 180°

The Law of Cosines is a useful tool to find either a length or internal angle of any triangle as long as you know at least the length of two sides and one angle or the length of all three sides.

### Science Notes Trigonometry Help

Do you need more help with trig? Here are example problems and other resources:

- Law of Sines Example Problem
- Right Triangles – Trigonometry Basics
- Right Triangle Trigonometry and SOHCAHTOA
- SOHCAHTOA Example Problem – Trigonometry Help
- Trig Table PDF
- Trig Identities Study Sheet PDF