Law of Cosines Calculator
Solve a triangle from three sides using the law of cosines, with a validity check for sides that cannot form a triangle.
Everything you type here is processed on your own device. No input is sent to a server, logged, or stored.
What the Law of Cosines Calculator does
This law of cosines calculator will solve a triangle from three sides using the law of cosines, with a validity check for sides that cannot form a triangle. Fill in all 3 fields and the result updates as you type — there is no Calculate button to press and no page reload. It is most often used for solving a triangle where all three sides are known. Next to this one sits our trigonometry calculator.
How to use it
- Enter the three side lengths.
- Check the validity row first — if the sides cannot form a triangle, the angles are meaningless.
- Read all three angles and the area.
How it works
The law of cosines generalises Pythagoras. When the included angle is 90 degrees its cosine is zero and the formula collapses to a² + b² = c². The extra term is the correction for a non-right angle.
The triangle inequality is checked first because three arbitrary lengths usually cannot form a triangle: the two shorter sides must add to more than the longest. Sides of 1, 2 and 10 fail, and a calculator that returns an angle for them is returning nonsense.
Heron's formula gives the area from the three sides alone with no angle needed, which is remarkable and genuinely useful for surveying — you can find the area of a triangular plot by measuring only its edges.
When to use it
- Solving a triangle where all three sides are known.
- Finding the area of a triangular plot from measured edges.
- Checking whether three lengths can form a triangle.
- Working out an angle in a truss or frame.
Common mistakes to avoid
- Not checking the triangle inequality first.
- Pairing an angle with the wrong opposite side.
- Using the law of sines where the ambiguous case applies — the law of cosines avoids that ambiguity.
Frequently asked questions
What is the law of cosines?
c² = a² + b² − 2ab cos C. It relates all three sides to one angle, and reduces to Pythagoras when that angle is 90 degrees.
When do three lengths form a triangle?
When the two shorter ones add to more than the longest. This is the triangle inequality, and it must hold for all three combinations.
What is Heron's formula?
An area formula using only the three sides: √(s(s−a)(s−b)(s−c)) where s is half the perimeter. No angles are needed.