# 8.09 Law of cosines

Lesson

In trigonometry the law of cosines relates the lengths of the sides and the cosine of one of its angles.

The law of cosines is useful in finding:

• the third side of a triangle when you know two sides and the angle between them (SAS)
• the angles of a triangle when you know all three sides (SSS)

If $\triangle ABC$ABC is a triangle with side lengths $BC=a$BC=a , $CA=b$CA=b and $AB=c$AB=c and the opposite angles of the sides are respectively angle $A$A, angle $B$B and angle $C$C, then the law of cosines relates the measures of the sides and angles with the following formula:

Law of cosines

$a^2=b^2+c^2-2bc\cos A$a2=b2+c22bccosA

$b^2=a^2+c^2-2ac\cos B$b2=a2+c22accosB

$c^2=a^2+b^2-2ab\cos C$c2=a2+b22abcosC

Notice that the Pythagorean Theorem $a^2=b^2+c^2$a2=b2+c2 makes an appearance in the law of cosines: $a^2=b^2+c^2-2bc\cos A$a2=b2+c22bccosA

#### Worked examples

##### Question 1

Solve: Find the measure of angle $B$B in the triangle.

Think: All three side lengths are known, so we can apply the law of cosines. The unknown measure of angle $B$B appears opposite side $b=3$b=3.

Do: Substitute the values in the formula and solve for the measure of angle $B$B.

 $b^2$b2 $=$= $a^2+c^2-2ac\cos B$a2+c2−2accosB $3^2$32 $=$= $5^2+6^2-2\times5\times6\cos B$52+62−2×5×6cosB $9$9 $=$= $25+36-60\cos B$25+36−60cosB $9-61$9−61 $=$= $-60\cos B$−60cosB $\frac{-52}{-60}$−52−60​ $=$= $\cos B$cosB $\cos B$cosB $=$= $0.866667$0.866667 $B$B $=$= $29.9^\circ$29.9°  to $1$1 decimal place

Reflect: Check that the answer seems reasonable.

##### Question 2

Solve: Find the value of $x$x in the diagram.

Think: The first thing we always do is identify which side is opposite the given angle. This side is the isolated variable in the formula. To find out which other values we are given we label the sides and angles using $a$a,$b$b and $c$c .

Do: Let's add the following labels to the triangle:

Now, substitute and solve for $c$c.

 $c^2$c2 $=$= $a^2+b^2-2ab\cos C$a2+b2−2abcosC $c^2$c2 $=$= $8^2+11^2-2\times8\times11\cos39^\circ$82+112−2×8×11cos39° $c^2$c2 $=$= $64+121-176\cos39^\circ$64+121−176cos39° $c^2$c2 $=$= $48.22$48.22 $c$c $=$= $6.94$6.94

Reflect: Check that the answer seems reasonable.

#### Practice questions

##### Question 3

Find the length of $a$a using the law of cosines.

##### Question 4

Find the value of angle $B$B using the law of cosines.

##### Question 5

Find the length of $c$c using the law of cosines.

## Law of sines versus law of cosines

When solving triangles, we might need to choose whether to use the law of sines or the law of cosines, (or indeed other aspects of trigonometry). The law of sines and law of cosines are true for all triangles. However, the information available to us determines what formulas we are actually able to solve. Here are some helpful shortcuts to determine when to use each one.

When to use which?

Use the law of sines

• When two angles and a side are known and you wish to find the other side (AAS or ASA)
• When two sides and an angle opposite one of the sides are known (SSA)

Use the law of cosines

• When you want to find the third side of a triangle when you know two sides and the angle between them (SAS)
• When you want to find the angles of a triangle when you know all three sides (SSS)

#### Practice questions

##### QUESTION 6

Calculate the length of $y$y in meters.

##### QUESTION 7

Find the value of angle $w$w in degrees.

##### QUESTION 8

$\triangle ABC$ABC consists of angles $A$A, $B$B and $C$C which appear opposite sides $a$a, $b$b and $c$c respectively. Consider the case where the measures of $a$a, $c$c and $A$A are given.

1. Which of the following is given?

$SSA$SSA: Two sides and an angle

A

$SAS$SAS: Two sides and the included angle

B

$SAA$SAA: two angles and a side

C

$ASA$ASA: two angles and the side between them

D

$SSS$SSS: Three sides

E

$SSA$SSA: Two sides and an angle

A

$SAS$SAS: Two sides and the included angle

B

$SAA$SAA: two angles and a side

C

$ASA$ASA: two angles and the side between them

D

$SSS$SSS: Three sides

E
2. Which law should be used to start solving the triangle?

the law of sines

A

the law of cosines

B

the law of sines

A

the law of cosines

B