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°.

Left: a triangle with corners A, B, C and sides a, b, c, each side across from the corner with the same letter. Right: the two laws, a² = b² + c² − 2bc·cos A and a / sin A = b / sin B = c / sin C, with the cases each one solves.
Side a is opposite angle A. The law of cosines solves SSS and SAS; the law of sines solves ASA, AAS and SSA.

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.

A triangle with base a from C to B and corner A on top. The height h = b·sin C drops from A to the base, cutting it into b·cos C next to C and a − b·cos C next to B. The right triangle on the right has legs h and a − b·cos C and hypotenuse c.
The height splits the triangle into two right triangles; Pythagoras on the right one gives c² = a² + b² − 2ab·cos C.

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

givenfirst stepthenhow many triangles
SSS: three sideslaw of cosines → an anglecosines again, angle sumone (if each side is less than the sum of the other two)
SAS: two sides, angle betweenlaw of cosines → third sidecosines for an angle, angle sumone
ASA: two angles, side betweenangle sum → third anglelaw of sinesone
AAS: two angles, side not betweenangle sum → third anglelaw of sinesone
SSA: two sides, angle not betweenlaw of sines → sin Bboth B and 180° − B0, 1 or 2
AAA: three anglesno side, so no size: only the shape is fixedinfinitely 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):

Four panels with A = 30° and b = 10, so h = 5. a = 4: the arc round C stays above the ray, no triangle. a = 5: the arc touches the ray at the foot of the height, one right triangle. a = 6: the arc cuts the ray at B1 and B2, two triangles. a = 11: one crossing on the ray and one behind A, one triangle.
SSA: side a swings round C. Too short, no triangle; just long enough, one right triangle; between h and b, two; at least b, one.
side awhat the arc doeslaw of sinestriangles
a = 4 < hnever reaches the raysin B = 1.25 > 1 ✗0
a = 5 = htouches it oncesin B = 1, B = 90°1 (right)
h < a = 6 < bcuts it twiceB = 56.44° or 123.56°2 ✓✓
a = 11 ≥ bsecond crossing is behind AB = 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).