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 7.2.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.
7.2.1 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 \(ABC\) is placed in the coordinate plane with vertex \(A\) at the origin, side \(c\) drawn along the \(x\)-axis, and vertex \(C\) located at some point \(\left( {x,y} \right)\) in the plane, as illustrated in Figure 7.2.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 \(C\) to the \(x\)-axis (this is the altitude or height). Recalling the basic trigonometric identities, we know that
\[\cos\;\theta = \frac{x\text{(adjacent)}}{b\text{(hypotenuse)}}\text{~and~}\sin\;\theta = \frac{y\text{(opposite)}}{b\text{(hypotenuse)}}\]
In terms of \(\theta,\mspace{9mu} x = b\cos\;\theta\) and \(y = b\sin\;\theta.\) The \((x,y)\) point located at \(C\) has coordinates \(\left( b\cos\;\theta, \right.\) \(b\sin\;\theta).\) Using the side \(\left( {x - c} \right)\) as one leg of a right triangle and \(y\) as the second leg, we can find the length of hypotenuse \(a\) using the Pythagorean Theorem. Thus,
\[\begin{array}{llllll} {\mspace{9mu} a^{2} = {(x - c)}^{2} + y^{2}} & & & & & \\ {\text{~~~~~~~} = {(b\cos\;\theta - c)}^{2} + {(b\sin\;\theta)}^{2}} & & & & & {\text{Substitute~}(b\cos\;\theta)\text{~for}\; x\;\;\text{and~}(b\sin\;\theta)\;\text{for~}y.} \\ {\text{~~~~~~~} = \left( {b^{2}\cos^{2}\theta - 2bc\cos\;\theta + c^{2}} \right) + b^{2}\sin^{2}\theta} & & & & & {\text{Expand~the~perfect~square}.} \\ {\text{~~~~~~~} = b^{2}\cos^{2}\theta + b^{2}\sin^{2}\theta + c^{2} - 2bc\cos\;\theta} & & & & & {\text{Group~terms~noting~that~}\cos^{2}\theta + \sin^{2}\theta = 1.} \\ {\text{~~~~~~~} = b^{2}\left( {\cos^{2}\theta + \sin^{2}\theta} \right) + c^{2} - 2bc\cos\;\theta} & & & & & {\text{Factor~out~}b^{2}.} \\ {\mspace{9mu} a^{2} = b^{2} + c^{2} - 2bc\cos\;\theta} & & & & & \end{array}\]
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.
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 7.2.4, with angles \(\alpha,\beta,\) and \(\gamma,\) and opposite corresponding sides \(a,b,\) and \(c,\) respectively, the Law of Cosines is given as three equations.
\[\begin{array}{l} {a^{2} = b^{2} + c^{2} - 2bc\;\;\cos\;\alpha} \\ {b^{2} = a^{2} + c^{2} - 2ac\;\;\cos\;\beta} \\ {c^{2} = a^{2} + b^{2} - 2ab\;\;\cos\;\gamma} \end{array}\]
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.
\[\begin{array}{l} \\ \begin{array}{l} \begin{array}{l} \\ {\cos\mspace{9mu}\alpha = \frac{b^{2} + c^{2} - a^{2}}{2bc}} \end{array} \\ {\cos\mspace{9mu}\beta = \frac{a^{2} + c^{2} - b^{2}}{2ac}} \\ {\cos\mspace{9mu}\gamma = \frac{a^{2} + b^{2} - c^{2}}{2ab}} \end{array} \end{array}\]
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 a second angle.
- Compute the measure of the remaining angle.
Find the unknown side and angles of the triangle in Figure 7.2.7.

Solution (click to reveal)
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 \(b,\) as we know the measurement of the opposite angle \(\beta.\)
\[\begin{array}{ll} {b^{2} = a^{2} + c^{2} - 2ac\cos\;\beta} & \\ {b^{2} = 10^{2} + 12^{2} - 2(10)(12)\cos(30^{\circ})\begin{array}{llll} & & & \end{array}} & {\text{Substitute~the~measurements~for~the~known~quantities}.} \\ {b^{2} = 100 + 144 - 240\left( \frac{\sqrt{3}}{2} \right)} & {\text{Evaluate~the~cosine~and~begin~to~simplify}.} \\ {b^{2} = 244 - 120\sqrt{3}} & \\ {b = \sqrt{244 - 120\sqrt{3}}} & {\text{Use~the~square~root~property}.} \\ {b \approx 6.013} & \end{array}\]
Because we are solving for a length, we use only the positive square root. Now that we know the length \(b,\) we can use the Law of Sines to fill in the remaining angles of the triangle. Solving for angle \(\alpha,\) we have
\[\begin{array}{ll} {\frac{\sin\;\alpha}{a} = \frac{\sin\;\beta}{b}} & \\ {\frac{\sin\;\alpha}{10} = \frac{\sin(30{^\circ})}{6.013}} & \\ {\sin\;\alpha = \frac{10\sin(30{^\circ})}{6.013}} & {\text{Multiply~both~sides~of~the~equation~by~10}.} \\ {\alpha = \sin^{- 1}\left( \frac{10\sin(30{^\circ})}{6.013} \right)\begin{array}{llll} & & & \end{array}} & {\text{Find~the~inverse~sine~of~}\frac{10\sin(30{^\circ})}{6.013}.} \\ {\alpha \approx 56.3{^\circ}} & \end{array}\]
The other possibility for \(\alpha\) would be \(\alpha = 180{^\circ}–56.3{^\circ} \approx 123.7{^\circ}.\) In the original diagram, \(\alpha\) is adjacent to the longest side, so \(\alpha\) is an acute angle and, therefore, \(123.7{^\circ}\) 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 \(0{^\circ}\) and \(180{^\circ}.\) Proceeding with \(\alpha \approx 56.3{^\circ},\) we can then find the third angle of the triangle.
\[\gamma = 180{^\circ} - 30{^\circ} - 56.3{^\circ} \approx 93.7{^\circ}\]
The complete set of angles and sides is
\[\begin{array}{ll} {\alpha \approx 56.3{^\circ}\begin{array}{llll} & & & \end{array}} & {a = 10} \\ {\beta = 30{^\circ}} & {b \approx 6.013} \\ {\gamma \approx 93.7{^\circ}} & {c = 12} \end{array}\]
Find the missing side and angles of the given triangle: \(\alpha = 30{^\circ},\) \(b = 12,\) \(c = 24.\)
Solution (click to reveal)
\(a \approx 14.9,\) \(\beta \approx 23.8{^\circ},\) \(\gamma \approx 126.2{^\circ}.\)
Find the angle \(\alpha\) for the given triangle if side \(a = 20,\) side \(b = 25,\) and side \(c = 18.\)
Solution (click to reveal)
For this example, we have no angles. We can solve for any angle using the Law of Cosines. To solve for angle \(\alpha,\) we have
\[\begin{array}{llll} & & & \\ {\text{~~~~~~~~~~~~~~}a^{2} = b^{2} + c^{2}-2bc\cos\;\alpha} & & & \\ {\text{~~~~~~~~~~~~~}20^{2} = 25^{2} + 18^{2}-2(25)(18)\cos\;\alpha} & & & {\text{Substitute~the~appropriate~measurements}.} \\ {\text{~~~~~~~~~~~~~}400 = 625 + 324 - 900\cos\;\alpha} & & & {\text{Simplify~in~each~step}.} \\ {\text{~~~~~~~~~~~~~}400 = 949 - 900\cos\;\alpha} & & & \\ {\text{~~~~~~~~~~}-549 = -900\cos\;\alpha} & & & {\text{Isolate~cos~}\alpha.} \\ {\text{~~~~~~~~~~}\frac{-549}{-900} = \cos\;\alpha} & & & \\ {\text{~~~~~~~~~~~}0.61 \approx \cos\;\alpha} & & & \\ {\cos^{-1}(0.61) \approx \alpha} & & & {\text{Find~the~inverse~cosine}.} \\ {\text{~~~~~~~~~~~~~~~~~}\alpha \approx 52.4{^\circ}} & & & \end{array}\]
See Figure 5.
Because the inverse cosine can return any angle between 0 and 180 degrees, there will not be any ambiguous cases using this method.
Given \(a = 5,b = 7,\) and \(c = 10,\) find the missing angles.
Solution (click to reveal)
\(\alpha \approx 27.7{^\circ},\) \(\beta \approx 40.5{^\circ},\) \(\gamma \approx 111.8{^\circ}\)
7.2.2 Solving Applied Problems Using the Law of Cosines
Just as the Law of Sines provided the appropriate equations to solve a number of applications, the Law of Cosines is applicable to situations in which the given data fits the cosine models. We may see these in the fields of navigation, surveying, astronomy, and geometry, just to name a few.
On many cell phones with GPS, an approximate location can be given before the GPS signal is received. This is accomplished through a process called triangulation, which works by using the distances from two known points. Suppose there are two cell phone towers within range of a cell phone. The two towers are located 6000 feet apart along a straight highway, running east to west, and the cell phone is north of the highway. Based on the signal delay, it can be determined that the signal is 5,050 feet from the first tower and 2,420 feet from the second tower. Determine the position of the cell phone north and east of the first tower, and determine how far it is from the highway.
Solution (click to reveal)
For simplicity, we start by drawing a diagram similar to Figure 7.2.13 and labeling our given information.
Using the Law of Cosines, we can solve for the angle \(\theta.\) Remember that the Law of Cosines uses the square of one side to find the cosine of the opposite angle. For this example, let \(a = 2{,}420,b = 5{,}050,\) and \(c = 6{,}000.\) Thus, \(\theta\) corresponds to the opposite side \(a = 2{,}420.\)
\[\begin{matrix} a^{2} & = & {b^{2} + c^{2} - 2bc~\cos\theta} \\ {(2{,}420)}^{2} & = & {{(5{,}050)}^{2} + {(6{,}000)}^{2} - 2(5{,}050)(6{,}000)~\cos\theta} \\ \begin{matrix} {(2{,}420)}^{2} & - & {{(5{,}050)}^{2} - {(6{,}000)}^{2}} \end{matrix} & = & {- 2(5{,}050)(6{,}000)~\cos\theta} \\ \frac{\begin{matrix} {(2{,}420)}^{2} & - & {{(5{,}050)}^{2} - {(6{,}000)}^{2}} \end{matrix}}{- 2(5{,}050)(6{,}000)} & = & {\cos\theta} \\ {\cos\theta} & \approx & {0.9183} \\ \theta & \approx & {\cos^{- 1}(0.9183)} \\ \theta & \approx & {23.3{^\circ}} \end{matrix}\]
To answer the questions about the phone’s position north and east of the tower, and the distance to the highway, drop a perpendicular from the position of the cell phone, as in Figure 7.2.13. This forms two right triangles, although we only need the right triangle that includes the first tower for this problem.
Using the angle \(\theta = 23.3{^\circ}\) and the basic trigonometric identities, we can find the solutions. Thus
\[\begin{array}{l} \begin{array}{l} \\ {\mspace{9mu}\;\;\;\;\;\;\cos(23.3{^\circ}) = \frac{x}{5{,}050}} \end{array} \\ {\text{~~~~~~~~~~~~~~~~~~~}x = 5{,}050\cos(23.3{^\circ})} \\ {\text{~~~~~~~~~~~~~~~~~~~}x \approx 4{,}638.15\;\text{feet}} \\ {\mspace{9mu}\text{~~}\sin(23.3{^\circ}) = \frac{y}{5{,}050}} \\ {\text{~~~~~~~~~~~~~~~~~~~}y = 5{,}050\sin(23.3{^\circ})} \\ {\text{~~~~~~~~~~~~~~~~~~~}y \approx 1{,}997.5\;\text{feet}} \\ \end{array}\]
The cell phone is approximately 4,638 feet east and 1998 feet north of the first tower, and 1998 feet from the highway.
Returning to our problem at the beginning of this section, suppose a boat leaves port, travels 10 miles, turns 20 degrees, and travels another 8 miles. How far from port is the boat? The diagram is repeated here in Figure 7.2.13.
Solution (click to reveal)
The boat turned 20 degrees, so the obtuse angle of the non-right triangle is the supplemental angle, \(180{^\circ} - 20{^\circ} = 160{^\circ}.\) With this, we can utilize the Law of Cosines to find the missing side of the obtuse triangle—the distance of the boat to the port.
\[\begin{array}{l} {x^{2} = 8^{2} + 10^{2} - 2(8)(10)\cos(160{^\circ})} \\ {x^{2} = 314.35} \\ {x = \sqrt{314.35}} \\ {x \approx 17.7\;\text{miles}} \end{array}\]
The boat is about 17.7 miles from port.