Law of Cosines: How to Use & Practice Examples

We have already seen how to solve triangles using the Law of Sines. Such problems involve two sides and two angles. The Law of Cosines (or the Cosine Rule) is used when we have all three sides involved and only one angle. The formula is:

c^{2} = a^{2} + b^{2} - 2ab\text{cos}y

The Law of Cosines 1


  • c is the unknown side
  • a and b are the given sides
  • γ is not any angle in the triangle, but the angle between the given sides.

We use the Law of Cosines to solve triangles that are not right-angled.

How to remember

This rule is very similar to the Pythagorean theorem. If angle γ were a right angle, we would have

 c^2 = a^2 + b^2 - 2ab\text{cos}90^\circ

We know that cos90°=0, so the equation above becomes

 c^2 = a^2 + b^2 - 0

 c^2 = a^2 + b^2

which is actually the Pythagorean theorem.


We can write the Law of Cosines for each angle in the triangle, following the pattern (two given sides and the angle between them):


The Law of Cosines 2


a^2 = b^2 + c^2 - 2bc\text{cos}\alpha

b^2 = a^2 + c^2 - 2ac\text{cos}\beta

c^2 = a^2 + b^2- 2ab\text{cos}\gamma

You don’t need to memorize all these formulas; it is important just to understand the rule and know the pattern.

Sometimes we are given all the three sides, and we need to find the angle. In that case, we can rearrange the formula above to get:

 \text{cos}\gamma = \frac{a^2+b^2-c^2}{2ab}

Example I

Find the missing side in the triangle below.

Law of Cosines 3


We are given side b=3 and side c=2. The angle between them is 100°. We need to find the length of the missing side, so let’s put the given information into the formula:

a^2 = b^2 + c^2 - 2bc\text{cos}\alpha

a = 3^2 + 2^2 - 2*3*2\text{cos}100^\circ

a = 9 + 4 - 12 * (-0.17)

a =15.04

Example II

Find the largest angle of a triangle whose sides are 12, 16 and 9.

The Law of Cosines 4


The largest angle of a triangle is the one opposite to the largest side. In the triangle above, the largest side is b so we’ll find the measure of angle β.

We can use the second formula

 \text{cos}\beta = \frac{a^2+c^2-b^2}{2ac}

 \text{cos}\beta = \frac{12^2+9^2-16^2}{2*12*9}

 \text{cos}\beta = \frac{144+81-256}{216}

 \text{cos}\beta = -\frac{31}{216}

 \text{cos}\beta = -0.1435

 \beta = cos^{-1}(-0.1435)

 \beta = 98.25^\circ

Example III

Use the Law of Cosines to find the length of the missing side.

The Law of Cosines 5

To apply the Law of Cosines in this problem, we need two sides and the angle between them. So don’t let the 22° angle confuse you. It does nothing for you here.

Since we need to find the missing side, we’ll use the formula:

 f^2 = d^2 + e^2 -2de\text{cos}\beta

Don’t let the different letters confuse you either! Both d and e are the given sides, and β is the angle between them, while f is the unknown side.

 f^2 = 14^2 + 18^2 -2*14*18*\text{cos}115^\circ

 f^2 = 196+ 324 - 504 *(-0.4226)

 f^2 = 520 + 212.99

 f^2 = 732.99

 f = 27.07


We use the Law of Cosines to solve triangles in two cases:

  1. We are given two sides and the angle between them
  2. We are given all three sides

We need to be careful – the formula works only if the angle given is the included angle.

Want to learn more? Check out more examples in Trigonometry + 100 other subjects at, the best place to get in-depth and instant homework help online.