Key takeaways
- The cosine rule is c² = a² + b² − 2ab × cos(C).
- Use it when you know two sides and the angle between them (SAS), or all three sides (SSS).
- To find an angle, rearrange to cos(C) = (a² + b² − c²) ÷ 2ab.
- When C = 90°, cos(C) = 0 and the rule becomes Pythagoras.
- For obtuse angles cos(C) is negative, so the third side gets longer.
In this guide
What is the cosine rule?
The cosine rule, also called the Law of Cosines, connects all three sides of a triangle with one of its angles. It works in every triangle: acute, right-angled or obtuse.
Think of it as a smarter Pythagorean theorem. Pythagoras only works when the angle is exactly 90°. The cosine rule adds a correction, −2ab × cos(C), that adjusts for any angle.
Why does the cosine rule matter?
The sine rule needs a side and its opposite angle to get started. Very often you don't have that pair. If you know two sides and the angle between them, or all three sides, the cosine rule is the only direct way in.
Pythagoras is the special case. The cosine rule is the full story for every triangle.
The formula
| Symbol | What it means | Example |
|---|---|---|
| c | The side opposite angle C (the one you find) | 6.24 m |
| a, b | The two sides that meet at angle C | 5 m, 7 m |
| C | The angle between a and b, in degrees | 60° |
| cos(C) | Cosine of the angle, from your calculator | cos(60°) = 0.5 |
To find an angle when you know all three sides, rearrange it:
How the angle changes the answer
| Angle C | cos(C) | Effect on c |
|---|---|---|
| Less than 90° | positive | c is shorter than in a right triangle |
| Exactly 90° | 0 | c² = a² + b² (Pythagoras) |
| More than 90° | negative | c is longer than in a right triangle |
How to use the cosine rule step by step
- 1Label the triangle. Call the unknown side c and the angle opposite it C. The other two sides are a and b.
- 2Square the two known sides and add them:
a² + b². - 3Work out `2ab × cos(C)` with your calculator in degree mode.
- 4Subtract to get c².
- 5Take the square root to get c.
Try it yourself. Enter two sides and the angle between them in the calculator below to find the third side with every step shown.
Try it yourself
Pre-filled with the example — change any value.
Finding an angle (SSS)
For a triangle with sides 5, 6 and 7, the largest angle is opposite the side of 7. So cos(C) = (25 + 36 − 49) ÷ (2 × 5 × 6) = 12 ÷ 60 = 0.2, and C = cos⁻¹(0.2) ≈ 78.46°. You can check inverse values with the inverse trig calculator.
Common mistakes to avoid
- Using an angle that is not between a and b. The cosine rule needs the included angle.
- Radian mode.
cos(60)in radians is about −0.95, which gives a wrong side. Use degree mode. - Forgetting the square root. The formula gives c², not c.
- Mixing signs with obtuse angles. With C = 120°,
cos(C) = −0.5, so−2ab × cos(C)becomes a plus. For a = 5, b = 7:c² = 74 + 35 = 109, soc ≈ 10.44.
Tips and tricks
- Find the largest angle first in an SSS problem. It is opposite the longest side, and it is the only angle that can be obtuse.
- Sanity check: c must be shorter than
a + band longer than the difference between a and b. - Right angle? Use the simpler Pythagorean theorem calculator. The law of cosines calculator gives the same results as this one.
Where you'll use it in real life
- Navigation: a ship sails 5 km, turns, and sails 7 km. The cosine rule gives its distance from the start.
- Surveying: finding the length across a field from two measured sides and the angle between them.
- Engineering: finding the length of a support beam in a roof or bridge.
- Sport: the distance between two players on a pitch from their distances and angle to a third point.
Quick summary
Use the cosine rule c² = a² + b² − 2ab × cos(C) when you know two sides and the angle between them, or rearrange it to find an angle when you know all three sides. Work out 2ab × cos(C) before subtracting, keep your calculator in degrees, and take the square root at the end. The calculator above shows every step.
Frequently asked questions
Can I use the cosine rule for right triangles?
Yes. When the angle is 90°, cos(90°) = 0, so the rule becomes the Pythagorean theorem c² = a² + b². Pythagoras is simply quicker.
How do I find an angle using the cosine rule?
Rearrange it to cos(C) = (a² + b² − c²) ÷ 2ab, work out the right side, then use inverse cosine (cos⁻¹) to get angle C.
When should I use the cosine rule instead of the sine rule?
Use the cosine rule when you know two sides and the angle between them, or all three sides. In those cases you do not have a side with its opposite angle, which the sine rule needs.
Why did I get a negative number under the square root?
Usually the brackets were wrong: work out 2ab × cos(C) first, then subtract it from a² + b². Also check your calculator is in degree mode.


