The Law of Sines from The Law of Sines needs an angle with its opposite side. When you know two sides and the angle between them (SAS), or all three sides (SSS), you need a different tool, and it turns out to be the Pythagorean theorem with a correction term.
Why it works
Place $C$ at the origin with side $b$ along the $x$-axis: $C(0, 0)$, $A(b, 0)$. Point $B$ is $a$ units from $C$ at angle $C$, so $B = (a \cos C, a \sin C)$. By the distance formula, $$c^2 = (a \cos C - b)^2 + (a \sin C)^2.$$ Expanding, $$c^2 = a^2 \cos^2 C - 2ab \cos C + b^2 + a^2 \sin^2 C.$$ Since $\cos^2 C + \sin^2 C = 1$ (the Pythagorean theorem in a right triangle with hypotenuse 1), this becomes $c^2 = a^2 + b^2 - 2ab \cos C$. When $C = 90^\circ$, $\cos C = 0$ and it is exactly $a^2 + b^2 = c^2$.
Key idea
Law of Cosines: $c^2 = a^2 + b^2 - 2ab \cos C$, where $C$ is the angle between sides $a$ and $b$. Use it for SAS (to find the third side) and for SSS (solved for $\cos C$, to find an angle).
Worked example: Two sides and the included angle
In $\triangle ABC$, $a = 5$, $b = 8$ and $m\angle C = 60^\circ$. Find $c$.
- $c^2 = 5^2 + 8^2 - 2(5)(8)\cos 60^\circ$.
- Multiply first: $2(5)(8)\cos 60^\circ = 80 \cdot \frac{1}{2} = 40$.
- $c^2 = 25 + 64 - 40 = 49$, so $c = 7$.
Answer: $c = 7$
Worked example: Three sides, find an angle
A triangle has sides $3$, $5$ and $7$. Find its largest angle.
- The largest angle is opposite the longest side, $7$. Solve for its cosine: $\cos C = \frac{a^2 + b^2 - c^2}{2ab}$, so $\cos C = \frac{9 + 25 - 49}{30} = -\frac{15}{30} = -\frac{1}{2}$.
- A negative cosine means an obtuse angle: $C = \cos^{-1}\left(-\frac{1}{2}\right) = 120^\circ$.
Answer: $120^\circ$
Worked example: With a calculator
Two sides of a triangular lot are $40$ m and $55$ m, meeting at $95^\circ$. How long is the third side?
- $c^2 = 40^2 + 55^2 - 2(40)(55)\cos 95^\circ$, which is $1600 + 3025 - 4400(-0.0872)$, or about $4625 + 383.5 = 5008.5$.
- $c \approx \sqrt{5008.5} \approx 70.8$ m.
Answer: About $70.8$ m
Common mistake
Combining $a^2 + b^2 - 2ab$ first and then multiplying by $\cos C$. Order of operations says multiply $2ab \cos C$ first, then subtract. In the first example, $(25 + 64 - 80) \cdot \frac{1}{2} = 4.5$ is wrong; $25 + 64 - 40 = 49$ is right. Check: the answer should be close to $a^2 + b^2$ when $C$ is near $90^\circ$.