Law of Cosines Calculator

Find a triangle’s third side from two sides and the angle between them with the law of cosines, plus the other two angles and the area.

Your details

°

Your data stays in your browser

Result

Enter the two sides and the angle between them, then press “Calculate side”.

Analysis and suggestions

Once calculated, this shows what your result means and suggestions based on your numbers.

Behind the result

Enter the sides in one unit and the angle in degrees.

Example · c² = a² + b² − 2ab × جتا C

c = √(5² + 7² − 2·5·7·cos 60°) = 6.245

How it is calculated

Comprehensive Calculator Guide

This law of cosines calculator finds the third side of any triangle from two sides and the angle between them, then the two remaining angles and the area. Sides 5 and 7 with a 60° angle between them give a third side of √39 ≈ 6.245. The law generalises Pythagoras: at 90° its last term vanishes.

The law

c² = a² + b² − 2ab cos C, where C is the angle between sides a and b and opposite side c.

At C = 90°, cos C = 0 and the law collapses to Pythagoras. For an obtuse angle cos C is negative, so c is longer than the hypotenuse of the matching right triangle.

The rest of the triangle

With c known, angle A comes from the same law turned around: cos A = (b² + c² − a²) ÷ 2bc, then B = 180° − A − C. The area is ½ab sin C.

How to Use

  1. Enter sides a and b.
  2. Enter the angle C between them in degrees.
  3. Press “Calculate side” to see side c, angles A and B and the area.

Formula Used

c² = a² + b² − 2ab × cos C

Practical Examples

Example 1: a = 5, b = 7, C = 60°
c² = 25 + 49 − 2 × 5 × 7 × 0.5 = 39, so c ≈ 6.245, A ≈ 43.9°, B ≈ 76.1°, area ≈ 15.16.
Example 2: a = 6, b = 8, C = 90°
cos 90° = 0, so c² = 36 + 64 = 100 and c = 10, as Pythagoras says; area 24.

Important Tips

  • Make sure the angle you enter is the one between the two sides.
  • To find an angle from three sides, rearrange the law and take the inverse cosine.
  • It gives the distance between two points when you know how far each is from you and the angle between them.

Common Mistakes to Avoid

  • Dropping the factor 2 in 2ab cos C.
  • Adding the last term instead of subtracting it.
  • Forgetting the final square root and reporting c² as c.

Frequently Asked Questions

Law of sines or law of cosines?
Cosines for two sides and the included angle, or three sides; sines for two angles and a side.
Is the law of cosines just Pythagoras?
It generalises it: at 90° cos C is zero and c² = a² + b² remains.
How do I find an angle from three sides?
cos C = (a² + b² − c²) ÷ 2ab, then take the inverse cosine.

Read Also

Results are estimates for educational purposes and may vary depending on your situation and data sources.