Triangle Calculator: How It Works
A triangle is fully determined by three independent measurements, and which three you have decides which method solves it. This calculator handles the standard cases; this page covers how to pick the right one and where the ambiguity lies.
Which case do you have?
| Known | Method | Solvable? |
|---|---|---|
| SSS — three sides | Law of cosines | Yes, uniquely |
| SAS — two sides, included angle | Law of cosines | Yes, uniquely |
| ASA / AAS — two angles, one side | Law of sines | Yes, uniquely |
| SSA — two sides, non-included angle | Law of sines | Ambiguous — 0, 1 or 2 triangles |
| AAA — three angles | — | Shape only; size undetermined |
The two laws
Law of cosines: c² = a² + b² − 2ab·cos(C)
Law of sines: a ÷ sin(A) = b ÷ sin(B) = c ÷ sin(C)
The law of cosines is a generalisation of Pythagoras. When C is 90°, cos(C) is 0 and the final term vanishes, leaving c² = a² + b².
Area
| Known | Formula |
|---|---|
| Base and height | ½ × base × height |
| Two sides and included angle | ½ab·sin(C) |
| Three sides | Heron: √[s(s−a)(s−b)(s−c)], s = (a+b+c)÷2 |
For a triangle with sides 5, 6 and 7: s = 9, so area = √(9 × 4 × 3 × 2) = √216 ≈ 14.7.
The ambiguous case
SSA is the one that catches people. Given two sides and an angle not between them, the shorter side can sometimes swing to meet the base at two different points, producing two valid triangles.
Because sin(θ) = sin(180° − θ), the law of sines returns an angle without telling you whether the true angle is acute or obtuse. Both may be geometrically valid. Always check whether the alternative angle also produces a triangle whose angles sum to 180°, and if it does, report both solutions.
Does a triangle exist?
The triangle inequality: the sum of any two sides must exceed the third. Sides of 2, 3 and 8 cannot form a triangle, because 2 + 3 is less than 8 — the two short sides cannot reach across. If a calculator returns an error or a NaN for three given sides, this is almost always why.
Angles must also sum to exactly 180° in plane geometry. On a sphere they sum to more, which is why great-circle navigation uses spherical trigonometry rather than these formulas.
Practical uses
- Surveying and construction — measuring inaccessible distances by triangulation.
- Navigation — position fixing from two known bearings.
- Roof and truss design — pitch, rafter length, load angles.
- Computer graphics — every 3D model is decomposed into triangles, because three points always define a flat plane.
A note on precision
Check whether your inputs are in degrees or radians before trusting a trigonometric result — this is the single most common error in practice. And when a triangle is very obtuse or nearly degenerate, small measurement errors in the inputs produce disproportionately large errors in the computed values.