Uni-Sine
MathematicsTrigonometry

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.

cabABC
Each side takes the small letter of the angle opposite it

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.

a^2 = b^2 + c^2 - 2bc\cos AFinding side a, using angle A
b^2 = a^2 + c^2 - 2ac\cos BFinding side b, using angle B
c^2 = a^2 + b^2 - 2ab\cos CFinding side c, using angle C

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:

\cos A = \frac{b^2 + c^2 - a^2}{2bc}The cosine rule rearranged for an angle

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 knowYou wantUse
Two sides and the angle between them (SAS)The third sideCosine rule
All three sides (SSS)Any angleCosine rule, rearranged
Two angles and any sideAnother sideSine rule
Two sides and an angle that is not between themAnother angleSine 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.

c = 10 cma = ?b = 7 cm48°ABC
Two sides and the angle between them: the cosine rule finds BC

BC is opposite the 48° angle, so call it a. Then b = 7, c = 10 and A = 48°.

a^2 = 7^2 + 10^2 - 2 \times 7 \times 10 \times \cos 48^\circ
a^2 = 149 - 140\cos 48^\circ = 149 - 93.678 = 55.322
a = \sqrt{55.322} = 7.44

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°.

a^2 = 6.2^2 + 9.5^2 - 2 \times 6.2 \times 9.5 \times \cos 115^\circ

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.

a^2 = 38.44 + 90.25 + 49.784 = 178.474
a = \sqrt{178.474} = 13.4

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.

d^2 = 12^2 + 18^2 - 2 \times 12 \times 18 \times \cos 110^\circ = 468 + 147.75 = 615.75
d = \sqrt{615.75} = 24.8

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.

\cos A = \frac{7^2 + 9^2 - 5^2}{2 \times 7 \times 9} = \frac{105}{126} = 0.8333
A = \cos^{-1}(0.8333) = 33.6^\circ

The smallest angle is 33.6°. Now you have two sides and the angle between them, so the area formula ½bc sin A works:

\text{Area} = \frac{1}{2} \times 7 \times 9 \times \sin 33.56^\circ = 17.4

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.

\cos A = \frac{4^2 + 6^2 - 9^2}{2 \times 4 \times 6} = \frac{-29}{48} = -0.6042
A = \cos^{-1}(-0.6042) = 127.2^\circ

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.

7^2 = x^2 + (x + 3)^2 - 2x(x + 3) \times \frac{1}{2}
49 = x^2 + x^2 + 6x + 9 - x^2 - 3x = x^2 + 3x + 9
x^2 + 3x - 40 = 0
(x + 8)(x - 5) = 0

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°.

y = \sqrt{89-80\cos\left( x ^\circ\right)}
20406080100120140160180-2246810121460°: side 790°: Pythagoras, 9.43180°: flat, 13
Drag to pan, scroll to zoom. x from 0 to 180, y from -2.6 to 15.6.

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:

a^2 = (b\sin A)^2 + (c - b\cos A)^2
a^2 = b^2\sin^2 A + c^2 - 2bc\cos A + b^2\cos^2 A

Since sin²A + cos²A = 1, the two b² terms combine into b²:

a^2 = b^2 + c^2 - 2bc\cos A

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.

ExamIs the cosine rule given?Form given
GCSE Maths Higher (AQA, Edexcel, OCR)Yes, on the formulae sheeta² = b² + c² − 2bc cos A only
GCSE Maths FoundationNo: it is Higher tier contentNot given
National 5 Maths (SQA)Yes, on the formulae listBoth a² = b² + c² − 2bc cos A and cos A = (b² + c² − a²)/2bc
A-level Maths (AQA, Edexcel)No: the booklet assumes you know itNot 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² = 9² + 12² − 2 × 9 × 12 × cos 40°
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.
The longest side is 11, so find the angle opposite it.
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.
The other angle is 180° − 70° = 110°, and the longer diagonal is opposite it.
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?
The angle between their courses is 120° − 30° = 90°.
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°.
The longest side is 7, so find the angle opposite it.
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.

Paper resets in

Common questions

What is the cosine rule used for?
Finding a missing side or angle in a triangle that has no right angle. It finds the third side when you know two sides and the angle between them, and any angle when you know all three sides.
What is the difference between the sine rule and the cosine rule?
The sine rule, a/sin A = b/sin B = c/sin C, needs a side and its opposite angle as a pair. The cosine rule needs either two sides and the angle between them, or all three sides. If you have a matching side and angle, use the sine rule; if not, use the cosine rule.
Is the cosine rule the same as the law of cosines?
Yes. Law of cosines is the usual name in the US. The formula is identical: c² = a² + b² − 2ab cos C, and US textbooks often write it with c and C rather than a and A.
How do you rearrange the cosine rule to find an angle?
Start with a² = b² + c² − 2bc cos A. Add 2bc cos A to both sides and subtract a² to get 2bc cos A = b² + c² − a². Divide by 2bc: cos A = (b² + c² − a²)/2bc. Then take the inverse cosine.
Can the cosine rule be used on a right-angled triangle?
Yes, it always works. With the 90° angle, cos 90° = 0, so it becomes a² = b² + c², which is Pythagoras' theorem. For a right-angled triangle, Pythagoras and SOH CAH TOA are simply quicker.
Is the cosine rule GCSE Higher only?
Yes. In England it is Higher tier content in GCSE Maths, and the formula is printed on the Higher formulae sheet. It does not appear on Foundation papers.

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
Read next
Maths · TrigonometrySine rule: formula, examples and the ambiguous caseThe sine rule formula for sides and angles, when to use it instead of the cosine rule, the ambiguous case, area of a triangle, examples and practice.