The cosine rule (law of cosines)
The cosine rule, called the law of cosines in the US, links the three sides of any triangle to one of its angles: a² = b² + c² − 2bc cos A. Use it to find the third side when you know two sides and the angle between them, or to find any angle when you know all three sides. Unlike SOH CAH TOA, it works in triangles with no right angle.
What is the cosine rule?
The cosine rule is Pythagoras' theorem for every triangle. Pythagoras only works when there is a right angle. The cosine rule adds a correction term, −2bc cos A, that allows for the angle not being 90°. When the angle is 90°, cos 90° = 0, the correction disappears and you are left with a² = b² + c².
The labels matter. Each side takes the small letter of the angle opposite it, so side a is opposite angle A, side b is opposite angle B and side c is opposite angle C. In the formula, A is the angle between sides b and c.
The cosine rule formula
There is one rule, but you can write it three ways, depending on which side you want. Each version starts with the side opposite the angle you use.
You only need to remember the first. The pattern is always the same: the side you want, squared, equals the other two sides squared, minus twice those two sides times the cosine of the angle between them.
Cosine rule for angles (the rearranged cosine rule)
To find an angle, rearrange the formula to make cos A the subject. Start from a² = b² + c² − 2bc cos A, add 2bc cos A to both sides, subtract a², then divide by 2bc:
Then use inverse cosine (cos⁻¹ on your calculator) to get the angle. This is why some people call it the inverse cosine rule. Notice that the side opposite the angle you want is the one with the minus sign in front of it.
When to use the cosine rule (and when to use the sine rule)
Look at what the question gives you. If the triangle has a right angle, SOH CAH TOA or Pythagoras is quicker. If not, choose between the sine rule and the cosine rule like this:
| You know | You want | Use |
|---|---|---|
| Two sides and the angle between them (SAS) | The third side | Cosine rule |
| All three sides (SSS) | Any angle | Cosine rule, rearranged |
| Two angles and any side | Another side | Sine rule |
| Two sides and an angle that is not between them | Another angle | Sine rule |
A quick test: if the question gives you a side and the angle opposite it as a pair, use the sine rule. If it does not, use the cosine rule. Many questions need both, one after the other, which is why you will see them taught together as the sine and cosine rules. Our Trigonometry Calculator solves any triangle and shows which rule it uses at each step.
Try one now. Find the missing side or angle, then press Mark to check your answer in the course.
Use the cosine rule practice.
Press Mark to have your answer marked in the Trigonometry course.
Using the cosine rule to find a side
Label the triangle so the side you want is a and the angle you know is A, opposite it. Write the formula, put the numbers in, work out the right-hand side and square root the result.
Example 1: two sides and the angle between them
In triangle ABC, AB = 10 cm, AC = 7 cm and angle BAC = 48°. Find BC.
BC is opposite the 48° angle, so call it a. Then b = 7, c = 10 and A = 48°.
BC = 7.44 cm to 3 significant figures. Type the whole right-hand side into your calculator in one go, and square root it at the end, rather than rounding in the middle.
Example 2: an obtuse angle
Find the third side of a triangle whose two sides of 6.2 m and 9.5 m meet at an angle of 115°.
For an obtuse angle, cos is negative: cos 115° = −0.4226. Subtracting a negative number adds it, so the third side comes out longer than it would for an acute angle.
The third side is 13.4 m to 3 significant figures. As a check, it is longer than both other sides, which it should be: the longest side is always opposite the largest angle.
Example 3: a bearings problem
A ship sails 12 km on a bearing of 040°, then turns and sails 18 km on a bearing of 110°. How far is it from where it started?
Sketch it first. At the turning point, the ship's path back to the start is on a bearing of 040° + 180° = 220°. The angle between that line and the new course of 110° is 220° − 110° = 110°. That is the angle between the two known sides, so use the cosine rule for the distance d back to the start.
The ship is 24.8 km from its starting point. Bearings questions almost always come down to finding one angle inside the triangle, so draw the north lines at each point and mark the angles before you start.
Using the cosine rule to find an angle
With all three sides, use the rearranged version. Put the side opposite the angle you want after the minus sign.
Example 4: three sides, then the area
A triangle has sides 5 cm, 7 cm and 9 cm. Find its smallest angle, then its area.
The smallest angle is opposite the shortest side, 5 cm. So a = 5, b = 7 and c = 9.
The smallest angle is 33.6°. Now you have two sides and the angle between them, so the area formula ½bc sin A works:
The area is 17.4 cm². This is the usual way to find the area of a triangle from three sides at GCSE: the cosine rule gives you an angle, and the area formula does the rest.
Example 5: finding an obtuse angle
A triangle has sides 4, 6 and 9. Find its largest angle.
The longest side is 9, so the largest angle is the one opposite it.
The largest angle is 127.2°. A negative cosine always means an obtuse angle, and the cosine rule handles it with no extra work. This is one place where the cosine rule beats the sine rule, which can give you an acute angle when the real one is obtuse.
Example 6: forming a quadratic
A triangle has sides x cm, (x + 3) cm and 7 cm. The angle between the sides x and x + 3 is 60°. Find x.
The 7 cm side is opposite the 60° angle. Use cos 60° = ½, then expand and simplify.
x = −8 is impossible for a length, so x = 5, and the sides are 5 cm, 8 cm and 7 cm. Check: 25 + 64 − 2 × 5 × 8 × ½ = 49, which is 7².
How the angle changes the third side
Fix two sides at 5 and 8 and open the angle between them. The graph shows the third side, worked out with the cosine rule, for every angle from 0° to 180°.
Here x is the angle in degrees and y is the length of the third side. At 0° the triangle is squashed flat and the third side is 8 − 5 = 3. At 90° it is √89 = 9.43, exactly what Pythagoras gives. At 180° it is flat again and the third side is 5 + 8 = 13. Every triangle with these two sides lies somewhere on this curve.
Proof of the cosine rule
You do not need this for GCSE, but A-level questions sometimes ask for it, and it shows where the −2bc cos A comes from.
Draw triangle ABC and drop a perpendicular from C to the line AB, meeting it at D. This splits the triangle into two right-angled triangles. In triangle ADC, the hypotenuse is b, so AD = b cos A and CD = b sin A. That leaves DB = c − b cos A.
Now use Pythagoras in triangle BDC, whose hypotenuse is a:
Since sin²A + cos²A = 1, the two b² terms combine into b²:
The same argument works for an obtuse angle, with D falling outside the triangle.
Common mistakes
- Pairing the wrong side and angle. The side on the left must be opposite the angle in the cosine. Mark the angle, then find the side across from it.
- Working out b² + c² − 2bc first, then multiplying by cos A. The cosine multiplies only the 2bc. With b = 7, c = 10 and A = 48°, (149 − 140) × cos 48° gives 6.02 instead of the correct 55.32.
- Forgetting to square root. The formula gives a², not a. If your side looks far too big, check you took the square root.
- Calculator in radians. Make sure it shows D or DEG. In radian mode, cos 48 gives −0.640 instead of 0.669.
- Using the cosine rule when the sine rule is simpler. If you have a side and its opposite angle, the sine rule is faster.
- Rounding too early. Keep the full value of a² on your calculator, and round only the final answer.
Is the cosine rule on the formula sheet?
It depends on the exam. This table was checked against the exam boards' own sheets and booklets in November 2026.
| Exam | Is the cosine rule given? | Form given |
|---|---|---|
| GCSE Maths Higher (AQA, Edexcel, OCR) | Yes, on the formulae sheet | a² = b² + c² − 2bc cos A only |
| GCSE Maths Foundation | No: it is Higher tier content | Not given |
| National 5 Maths (SQA) | Yes, on the formulae list | Both a² = b² + c² − 2bc cos A and cos A = (b² + c² − a²)/2bc |
| A-level Maths (AQA, Edexcel) | No: the booklet assumes you know it | Not given |
In England, Ofqual has confirmed that GCSE Maths formulae sheets will continue for the lifetime of the current GCSEs, and AQA and OCR have published theirs for 2027. The GCSE sheet only prints the version for a side, so you must be able to rearrange it for an angle yourself. In A-level Maths, the sine and cosine rules are assumed knowledge from GCSE and are not in the AQA or Edexcel formulae booklets, so learn them.
Cosine rule questions with answers
1. In triangle ABC, b = 9 cm, c = 12 cm and angle A = 40°. Find side a.
a² = 225 − 165.47 = 59.53
a = 7.72 cm to 3 significant figures
2. A triangle has sides 6, 8 and 11. Find its largest angle.
cos A = (6² + 8² − 11²) ÷ (2 × 6 × 8) = −21 ÷ 96 = −0.21875
A = 102.6°, an obtuse angle because cos A is negative
3. A parallelogram has sides 8 cm and 5 cm, and one of its angles is 70°. Find the length of its longer diagonal.
d² = 8² + 5² − 2 × 8 × 5 × cos 110° = 89 + 27.36 = 116.36
d = 10.8 cm to 3 significant figures
4. Two boats leave a harbour together. One sails 15 km on a bearing of 030°, the other 20 km on a bearing of 120°. How far apart are they?
d² = 15² + 20² − 2 × 15 × 20 × cos 90° = 225 + 400 − 0 = 625
d = 25 km. With a 90° angle the cosine rule is just Pythagoras.
5. Show that the largest angle of a triangle with sides 3, 5 and 7 is exactly 120°.
cos A = (3² + 5² − 7²) ÷ (2 × 3 × 5) = −15 ÷ 30 = −½
cos 120° = −½, so A = 120° exactly
Stuck on one? Put the sides and angles into the Trigonometry Calculator to check your answer and see each step. To learn the topic from the start, the Trigonometry course builds from SOH CAH TOA to the sine rule, the cosine rule and the area of any triangle.
Practise the cosine rule in a short timed paper
The cosine rule is a regular on GCSE Maths Higher papers, often inside a bearings or area question. GCSE Maths Higher gives you a short timed paper every day, with 8 questions worth 25 to 35 marks across the whole course. In Scotland the same practice opens as National 5 Maths.
GCSE Maths Higher
Start today's paperPaper resets in
Common questions
What is the cosine rule used for?
What is the difference between the sine rule and the cosine rule?
Is the cosine rule the same as the law of cosines?
How do you rearrange the cosine rule to find an angle?
Can the cosine rule be used on a right-angled triangle?
Is the cosine rule GCSE Higher only?
Revision cards
Say the answer first, then flip the card to check it.
Where to go next
- Solve it
Trigonometry Calculator
Interactive triangle solver with step-by-step
Open the tool - Learn it
Trigonometry
Understand the true math behind everyday geometry with trig functions and identities
Start the course - Test it
GCSE Maths Higher
A new exam-style paper every day, with instant marking and a mark scheme
Start today's paper