In this explainer, we will learn how to find the sides and angles in non-right triangles using the law of cosines.

The law of cosines, also known as the cosine rule, allows us to relate all three sides of a triangle with one of its angles.

### Definition: The Law of Cosines

Let us consider a triangle , with corresponding sides of lengths , , and . For this triangle, each side has been labeled with the lower case letter of its opposite angle.

The law of cosines tells us that

It may be useful to see that the law of cosines can be viewed as a generalized form of the Pythagorean theorem. In order to see this, let us consider an arbitrary triangle with an angle .

Inputting this value into the law of cosines, we can see that our final term becomes :

Since we know that , we can see the last term will vanish from our equation:

Here, we can see that, for the special case of a right triangle, the law of cosines reduces to the Pythagorean theorem, with side length being defined as the hypotenuse.

The law of cosines can be used in a couple of different cases. The first case is when finding an unknown side length when given its opposite angle and the two adjacent side lengths. You may see the angle referred to as โthe enclosed angleโ in this situation.

Understanding each of the terms will help us correctly utilize the cosine rule:

In this case, we have chosen to observe the relationship between the side lengths with
respect to the enclosed angle . It is worth noting that the law of cosines
can be applied to a triangle with respect to **any** of its angles.

We could instead observe the relationship between the side lengths with respect to either of the remaining two angles (bottom left and bottom right in the diagram), simply by relabeling our triangle to fit the known information.

Let us now look at some examples where the law of cosines is used to find an unknown length in a triangle.

### Example 1: Using the Law of Cosines to Calculate an Unknown Length in a Triangle

is a triangle where , , and . Find length giving the answer to three decimal places.

### Answer

Often, sketching out a triangle can be helpful for visualizing this type of problem (diagram not to scale).

Looking at our triangle, we can see that we have two side lengths, and , and the enclosed angle, . This situation tells us that we can use the law of cosines:

We can define the values of our triangle with respect to the law of cosines, starting with the enclosed angle. The final term of our equation will therefore contain the following element:

As required, the unknown side length, , is opposite the enclosed angle. We therefore define the side lengths as follows:

Substituting these values into the law of cosine, we find the following equation:

Finally, we can simplify and take the square root of both sides of our equation. We can also ignore the negative solution to our square root, since we are solving to find a length:

Our answer has been round to three decimal places as required by the question.

### Example 2: Using the Law of Cosines to Calculate an Unknown Length in a Triangle

is a triangle where , , and . Find the value of giving the answer to three decimal places.

### Answer

When approaching this type of problem, it can be helpful to sketch out the triangle, as shown below (not to scale).

Looking at our triangle, we can see that we have two side lengths, and , and a trigonometric evaluation for the enclosed angle, . This situation tells us that we can use the law of cosines:

Substituting these values into the law of cosines, we find the following equation:

Simplifying our equation and solving for , we get the following side length, which we round to three decimal places:

Let us now consider the second case in which the law of cosines can be used to solve problems. The questions we have looked at so far involved finding an unknown side length when given its opposite angle and the two adjacent side lengths.

Let now us consider a new case where we have a triangle with the side lengths , , and and we wish to find an unknown angle .

### How To: Rearranging the Law of Cosines

To help us solve this problem, we can rearrange our current equation to a more convenient form. To start, we can add to both sides of the law of cosines:

We can now subtract from both sides:

Finally, we can divide both sides by , giving us the cosine of angle in terms of the side lengths of our triangle:

In this example, we have chosen to focus on angle ; however, this form of the law of cosines can be used to find any of the angles in a triangle by observing the following relationships between the variables:

### Example 3: Using the Law of Cosines to Calculate an Angle in a Triangle

is a triangle where , , and . Find the smallest angle in giving the answer to the nearest second.

### Answer

As with most problems of this type, it may be helpful to sketch out the triangle (not to scale) to help visualize the problem.

We know that, for any triangle, the smallest side will be opposite to the smallest angle.

Inspecting our side lengths, we can see that . We can therefore conclude that angle is the smallest, since it is opposite side .

In order to find , we can use the following form of the law of cosines: Our side lengths then take the following values:

Substituting these values into the law of cosines, we find the following equation: We can then multiply out each of the terms and simplify the right-hand side of the equation:

Lastly, we solve for angle :

We have now found in degrees; however, the question requires us to give a solution to the nearest second. In order to do this, we can recall the following relationship between degrees (), minutes (), and seconds ().

Looking at our solution, we can see that with a remainder of . We can multiply this remainder by 60 to find the number of minutes in our solution:

Using the same method, we see that this remainder contains with a remainder of . Again multiplying this by 60, we can calculate the number of seconds:

We can now write our solution to the nearest second:

Some questions may require you to use a combination of both forms of the law of cosines in order to solve a triangle. We will now explore examples where the equation is used in both forms sequentially.

### Example 4: Using the Law of Cosines to Find Unknown Angles and Lengths of a Triangle

is a triangle where , , and . Find the missing length rounded to three decimal places and the missing angles rounded to the nearest degree.

### Answer

We first sketch our triangle to visualize the problem.

Upon inspection, we see that the our triangle contains one known angle enclosed between two known side lengths:

This situation tells us that we can use the first form of the law of cosines. Using this form of the equation, we can formulate a relationship between angle and the three sides of our triangle:

We can now substitute in the known information from our triangle:

Next, we evaluate each individual term on the right-hand side of our equation and simplify it. In doing this, we can recognize that is one of the exact trigonometric ratios:

We can now take the square root of both sides of our equation, ignoring the negative solution since we are solving to find the length, . We round our answer to three decimal places, as stated in the question:

Let us now redraw our triangle with the newly found information.

We now have a triangle with three known sides and one known angle. In order to find either of the two remaining angles, we can use the second form of the law of cosines. Let us find angle using the following equation:

We now substitute our side lengths into the equation. Here we have chosen to use the exact length of side , instead of the rounded answer, to maintain precision:

We can then multiply out each of the terms and simplify the right-hand side of the equation:

We now solve for and round to the nearest degree as stated in the question:

Finally, we know that angles in a triangle sum to . Since two of the angles in the triangle are now known, we are able to find the third by substituting into the following equation:

Solving for , we complete the information for the triangle giving our final answer to the nearest degree:

In some situations, we may not be able to use the law of cosines immediately. In such cases, it may be necessary to first use other geometric methods to find an angle or side length. Doing this will allow us to proceed using one of the methods described above in this explainer.

Here we show an example using the area of a triangle and standard trigonometric techniques.

### Example 5: Solving a Triangle by Using Trigonometry in Combination with the Law of Cosines

is a triangle where
,
,
and the area is
cm^{2}.
Find the other lengths and angles giving lengths to one decimal place and angles to
the nearest degree.

### Answer

Here we sketch the triangle using the known information.

Looking at our triangle, we have one known angle and one of its adjacent side lengths. Unfortunately, this information is not sufficient to use the law of cosines in either form! In order to proceed, we will need to make use of a combination of techniques:

- Use the given area to find the height of the triangle.
- Use trigonometry in conjunction with triangle height to find the side length .
- Use the law of cosines to solve for the remaining unknowns.

**1. Use the Given Area to Find the Height of the Triangle**

Alongside the given angle and the side length, the question also provides us with the area of the triangle. Let us recall the formula for the area of a triangle: Taking to be the base of our triangle, let us now redraw our diagram. A new point, , has been marked on the base of the triangle directly below point . The line segment is therefore the perpendicular height of the triangle.

Using the formula for area of a triangle, we can substitute in the known information: We can now solve to find by multiplying both sides of the equation by 2 and dividing by 38:

**2. Use Trigonometry in Conjunction with Triangle Height to Find Side Length **

Now that we have found the height of the triangle, let us observe triangle . Upon inspection, we see this is a right triangle with one known side and one known angle .

We can therefore use the rules of trigonometry to find side length : Looking at angle , we find that is the opposite side and is the hypotenuse (within triangle ): We can substitute in the known information and rearrange our equation to find : Recognizing that is one of the exact trigonometric ratios then allows us to solve: Since we have been asked to give our answer to one decimal place, we write .

Here we see our triangle with the new information.

**3. Use the Law of Cosines to Solve for the Remaining Unknowns**

Now that we have found , we have a familiar situation within triangle , where a known angle is enclosed between two known side lengths: Using the first form of the law of cosines, we formulate a relationship between angle and the three sides of our triangle: We now substitute in the known information from our triangle: Next, we simplify the right-hand side of our equation, recognizing that is one of the exact trigonometric ratios:

We can now take the square root of both sides of our equation, ignoring the negative solution since we are solving to find the length, . Our answer is rounded to one decimal place, as stated in the question:

We now have a triangle with three known sides and one known angle.

The second form of the law of cosines can be used to find either of the remaining angles, but letโs choose angle and construct a relationship using the following equation: We first substitute in our side lengths into the equation: We can now solve for , by simplifying our terms and taking the inverse cosine of both sides. Our answer is rounded to the nearest degree as stated in the question:

Now that we have found two angles, we can use the fact that angles in a triangle sum to to solve for , giving our answer to the nearest degree:

### Key Points

- The law of cosines allows us to relate all three sides of a triangle with one of its angles.
- The law of cosines can be viewed as a generalized form of the Pythagorean theorem and will work for all triangles.
- In order to find an unknown side length in a triangle when given its opposite angle and the two adjacent side lengths, we can use the following form of the law of cosines:
- In order to find an unknown angle in a triangle when given all three side lengths, we can use the following rearranged form of the law of cosines: