The cosine rule (also called the law of cosines) is a formula that connects the three side lengths of a triangle with one of its angles.
It is especially useful for non-right-angled triangles, where Pythagoras cannot be applied directly.
The Cosine Rule Links Three Sides and One Angle
In a triangle $ABC$, we use the standard convention:
side $a$ is opposite angle $A$,
side $b$ is opposite angle $B$,
side $c$ is opposite angle $C$.
Definition
Cosine rule
A formula for any triangle that relates a side length to the other two side lengths and the cosine of the included angle. For triangle $ABC$: $a^{2}=b^{2}+c^{2}-2bc\cos A$ (and similarly for $b$ and $c$).
The cosine rule has three equivalent versions:
$$a^{2} = b^{2}+c^{2}-2bc\cos A $$
$$b^{2} = a^{2}+c^{2}-2ac\cos B$$
$$c^{2} = a^{2}+b^{2}-2ab\cos C$$
Choosing the Correct Version Is a Matching Problem
Pick the version where:
the single side squared on the left is the side you want (or the side opposite the angle you want), and
the cosine uses the angle between the two sides being multiplied.
Tip
A reliable quick-check: in $a^{2}=b^{2}+c^{2}-2bc\cos A$, the angle is $A$ and the multiplied sides are $b$ and $c$.
That means $A$ is the angle "between" sides $b$ and $c$, and $a$ is opposite $A$.
The Cosine Rule Is a Generalization of Pythagoras
If the triangle is right-angled at $A$, then $A=90^{\circ}$ and $\cos 90^{\circ}=0$.
Substitute into the cosine rule: $$a^{2}=b^{2}+c^{2}-2bc\cos 90^{\circ}=b^{2}+c^{2}$$
So Pythagoras' theorem is a special case of the cosine rule.
Note
This is one reason the cosine rule is so powerful: it works for every triangle, and it automatically becomes Pythagoras when the included angle is $90^{\circ}$.
Rearranging the Cosine Rule Lets You Find Angles
When the unknown is an angle, it is usually easiest to rearrange into a cosine form.
Starting from: $$a^{2}=b^{2}+c^{2}-2bc\cos A$$
Rearrange for $\cos A$: $$2bc\cos A=b^{2}+c^{2}-a^{2}$$ $$\cos A=\frac{b^{2}+c^{2}-a^{2}}{2bc}$$
Then you can find the angle with an inverse cosine: $$A=\arccos\left(\frac{b^{2}+c^{2}-a^{2}}{2bc}\right)$$
Common Mistake
Calculator mode matters.
If your triangle measurements are in degrees, your calculator must be in degree mode before using $\cos$ or $\arccos$.
When to Use Cosine Rule Versus Sine Rule
Both the sine rule and the cosine rule solve triangles, but they need different information.
Compute $a^{2}$ and then square root: $$a\approx 6.61\text{ cm} \;\; (3\text{ s.f.})$$
Tip
When finding a side, keep extra decimal places until the final step, then round to the requested accuracy (for example, $3$ significant figures or $1$ decimal place).
Example question
A triangle has side lengths $a=132$, $b=98$, $c=65$. Find angle $A$ (to the nearest degree).
Rearrange to isolate $\cos A$, then evaluate: $$\cos A\approx -0.28218$$
So: $$A=\arccos(-0.28218)\approx 106^{\circ}$$
Common Mistake
If your cosine value is negative, the angle is obtuse (greater than $90^{\circ}$).
Do not "force" an acute angle just because you expect one.
Spatial Applications: Bearings and the Angle Between Courses
Cosine rule is very useful in navigationproblems (bearings, routes, and distances), because these problems often create a triangle where you know two sides (distances travelled) and the included angle (difference between bearings).
Example
Two Boats Leaving a Harbour
One boat travels on a bearing of $060^{\circ}$ for $13\text{ km}$ and another on a bearing of $135^{\circ}$ for $8\text{ km}$.
Draw two rays from the harbour, one at $060^{\circ}$ and one at $135^{\circ}$.
The angle between their courses is the difference in bearings: $135^{\circ}-60^{\circ}=75^{\circ}$
Now you have an SAS triangle, so you can find the distance $d$ between boats using: $$d^{2}=13^{2}+8^{2}-2(13)(8)\cos 75^{\circ}$$
Hint
In bearing diagrams, angles are measured clockwise from North.
The triangle angle at the harbour is often the difference between two bearings, but only after you are sure both bearings are measured from the same reference direction.
Problem Solving with Three Sides: Largest and Smallest Angles
If you know all three sides, the cosine rule lets you find any angle. A powerful strategy is:
the largest angle is opposite the longest side,
the smallest angle is opposite the shortest side.
Example
Longest side is $7$, so the largest angle is opposite $7$.
Use the rearranged cosine rule for that angle.
If $a=7$, $b=6$, $c=4$: $$\cos A=\frac{b^{2}+c^{2}-a^{2}}{2bc}=\frac{6^{2}+4^{2}-7^{2}}{2(6)(4)}$$
Then $A=\arccos(\cdots)$.
Repeat with $a=4$ (opposite smallest angle) to find the smallest angle.
Exam technique
In "largest angle/smallest angle" questions, do not guess.
First identify the opposite side by size, then apply the cosine rule.
Examiners reward correct selection of the angle-opposite side relationship.
Common Mistake
Here is a list of common mistakes for you to avoid:
Mixing up which side is opposite which angle. Always label the triangle first.
Using the wrong included angle for the $-2bc\cos A$ part.
Rounding too early, which can shift an angle by $1^{\circ}$ or more.
Forgetting that $\arccos$ returns an angle in the correct range, but your calculator must be in the correct mode (degrees vs radians).
Active recall
In triangle $ABC$, which side is $b$?
When would you choose cosine rule instead of sine rule?
Rearrange $c^{2}=a^{2}+b^{2}-2ab\cos C$ to make $\cos C$ the subject.
If $\cos A=0$, what type of triangle angle is $A$?