# Law of Cosines Example Problem

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

a2 = b2 + c2 – 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.

b2 = a2 + c2 – 2ac·cos B

c2 = a2 + b2 – 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:

a2 = h2 + y2

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

a2 = (c – b·cos A)2 + (b·sin A)2

Expand to get

a2 = c2 – 2bc·cos A + b2·cos2A + b2·sin2A

Combine the terms containing b2

a2 = c2 – 2bc·cos A + b2(cos2A + sin2A)

Using the trig identity cos2A + sin2A = 1, this equation becomes

a2 = c2 – 2bc·cos A + b2(1)

a2 = c2 – 2bc·cos A + b2

Rearrange the terms to get the Law of Cosines

a2 = b2 + c2 – 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

c2 = a2 + b2 – 2ab·cos C

On this triangle,
a = 12
b = 5 and
C = 90°

Plug in these values to get:

c2 = (12)2 + (5)2 – 2(12)(5)·cos 90°

c2 = 144 + 25 – 120·cos 90°

c2 = 169 – 120·(0)

c2 = 169 – 0

c2 = 169

c = 13

Let’s check this using the Pythagorean Theorem

a2 + b2 = c2

(12)2 + (5)2 = c2

144 + 25 = c2

169 = c2

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

a2 = b2 + c2 – 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 A = 5/13 = 0.3846

A = 67.38°

Find B using

b2 = a2 + c2 – 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: