topic badge

8.06 Law of cosines

Introduction

In lesson  8.05 Law of sines  , we learned about a new tool to solve for missing sides and angles in oblique triangles, and how to distinguish the ambiguous case. We will learn a different tool that can also be used for finding missing sides and angles in triangles, and encounter the ambiguous case in a different way.

Law of cosines

The law of cosines is a useful equation that relates the sides of a triangle to the cosine of one of its angles. The law of cosines can be used to solve any triangle where two sides and any angle are given (SAS or SSA) or all three sides are given (SSS).

Triangle A B C. The side opposite vertex A has a length of lowercase a, the side opposite vertex B has a length of lowercase b, and the side opposite vertex C has a length of lowercase c. An arrow from vertex C to side c is drawn inside the triangle.

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

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

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

If using the law of cosines for two sides and the non-included angle (SSA) to solve for a missing side, we could encounter the ambiguous case. However, it will come up through examining the discriminant of the resulting quadratic:

  • If the quadratic has two solutions, there are two possible triangles
  • If the quadratic has one solution, one triangle exists
  • If the quadratic has no solutions, no triangle exists

Examples

Example 1

Consider the diagram shown below:

a

Formulate a plan for proving the law of cosines: a^2=b^2+c^2-2bc \cos A.

Worked Solution
Create a strategy

The law of cosines contains calculations for the cosines of angles and the Pythagorean theorem. In order to calculate the cosine of an angle or use the Pythagorean theorem, we need to have a right triangle.

So, let's divide \triangle ABC into two right triangles by constructing an altitude \overline{CD} from \angle C to \overline{AB}. We can label the height of the segment as h, then label \overline{AD} as x and \overline{BD} as c-x, since we'll be using the adjacent sides of the angles with cosine.

Apply the idea

After constructing two right triangles from the given triangle, we can use the Pythagorean theorem and \cos \theta = \dfrac{\text{adjacent}}{\text{hypotenuse}} to begin proving the law of cosines.

b

Use your plan from part (a) to prove the law of cosines for any triangle.

Worked Solution
Create a strategy

For \triangle BCD, we can write an equation for the Pythagorean theorem in terms of a^2: a^2 = h^2 + \left( c - x \right)^2.

For \triangle ACD, we can write the an equation for the Pythagorean theorem in terms of h^2: h^2 = b^2 - x^2 and the trigonometric ratio \cos A = \dfrac{x}{b}.

We can substitute the expressions for h^2 and x in the first equation and use that to show the law of cosines.

Apply the idea

From \triangle ACD:

\displaystyle \cos A\displaystyle =\displaystyle \dfrac{x}{b}Sine of \angle A
\displaystyle b \cdot \cos A\displaystyle =\displaystyle xMultiply both sides of the equation by b

Substituting the expressions from \triangle ACD, we have:

\displaystyle a^2\displaystyle =\displaystyle h^2 + \left( c - x \right) ^2Pythagorean theorem
\displaystyle a^2\displaystyle =\displaystyle b^2- x^2 + \left( c - x \right)^2Substitute h^2=b^2 - x^2
\displaystyle a^2\displaystyle =\displaystyle b^2- \left(b \cos A \right)^2 + \left( c - b \cos A \right)^2Substitute x=b \cdot \cos A
\displaystyle a^2\displaystyle =\displaystyle b^2 - \left(b \cos A \right)^2 - \left(c-b \cos A \right) \left( c-b \cos A \right)Expand the binomials to prepare for distribution
\displaystyle a^2\displaystyle =\displaystyle b^2 - \left(b \cos A \right)^2 + c^2 - bc \cos A - bc \cos A + \left( b \cos A \right)^2Distribute
\displaystyle a^2\displaystyle =\displaystyle b^2 + c^2 - 2bc \cos ACombine like terms

Example 2

Find the value of x using the law of cosines. Round your answer to two decimal places.

Triangle A B C. Side A B has a length of 4.1, side B C has a length of x, and side C A has a length of 6.4. Angle A has a measure of 112 degrees.
Worked Solution
Apply the idea
\displaystyle a^2\displaystyle =\displaystyle b^2+c^2-2bc\cos{A}Law of cosines
\displaystyle x^2\displaystyle =\displaystyle \left(6.4 \right)^2+ \left(4.1 \right)^2-2 \left(6.4 \right) \left(4.1 \right)\cos{\left(112\degree \right)}Substitute given values
\displaystyle x\displaystyle =\displaystyle \sqrt{\left(6.4 \right)^2+ \left(4.1 \right)^2-2 \left(6.4 \right) \left(4.1 \right)\cos{\left(112\degree \right)}}Evaluate the square root of both sides
\displaystyle x\displaystyle =\displaystyle 8.80Evaluate the exponents, multiplication, addition, and subtraction
Reflect and check

Remember that when evaluating the square root, the answers can be \pm, and since we are referring to a length in this problem, the only solution is the positive square root.

Rounding errors can cause a large amount of variation in our solutions. When possible, it's best to leave expressions as exact values until the final calculation.

Example 3

A goal has posts that are 2 \text{ m} apart. Deepa shoots for the goal when she is 2.6 \text{ m} from one post and 3.1 \text{ m} from the other post.

Find the measure of the angle, x, in which she can score a goal. Round your answer to two decimal places.

Worked Solution
Create a strategy

Label the side lengths and angle measures using labels from the law of cosines: a=2, b=3.1, c=2.6, and A=x. Then, we'll substitute the values into the law of cosines and solve for the unknown angle.

Apply the idea
\displaystyle a^2\displaystyle =\displaystyle b^2 + c^2 -2bc \cos ALaw of cosines
\displaystyle \left(2 \right)^2\displaystyle =\displaystyle \left(3.1 \right)^2 + \left(2.6 \right)^2 - 2 \left(3.1 \right) \left(2.6 \right) \cos \left(x \right)Substitution
\displaystyle 4\displaystyle =\displaystyle 9.61+6.76-16.12 \cos \left( x \right)Evaluate the exponents and multiplication
\displaystyle -12.37\displaystyle =\displaystyle -16.12 \cos \left( x \right)Subtract 9.61 and 6.76 from both sides of the equation
\displaystyle \dfrac{12.37}{16.12}\displaystyle =\displaystyle \cos \left(x \right)Divide both sides of the equation by -16.12
\displaystyle \cos ^{-1} \left( \dfrac{12.37}{16.12} \right)\displaystyle =\displaystyle xApply the inverse cosine to both sides
\displaystyle 39.88\displaystyle =\displaystyle xEvaluate the inverse cosine

Example 4

Given the following measurements in a triangle, find the value of missing side length c. Round to two decimal places.

A= 68.7 \degree, a=88, and b=92

Worked Solution
Create a strategy

Draw and label a diagram.

From this diagram we can see that we were given two sides and their non-included angle. This is an example of the ambiguous case and when we solve we may find one, two, or no solutions to this problem.

Since we are given m \angle A, substitute the given values into a^2=b^2+c^2-2bc\cos{A} and solve for c.

Apply the idea
\displaystyle a^2\displaystyle =\displaystyle b^2+c^2-2bc\cos{A}Law of cosines
\displaystyle \left( 88 \right)^2\displaystyle =\displaystyle \left(92 \right)^2+ c^2 - 2 \left(92 \right)c \cos \left( 68.7 \degree \right)Substitution
\displaystyle 7744\displaystyle =\displaystyle 8464 + c^2 - 66.84cEvaluate the exponents and multiplication
\displaystyle 0\displaystyle =\displaystyle c^2 -66.84c +720Subtract 7744 from both sides and commutative property of addition

In order to solve for c, substitute the values from the equation which we can write as x^2-66.84x+720=0 into the quadratic formula, remembering that the value of x is the missing side length c:

\displaystyle x\displaystyle =\displaystyle \dfrac{ -b \pm \sqrt{b^2 -4ac}}{2a}Quadratic formula
\displaystyle x\displaystyle =\displaystyle \dfrac{66.84 \pm \sqrt{\left(-66.84 \right)^2 -4 \left(1 \right) \left(720 \right)}}{2 \left(1 \right)}Substitution
\displaystyle x\displaystyle =\displaystyle \dfrac{66.84 \pm \sqrt{1587.59}}{2}Evaluate the multiplication and subtraction

Note that at this point, we know there will be two possible solutions, since the discriminant is positive. We will continue solving:

\displaystyle x\displaystyle =\displaystyle \dfrac{66.84 \pm 39.84}{2}Evaluate the square root
\displaystyle x\displaystyle =\displaystyle 53.34 \quad \text{ or } \quad x = 13.51Simplify the addition/subtraction and division

Therefore, the missing side length is 53.34 or 13.50.

Reflect and check

We could use the law of cosines to find the other missing values of the possible triangles or use the law of sines:

\displaystyle \dfrac{\sin A}{a}\displaystyle =\displaystyle \dfrac{\sin B_1}{b}Law of sines
\displaystyle \dfrac{\sin 68.7 \degree}{88}\displaystyle =\displaystyle \dfrac{\sin B_1}{92}Substitution
\displaystyle 92\left(\frac{\sin{68.7 \degree }}{88}\right)\displaystyle =\displaystyle \sin{B_1}Multiply both sides of the equation by 92
\displaystyle \sin^{-1}\left({92\left(\frac{\sin{68.7 \degree}}{88}\right)}\right)\displaystyle =\displaystyle B_1Apply the inverse sine to both sides
\displaystyle 76.92 \degree\displaystyle =\displaystyle B_1Evaluate the inverse sine

At this point, we know that there is another triangle that exists with the given values. We can find the other possible angle measure for \angle B by subtracting 76.92 \degree from 180 \degree and getting \angle B_2= 103.08 \degree.

Working through solution 1 we have: A=68.7 \degree, a=88, b=92, and B_1=76.92 \degree. We can find the measure of \angle C_1 using the triangle sum theorem: 68.7 \degree + 76.92 \degree + m \angle C_1 = 180 \degree, so m \angle C_1 = 34.38 \degree. Finally, we can write a proportion for the law of sines again to determine the missing side length c_1:

\displaystyle \dfrac{\sin A}{a}\displaystyle =\displaystyle \dfrac{\sin C_1}{c_1}Law of sines
\displaystyle \dfrac{\sin 68.7 \degree}{88}\displaystyle =\displaystyle \dfrac{\sin 34.38 \degree}{c_1}Substitution
\displaystyle \dfrac{ c_1 \cdot \sin 68.7 \degree}{88}\displaystyle =\displaystyle \sin 34.38 \degreeMultiply both sides of the equation by c_1
\displaystyle c_1\displaystyle =\displaystyle \sin 34.38 \degree \cdot \dfrac{88}{\sin 68.7 \degree}Multiply both sides of the equation by \dfrac{88}{\sin 68.7 \degree}
\displaystyle c_1\displaystyle =\displaystyle 53.34Evaluate the multiplication and division

This is approximately one of the possible side lengths we found for the triangle using the law of cosines.

Now, working through solution 2 we have: A=68.7 \degree, a=88, b=92, and B_2=103.08 \degree. We can find the measure of \angle C_2 using the triangle sum theorem:68.7 \degree + 103.08 \degree + m \angle C_2 = 180 \degree, so m \angle C_2 = 8.22 \degree. Finally, we can write a proportion for the law of sines again to determine the missing side length c_2:

\displaystyle \dfrac{\sin A}{a}\displaystyle =\displaystyle \dfrac{\sin C_2}{c_2}Law of sines
\displaystyle \dfrac{\sin 68.7 \degree}{88}\displaystyle =\displaystyle \dfrac{\sin 8.22 \degree}{c_2}Substitution
\displaystyle \dfrac{ c_2 \cdot \sin 68.7 \degree}{88}\displaystyle =\displaystyle \sin 8.22 \degreeMultiply both sides of the equation by c_2
\displaystyle c_2\displaystyle =\displaystyle \sin 8.22 \degree \cdot \dfrac{88}{\sin 68.7 \degree}Multiply both sides of the equation by \dfrac{88}{\sin 68.7 \degree}
\displaystyle c_2\displaystyle =\displaystyle 13.50Evaluate the multiplication and division

This is approximately the other possible side length we found for the triangle using the law of cosines.

Idea summary

We can apply the law of cosines to find missing values in an oblique triangle. Given an angle and its opposite side plus one additional side or angle or all three sides, we are guaranteed one unique solution:

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

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

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

The ambiguous case occurs when using the law of cosines to solve a triangle given two sides and the non-included angle. Use these rules for determining the possible solution:

  • Case 1: No triangle exists. This is the case when the discriminant of the quadratic is negative
  • Case 2: Exactly one triangle exists. This is the case when the discriminant of the quadratic is zero
  • Case 3: Two possible triangles exist. This is the case when the discriminant of the quadratic is positive

Outcomes

G.SRT.D.10 (+)

Prove the laws of sines and cosines and use them to solve problems.

G.SRT.D.11 (+)

Understand and apply the law of sines and the law of cosines to find unknown measurements in right and non-right triangles.

What is Mathspace

About Mathspace