The Cosine Rule
Suppose you know your distances to two landmarks and the angle between them as you swing from one to
the other — how far apart are the landmarks themselves? A ship altering course, a drone crossing a
field, a builder sizing a roof truss: whenever you have two sides and the angle wedged between them,
the cosine rule hands you the third distance.
The sine rule is a wonderful
tool — but it has one demand: you must already know a side paired with the angle opposite
it. Plenty of real triangles refuse to hand you such a pair. Picture a triangle where you know two
sides and only the angle wedged between them. No side lines up with a known opposite
angle, so the sine rule simply cannot start.
This is where the cosine rule steps in. It is a
generalisation of Pythagoras that works in any triangle, right-angled or
not:
a^2 = b^2 + c^2 - 2bc\cos A
Use it in two situations:
-
you know two sides and the included angle
(b, c and A) and
want the third side a;
-
you know all three sides and want an angle — rearrange to
\cos A = \dfrac{b^2 + c^2 - a^2}{2bc}
then take the inverse cosine.
Notice that when A = 90^\circ we have
\cos A = 0, so the last term vanishes and the rule collapses to
a^2 = b^2 + c^2 — Pythagoras' theorem. The cosine rule is Pythagoras
with a correction term stitched on for triangles that aren't right-angled.
In any triangle, with each side opposite the angle of the same letter:
-
to find a side from two sides and the included angle, use
a^2 = b^2 + c^2 - 2bc\cos A;
-
to find an angle from all three sides, rearrange to
\cos A = \dfrac{b^2 + c^2 - a^2}{2bc};
-
when the included angle is 90^\circ,
\cos A = 0 and it reduces to Pythagoras'
theorem a^2 = b^2 + c^2.
The included angle
Here is a scalene triangle. Step through it to see how sides b and
c meet at vertex A — the angle
A between them is the one the cosine rule uses to reach the
opposite side a.
Worked example 1 — find the third side
Two roads leave a village at an angle of 50^\circ to each other. One
friend walks 7\text{ km} along the first road; another walks
9\text{ km} along the second. How far apart are they now?
You know two sides — b = 7 and c = 9 — and
the angle A = 50^\circ squeezed between them. That's a
two-sides-and-the-included-angle setup, so drop it straight into the rule:
a^2 = b^2 + c^2 - 2bc\cos A
= 7^2 + 9^2 - 2(7)(9)\cos 50^\circ
a^2 = 49 + 81 - 126 \times 0.6428 = 130 - 81.0 = 49.0
a = \sqrt{49.0} \approx 7.0\text{ km}
Do the whole b^2 + c^2 - 2bc\cos A as one calculation before taking the
square root — the -2bc\cos A is a single term, not something to square
on its own.
Worked example 2 — find an angle from three sides
A triangular garden bed has sides a = 8\text{ m},
b = 5\text{ m} and c = 7\text{ m}. Find the
angle A opposite the longest side.
Three sides, no angles — so use the rearranged form. Put the side you want the opposite angle for
(a) with a minus sign:
\cos A = \frac{b^2 + c^2 - a^2}{2bc}
= \frac{5^2 + 7^2 - 8^2}{2(5)(7)}
\cos A = \frac{25 + 49 - 64}{70} = \frac{10}{70} \approx 0.1429
A = \cos^{-1}(0.1429) \approx 81.8^\circ
A neat feature: unlike the sine rule, the cosine has no ambiguous case for angles.
Because \cos is negative for obtuse angles and positive for acute ones,
\cos^{-1} pins down exactly one angle between
0^\circ and 180^\circ.
Worked example 3 — the right-angle special case
Take sides b = 6 and c = 8 with an included
angle of exactly 90^\circ. The cosine rule gives
a^2 = 6^2 + 8^2 - 2(6)(8)\cos 90^\circ
= 36 + 64 - 96 \times 0 = 100,
a = \sqrt{100} = 10.
The correction term switched itself off, and we're left with
a^2 = b^2 + c^2 — the familiar 6-8-10 Pythagorean triangle. The cosine
rule didn't replace Pythagoras; it contains it.
Three slip-ups catch people out with the cosine rule:
-
The angle must be the included one. To find a side you need the two sides
and the angle between them. If the angle you're given isn't wedged between the two known
sides, the formula won't work — you'd want the
sine rule instead. To find
an angle you need all three sides.
-
Mind the order of operations. Compute
a^2 = b^2 + c^2 - 2bc\cos C as one expression. The
-2bc\cos C is a single term; do not square
(b+c), and do not forget to multiply by
\cos C. And remember the final answer for a side needs a
square root at the end.
-
Keep the calculator in degrees. If it's set to radians,
\cos 50 gives a wildly wrong number. A quick check:
\cos 60^\circ should read exactly
0.5.
Look again at a^2 = b^2 + c^2 - 2bc\cos A. The first part,
b^2 + c^2, is pure Pythagoras. The tail
-2bc\cos A is a correction term that accounts for the
angle not being 90^\circ. Open the angle wider than a right angle and
\cos A turns negative, so we add to
b^2 + c^2 and the far side stretches longer. Close it below
90^\circ and \cos A is positive, so we
subtract and the side shrinks. Set it to exactly 90^\circ and
\cos A = 0 — the correction disappears and Pythagoras stands alone.
That one elegant generalisation, teamed up with the sine rule, lets you solve
absolutely any triangle from a handful of measurements. Together they are the mathematical
backbone of navigation, surveying, and 3D computer graphics — every time a game
engine lights a polygon or a ship plots a course, cosine-rule triangles are doing quiet work
underneath.