Law of Cosines Calculator
The third side of a triangle from two sides and the angle between them — the law of cosines — with the other two angles, the area, the perimeter and the type of triangle it makes.
Pythagoras works for right angles; the law of cosines is its general form.
How the law of cosines calculator works
Pythagoras works for right angles; the law of cosines is its general form. The square of the unknown side is the sum of the squares of the two known sides, less twice their product times the cosine of the included angle. Once all three sides are known, the same law run backwards gives each remaining angle, and half the product of two sides and the sine of their angle gives the area.
Formula: c² = a² + b² − 2ab cos C; cos A = (b² + c² − a²) / (2bc); area = ½ ab sin C
Worked examples
| Inputs | Third side c | Note |
|---|---|---|
| 8 and 11 at 37° | 6.66634 | about 6.67 |
| A right angle | 5 | Pythagoras: 5 |
| An obtuse angle | 16.52271 | a long third side |
FAQFrequently asked questions
What is the law of cosines?
The generalisation of Pythagoras to any triangle: c² = a² + b² − 2ab cos C. With a right angle the cosine is zero and it collapses to a² + b² = c².
When do I use it?
When you know two sides and the angle between them (SAS), or all three sides and want the angles (SSS). Two angles and a side is a job for the law of sines.
Why does an obtuse angle make the third side longer?
Because the cosine of an angle over 90° is negative, so the correction term adds rather than subtracts. At 180° the sides simply lie end to end.
How is the area found?
Half the product of two sides and the sine of the angle between them — the same two sides and angle you started with, so no extra measurement is needed.
Does it work in three dimensions?
Any three points define a plane, so any triangle is flat and the law applies. It also underlies the distance between two vectors given their angle.
Where these figures come from
- NIST Digital Library of Mathematical Functions — reference definitions for elementary and special functions
- Wolfram MathWorld — definitions and formulas for every topic on this page
- NIST/SEMATECH e-Handbook of Statistical Methods — the statistical formulas (mean, variance, z, confidence intervals, sample size)
- Australian Curriculum (ACARA) — Mathematics — the terms and methods taught in Australian schools
Last checked: September 2026. Formulas are fixed by mathematics and do not change with tax years or regulations.