Law of Cosines

In this lesson, you will learn

  • the three forms of the Law of Cosines, and how it is related to the Pythagorean theorem
  • when to use the Law of Cosines: SAS and SSS triangles
  • how to solve a triangle step by step, and how to prove the formula

Law of Cosines Formula

Definition

The Law of Cosines, also called the Cosine Rule or the Cosine Law, states that the square of a side of a triangle is equal to the sum of the squares of the other two sides minus twice their product times the cosine of their included angle.

Triangle ABC with side a opposite angle A, side b opposite angle B and side c opposite angle C, above the three formulas of the law of cosines

If a, b, and c are the lengths of the sides of a triangle, and A, B, and C are the measures of the angles opposite these sides, then

a2 = b2 + c2 βˆ’ 2bc cos(A) b2 = a2 + c2 βˆ’ 2ac cos(B) c2 = a2 + b2 βˆ’ 2ab cos(C)

Notice what happens when C = 90 degrees

c2 = a2 + b2 βˆ’ 2ab cos(90)

c2 = a2 + b2 since cos(90) = 0

Remember

The Cosine Rule is a generalization of the Pythagorean theorem so that the formula works for any triangle.

Which angle is in the formula for b2?

Show answer

Angle B. It is the angle opposite side b, and it sits between the other two sides, a and c.

When Should You Use the Law of Cosines?

We use the Law of Cosines to solve an oblique triangle or any triangle that is not a right triangle. When solving an oblique triangle, you are trying to find the lengths of the three sides and the measures of the three angles of the oblique triangle.

Solving an SAS triangle or Side-Angle-Side triangle

If two sides and the included angle (SAS) of an oblique triangle are known, then none of the three ratios in the Law of Sines is known. Therefore you must first use the law of cosines to find the third side or the side opposite the given angle. Follow the three steps below to solve an oblique triangle.

  1. Use the Law of Cosines to find the side opposite the given angle
  2. Use either the Law of Sines or the Law of Cosines again to find another angle
  3. Find the third angle by subtracting the measure of the given angle and the angle found in step 2 from 180 degrees.

Solving an SSS triangle or Side-Side-Side triangle

If three sides (SSS) are known, solving the triangle means finding the three angles. Follow the following three steps to solve the oblique triangle.

  1. Use the law of cosines to find the largest angle opposite the longest side
  2. Use either the Law of Sines or the Law of Cosines again to find another angle
  3. Find the third angle by subtracting the measures of the angles found in step 1 and step 2 from 180 degrees.
Common mistake

The angle in the formula must be the angle between the two sides you use, which is also the angle opposite the side you are finding. For a2, use b, c and angle A, never angle B or C.

You know all three sides of a triangle: 4, 6 and 9. Which angle should you find first?

Show answer

The angle opposite the side of length 9. In an SSS triangle, start with the largest angle, which is opposite the longest side.

Examples Showing How to Use the Law of Cosines

Worked example: Example #1: Solve the triangle shown below with A = 120 degrees, b = 7, and c = 8.
Triangle ABC with side b = 7, side c = 8 and a 120 degree angle at vertex A between them
  1. Use the Law of Cosines to find side a.
    a2 = b2 + c2 βˆ’ 2bc cos(A)
    a2 = 72 + 82 βˆ’ 2(7)(8) cos(120)
    a2 = 49 + 64 βˆ’ 2(56)(βˆ’0.5)
    a2 = 113 + 1(56)
    a2 = 113 + 56
    a2 = 169
    a = √169 = 13
  2. Use the Law of Sines to find angle C.
    sin C / c = sin A / a
    sin C / 8 = sin 120 / 13
    sin C / 8 = 0.866 / 13
    sin C / 8 = 0.0666
    Multiply both sides by 8
    sin C = 0.0666(8)
    sin C = 0.5328
    C = arcsin(0.5328)
    C = 32.19
  3. Find the third angle.
    Angle B = 180 βˆ’ 120 βˆ’ 32.19
    Angle B = 27.81

The lengths of the sides of the triangle are 7, 8, and 13. The measures of the angles of the triangle are 27.81, 32.19, and 120 degrees.

Example #2: Solve a triangle ABC if a = 9, b = 12, and c = 10.

There are no missing sides. We just need to find the missing angles. Since the angle opposite the longest side is angle B, use b2 = a2 + c2 βˆ’ 2ac cos(B) to find cos(B).

b2 = a2 + c2 βˆ’ 2ac cos(B)

122 = 92 + 102 βˆ’ 2(9)(10) cos(B)

144 = 81 + 100 βˆ’ 2(90) cos(B)

144 = 181 βˆ’ 180 cos(B)

144 βˆ’ 181 = βˆ’180 cos(B)

βˆ’37 = βˆ’180 cos(B)

Divide both sides by βˆ’180

cos(B) = βˆ’37 / βˆ’180 = 0.2056

B = arccos(0.2056)

B = 78.14 degrees

Use the Law of Sines to find angle A

sin(A) / a = sin(B) / b

sin(A) / 9 = sin(78.14) / 12

sin(A) / 9 = 0.97865 / 12

sin(A) / 9 = 0.081554

Multiply both sides by 9

sin(A) = 0.081554(9)

sin(A) = 0.734

A = arcsin(0.734)

A = 47.22 degrees

Angle C = 180 βˆ’ 78.14 βˆ’ 47.22

Angle C = 54.64

In a triangle, b = 3, c = 5 and A = 120 degrees. Find a.

Show answer

a = 7. a2 = 9 + 25 βˆ’ 2(3)(5)(βˆ’0.5) = 34 + 15 = 49, so a = √49 = 7.

Proof of the Law of Cosines

To prove the Law of Cosines, put a triangle ABC in a rectangular coordinate system as shown in the figure below. Notice that the vertex A is placed at the origin and side c lies along the positive x-axis.

Triangle ABC on a coordinate plane with A at (0,0), B at (c,0) on the x-axis and C at (x,y). Side b runs from A to C, side a from C to B, and a vertical segment of length y drops from C to the x-axis at distance x from A.

Use the distance formula and the points (x,y) and (c,0) to find the length of a.

a = √(x βˆ’ c)2 + (y βˆ’ 0)2

a = √(x βˆ’ c)2 + y2

Square both sides of the equation

a2 = (x βˆ’ c)2 + y2

Now, we need to find x and y and replace them in a2 = (x βˆ’ c)2 + y2

Using the triangle, write expressions for sin A and cos A and then solve for x and y.

sin(A) = y / b, so y = b sin(A)

cos(A) = x / b, so x = b cos(A)

a2 = (b cos A βˆ’ c)2 + (b sin A)2

a2 = b2 cos2 A βˆ’ 2bc cos A + c2 + b2 sin2 A

Rearrange terms

a2 = b2 cos2 A + b2 sin2 A + c2 βˆ’ 2bc cos A

a2 = b2(cos2 A + sin2 A) + c2 βˆ’ 2bc cos A

a2 = b2(1) + c2 βˆ’ 2bc cos A since cos2 A + sin2 A = 1

a2 = b2 + c2 βˆ’ 2bc cos A.

The proof can also be done with a triangle that has an obtuse angle. The result will still be the same.

Summary

  • Law of Cosines: a2 = b2 + c2 βˆ’ 2bc cos(A), and the same pattern for b2 and c2.
  • The angle in the formula is the angle opposite the side on the left, between the other two sides.
  • When the angle is 90 degrees, cos(90) = 0 and the formula becomes the Pythagorean theorem.
  • Use it first for SAS (to find the third side) and for SSS (to find the largest angle).
  • Find the last angle by subtracting the other two angles from 180 degrees.

Test Yourself: 10-Question Quiz

Now check what you learned. Every answer is explained, and each time you play you get new questions.

Question 1 of 10Score: 0