topic badge

8.08 Law of cosines

Lesson

Concept summary

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), we could encounter a scenario where there is no valid triangle. However, using the law of cosines in this case would result in a quadratic equation and the discriminant would tell us about the number of valid triangles.

Worked examples

Example 1

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.

Solution

\displaystyle a^2\displaystyle =\displaystyle b^2+c^2-2bc\cos{A}Law of cosines
\displaystyle x^2\displaystyle =\displaystyle (6.4)^2+(4.1)^2-2(6.4)(4.1)\cos{(112\degree)}Substitute given values
\displaystyle x\displaystyle =\displaystyle \sqrt{(6.4)^2+(4.1)^2-2(6.4)(4.1)\cos{(112\degree)}}Square root both sides
\displaystyle x\displaystyle =\displaystyle 8.80Evaluate

Reflection

Rounding errors can cause a large amount of variation in our solutions so it's best to leave expressions as exact values until the final step when we can.

Example 2

Find m\angle{C} in a triangle with side lengths a=1\text{ cm}, b=3\text{ cm}, and c=3.4\text{ cm}. Round your answer to two decimal places.

Approach

In this example we are given the length of all three sides (SSS) so we will apply the law of cosines to find the missing angle.

We can substitute the given values into the law of cosines as it's written, but it will make evaluating simpler if we first rearrange the equation to isolate the unknown angle:

\displaystyle c^2\displaystyle =\displaystyle a^2+b^2-2ab\cos{C}Law of cosines
\displaystyle c^2+2ab\cos{C}\displaystyle =\displaystyle a^2+b^2Add 2ab\cos{C} to both sides
\displaystyle 2ab\cos{C}\displaystyle =\displaystyle a^2+b^2-c^2Subtract c^2 to both sides
\displaystyle \cos{C}\displaystyle =\displaystyle \frac{a^2+b^2-c^2}{2ab}Divide both sides by 2ab
\displaystyle C\displaystyle =\displaystyle \cos^{-1}{\left(\dfrac{a^2+b^2-c^2}{2ab}\right)}Apply the inverse cosine function

This equation can now be used to solve for the missing angle directly.

Solution

Substitute each of the three known sides into the expression, \cos^{-1}{\left(\frac{a^2+b^2-c^2}{2ab}\right)}. We get: \cos^{-1}{\left(\dfrac{(1)^2+(3)^2-(3.4)^2}{2(1)(3)}\right)}

Which evaluates to give us m\angle{C}=105.07\degree.

Reflection

We would get the same value for m\angle{C} even if we did not rearrange the equation first.

Outcomes

G.N.Q.A.1

Use units as a way to understand real-world problems.*

G.N.Q.A.1.A

Use appropriate quantities in formulas, converting units as necessary.

G.SRT.C.5

Solve triangles.*

G.SRT.C.5.C

Use the Law of Sines and Law of Cosines to solve non-right triangles in a real-world context.

G.MP1

Make sense of problems and persevere in solving them.

G.MP2

Reason abstractly and quantitatively.

G.MP3

Construct viable arguments and critique the reasoning of others.

G.MP4

Model with mathematics.

G.MP5

Use appropriate tools strategically.

G.MP6

Attend to precision.

G.MP7

Look for and make use of structure.

G.MP8

Look for and express regularity in repeated reasoning.

What is Mathspace

About Mathspace