Cosine Rule Calculator (Law of Cosines)

Apply the cosine rule to find a side or an angle, with the steps shown.

The cosine rule

The cosine rule links the three sides of any triangle to one of its angles:

c² = a² + b² − 2ab cos C, and in the other direction, cos C = (a² + b² − c²) ÷ (2ab).

It is the “Pythagoras for any triangle”: when C = 90°, cos C = 0 and the rule becomes c² = a² + b². Use it when you know two sides and the angle between them (to find the third side) or all three sides (to find an angle).

Worked examples

  • Finding a side: a = 7, b = 10 and C = 40°. c² = 49 + 100 − 2 × 7 × 10 × cos 40° = 41.7538, so c = 6.4617.
  • Finding an angle: a = 5, b = 6, c = 7. cos C = (25 + 36 − 49) ÷ (2 × 5 × 6) = 0.2, so C = 78.46°.

After the first step, the solver finds the other two angles and the area, and draws the triangle.

The drawing has Download PNG and Download SVG buttons, so you can save it for homework, a report or a slide.

Tips

  • Make sure your calculator is in degree mode when you do it by hand.
  • The angle in the formula must be the one between the two known sides, and opposite the side you are finding.
  • An obtuse angle has a negative cosine. That is why the rule works for triangles with angles over 90° as well.
  • For a triangle with an angle and its opposite side known, the sine rule is often quicker.

How to cite this page

CalcPulse. (2026). Cosine Rule Calculator. https://calcpulse.com/cosine-rule-calculator/

Frequently asked questions

What is the cosine rule?

c² = a² + b² − 2ab cos C. It relates the three sides of a triangle to the angle opposite one of them.

When do I use the cosine rule?

When you know two sides and the angle between them, or all three sides.

How do I find an angle with the cosine rule?

Rearrange it: cos C = (a² + b² − c²) ÷ (2ab), then take the inverse cosine. Use the 'Find an angle' tab.

What is the difference between the cosine rule and Pythagoras?

Pythagoras only works for right-angled triangles. The cosine rule works for every triangle and reduces to Pythagoras when the angle is 90°.

Why is my answer wrong on a calculator?

Check that it is in degree mode, and that the angle you used is the one between the two known sides.

Last updated