MathemagiciansLibraryExplorationsDeep Dives
← Mathematics · Upper Secondary
MathematicsUpper Secondary

The cosine rule — SAS and SSS triangles

U3 — Geometry Advanced › U3.3 — Trigonometry in Non-Right-Angled TrianglesLecture 2 of 4~2700 words

Two sides, the angle between them, and no rule that works

Here is a triangle the sine rule cannot solve. Side is 7 cm, side is 10 cm, and the angle between them, A, is 55°. How long is the third side, ?

Try the sine rule. It needs one complete pair: a side and the angle facing it. Side faces the 55° angle, but we do not know . Side faces angle B, and side faces angle C, but we know neither angle. Every fraction in the sine rule has an unknown in it. The lecture on the sine rule ended with exactly this warning: two sides with the angle between them need a different rule.

Now try Pythagoras: cm. But Pythagoras needs a 90° angle between and . Our angle is 55°, so the two sides close in more tightly, and must be shorter. How much shorter?

Pythagoras is not wrong here. It is incomplete. It needs a correction that depends on the angle and is zero at exactly 90°. Watch the correction happen before we find it.

Explore — open the angle and watch the third side

Sides b = 7 cm and c = 10 cm are joined at A like a hinge. Change the angle A. Compare the third side, a, with the Pythagoras length, √149 ≈ 12.21 cm.

This table shows the third side of a triangle with cm and cm, for different angles A between them. Pythagoras alone would give every time.

Angle ACorrection to 149 (cm)
30°≈ −121.24≈ 27.76≈ 5.27
55°≈ −80.30≈ 68.70≈ 8.29
90°0149≈ 12.21
120°+70219≈ 14.80
150°≈ +121.24≈ 270.24≈ 16.44

Below 90° the correction takes something away, so is shorter than 12.21 cm. At 90° the correction is zero. Above 90° the correction adds, so is longer.

You should have seen three things. When A is less than 90°, side is shorter than the Pythagoras length. At exactly 90°, the two lengths match. When A is more than 90°, side is longer. The correction changes sign at 90°, and so does . The rest of this lecture shows why.

Where the correction comes from: Pythagoras, twice

We use the same trick as the sine rule: drop a height. From C, draw the height down to H on AB. Now there are two right-angled triangles, ACH on the left and BCH on the right, and Pythagoras works in each one.

Call the distance from A to H . Then the rest of the base, from H to B, is .

ABCHAbahxc − x
The height h from C splits the triangle into two right-angled triangles. The base c is split into x, from A to H, and c − x, from H to B.

Now follow the argument one move at a time. Each move has a reason.

Tidy the order, and here is the result:

The first part, , is Pythagoras. The last part, , is the correction we were looking for. Like the height in the sine rule, and were only a bridge: neither survives to the end.

Now put A = 90°. Then , the correction disappears, and you are left with . Pythagoras is not a different rule. It is the cosine rule at 90°. That is it. That is the whole idea: Pythagoras plus a correction for the angle.

What if angle A is obtuse?

The argument assumed that H lands between A and B. When A is obtuse, it does not. The height from C now lands outside the triangle, on the base line extended beyond A.

ABCHA180° − Abachb cos(180° − A)
When angle A is obtuse, the height from C lands at H, outside the triangle. The angle at A inside the right-angled triangle ACH is 180° − A, so AH = b cos(180° − A).

This is the hard part of the lecture. Spend time here. The right-angled triangle ACH still exists, but its angle at A is now , because angles on a straight line add to 180°. So the distance from H to A is . And H is on the far side of A, so the base of the triangle BCH is longer than : it is .

Run the same moves. Pythagoras in BCH, then in ACH, gives:

The sign in the middle is now plus. This matches the explorer: for an obtuse angle, the third side is longer than Pythagoras gives. So one formula covers both cases only if means the negative number when A is obtuse.

That is exactly how the cosine of an obtuse angle is defined, and it is what your calculator does. Try it: , and . The sine rule lecture gave you one fact about obtuse angles. Here is its partner.

The partner fact

For any angle between 0° and 180°, . So an acute angle has a positive cosine, , and an obtuse angle has a negative cosine. The unit circle at Pre-University shows why this is the natural definition.

If angle B is obtuse instead, H lands beyond B and is negative. But Move 1 squares it, and , so nothing changes. The cosine rule holds in every triangle.

The cosine rule

In any triangle ABC, with side opposite angle A, side opposite B and side opposite C:

Rearranged to find an angle:

The rule works from any corner. In words: the square of one side equals the sum of the squares of the other two, minus twice their product times the cosine of the angle between them. The side on the left and the angle in the cosine are a pair: the angle faces that side. So from corner C, the rule reads .

The angle form is not a second formula to learn. Add to both sides, subtract , and divide by : it is the same rule, solved for .

Stop and think

A student finds an angle with the cosine rule and gets . She decides she must have made a mistake, because "cosines are positive". Is she right?

Show the answer

No. A negative cosine is not a mistake. It tells you that A is obtuse. Here , and the calculator gives this directly. As an angle grows from 0° to 180°, its cosine falls steadily from 1 to −1, so each cosine belongs to exactly one angle in a triangle. There is never a second angle to test.

When to use which rule

Every triangle problem starts with one question: what do you know?

You knowBooks call itUse
Two sides and the angle between themSASCosine rule, to find the third side
All three sidesSSSCosine rule, angle form
Two angles and any sideAAS, ASASine rule
Two sides and an angle that is not between themSSASine rule, then test the second angle

The test is the complete pair. If you know a side and the angle facing it, use the sine rule. If not, the cosine rule is the way in.

Worked examples

Worked Example 1 — The triangle from the start

In triangle ABC, cm, cm and A = 55°. Find .

Think first. The 55° angle is between the two known sides, and it faces the unknown side . This is SAS.

Here , and .

Check. The angle is acute, so must be shorter than the Pythagoras length, cm. It is. ✓ Also, a side must lie between the difference and the sum of the other two, 3 and 17. ✓

Worked Example 2 — Finishing a triangle: the cosine rule, then the sine rule

The sine rule lecture left this triangle unsolved: cm, cm and C = 50°. Find , then the other two angles.

Think first. Angle C is between and , and it faces . So use the rule from corner C.

Here , and .

So cm. Keep the full calculator value for the next step.

Now the pair (, C) is complete, so the sine rule is ready. Which angle should you find first? Find the smaller of the two, the one facing the shorter side. Here that is A, because is shorter than . An angle facing a side that is not the longest can never be obtuse, so the calculator's single answer is safe.

So A ≈ 50.0°, and B ≈ 180° − 50° − 50.0° = 80.0°.

Check. The cosine rule made almost exactly equal to . So the triangle is very nearly isosceles, and A should be very nearly C = 50°. It is. ✓ The largest angle, 80.0°, faces the longest side, . ✓

Worked Example 3 — Three sides, two angles

In triangle PQR, , and . Find angle P, then angle Q.

Think first. All three sides are known: SSS. In the angle form, the side facing the angle you want is the one with the minus sign.

So , and P = .

For Q, side takes the minus sign:

So .

The cosine is negative, so Q is obtuse: Q ≈ 92.9°.

Check. There is a quick test without any cosines. Compare the square of the longest side with the other two squares added: , and . Since 64 is a little more than 61, the angle facing the longest side is a little more than 90°. ✓ Then R ≈ 180° − 38.6° − 92.9° = 48.5°, and the angles are in the same order as their sides: 5 < 6 < 8. ✓

Keep that quick test. With longest side : if , the angle facing is 90°. If is less, it is acute. If more, it is obtuse. It is the correction, read for its sign.

Worked Example 4 — Which angle is in the triangle?

A ship sails 12 km due east from port A to point B. At B it turns left through 60° and sails 9 km to C. How far is the ship from the port?

Think first. The 60° is the turn: the angle between the old direction and the new one. It sits outside the triangle, between BC and the line AB continued beyond B. The angle inside the triangle at B is on the other side of BC, so it is .

ABC12 km9 km?60° turn120°
The turn of 60° is measured from the old course, continued beyond B. The angle inside the triangle at B is 180° − 60° = 120°.

Here , and .

Since , the last term is .

So AC = km.

Check. The ship turned only a little, so its path is nearly straight. AC should be a little less than km. It is. ✓ Using 60° would give km: a ship that had turned sharply back towards the port.

Three traps

Trap 1 — Subtracting before multiplying

In , the cosine multiplies 140 only. Writing is wrong. Find the product first, then subtract. On a calculator, type the whole line in one go, exactly as written.

Trap 2 — The wrong angle or the wrong side

The angle in the cosine must be the one between the two sides you square on the right, and it must face the side on the left. In the angle form, the side facing the angle you want is the one subtracted. Put a finger on the angle, go straight across the triangle, and that side gets the minus sign.

Trap 3 — Losing the sign of an obtuse cosine

When the angle is obtuse, is negative, so is positive. A student who writes instead of has subtracted a negative as if it were positive. Keep the brackets: .

Trap 1 is the most common mistake in this topic. Find it below.

Spot the error — a side that is too short

A student finds side a when b = 6 cm, c = 8 cm and A = 40°. One line contains the mistake. Tap the line where it first goes wrong.

This box shows a student's working for cm, cm and A = 40°, with the line where it goes wrong.

  • a² = b² + c² − 2bc cos A. Correct: the angle A is between b and c.
  • a² = 36 + 64 − 2 × 6 × 8 × cos 40°. Correct substitution.
  • a² = 100 − 96 cos 40°. Correct: 36 + 64 = 100 and 2 × 6 × 8 = 96.
  • a² = 4 cos 40°. This is the error. The student subtracted 96 from 100 before multiplying by cos 40°. The cosine belongs to 96 only.
  • a² ≈ 3.064 and a ≈ 1.75 cm. These follow from the wrong line.

The correct working is , so cm. A check would have caught the error: a side must be longer than the difference of the other two, cm, and 1.75 cm is not.

Try it yourself

Work each one on paper first. Open a hint only when you are stuck.

  1. In triangle XYZ, cm, cm and Z = 112°. Find , to 3 significant figures.

    Hint 1

    Angle Z is between and , and it faces . Write the rule from corner Z.

    Hint 2

    . The cosine is negative.

    Full answer

    . Since , the last term is about . So , and cm. Check: Z is obtuse, so must be longer than the Pythagoras length cm. ✓ It is also less than cm. ✓

  2. A triangle has sides 4 cm, 6 cm and 9 cm. Is it acute, right-angled or obtuse? Find its largest angle to 1 decimal place.

    Hint 1

    Compare with first. That answers the first question.

    Hint 2

    The largest angle faces the 9 cm side, so 9² is the one subtracted: .

    Full answer

    is more than , so the triangle is obtuse. , so . Check: the cosine is negative, which matches an obtuse angle. ✓ The other two angles, found the same way, are about 20.7° and 32.1°, and . ✓

  3. A parallelogram has sides 6 cm and 10 cm, and one angle of 70°. Find the lengths of both diagonals.

    Hint 1

    Each diagonal cuts the parallelogram into two triangles with sides 6 and 10. Neighbouring angles of a parallelogram add to 180°, so the angles are 70° and 110°.

    Hint 2

    The shorter diagonal faces the 70° angle, and the longer one faces the 110° angle. Use the cosine rule for each.

    Full answer

    Shorter diagonal: , so cm. Longer diagonal: , so cm. Check: since , the two corrections cancel when you add the squares. So . Indeed . ✓

  4. A stretch. The sine rule lecture met this SSA triangle: A = 40°, cm and cm. Write the cosine rule for side , with as the unknown. Solve the equation, and explain what its two answers mean.

    Hint 1

    . This is a quadratic equation in .

    Hint 2

    Rearrange to , with . Use the quadratic formula.

    Full answer

    , so (using the full value of ). The quadratic formula gives , so cm or cm. Both are positive, so both are real triangles. These are the two triangles of the ambiguous case. With , the angle form gives C ≈ 81.0° and B ≈ 59.0°. With , it gives C ≈ 19.0° and B ≈ 121.0°, the same pairs the sine rule found. Check: the product of the roots of is 63, and . ✓ The ambiguous case is not a weakness of the sine rule. It is a fact about the triangle, and the cosine rule finds it too, as a quadratic with two positive roots.

An old rule with a long history

The cosine rule is far older than the cosine. Euclid's Elements, written about 300 BC, states it twice, in the language of areas: Book II, Proposition 12 for an obtuse angle and Proposition 13 for an acute one. Euclid proved both by dropping a height and using Pythagoras twice, as this lecture did. In 1427 the Persian mathematician Jamshīd al-Kāshī wrote the rule as a method for solving triangles, and in France it is still called the theorem of Al-Kashi. (Source: Wikipedia, "Law of cosines".)

The bigger idea

The cosine rule shows something true across mathematics: a special case often hides a general rule. Pythagoras is the cosine rule at 90°. The cosine rule is Pythagoras with the angle put back in.

The correction term, , will come back. In the lecture on vectors, two arrows joined at a point, at an angle, make exactly this triangle, and at Pre-University the term gets its own name. Astronomers also needed a cosine rule for triangles drawn on a sphere. Around the year 900, al-Battānī used one to find angular distances between stars. For a triangle that is tiny compared with the sphere, it becomes the flat rule you have just learned.

Key concepts in this lesson