Right triangles are the comfortable special case — but most triangles in the world have no right angle in sight. The law of sines and the law of cosines hand you the keys to every triangle, letting you recover all six measurements from just three.
Beyond right triangles
All of basic trigonometry — the \( \sin \), \( \cos \), and \( \tan \) you met earlier — was built inside a right triangle. That is a powerful start, but a right angle is a luxury most triangles do not have. The roof of a house, a sailing course, a surveyor's plot of land: these are almost always oblique triangles, with no \( 90^\circ \) corner to lean on.
To talk about any triangle precisely, we need a consistent way to name its parts. The convention is beautifully simple: label the three angles with capital letters \( A \), \( B \), \( C \), and label each side with the lowercase letter of the angle opposite it. So side \( a \) sits across from angle \( A \), side \( b \) across from angle \( B \), and side \( c \) across from angle \( C \).
That opposite-pairing is the heart of everything that follows — each law connects a side to the angle staring at it from across the triangle. Keep one fact from earlier close at hand, too: the three angles of any triangle always sum to a straight angle,
\[ A + B + C = 180^\circ \]so the moment you know two angles, the third is free.
The law of sines
The first tool says that in any triangle, the ratio of a side to the sine of its opposite angle is the same for all three pairs:
\[ \frac{a}{\sin A} = \frac{b}{\sin B} = \frac{c}{\sin C} \]Read it as a single shared value that ties each side to the angle facing it. A bigger angle yawns open across a longer side, and this ratio captures that link exactly. Because the equation chains three equal fractions, you only ever use two of them at a time — pick the pair where you already know three of the four quantities, and solve for the missing one.
The law of sines is the right tool whenever your known pieces include a complete side–angle pair (a side and the angle across from it). Three classic situations fit:
- ASA — two angles and the side between them.
- AAS — two angles and a side not between them.
- SSA — two sides and an angle opposite one of them (the tricky case, handled at the end).
In the two angle-heavy cases you typically find the third angle first with \( A + B + C = 180^\circ \), then sweep through the law of sines to recover the unknown sides one at a time.
Tip The law of sines needs a matched side–angle pair to get started — a side and the angle opposite it. If every angle you know is wedged between two known sides with no opposite pair in sight, reach for the law of cosines instead.
The law of cosines
When you have no complete side–angle pair, the law of sines stalls — and the law of cosines takes over. It is a single, more muscular relationship between all three sides and one angle:
\[ a^2 = b^2 + c^2 - 2bc\cos A \]By symmetry, the same shape works for each corner — just keep the angle and its opposite side matched:
\[ b^2 = a^2 + c^2 - 2ac\cos B, \qquad c^2 = a^2 + b^2 - 2ab\cos C \]Notice the structure. The first two terms, \( b^2 + c^2 \), are exactly what the Pythagorean theorem would give. The final term \( -2bc\cos A \) is a correction that bends the result to account for an angle that is not \( 90^\circ \). And that is the loveliest part: when \( A = 90^\circ \), the cosine vanishes, \( \cos 90^\circ = 0 \), so the correction disappears and the formula collapses straight back into
\[ a^2 = b^2 + c^2. \]The law of cosines is not a rival to Pythagoras — it is Pythagoras, generalised to every angle. Use it in exactly the two situations where the law of sines cannot start:
- SAS — two sides and the angle between them. Solve for the third side directly.
- SSS — all three sides known. Rearrange to find any angle: \( \cos A = \dfrac{b^2 + c^2 - a^2}{2bc} \).
In words The law of cosines is Pythagoras with a built-in adjuster. The \( -2bc\cos A \) term shrinks the result when angle \( A \) is acute and grows it when \( A \) is obtuse (since \( \cos A \) turns negative). At exactly \( 90^\circ \) the adjuster reads zero and you are back to \( a^2 = b^2 + c^2 \).
A worked SAS solve
Let us fully solve a triangle from a side–angle–side start. Suppose we know two sides and the angle wedged between them: \( b = 7 \), \( c = 8 \), and the included angle \( A = 50^\circ \). The widget below shows exactly this triangle — drag the angle handle or step the controls, and watch every measurement update live so you can check our work as we go.
Step 1 — find the third side with the law of cosines. The unknown side \( a \) sits opposite the known angle \( A \), so it is the perfect target:
\[ a^2 = b^2 + c^2 - 2bc\cos A = 7^2 + 8^2 - 2(7)(8)\cos 50^\circ \]Working it out, \( 49 + 64 = 113 \), and \( 2(7)(8) = 112 \). Since \( \cos 50^\circ \approx 0.6428 \), the correction is \( 112 \times 0.6428 \approx 71.99 \). So \( a^2 \approx 113 - 71.99 = 41.01 \), giving
\[ a = \sqrt{41.01} \approx 6.40. \]Step 2 — find a second angle with the law of sines. Now that we have the complete pair \( (a, A) \), the law of sines can finish the job. Solve for \( \sin B \):
\[ \frac{\sin B}{b} = \frac{\sin A}{a} \quad\Longrightarrow\quad \sin B = \frac{b\sin A}{a} = \frac{7\sin 50^\circ}{6.40} \approx \frac{7 \times 0.7660}{6.40} \approx 0.8374 \]Taking the inverse sine, \( B \approx 56.9^\circ \).
Step 3 — find the last angle with the angle sum. No more trigonometry needed; the angles must total \( 180^\circ \):
\[ C = 180^\circ - A - B \approx 180^\circ - 50^\circ - 56.9^\circ = 73.1^\circ. \]The triangle is fully solved: \( a \approx 6.40 \), \( B \approx 56.9^\circ \), \( C \approx 73.1^\circ \). These are precisely the values the widget reports — a satisfying check that the two laws agree.
The ambiguous case (SSA)
One honest warning before you set out. The SSA setup — two sides and an angle opposite one of them — can be slippery, because the information you are given may describe zero, one, or two different triangles.
Picture swinging a side of fixed length down from a known angle, hunting for where it lands on the opposite ray. Sometimes it falls short and never reaches — no triangle exists. Sometimes it just grazes the line in exactly one spot — one triangle. And sometimes it can reach in two different places, both valid — two triangles. This is why SSA is nicknamed the ambiguous case.
The root of the trouble is that \( \sin B = \sin(180^\circ - B) \): an angle and its supplement share the same sine, so when you take an inverse sine your calculator hands back only one of two possible angles. Whenever you solve an SSA triangle, pause and ask whether the supplementary angle also produces a valid triangle — that is, whether the three angles still sum to less than \( 180^\circ \). If it does, there are genuinely two answers, and the problem usually expects both.
- Two sides and the included angle — use the law of cosines: \( a^2 = b^2 + c^2 - 2bc\cos A \).
- Substitute: \( a^2 = 5^2 + 6^2 - 2(5)(6)\cos 60^\circ \).
- Evaluate the pieces: \( 25 + 36 = 61 \), and \( 2(5)(6) = 60 \). Since \( \cos 60^\circ = \tfrac{1}{2} \), the correction is \( 60 \times \tfrac{1}{2} = 30 \).
- So \( a^2 = 61 - 30 = 31 \), and \( a = \sqrt{31} \approx 5.57 \).
The third side is \( a = \sqrt{31} \approx \mathbf{5.57} \).
- We have the complete pair \( (a, A) \) and a second angle — the law of sines fits.
- Set the matching ratios equal: \( \dfrac{b}{\sin B} = \dfrac{a}{\sin A} \).
- Solve for \( b \): \( b = \dfrac{a\sin B}{\sin A} = \dfrac{10\sin 75^\circ}{\sin 40^\circ} \).
- Use \( \sin 75^\circ \approx 0.9659 \) and \( \sin 40^\circ \approx 0.6428 \): \( b \approx \dfrac{10 \times 0.9659}{0.6428} \approx \dfrac{9.659}{0.6428} \).
So side \( b \approx \mathbf{15.03} \).
Practice
Try each one yourself, then reveal the full solution.
1. In a triangle, \( A = 40^\circ \), \( B = 75^\circ \), and \( a = 10 \). Find the third angle \( C \) and side \( b \).
First the third angle comes free from the angle sum: \( C = 180^\circ - 40^\circ - 75^\circ = 65^\circ \).
Since we have the matched pair \( (a, A) \), use the law of sines: \( b = \dfrac{a\sin B}{\sin A} = \dfrac{10\sin 75^\circ}{\sin 40^\circ} \).
With \( \sin 75^\circ \approx 0.9659 \) and \( \sin 40^\circ \approx 0.6428 \), this gives \( b \approx \dfrac{9.659}{0.6428} \approx \mathbf{15.03} \), with \( C = \mathbf{65^\circ} \).
2. A triangle has all three sides known: \( a = 5 \), \( b = 6 \), \( c = 7 \). Find the largest angle.
The largest angle always sits opposite the longest side, so we want angle \( C \), opposite \( c = 7 \). With all three sides known (SSS), rearrange the law of cosines: \( \cos C = \dfrac{a^2 + b^2 - c^2}{2ab} \).
Substitute: \( \cos C = \dfrac{5^2 + 6^2 - 7^2}{2(5)(6)} = \dfrac{25 + 36 - 49}{60} = \dfrac{12}{60} = 0.2 \).
Taking the inverse cosine, \( C = \cos^{-1}(0.2) \approx \mathbf{78.5^\circ} \).
3. Two sides of a triangle are \( b = 10 \) and \( c = 12 \), with an included angle \( A = 40^\circ \). Find the third side \( a \).
Two sides and the angle between them is the SAS pattern, so the law of cosines applies: \( a^2 = b^2 + c^2 - 2bc\cos A \).
Substitute: \( a^2 = 10^2 + 12^2 - 2(10)(12)\cos 40^\circ = 100 + 144 - 240\cos 40^\circ \).
Since \( \cos 40^\circ \approx 0.7660 \), the correction is \( 240 \times 0.7660 \approx 183.85 \), so \( a^2 \approx 244 - 183.85 = 60.15 \).
Therefore \( a = \sqrt{60.15} \approx \mathbf{7.76} \).