The Cosine Rule

Pythagoras, with a correction for the angle.

Pythagoras, and what happens without a right angle

In a right triangle with legs a and b and hypotenuse c, Pythagoras gives c² = a² + b². The two shorter sides meet at the right angle, and c is the side facing it.

Keep the two sides a and b the same length and change the angle C between them. Close the angle below 90° and the side c facing it gets shorter, so c² is less than a² + b². Open it past 90° and c gets longer, so c² is more than a² + b². The cosine rule says exactly how much less or more.

θ = 60°hide the unit tiles

at 60° the term −2ab cos θ is −12, so a² + b² and c² are not equal

Find the angle where a² + b² = c²

Two sides of 3 and 4, with the angle between them as the handle. At 60° the square on the third side is 13, less than 9 + 16 = 25; at 90° it is exactly 25; past 90° it is more. The printed rule shows the term 2ab cos θ that makes the difference.

The height, and where its foot lands

Take a triangle with sides a and b and the angle C between them, and drop the height from the corner A onto side a. It splits the triangle into two right triangles.

The right triangle containing the angle C has hypotenuse b. The height is opposite C, so it is b sin C. The piece of side a between C and the foot of the height is adjacent to C, so it is b cos C.

The rest of side a, from the foot to the corner B, is what is left over: a − b cos C.

abcCb sin C

The height from A, in the right triangle with hypotenuse b, is the side opposite C: b sin C.

abcCa − b cos Cb cos C

The foot of the height cuts side a into b cos C, next to C, and a − b cos C, next to B.

Pythagoras on the triangle holding c

The other right triangle, on the side of B, has hypotenuse c and legs b sin C and a − b cos C. Pythagoras gives c² = (b sin C)² + (a − b cos C)².

Multiply out the brackets. (b sin C)² is b² sin²C, and (a − b cos C)² is a² − 2ab cos C + b² cos²C. So c² = b² sin²C + b² cos²C + a² − 2ab cos C.

Now look at the first right triangle again. Its legs are b sin C and b cos C and its hypotenuse is b, so by Pythagoras b² sin²C + b² cos²C = b². Replace those two terms with b²: c² = a² + b² − 2ab cos C. That is the cosine rule.

Pythagoras is the special case

When C = 90°, cos C = cos 90° = 0, so the term 2ab cos C is 0 and the rule becomes c² = a² + b². Pythagoras is the cosine rule for a right angle.

For any other angle, 2ab cos C is the correction. When C is acute, cos C is positive, so the correction is taken off and c² is less than a² + b². When C is obtuse, cos C is negative, so taking off a negative number adds, and c² is more than a² + b².

Exact values at 60° and 120°

Two sides of 3 and 5 have an angle of 60° between them. Then c² = 3² + 5² − 2 × 3 × 5 × cos 60° = 9 + 25 − 30 × ½ = 34 − 15 = 19, so c = √19, which is 4.36 to 2 decimal places.

Open the same angle to 120°. Now cos 120° = −½, so c² = 34 − 30 × (−½) = 34 + 15 = 49, and c = 7. The third side is longer, as the obtuse angle requires.

A worked value

Sides of 7 cm and 5 cm meet at 52°. Then c² = 7² + 5² − 2 × 7 × 5 × cos 52° = 49 + 25 − 70 × cos 52°. With cos 52° = 0.6157, to 4 decimal places, 70 × 0.6157 = 43.10, so c² = 74 − 43.10 = 30.90 and c = √30.90 = 5.56 cm, to 2 decimal places.

Check through the two right triangles. The height is 5 sin 52° = 3.940 cm, the piece next to C is 5 cos 52° = 3.078 cm, and the rest of side a is 7 − 3.078 = 3.922 cm. Pythagoras gives c² = 3.940² + 3.922² = 15.52 + 15.38 = 30.90, the same value.

Three versions of one rule

The rule can be written for any side: c² = a² + b² − 2ab cos C, b² = a² + c² − 2ac cos B, and a² comes the same way from b, c and the angle A between them. In each one, the side on the left faces the angle in the cosine, and the other two sides are the ones that meet at that angle.

Use it to find a side when two sides and the angle between them are known. That is the case where the sine rule cannot start, because no side is known together with the angle facing it.

When the angle C is obtuse

If C is obtuse, the height from A lands on side a extended beyond C, outside the triangle. The distance from C to the foot is b cos (180° − C), and since cos C is negative, that distance is −b cos C.

The leg of the right triangle holding c is then a + (−b cos C), which is a − b cos C once more. The rest of the argument is unchanged, so the cosine rule holds for an obtuse angle as well.

The usual mistakes

Using Pythagoras when the angle is not 90°. Without the term 2ab cos C, the answer is right only at a right angle.

Working out (a² + b² − 2ab) × cos C. The product 2ab cos C is a single term, taken off a² + b². Multiply 2, a, b and cos C together first.

Pairing the wrong angle with the side. The angle in the cosine is the one between the two known sides, facing the side being found.

Forgetting the square root. The rule gives c², so the side itself is √(c²).

Worked example: A Surveyor Measuring Across a Lake from a Point on the Shore

Question A surveyor cannot measure straight across a lake from a jetty J to a boathouse H, so she stands at a point P on the shore where she can see both. She measures PJ = 350 m, PH = 420 m and the angle JPH = 72°. Take cos 72° = 0.309, sin 72° = 0.951 and sin−1(0.8757) = 61.1°. (a) How far is it across the lake from the jetty to the boathouse, to 1 decimal place? (b) What is the angle PJH at the jetty, to 1 decimal place?

  1. 1.The sides PJ and PH and the angle between them are known, so the cosine rule gives the side opposite that angle: JH2 = PJ2 + PH2 − 2 × PJ × PH × cos 72°.

    lake72 degPJH350 m420 mJH2= 3502+ 4202− 2 × 350 × 420 × cos 72
    lake72 degPJH350 m420 mJH2= 3502+ 4202− 2 × 350 × 420 × cos 72
    Two sides and the angle between them are known, so the cosine rule gives the third side.
  2. 2.JH2 = 122500 + 176400 − 2 × 350 × 420 × 0.309 = 298900 − 90846 = 208054.

    lake72 degPJH350 m420 mJH2= 3502+ 4202− 2 × 350 × 420 × cos 72JH2= 298900 − 90846 = 208054
    lake72 degPJH350 m420 mJH2= 3502+ 4202− 2 × 350 × 420 × cos 72JH2= 298900 − 90846 = 208054
    JH2 = 122500 + 176400 − 2 × 350 × 420 × 0.309 = 208054.
  3. 3.(a) JH = √208054 = 456.1 m, the distance across the lake.

    lake72 degPJH350 m420 m456.1 mJH2= 3502+ 4202− 2 × 350 × 420 × cos 72JH2= 298900 − 90846 = 208054JH =√208054= 456.1 m
    lake72 degPJH350 m420 m456.1 mJH2= 3502+ 4202− 2 × 350 × 420 × cos 72JH2= 298900 − 90846 = 208054JH =√208054= 456.1 m
    (a) JH = √208054 = 456.1 m.
  4. 4.For the angle at J, PH = 420 m is the side opposite it. The sine rule gives sin J420 = sin 72°456.1, so sin J = 420 × 0.951456.1 = 399.42456.1 = 0.8757.

    lake72 degPJH350 m420 m456.1 mJH2= 3502+ 4202− 2 × 350 × 420 × cos 72JH2= 298900 − 90846 = 208054JH =√208054= 456.1 msin J = 420 × 0.951/456.1 = 0.8757
    lake72 degPJH350 m420 m456.1 mJH2= 3502+ 4202− 2 × 350 × 420 × cos 72JH2= 298900 − 90846 = 208054JH =√208054= 456.1 msin J = 420 × 0.951/456.1 = 0.8757
    The sine rule: sin J = 420 × 0.951456.1 = 0.8757.
  5. 5.(b) J = sin−1(0.8757) = 61.1°. The other angle with the same sine, 180 − 61.1 = 118.9°, is rejected: PH is shorter than JH, so the angle at J must be smaller than the 72° angle at P. Check: the third angle is 180 − 72 − 61.1 = 46.9°, the smallest, opposite the shortest side PJ.

    lake72 deg61.1 degPJH350 m420 m456.1 mJH2= 3502+ 4202− 2 × 350 × 420 × cos 72JH2= 298900 − 90846 = 208054JH =√208054= 456.1 msin J = 420 × 0.951/456.1 = 0.8757J = 61.1 deg, not 118.9 deg
    lake72 deg61.1 degPJH350 m420 m456.1 mJH2= 3502+ 4202− 2 × 350 × 420 × cos 72JH2= 298900 − 90846 = 208054JH =√208054= 456.1 msin J = 420 × 0.951/456.1 = 0.8757J = 61.1 deg, not 118.9 deg
    (b) J = 61.1°; 118.9° is rejected, because PH is shorter than JH.

Answer: (a) 456.1 m; (b) 61.1°

Common mistakes

  • Writing JH2 = 3502 + 4202. That is Pythagoras, which holds only when the angle at P is 90°; here it is 72°, so the term 2 × 350 × 420 × cos 72° must be taken off.
  • Working out 3502 + 4202 − 2 × 350 × 420 first and then multiplying by cos 72°. The product 2 × 350 × 420 × cos 72° is a single term, taken off the sum of the two squares.

More triangle trigonometry problems, worked step by step →

Practice The Cosine Rule in the app