topic badge
Middle Years

12.02 Cosine rule


We previously used the sine rule to help us find information in non-right-angled triangles. By relating sides and their opposite angles, we were able to find an unknown side or angle.

But there are situations where the sine rule is not useful:

Two side lengths and one angle are known, but we can't match the known sides with a known angle to use the sine rule. Three side lengths are known, but there is no known angle to match with these sides.

In these situations, we will instead use the cosine rule.

The cosine rule

If the three side lengths in a triangle are $a$a, $b$b and $c$c, with an angle $C$C opposite the side with length $c$c, then:

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

When looking to solve for an unknown angle, the equation can also be rearranged and written as:

$\cos C=\frac{a^2+b^2-c^2}{2ab}$cosC=a2+b2c22ab.

The cosine rule relates the lengths of all three sides in a triangle and the cosine of one of its angles. Therefore, the cosine rule is will help us to find:

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

This rule can be proven using Pythagoras' theorem and right-angled trigonometry. There is an opportunity to work through a proof in the exercise.

Note: The formula can be written in terms of any of the sides or angles, familiarise yourself with the forms below and note the pattern. If a triangle is labelled differently we can adapt the rule using the pattern.

Cosine rule forms

The actual letters used in the formula do not have to be the same as the triangle. The convention is that the lengths of sides are given in lowercase letters $a,b,c,q,u,v,s,t$a,b,c,q,u,v,s,t and the size of the angles given in capital letters $A,B,C,Q,U,V,S,T$A,B,C,Q,U,V,S,T

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

$v^2=s^2+t^2-2st\cos V$v2=s2+t22stcosV

$w^2=u^2+v^2-2uv\cos W$w2=u2+v22uvcosW

Finding a side length

To find a missing side using the cosine rule, we need to know two side lengths and their included angle.

Worked example

Example 1

In the triangle on the right, find the length marked $x$x, correct to the nearest whole number.

The first thing to do is identify which side is opposite the given angle. This side is the subject of the formula. To find out which other values we are given we label the sides using $a$a,$b$b and $c$c.

Add the following labels to the triangle:

So, $x$x corresponds to $c$c in the cosine rule formula. We substitute the values into the right places in the formula and solve for $x$x. The side of length $c$c must always be the side opposite the angle $C$C, but $a$a and $b$b can represent either of the other two side lengths.

$c^2$c2 $=$= $a^2+b^2-2ab\cos C$a2+b22abcosC
$x^2$x2 $=$= $10^2+4^2-2\times10\times4\cos32^\circ$102+422×10×4cos32°
  $=$= $100+16-80\cos32^\circ$100+1680cos32°
  $=$= $48.15615$48.15615$\ldots$
$x$x $=$= $\sqrt{48.15615\ldots}$48.15615
  $=$= $7$7 (to the nearest whole number)

Finding an angle

To find a missing angle using the cosine rule, we need to know all three side lengths

Worked example

Example 2

Solve for the unknown angle $x$x in the triangle on the right, correct to $1$1 decimal place.

All three side lengths are known, so we can apply the cosine rule. The unknown angle $x$x appears opposite the side with length $9$9, so we should label this side with a $c$c. Since we are finding an angle, we should use the second, rearranged version of the cosine rule given above.

Add the following labels to the triangle:

Substitute these values, including $C=x$C=x, into the rearranged version of the cosine rule. Remember that $c$c must be the side opposite angle $C$C, and $a$a and $b$b can represent either of the other two side lengths.

$\cos C$cosC $=$= $\frac{a^2+b^2-c^2}{2ab}$a2+b2c22ab
$\cos x$cosx $=$= $\frac{7^2+6^2-9^2}{2\times7\times6}$72+62922×7×6
  $=$= $\frac{4}{84}$484
$x$x $=$= $\cos^{-1}\left(\frac{4}{84}\right)$cos1(484)
  $=$= $87.3^\circ$87.3° (to $1$1 decimal place)


Pythagoras again?

What happens when the angle $C$C is $90^\circ$90°? This means the triangle is right-angled, and the side $c$c is the hypotenuse. Putting this into the cosine rule, we get:

$c^2$c2 $=$= $a^2+b^2-2ab\cos C$a2+b22abcosC
  $=$= $a^2+b^2-2ab\cos\left(90^\circ\right)$a2+b22abcos(90°)
  $=$= $a^2+b^2-2ab\times0$a2+b22ab×0
  $=$= $a^2+b^2$a2+b2

which is Pythagoras' theorem! This is why we say that the cosine rule is a generalisation of Pythagoras' theorem.


Practice questions

Question 1

Find the length of $a$a using the cosine rule.

Round your answer to two decimal places.

Question 2

Find the value of angle $B$B using the cosine rule.

Round your answer to the nearest degree.

Question 3

In $\triangle QUV$QUV, $q=4$q=4, $u=10$u=10 and $\cos V=\frac{1}{5}$cosV=15.

Solve for $v$v.

What is Mathspace

About Mathspace