The idea: three parts decide a triangle
A triangle has six parts: three sides and three angles. The usual names pair them up: side a is across from angle A, b across from B, c across from C. Give three of the parts, at least one of them a side, and the other three can be worked out. That is called solving the triangle. Two rules do all the work: the law of cosines and the law of sines, plus the fact that the angles add up to 180°.
The law of cosines
For any triangle, c² = a² + b² − 2ab·cos C (and the same with the letters turned round: a² = b² + c² − 2bc·cos A). It is Pythagoras with a correction term. When C = 90°, cos C = 0 and it is exactly a² + b² = c². An acute C makes c shorter than Pythagoras says, an obtuse C makes it longer (Demo: 90° turns cosines into Pythagoras: 3² + 4² − 24·0 = 25, so c = 5).
Why it holds: drop the height h from A onto side a. It cuts a into b·cos C and a − b·cos C, and the height is b·sin C. Pythagoras in the right-hand part gives c² = (b sin C)² + (a − b cos C)² = a² + b² − 2ab cos C, using sin² + cos² = 1.
Use it when all three sides are known (SSS: solve it for the angle, cos A = (b² + c² − a²) / 2bc), or when two sides and the angle between them are known (SAS: it gives the third side). For a = 7, b = 8, c = 5: cos A = (64 + 25 − 49) / 80 = 0.5, so A = 60°. Going the other way, b = 8, c = 5, A = 60° gives a² = 89 − 40 = 49, a = 7: the same triangle (Demo: SSS and SAS, same triangle). The arccos never gives two answers, because every angle from 0° to 180° has its own cosine.
The law of sines
a / sin A = b / sin B = c / sin C. Each side divided by the sine of the angle across from it gives the same number k, and k is the diameter 2R of the circle through the three corners (see circle theorems for why). Why the first two are equal: the height from C onto side c is both b·sin A and a·sin B, so a/sin A = b/sin B.
It needs one complete pair: a side and its opposite angle. With two angles known (ASA or AAS) the third comes from the sum, and then every pair is complete. For A = 40°, B = 60°, c = 10: C = 80°, k = 10 / sin 80° = 10.15, a = 10.15·sin 40° = 6.53, b = 10.15·sin 60° = 8.79 (Demo: ASA and AAS with the law of sines). The page checks each answer with the other law.
Which law for which case
| given | first step | then | how many triangles |
|---|---|---|---|
| SSS: three sides | law of cosines → an angle | cosines again, angle sum | one (if each side is less than the sum of the other two) |
| SAS: two sides, angle between | law of cosines → third side | cosines for an angle, angle sum | one |
| ASA: two angles, side between | angle sum → third angle | law of sines | one |
| AAS: two angles, side not between | angle sum → third angle | law of sines | one |
| SSA: two sides, angle not between | law of sines → sin B | both B and 180° − B | 0, 1 or 2 |
| AAA: three angles | no side, so no size: only the shape is fixed | infinitely many (similar triangles) | |
After the second angle, prefer the angle sum over another law: it is exact and cannot pick the wrong angle.
The ambiguous case: SSA
Given A, b and a, angle A and side b fix the corner C. Corner B must be on the ray from A, at distance a from C: where a circle of radius a round C meets the ray. The height from C to the ray is h = b·sin A. Comparing a with h and b tells how many triangles there are (Demo: SSA as a grows: 0, 1, 2, 1 triangles, with A = 30°, b = 10, h = 5):
| side a | what the arc does | law of sines | triangles |
|---|---|---|---|
| a = 4 < h | never reaches the ray | sin B = 1.25 > 1 ✗ | 0 |
| a = 5 = h | touches it once | sin B = 1, B = 90° | 1 (right) |
| h < a = 6 < b | cuts it twice | B = 56.44° or 123.56° | 2 ✓✓ |
| a = 11 ≥ b | second crossing is behind A | B = 27.04° (152.96° + 30° > 180°) | 1 |
The law of sines shows the same thing in numbers. sin B = b·sin A / a, and every sine below 1 belongs to two angles, B and 180° − B (see the unit circle: two points have the same height). The calculator's arcsin only returns the acute one, so always test the obtuse one too: it is a real triangle if A + (180° − B) is less than 180°. For a = 6 the two triangles have C = 93.56°, c = 11.98 and C = 26.44°, c = 5.34 (Demo: SSA with two triangles). If A itself is 90° or more, there is at most one triangle, and only when a > b.
For the right-angle special case, both laws shrink to the definitions sin = opposite / hypotenuse and Pythagoras; see the Pythagorean theorem. The circle through the three corners, with diameter k = 2R, is drawn on triangle centres.
The right-angle case these laws reduce to: see Right-Triangle Trigonometry.
What the page leaves out
Heron's formula and the area ½ab·sin C; the law of tangents and Mollweide's formulas; proving the law of cosines with the dot product (|a − b|² = |a|² + |b|² − 2a·b, see vectors and the dot product); rounding errors when a triangle is very flat; checking the triangle inequality for SSS input; spherical triangles, where the angles add up to more than 180°; and typing your own numbers (the page uses fixed presets).
See where this page fits on the Trigonometry & Geometry mind map.