17 Non-right Triangles: Law of Cosines
Learning Objectives
In this section, you will:
- Use the Law of Cosines to solve oblique triangles.
- Solve applied problems using the Law of Cosines.
- Use Heron’s formula to find the area of a triangle.
Suppose a boat leaves port, travels 10 miles, turns 20 degrees, and travels another 8 miles as shown in (Figure 1). How far from port is the boat?

Unfortunately, while the Law of Sines enables us to address many non-right triangle cases, it does not help us with triangles where the known angle is between two known sides, a SAS (side-angle-side) triangle, or when all three sides are known, but no angles are known, a SSS (side-side-side) triangle. In this section, we will investigate another tool for solving oblique triangles described by these last two cases.
Using the Law of Cosines to Solve Oblique Triangles
The tool we need to solve the problem of the boat’s distance from the port is the Law of Cosines, which defines the relationship among angle measurements and side lengths in oblique triangles. Three formulas make up the Law of Cosines. At first glance, the formulas may appear complicated because they include many variables. However, once the pattern is understood, the Law of Cosines is easier to work with than most formulas at this mathematical level.
Understanding how the Law of Cosines is derived will be helpful in using the formulas. The derivation begins with the Generalized Pythagorean Theorem, which is an extension of the Pythagorean Theorem to non-right triangles. Here is how it works: An arbitrary non-right triangle is placed in the coordinate plane with vertex
at the origin, side
drawn along the x-axis, and vertex
located at some point
in the plane, as illustrated in (Figure 2). Generally, triangles exist anywhere in the plane, but for this explanation we will place the triangle as noted.

We can drop a perpendicular from to the x-axis (this is the altitude or height). Recalling the basic trigonometric identities, we know that
Solving x and y in terms of and
The
point located at
has coordinates
Using the side
as one leg of a right triangle and
as the second leg, we can find the length of hypotenuse
using the Pythagorean Theorem. Thus,
The formula derived is one of the three equations of the Law of Cosines. The other equations are found in a similar fashion.
Keep in mind that it is always helpful to sketch the triangle when solving for angles or sides. In a real-world scenario, try to draw a diagram of the situation. As more information emerges, the diagram may have to be altered. Make those alterations to the diagram and, in the end, the problem will be easier to solve.
Law of Cosines
The Law of Cosines states that the square of any side of a triangle is equal to the sum of the squares of the other two sides minus twice the product of the other two sides and the cosine of the included angle. For triangles labeled as in (Figure 3 ), with angles and
and opposite corresponding sides
and
respectively, the Law of Cosines is given as three equations.

To solve for a missing side measurement, the corresponding opposite angle measure is needed.
When solving for an angle, the corresponding opposite side measure is needed. We can use another version of the Law of Cosines to solve for an angle.
Given two sides and the angle between them (SAS), find the measures of the remaining side and angles of a triangle.
- Sketch the triangle. Identify the measures of the known sides and angles. Use variables to represent the measures of the unknown sides and angles.
- Apply the Law of Cosines to find the length of the unknown side or angle.
- Apply the Law of Sines or Cosines to find the measure of the angle opposite the stated sides.
- Compute the measure of the remaining angle.
Finding the Unknown Side and Angles of a SAS Triangle
Find the unknown side and angles of the triangle in (Figure 4). Round to the tenths.

Show Solution
First, make note of what is given: two sides and the angle between them. This arrangement is classified as SAS and supplies the data needed to apply the Law of Cosines.
Each one of the three laws of cosines begins with the square of an unknown side opposite a known angle. For this example, the first side to solve for is side as we know the measurement of the opposite angle
Because we are solving for a length, we use only the positive square root. Now that we know the length we can use the Law of Sines to fill in the remaining angles of the triangle. Solving for angle
we have
The other possibility for would be
In the original diagram,
is adjacent to the longest side, so
is an acute angle and, therefore,
does not make sense. Notice that if we choose to apply the Law of Cosines, we arrive at a unique answer. We do not have to consider the other possibilities, as cosine is unique for angles between
and
Proceeding with
we can then find the third angle of the triangle.
The complete set of angles and sides is
Try It
Find the missing side and angles of the given triangle:
Show Solution
Solving for an Angle of a SSS Triangle
Edit this for SSS
Given two sides and the angle between them (SAS), find the measures of the remaining side and angles of a triangle.
- Sketch the triangle. Identify the measures of the known sides and angles. Use variables to represent the measures of the unknown sides and angles.
- Apply the Law of Cosines to find the length of the unknown side or angle.
- Apply the Law of Sines or Cosines to find the measure of the angle opposite the stated sides.
- Compute the measure of the remaining angle.
Find the angle for the given triangle if side
side
and side
Round to the tenths place.
Show Solution
For this example, we have no angles. We can solve for any angle using the Law of Cosines. To solve for anglewe have
See (Figure 5).

Analysis
Because the inverse cosine can return any angle between 0 and 180 degrees, there will not be any ambiguous cases using this method.