Login
📚 Trigonometry
Chapters ▾

3.3 The Law of Cosines

If we know two angles and one side of a triangle, we can use the Law of Sines to solve the triangle. We can also use the Law of Sines when we know two sides and the angle opposite one of them. But the Law of Sines is not helpful for the problem that opened this chapter, finding the distance from Avery to Clio. In this case we know two sides of the triangle, a and c , and the included angle, B .

oblique triangles

To solve a triangle when we know two sides and the included angle, we will need a generalization of the Pythagorean theorem known as the Law of Cosines.

In a right triangle, with C = 90 , the Pythagorean theorem tells us that

c 2 = a 2 + b 2

If we allow angle C to vary, but keep a and b the same length, the side c will grow or shrink, depending on whether we increase or decrease the angle C , as shown below.

three triangles

The Pythagorean theorem is actually a special case of a more general law that applies to all triangles, no matter what the size of angle C . The equation relating the three sides of a triangle is

c 2 = a 2 + b 2 2 a b cos ( C )

You can see that when C is a right angle, cos 90 = 0 , so the equation reduces to the Pythagorean theorem.

We can write similar equations involving the angles or A or B . The three equations are all versions of the Law of Cosines.

Finding a Side

Now we can solve the problem of the distance from Avery to Clio. Here is the figure from Section 3.1 showing the location of the three towns.

triangle between towns

In A B C , a = 11 ,   c = 23 , and B = 87 . Find b , and round your answer to two decimal places.

We use the Law of Cosines.

b 2 = 11 2 + 23 2 11 ( 23 ) cos ( 87 ) = 623.52

so b = 623.52 = 24.97 .

Finding an Angle

We can also use the Law of Cosines to find an angle when we know all three sides of a triangle. Pay close attention to the algebraic steps used to solve the equation in the next example.

In A B C ,   a = 5.3 ,   b = 4.7 , and   c = 6.1 . Find angle B , and round your answer to two decimal places.

Substitute the known values into the Law of Cosines to get

4.7 2 = 5.3 2 + 6.1 2 2 ( 5.3 ) ( 6.1 ) cos ( B )

from which we find cos ( B ) = 0.6683 , so

B = cos 1 ( 0.6683 ) = 48.07

.

Once we have calculated one of the angles in a triangle, we can use either the Law of Sines or the Law of Cosines to find a second angle. Here is how we would use the Law of Sines to find angle A in the previous Example.

sin ( A ) a = sin ( C ) c Substitute the known values. sin ( A ) 6 = sin ( 115.4 ) 11 Solve for sin A . sin ( A ) = 6 sin ( 115.4 ) 11 0.4928

Thus, A = sin 1 ( 0.4928 ) = 29.5 . There are two angles with sine 29.5 , but we know that A is an acute angle because it is opposite the shortest side of the triangle. Finally,

B = 180 ( A + C ) 35.1

Alternatively, we can use the Law of Cosines to find angle A .

a 2 = b 2 + c 2 2 b c cos ( A ) Substitute the known values. 6 2 = 7 2 + 11 2 2 ( 7 ) ( 11 ) cos ( A ) Simplify each side. 36 = 49 + 121 154 cos ( A ) Isolate the cosine term. 134 = 154 cos ( A ) Solve for cos ( A ) . 67 77 = cos ( A ) Solve for A. A = cos 1 ( 67 77 ) = 29.5

Navigation

Even with the aid of GPS (Global Positioning System) instruments, aircraft pilots and ship captains need to understand navigation based on trigonometry.

Howard wants to fly from Anchorage to Nome, Alaska, a distance of 540 miles on a heading 57 west of north. After flying for some time, he discovers that his heading is in error, and he is actually flying 47 west of north. Howard corrects his flight plan and changes course when he is exactly 200 miles from Anchorage. What is his new heading, and how far is he from Nome?

triangle

We use the Law of Cosines to find his distance from Nome:

d 2 = 540 2 + 200 2 2 ( 200 ) ( 540 ) cos ( 10 )

Solving for d gives 344.8. Next, use either law to find that angle B is 164.22 . The new heading is 47 plus the supplement of B , or 47 + 15.78 = 62.78 west of north, and the distance is 344.8 miles.

Which Law to Use

How can we decide which law, the Law of Sines or the Law of Cosines, is appropriate for a given problem?

  • If we are solving a right triangle, we don't need the Laws of Sines and Cosines; all we need are the definitions of the trigonometric ratios.
  • But for oblique triangles, we can identify the following cases:

In the triangle at right, which part of the triangle can you find, and which law should you use?

triangle

We know two sides and the included angle, so we can find side c using the Law of Cosines.

In the previous Example we used the Law of Sines to find an angle. Because there are always two angles with a given sine, we should check whether both possible angles result in a triangle. But here is another approach: We can apply the Law of Cosines to find the third side first. With that method, we'll need the quadratic formula.

Using the Law of Cosines for the Ambiguous Case

In Section 3.2 we encountered the ambiguous case:

If we know two sides a and b of a triangle and the acute angle α opposite one of them, there may be one solution, two solutions, or no solution, depending on the size of a in relation to b and α , as shown below.

To discover which case applies (no triangle, one triangle, or two triangles), we can begin by using the Law of Cosines to find the third side. As we saw in the previous Example, for this method we need the quadratic formula.

A quadratic equation can have one solution, two solutions, or no solution, depending on the value of the discriminant, D = b 2 4 a c . (Note that the discriminant is the expression under the radical in the quadratic formula. Perhaps you recall how the discriminant determines the number of solutions, and why.)

  • If   D > 0 , the equation has two solutions.
  • If   D = 0 , the equation has one solution.
  • If   D < 0 , the equation has no (real) solution.

And the number of solutions determines the number of triangles that fit the given properties.

  • If the quadratic equation has one positive solution, there is one triangle.
  • If the quadratic equation has two positive solutions, there are two triangles.
  • If the quadratic equation has no positive solutions, there is no triangle with the given properties.

Use the Law of Cosines to find all triangles A B C with A = 48 ,   a = 10 , and b = 15 .

Using the Law of Cosines to find side c , we get the equation

a 2 = b 2 + c 2 2 b c cos ( A ) 100 = 225 + c 2 30 c cos ( 48 )

Putting this quadratic equation into standard form we get

c 2 20.07 c + 125 = 0

The discriminant is

b 2 4 a c = 20.07 2 4 ( 125 ) = 97.2

Because the discriminant is negative, the equation has no solution, and there is no triangle satisfying the stated conditions.

Review the following skills you will need for this section.

Section 3.3 Summary

Vocabulary

  • Quadratic equation
  • Quadratic formula
  • Discriminant

Concepts

  1. The Law of Sines is not helpful when we know two sides of the triangle and the included angle. In this case we need the Law of Cosines.
  2. We can also use the Law of Cosines to find an angle when we know all three sides of a triangle.
  3. We can use the Law of Cosines to solve the ambiguous case.

Study Questions

  1. The Law of Cosines is really a generalization of what familiar theorem?
  2. If you know all three sides of a triangle and one angle, what might be the advantage in using the Law of Cosines o find another angle, instead of the Law of Sines?
  3. State the quadratic formula from memory. Try to sing the quadratic formula to the tune of "Pop Goes the Weasel."
  4. Francine is solving a triangle in which a = 20 ,   b = 16 , and A = 26 . She finds that sin B = 0.3507 . How does she know that B = 20.5 , and not 159.5 ?

Skills

  1. Use the Law of Cosines to find the side opposite an angle #7-12
  2. Use the Law of Cosines to find an angle #13-20
  3. Use the Law of Cosines to find a side adjacent to an angle #21-26
  4. Decide which law to use #27-34
  5. Solve a triangle #35-42
  6. Solve problems using the Law of Cosines #43-56

Homework 3.3

  1. Simplify     5 2 + 7 2 2 ( 5 ) ( 7 ) cos ( θ )
  2. Evaluate the expression in part (a) for θ = 29
  3. Evaluate the expression in part (a) for θ = 151
  1. 74 70 cos ( θ )
  2. 12.78
  3. 135.22
  1. Simplify     26.1 2 + 32.5 2 2 ( 26.1 ) ( 32.5 ) cos ( ϕ )
  2. Evaluate the expression in part (a) for ϕ = 64
  3. Evaluate the expression in part (a) for ϕ = 116
  1. Solve     b 2 = a 2 + c 2 2 a c cos ( β )     for     cos ( β )
  2. For the equation in part (a), find cos β if a = 5 ,   b = 11 , and c = 8 .
  1. a 2 + c 2 b 2 2 a c
  2. 0.4
  1. Solve     a 2 = b 2 + c 2 2 b c cos ( α )     for     cos ( α )
  2. For the equation in part (a), find cos ( α ) if a = 4.6 ,   b = 7.2 , and c = 9.4 .
  1. The equation     9 2 = b 2 + 4 2 2 b ( 4 ) cos ( α )     is quadratic in b . Write the equation in standard form.
  2. Solve the equation in part (a) for b if α = 48 .
  1. b 2 8 cos ( α ) b 65 = 0
  2. 11.17 ,   5.82
  1. The equation     6 2 = 5 2 + c 2 2 ( 5 ) c cos ( β )     is quadratic in c . Write the equation in standard form.
  2. Solve the equation in part (a) for c if β = 126 .

For Problems 7–12, use the Law of Cosines to find the indicated side. Round to two decimal places.

triangle

7.70

triangle
triangle

13.44

triangle
triangle

5.12

triangle

For Problems 13–16,use the Law of Cosines to find the indicated angle. Round to two decimal places.

triangle

133.43

triangle
triangle

40.64

triangle

For Problems 17–20, find the angles of the triangle. Round answers to two decimal places.

a = 23 ,   b = 14 ,   c = 18

A = 91.02 ,   B = 37.49 ,   C = 51.49

a = 18 ,   b = 25 ,   c = 19

a = 16.3 ,   b = 28.1 ,   c = 19.4

A = 34.34 ,   B = 103.49 ,   C = 42.17

a = 82.3 ,   b = 22.5 ,   c = 66.8

For Problems 21–26, use the Law of Cosines to find the unknown side. Round your answers to two decimal places.

triangle

6.30 or 2.70

triangle
triangle

29.76 or 5.91

triangle
triangle

16.00

triangle

For Problems 27–34, which law should you use to find the labeled unknown value, the Law of Sines or the Law of Cosines? Write an equation you can solve to find the unknown value. For Problems 31-34, you may need two steps to find the unknown value.

triangle

Law of Cosines: 61 2 = 29 2 + 46 2 2 29 46 cos ( ϕ )

triangle
triangle

Law of Sines: a sin ( 46 ) = 16 sin ( 25 )

triangle
triangle

First the Law of Cosines: x 2 = 47 2 + 29 2 2 47 29 cos ( 81 ) , then either the Law of Sines: sin ( θ ) 47 = sin ( 81 ) x or the Law of Cosines: 47 2 = x 2 + 29 2 2 x 29 cos ( θ )

triangle
triangle

Law of Cosines: 9 2 = 4 2 + z 2 2 4 z cos ( 28 ) , or use the Law of Sines first to find the (acute) angle opposite the side of length 4, then find the angle opposite the side of length z by subtracting the sum of the known angles from 180 , then using the Law of Sines again.

triangle

For Problems 35–42,

  1. Sketch and label the triangle.
  2. Solve the triangle. Round answers to two decimal places.

B = 47 ,   a = 23 ,   c = 17

  1. triangle
  2. b = 16.87 ,   A = 85.53 ,   C = 47.47

C = 32 ,   a = 14 ,   b = 18

a = 8 ,   b = 7 ,   c = 9

  1. triangle
  2. A = 58.41 , B = 48.19 , C = 73.40

a = 23 ,   b = 34 ,   c = 45

b = 72 ,   c = 98 ,   B = 38

  1. triangle
  2. a = 116.52 ,   A = 85.07 ,   C = 56.93 or a = 37.93 ,   A = 18.93 ,   C = 123.07

a = 28 ,   c = 41 ,   A = 27

c = 5.7 ,   A = 59 ,   B = 82

  1. triangle
  2. a = 7.76 ,   b = 8.97 ,   C = 39

b = 82 ,   A = 11 ,   C = 42

For Problems 43–52,

  1. Sketch and label a triangle to illustrate the problem.
  2. Solve the problem. Round answers to one decimal place.

A surveyor would like to know the distance P Q across a small lake, as shown in the figure. She stands at point O and measures the angle between the lines of sight to points P and Q at 76 . She also finds O P = 1400 meters and O Q = 600 meters. Calculate the distance P Q .

lake
  1. triangle
  2. 1383.3 m

Highway engineers plan to drill a tunnel through Boney Mountain from G to H , as shown in the figure. The angle at point F is 41 , and the distances to G and H are 900 yards and 2500 yards, respectively. How long will the tunnel be?

mountains

Two pilots leave an airport at the same time. One pilot flies 3 east of north at a speed of 320 miles per hour, the other flies 157 east of north at a speed of 406 miles per hour. How far apart are the two pilots after 3 hours? What is the heading from the first plane to the second plane at that time?

  1. triangle
  2. 2123 mi, 168.43 east of north

Two boats leave port at the same time. One boat sails due west at a speed of 17 miles per hour, the other powers 42 east of north at a speed of 23 miles per hour. How far apart are the two boats after 2 hours? What is the heading from the first boat to the second boat at that time?

Caroline wants to fly directly south from Indianapolis to Cancun, Mexico, a distance of 1290 miles. However, to avoid bad weather, she flies for 400 miles on a heading 18 east of south. What is the heading to Cancun from that location, and how far is it?

  1. triangle
  2. 7.74 west of south, 917.9 mi

Alex sails 8 miles from Key West, Florida on a heading 40 east of south. He then changes course and sails for 10 miles due east. What is the heading back to Key West from that point, and how far is it?

The phone company wants to erect a cell tower on a steep hill inclined 26 to the horizontal. The installation crew plans to run a guy wire from a point on the ground 20 feet uphill from the base of the tower and attach it to the tower at a height of 100 feet. How long should the guy wire be?

  1. triangle
  2. 92.99 ft

Sandstone Peak rises 3500 feet above the desert. The Park Service plans to run an aerial tramway up the north face, which is inclined at an angle of 68 to the horizontal. The base station will be located 500 feet from the foot of Sandstone Peak. Ignoring any slack in the cable, how long should it be?

The sides of a triangle are 27 cm, 15 cm, and 20 cm. Find the area of the triangle. (Hint: Find one of the angles first.)

147.73   cm 2

The sides of a parallelogram are 10 inches and 8 inches, and form an angle of 130 . Find the lengths of the diagonals of the parallelogram.

For Problems 53–56, find x , the distance from one vertex to the foot of the altitude.

triangle

10.53

triangle
triangle

4.08

triangle

Problems 57 and 58 prove the Law of Cosines.

triangles
  1. Copy the three figures above showing the three possibilities for an angle C in a triangle: C is acute, obtuse, or a right angle. For each figure, explain why it is true that c 2 = ( b x ) 2 + y 2 , then rewrite the right side to get c 2 = ( x 2 + y 2 ) + b 2 2 b x .
  2. For each figure, explain why it is true that x 2 + y 2 = a 2 .
  3. For all three figures, a is the distance from the origin to the point ( x , y ) . Use the definition of cosine to write cos ( C ) in terms of a and x , then solve your equation for x .
  4. Start with the last equation from (a), and substitute expressions from (b) and (c) to conclude one case of the Law of Cosines.
  1. First figure: b x is the base of the small right triangle. Second: x is the horizontal distance between P and the x -axis, so b + ( x ) or b x is the base of the large right triangle. Third: x = 0 , and b is the base of a right triangle.
  2. First: x and y are the legs of a right triangle, a is the hypotenuse. Second: x and y are the legs of a right triangle with hypotenuse a . Third: x = 0 and y = a
  3. x = a cos ( C )

Demonstrate the other two cases of the Law of Cosines:

  • a 2 = b 2 + c 2 2 b c cos ( A )
  • b 2 = a 2 + c 2 2 a c cos ( B )

(Hint: See Problem 57 and switch the roles of a and c , etc.)

Use the Law of Cosines to prove the projection laws:

a = b cos ( C ) + c cos ( B ) b = c cos ( A ) + a cos ( C ) c = a cos ( B ) + b cos ( A )

Illustrate with a sketch. (Hint: Add together two of the versions of the Law of Cosines.)

b 2 + c 2 = ( a 2 + c 2 2 a c cos ( B ) ) + ( a 2 + b 2 2 b c cos ( C ) ) = 2 a 2 + b 2 + c 2 2 a ( c cos ( B ) + b cos ( C ) )

so 2 a 2 = 2 a ( c cos ( B ) + b cos ( C ) ) , and dividing both sides by 2 a yields a = ( c cos ( B ) + b cos ( C )

If A B C is isosceles with a = b , show that c 2 = 2 a 2 ( 1 cos ( C ) ) .

Use the Law of Cosines to prove:

1 + cos ( A ) = ( a + b + c ) ( a + b + C ) 2 b c 1 cos ( A ) = ( a b + c ) ( a + b + C ) 2 b c

For the first equation, start with the Law of Cosines in the form

a 2 = b 2 + c 2 2 b c cos ( A )

Add 2 a b + 2 b c cos ( A ) a 2 to both sides of the equation, factor the right side, then divide both sides by 2 b c .

For the second equation, start with the Law of Cosines in the form

b 2 + c 2 2 b c cos ( A ) = a 2

Add 2 b c b 2 c 2 to both sides of the equation, factor the right side, then divide both sides by 2 b c .

Prove that

cos ( A ) a + cos ( B ) b + cos ( C ) c = a 2 + b 2 + c 2 2 a b c

Trigonometry by Katherine Yoshiwara (yoshiwarabooks.org), GNU Free Documentation License 1.2 or later. Adapted for the XYZ HTML edition with the authors' permission (recorded 2026-07-04). License: GFDL-1.2-or-later.