Law of cosines
The law of sines needs a side and the angle across from it. What do you do with two sides and the angle between them, or with three sides and no angle at all?
Where you are 6 in Laws of sines and cosines
When you reach for it
The law of sines works on a triangle once you know one side together with the angle across from it. Two kinds of triangle never hand you such a pair:
- SAS: two sides and the angle between them, the included angle.
- SSS: all three sides, and no angle.
Both arrangements fix the triangle (SAS and SSS are congruence criteria), so the missing parts are determined. The law of cosines computes them. It also answers a question the other tools handle badly: given only lengths, how big is an angle?
As before, the triangle is ABC and each side is named by the lowercase letter of the angle across from it.
The procedure
Day 1: the law, from coordinates
Place the triangle on the coordinate plane with C at the origin and side CB along the positive x-axis, so B = (a, 0). Side CA has length b and leaves the origin at the angle C measured from the positive x-axis. The point on the The unit circle at that angle is (\cos C, \sin C); scaling it by b gives the point at distance b in the same direction:
Now c is just the distance from A to B, and the The distance formula gives its square:
The Pythagorean identity \cos^2 C + \sin^2 C = 1 collapses the bracket:
When the angle is obtuse
The law of sines needed a separate argument for an obtuse angle. This derivation does not. If C is obtuse, the terminal side of C lies in the second quadrant, \cos C < 0, and A sits to the left of the y-axis. But (b\cos C,\ b\sin C) came from the unit-circle definition of cosine and sine, not from a right triangle, so those are still the coordinates of A, and no step of the algebra used a sign. If C = 90^\circ, then A = (0, b) on the y-axis, which is the same formula with the quadrantal values \cos 90^\circ = 0 and \sin 90^\circ = 1.
The law of cosines
Nothing made C special: putting A or B at the origin gives the other two forms. In any triangle ABC,
In words: the square of one side is the sum of the squares of the other two, minus twice their product times the cosine of the angle between them, which is the angle across from the first side.
The Pythagorean theorem inside it
When C = 90^\circ, \cos C = 0 and the law is c^2 = a^2 + b^2: the The Pythagorean theorem. The term -2ab\cos C is the correction for an angle that is not right. If C is acute, \cos C > 0 and c^2 < a^2 + b^2; if C is obtuse, \cos C < 0 and c^2 > a^2 + b^2. Read backward, this classifies a triangle from its sides alone: compare the square of the longest side with the sum of the other two squares. Less means the largest angle is acute, so all three are; equal means right; greater means obtuse.
Solving SAS
Given a, b and the included angle C, the law gives c at once. One of the two remaining angles then comes from the law of sines or from the law of cosines again, and the third from the angle sum.
The law of sines needs care here. An inverse sine returns an angle between 0^\circ and 90^\circ, and since \sin x = \sin(180^\circ - x), an obtuse angle comes back as its supplement with no warning. The safe choice is the smaller of the two remaining angles, the one across from the shorter of the two given sides (the larger side is across from the larger angle). The two remaining angles add to 180^\circ - C, less than 180^\circ, so the smaller one is under 90^\circ, and the inverse sine returns it correctly. The law of cosines, used again, is always safe.
Keep full calculator values and round only at the end, sides to two decimal places and angles to hundredths of a degree.
Day 2: an angle from three sides
Solve c^2 = a^2 + b^2 - 2ab\cos C for the cosine, which is allowed because a and b are positive:
Then C = \cos^{-1}(\ldots). This step has no ambiguity. As an angle runs from 0^\circ to 180^\circ, its unit-circle point moves from (1, 0) to (-1, 0) and its x-coordinate falls the whole way, so each cosine between -1 and 1 belongs to exactly one angle in that range, and the inverse cosine returns that angle. A negative cosine is an obtuse angle, reported as obtuse.
Solving SSS and choosing a law
With three sides, find the largest angle first, across from the longest side, by the law of cosines. It is the only angle that could be obtuse; once it is known, the other two are acute, and either law finishes the triangle.
The rule for which law starts a triangle is short: the law of sines needs one complete side-and-opposite-angle pair, or two angles from which the angle sum makes one.
| Given | Name | Start with |
|---|---|---|
| two angles and any side | AAS, ASA | the law of sines |
| two sides and the angle between them | SAS | the law of cosines |
| three sides | SSS | the law of cosines |
| two sides and an angle not between them | SSA | the law of sines with the height test, or the law of cosines as a quadratic (Example 6) |
Worked examples
Examples 1 to 3 belong to Day 1, the third side of an SAS triangle. Examples 4 to 6 belong to Day 2, angles from sides.
An obtuse included angle, exactly
In triangle ABC, a = 3, b = 5 and C = 120^\circ. Find c.
SolutionThe given angle is between the given sides, so the law with c^2 on the left applies. The angle 120^\circ has reference angle 60^\circ and lies in the second quadrant, where cosine is negative, so \cos 120^\circ = -\tfrac{1}{2}. Then
and c = 7. Subtracting a negative term adds: the obtuse angle pushes B and A farther apart than a right angle would. Check: 7^2 = 49 > 3^2 + 5^2 = 34, so the angle across from c is obtuse, as given.
Solving an SAS triangle
In triangle ABC, b = 6, c = 15 and A = 28^\circ. Solve the triangle.
SolutionThe angle A is between b and c, so use the form with a^2:
so a \approx 10.10.
The remaining angles are B, across from 6, and C, across from 15. The shorter side is 6, so B is the smaller angle and must be acute. The law of sines finds it safely:
Then C = 180^\circ - 28^\circ - 16.19^\circ = 135.81^\circ.
Starting with C instead would have gone wrong: \sin C = \dfrac{15\sin 28^\circ}{a} \approx 0.6970, and the inverse sine returns 44.19^\circ, the supplement of the true angle. Check by cosines, which cannot mislead: \cos C = \dfrac{6^2 + a^2 - 15^2}{2(6)(a)} \approx -0.7170, and C \approx 135.81^\circ.
So a \approx 10.10, B \approx 16.19^\circ, C \approx 135.81^\circ.
Pitcher’s plate to first base
A baseball diamond is a square 90 feet on a side, with home plate H, first base F, second base S and third base T at the corners. The pitcher’s plate P is 60.5 feet from home plate, on the line from home to second base. How far is the pitcher’s plate from first base, and what are the angles of triangle HPF?
SolutionThe diagonal HS of a square bisects the right angle at H, so the angle between the first-base line and the line to second base is 45^\circ. Triangle HPF has HF = 90, HP = 60.5 and the 45^\circ angle between them: SAS. With d = PF,
so d \approx 63.72 feet.
Of the two remaining angles, the one at F is across from 60.5, the shorter of the two given sides, so it is the smaller and acute:
Then P = 180^\circ - 45^\circ - 42.18^\circ = 92.82^\circ. The angle at the pitcher’s plate is obtuse, barely, and an inverse sine taken there would have reported 87.18^\circ. Check: 90^2 = 8100 is more than 60.5^2 + d^2 \approx 3660.25 + 4059.86 = 7720.11, so the angle across from HF is obtuse.
The pitcher’s plate is about 63.72 feet from first base, and the triangle’s angles are 45^\circ at home, 42.18^\circ at first and 92.82^\circ at the plate.
Three sides and an exact angle
Solve the triangle with a = 5, b = 7 and c = 8.
SolutionThe longest side is c = 8, so C is the largest angle and goes first:
so C \approx 81.79^\circ.
The cosine is positive, so C is acute, and so are the other two. For B, the angle between a and c:
so B = 60^\circ exactly.
Then A = 180^\circ - 81.79^\circ - 60^\circ = 38.21^\circ. Check: \cos A = \dfrac{7^2 + 8^2 - 5^2}{2(7)(8)} = \dfrac{88}{112} = \dfrac{11}{14}, and \cos^{-1}\dfrac{11}{14} \approx 38.21^\circ.
Where is the fielder?
On a softball diamond the bases are 60 feet apart. Parth, in the outfield, stands 150 feet from home plate H and 110 feet from first base F, in fair territory. Find the angle \theta at home plate between the first-base line and the line to Parth, and the angle at first base.
SolutionCall Parth’s spot Q. Triangle HFQ has all three sides: HF = 60, HQ = 150, FQ = 110. The angle at H is between HF and HQ, across from FQ:
so \theta \approx 38.94^\circ. The line to second base makes 45^\circ with the first-base line, so Parth is about 6.06^\circ to the first-base side of it.
The angle at F is between HF and FQ, across from HQ = 150:
so F \approx 121.01^\circ. The negative cosine announced the obtuse angle; the law of sines would have given 58.99^\circ. The third angle, at Parth, is 180^\circ - 38.94^\circ - 121.01^\circ = 20.05^\circ.
Two sides and an angle not between them
In triangle ABC, A = 40^\circ, a = 8 and b = 10. Use the law of cosines to find every possible value of c.
SolutionThe known angle A sits between the unknown c and the known b, and the side across from it is the known a. So the form with a^2 has one unknown, c:
which rearranges to the quadratic
where 20\cos 40^\circ \approx 15.3209.
By the The quadratic formula, the discriminant is 15.3209^2 - 4(36) \approx 90.73, with square root about 9.525, so
so c \approx 12.42 or c \approx 2.90.
Both roots are positive, so two triangles fit. That agrees with the height test: h = 10\sin 40^\circ \approx 6.43, and h < a < b. The quadratic sorts every SSA case on its own: a negative discriminant means no triangle, and since the product of the roots is b^2 - a^2, when a \ge b at most one root is positive and at most one triangle fits.
Boundaries
The three sides must make a triangle. Each side must be less than the sum of the other two (Triangle inequality). Otherwise the formula for \cos C returns a number outside [-1, 1], and no angle has that cosine. Equality gives a cosine of exactly 1 or -1: a flattened figure, not a triangle.
The angle in the formula is the angle between the two sides on the right. It is the angle across from the side on the left. Any other angle gives a different, wrong length.
Angles strictly between 0^\circ and 180^\circ. At C = 180^\circ the law gives c = a + b, and at C = 0^\circ it gives c = |a - b|: three points on one line.
An inverse sine is safe only on an angle known to be acute. The inverse cosine never needs that knowledge.
Decimal answers are approximations, exact only when the cosines are, as in Examples 1 and 4.
Where this goes next
The law of cosines turns three sides into an angle, and the sine of that angle gives the area from two sides and the included angle; doing that algebra once and for all yields Heron’s formula. Applications of oblique triangles uses both laws to fix positions from measured angles and distances. In Bearings and navigation it checks the distance after two legs of a trip. Applied to two arrows and the arrow joining their tips, it becomes the dot product formula, and it gives the size of the combined push of two forces at an angle.
Exercises
Day 1: the third side
Find the third side, exactly where the cosine is exact, otherwise to two decimal places.
- a = 4, b = 7, C = 60^\circ.
- a = 6, b = 10, C = 120^\circ.
- b = 12, c = 9, A = 90^\circ. Find a.
- \displaystyle a = \sqrt{2}, b = 3, C = 45^\circ.
Day 1: solving SAS triangles
Solve each triangle. Say which angle you found by the law of sines, and why it was safe.
- a = 11, b = 7, C = 52^\circ.
- b = 14, c = 9, A = 137^\circ.
- a = 5, c = 16, B = 25^\circ. Also give the wrong value an inverse sine would report for C.
- On a softball diamond the bases are 60 feet apart and the pitcher’s plate is 43 feet from home plate, on the line to second base. How far is the pitcher’s plate from first base? Find the angle at the pitcher’s plate in the triangle home, pitcher’s plate, first base, and say whether it is acute or obtuse.
- On a baseball diamond, Nandini catches a fly ball 250 feet from home plate, on a line making 30^\circ with the first-base line toward second base. How far is she from first base, which is 90 feet from home?
- Take a = 8 and b = 15. Find c when C = 89^\circ, C = 90^\circ and C = 91^\circ.
Day 2: angles from three sides
- Find the largest angle of the triangle with sides 7, 8 and 13, exactly.
- Solve the triangle with a = 11, b = 13, c = 20.
- Without finding any angle, decide whether each triangle is acute, right or obtuse: (a) 6, 9, 11; (b) 7, 24, 25; (c) 8, 9, 10.
- Find the largest angle of the triangle with sides 4, 6 and 9.
- On the softball diamond, Gaurav stands in fair territory 120 feet from home plate and 90 feet from first base. Find the angle at home plate between the first-base line and the line to Gaurav. Is he on the first-base side or the third-base side of the line to second base?
- On the baseball diamond, a ball lands in fair territory 300 feet from home plate and 240 feet from first base. Find the angle at home plate between the first-base line and the line to the ball.
- Show that no triangle has sides 5, 6 and 12 by computing what the law of cosines gives for the largest angle’s cosine.
Day 2: which law first
- For each set of parts, name the arrangement and the law that starts the triangle: (a) A = 50^\circ, B = 60^\circ, c = 9; (b) a = 7, b = 10, C = 70^\circ; (c) a = 4, b = 5, c = 6; (d) a = 6, b = 9, A = 30^\circ.
- In triangle ABC, A = 32^\circ, a = 7 and b = 9. Use the law of cosines to find every possible c, and say how many triangles there are.
Reasoning
- Explain why the law of cosines contains the Pythagorean theorem, and why c^2 < a^2 + b^2 exactly when C is acute.
- Derive a^2 = b^2 + c^2 - 2bc\cos A by placing A at the origin and B on the positive x-axis.
- The law of sines needed a separate argument for an obtuse angle. Explain why the coordinate derivation of the law of cosines does not.
- After the third side of an SAS triangle is found, explain why the smaller of the two remaining angles may be found by the law of sines but the larger may not, and why the inverse cosine never has this problem.
- What does the law of cosines give at C = 0^\circ and at C = 180^\circ? Use the quadrantal values of cosine and describe the figure in each case.
Answers
- \displaystyle c = \sqrt{37} \approx 6.08. c^2 = 16 + 49 - 2(4)(7)\cdot\tfrac{1}{2} = 37.
- c = 14. c^2 = 36 + 100 - 2(6)(10)\left(-\tfrac{1}{2}\right) = 196.
- a = 15. \cos 90^\circ = 0, so a^2 = 144 + 81 = 225: the Pythagorean theorem.
- \displaystyle c = \sqrt{5} \approx 2.24. \displaystyle c^2 = 2 + 9 - 2(\sqrt{2})(3)\cdot\dfrac{\sqrt{2}}{2} = 11 - 6 = 5.
- c \approx 8.67, B \approx 39.50^\circ, A \approx 88.50^\circ. c^2 = 121 + 49 - 154\cos 52^\circ \approx 75.19. B is across from 7, the shorter given side, so it is acute: \sin B = \dfrac{7\sin 52^\circ}{c}. Then A = 180^\circ - 52^\circ - B.
- a \approx 21.48, C \approx 16.61^\circ, B \approx 26.39^\circ. a^2 = 196 + 81 - 252\cos 137^\circ \approx 461.30. C is across from 9, the shorter given side: \sin C = \dfrac{9\sin 137^\circ}{a}. Then B = 180^\circ - 137^\circ - C.
- b \approx 11.66, A \approx 10.44^\circ, C \approx 144.56^\circ; an inverse sine for C reports 35.44^\circ. b^2 = 25 + 256 - 160\cos 25^\circ. A is across from 5: \sin A = \dfrac{5\sin 25^\circ}{b}, then C = 180^\circ - 25^\circ - A, and \sin C is also the sine of 180^\circ - C.
- About 42.43 feet; the angle is about 89.23^\circ, acute. d^2 = 60^2 + 43^2 - 2(60)(43)\cos 45^\circ \approx 1800.33. The angle at the plate is across from 60: \cos P = \dfrac{43^2 + d^2 - 60^2}{2(43)d} \approx 0.0135. On the baseball diamond (Example 3) the same angle was obtuse.
- About 177.85 feet. d^2 = 90^2 + 250^2 - 2(90)(250)\cos 30^\circ.
- c \approx 16.88, c = 17, c \approx 17.12. c^2 = 289 - 240\cos C; at 90^\circ the correction term is zero, and it changes sign as C passes 90^\circ.
- 120^\circ. \cos C = \dfrac{49 + 64 - 169}{2(7)(8)} = \dfrac{-56}{112} = -\dfrac{1}{2}.
- C \approx 112.62^\circ, B \approx 36.87^\circ, A \approx 30.51^\circ. Largest first: \cos C = \dfrac{121 + 169 - 400}{286} = -\dfrac{5}{13}. Then \cos B = \dfrac{121 + 400 - 169}{440} = \dfrac{4}{5}, and A = 180^\circ - C - B.
- (a) obtuse, 121 > 36 + 81 = 117; (b) right, 625 = 49 + 576; (c) acute, 100 < 64 + 81 = 145.
- About 127.17^\circ. \cos = \dfrac{16 + 36 - 81}{48} = -\dfrac{29}{48}.
- About 46.57^\circ, on the third-base side, by about 1.57^\circ. \cos\theta = \dfrac{60^2 + 120^2 - 90^2}{2(60)(120)} = \dfrac{9900}{14{,}400} = 0.6875, and 46.57^\circ is more than the 45^\circ of the line to second base.
- About 41.41^\circ. \cos\theta = \dfrac{90^2 + 300^2 - 240^2}{2(90)(300)} = \dfrac{40{,}500}{54{,}000} = 0.75.
- The cosine would be \dfrac{25 + 36 - 144}{60} = -\dfrac{83}{60} < -1, which no angle has. Equivalently, 5 + 6 < 12.
- (a) ASA, law of sines (the angle sum gives C, pairing it with c). (b) SAS, law of cosines. (c) SSS, law of cosines. (d) SSA, law of sines with the height test, or the law of cosines as a quadratic in c.
- c \approx 12.76 or c \approx 2.51: two triangles. 49 = 81 + c^2 - 18c\cos 32^\circ, so c^2 - (18\cos 32^\circ)c + 32 = 0, and both roots are positive. The height test agrees: 9\sin 32^\circ \approx 4.77 < 7 < 9.
- At C = 90^\circ the term -2ab\cos C is zero, leaving c^2 = a^2 + b^2. Since a, b > 0, the sign of a^2 + b^2 - c^2 = 2ab\cos C is the sign of \cos C, which is positive exactly for 0^\circ < C < 90^\circ.
- With A at the origin, B = (c, 0) and C = (b\cos A,\ b\sin A). Then a^2 = (b\cos A - c)^2 + b^2\sin^2 A. Expanding and grouping gives a^2 = b^2(\cos^2 A + \sin^2 A) + c^2 - 2bc\cos A, and the Pythagorean identity leaves a^2 = b^2 + c^2 - 2bc\cos A.
- The coordinates (b\cos C,\ b\sin C) come from the unit-circle definition, which holds for every angle, so the vertex is placed correctly whatever the sign of \cos C; the distance formula and the identity hold for all values. The law of sines read \sin off a right triangle inside the figure, and that right triangle changes when the angle is obtuse.
- The two remaining angles add to 180^\circ - C < 180^\circ, so the smaller is under 90^\circ; the inverse sine returns angles from 0^\circ to 90^\circ, so it returns the smaller angle correctly. The larger may be obtuse, and \sin x = \sin(180^\circ - x) means the inverse sine would return its supplement. Cosine takes each value once between 0^\circ and 180^\circ, so the inverse cosine returns the one triangle angle with that cosine.
- At C = 0^\circ, \cos C = 1 and c^2 = (a - b)^2, so c = |a - b|: side b lies along side a. At C = 180^\circ, \cos C = -1 and c^2 = (a + b)^2, so c = a + b: the sides point in opposite directions. Either way the three points are on one line and there is no triangle.