Skip to content
Family Table Math

The Cosine Law

The sine law needs a side and its opposite angle. When you don’t have such a pair, as when you know two sides and the angle between them, or all three sides, the cosine law steps in. It’s the Pythagorean theorem, upgraded to work in any triangle. All angles are in degrees.

In any triangle ABCABC (labelled as below):

Triangle ABC with side a opposite angle A, side b opposite angle B, and side c opposite angle C A B C c b a
c2=a2+b2−2abcos⁡Cc^2 = a^2 + b^2 - 2ab\cos C

The same pattern works for every side: a2=b2+c2−2bccos⁡Aa^2 = b^2 + c^2 - 2bc\cos A and b2=a2+c2−2accos⁡Bb^2 = a^2 + c^2 - 2ac\cos B. The side on the left is opposite the angle in the cosine.

Rearranging to find an angle from three sides:

cos⁡C=a2+b2−c22ab\cos C = \frac{a^2 + b^2 - c^2}{2ab}
You knowUse
two sides and the angle between them (SAS)cosine law, to find the third side
all three sides (SSS)cosine law, to find an angle
a side and its opposite angle, plus one moresine law

If ∠C=90∘\angle C = 90^\circ, then cos⁡C=0\cos C = 0 and the law becomes c2=a2+b2c^2 = a^2 + b^2. The −2abcos⁡C-2ab\cos C term corrects for angles that aren’t right angles.

The cosine law has no ambiguous case: cos⁡−1\cos^{-1} gives values from 0∘0^\circ to 180∘180^\circ, and a negative cosine correctly gives an obtuse angle.

Example 1: Two sides and the included angle (SAS)

Section titled “Example 1: Two sides and the included angle (SAS)”

In △ABC\triangle ABC, a=8a = 8, b=11b = 11, and ∠C=52∘\angle C = 52^\circ. Find cc to two decimal places.

Solution.

c2=82+112−2(8)(11)cos⁡52∘=185−176cos⁡52∘≈76.64\begin{aligned} c^2 &= 8^2 + 11^2 - 2(8)(11)\cos 52^\circ \\ &= 185 - 176\cos 52^\circ \\ &\approx 76.64 \end{aligned}

So c≈76.64≈8.75c \approx \sqrt{76.64} \approx 8.75.

A triangle has sides a=7a = 7, b=9b = 9, and c=12c = 12. Find its largest angle.

Solution. The largest angle is opposite the longest side, so find ∠C\angle C:

cos⁡C=72+92−1222(7)(9)=49+81−144126=−14126≈−0.1111\cos C = \frac{7^2 + 9^2 - 12^2}{2(7)(9)} = \frac{49 + 81 - 144}{126} = \frac{-14}{126} \approx -0.1111

∠C≈cos⁡−1(−0.1111)≈96.4∘\angle C \approx \cos^{-1}(-0.1111) \approx 96.4^\circ. The negative cosine tells you the angle is obtuse.

Use the cosine law to find cc when a=3a = 3, b=4b = 4, and ∠C=90∘\angle C = 90^\circ.

Solution.

c2=9+16−2(3)(4)cos⁡90∘=25−0=25⇒c=5c^2 = 9 + 16 - 2(3)(4)\cos 90^\circ = 25 - 0 = 25 \quad\Rightarrow\quad c = 5

That’s the familiar 33–44–55 right triangle.

Two hikers leave camp on straight paths 65∘65^\circ apart. One walks 4.54.5 km and the other walks 66 km. How far apart are they?

Solution. The angle between the two known sides is 65∘65^\circ:

d2=4.52+62−2(4.5)(6)cos⁡65∘=56.25−54cos⁡65∘≈33.43d^2 = 4.5^2 + 6^2 - 2(4.5)(6)\cos 65^\circ = 56.25 - 54\cos 65^\circ \approx 33.43

d≈5.78d \approx 5.78 km.

Using an angle that isn’t between the two sides. For c2=a2+b2−2abcos⁡Cc^2 = a^2 + b^2 - 2ab\cos C, angle CC must be the angle between sides aa and bb (opposite cc).

Order of operations. 185−176cos⁡52∘185 - 176\cos 52^\circ means multiply first, then subtract. It isn’t (185−176)cos⁡52∘(185 - 176)\cos 52^\circ.

Forgetting the square root. The formula gives c2c^2. Take the square root at the end.

Picking the wrong angle to find first. When solving a whole triangle from three sides, find the largest angle first with the cosine law. Then the remaining angles are acute, and the sine law is safe to use.

1. (Warm-up) Which law would you use first?

  • (a) two sides and the angle between them
  • (b) two angles and a side
  • (c) three sides
  • (d) two sides and an angle opposite one of them
Solution

(a) Cosine law. (b) Sine law. (c) Cosine law. (d) Sine law (watch for the ambiguous case).

2. (Warm-up) Find cc if a=3a = 3, b=5b = 5, and ∠C=60∘\angle C = 60^\circ. Give an exact answer and a decimal.

Solutionc2=9+25−2(3)(5)(12)=34−15=19c^2 = 9 + 25 - 2(3)(5)\left(\tfrac{1}{2}\right) = 34 - 15 = 19

c=19≈4.36c = \sqrt{19} \approx 4.36.

3. (Warm-up) A triangle has all three sides equal to 55. Use the cosine law to find one of its angles.

Solutioncos⁡C=25+25−252(5)(5)=2550=12\cos C = \frac{25 + 25 - 25}{2(5)(5)} = \frac{25}{50} = \frac{1}{2}

So ∠C=60∘\angle C = 60^\circ, as expected for an equilateral triangle.

4. (Core) In △ABC\triangle ABC, b=14b = 14, c=9c = 9, and ∠A=110∘\angle A = 110^\circ. Find aa.

Solutiona2=142+92−2(14)(9)cos⁡110∘=277−252cos⁡110∘≈363.19a^2 = 14^2 + 9^2 - 2(14)(9)\cos 110^\circ = 277 - 252\cos 110^\circ \approx 363.19

a≈19.06a \approx 19.06. (cos⁡110∘\cos 110^\circ is negative, so this side is longer than it would be in a right triangle.)

5. (Core) A triangle has sides 1010, 1313, and 1515. Find its smallest angle.

Solution

The smallest angle is opposite the shortest side, 1010:

cos⁡θ=132+152−1022(13)(15)=294390≈0.7538\cos\theta = \frac{13^2 + 15^2 - 10^2}{2(13)(15)} = \frac{294}{390} \approx 0.7538

θ≈41.1∘\theta \approx 41.1^\circ.

6. (Core) Find all three angles of a triangle with sides 66, 88, and 1111.

Solution

Largest angle first (opposite 1111):

cos⁡C=36+64−1212(6)(8)=−2196⇒∠C≈102.6∘\cos C = \frac{36 + 64 - 121}{2(6)(8)} = \frac{-21}{96} \quad\Rightarrow\quad \angle C \approx 102.6^\circ

Angle opposite 66:

cos⁡A=64+121−362(8)(11)=149176⇒∠A≈32.2∘\cos A = \frac{64 + 121 - 36}{2(8)(11)} = \frac{149}{176} \quad\Rightarrow\quad \angle A \approx 32.2^\circ

The third angle is about 180∘−102.6∘−32.2∘=45.2∘180^\circ - 102.6^\circ - 32.2^\circ = 45.2^\circ.

7. (Core) A triangular garden has two sides of 1212 m and 1515 m with a 72∘72^\circ angle between them. How much fencing is needed to go all the way around?

Solutionc2=144+225−2(12)(15)cos⁡72∘=369−360cos⁡72∘≈257.75c^2 = 144 + 225 - 2(12)(15)\cos 72^\circ = 369 - 360\cos 72^\circ \approx 257.75

c≈16.05c \approx 16.05 m. The fencing needed is about 12+15+16.05=43.0512 + 15 + 16.05 = 43.05 m.

8. (Challenge) Explain what the cosine law says about c2c^2 compared with a2+b2a^2 + b^2 when ∠C\angle C is acute, right, and obtuse.

Solution

c2=a2+b2−2abcos⁡Cc^2 = a^2 + b^2 - 2ab\cos C, and 2ab2ab is positive.

  • Acute CC: cos⁡C>0\cos C \gt 0, so c2<a2+b2c^2 \lt a^2 + b^2.
  • Right CC: cos⁡C=0\cos C = 0, so c2=a2+b2c^2 = a^2 + b^2 (Pythagoras).
  • Obtuse CC: cos⁡C<0\cos C \lt 0, so c2>a2+b2c^2 \gt a^2 + b^2.

The bigger the angle, the longer the opposite side.

9. (Challenge) A parallelogram has sides of 66 cm and 1010 cm with an angle of 50∘50^\circ between them. Find the lengths of both diagonals.

Solution

The parallelogram’s angles are 50∘50^\circ and 130∘130^\circ. Each diagonal is the third side of a triangle with sides 66 and 1010.

Short diagonal (50∘50^\circ): d2=36+100−120cos⁡50∘≈58.87d^2 = 36 + 100 - 120\cos 50^\circ \approx 58.87, so d≈7.67d \approx 7.67 cm.

Long diagonal (130∘130^\circ): d2=36+100−120cos⁡130∘≈213.13d^2 = 36 + 100 - 120\cos 130^\circ \approx 213.13, so d≈14.60d \approx 14.60 cm.