The Pythagorean theorem turns right triangles into the equation $a^{2} + b^{2} = c^{2}$. Whole-number solutions like $(3, 4, 5)$ and $(5, 12, 13)$ have fascinated people for nearly 4,000 years; a Babylonian clay tablet, Plimpton 322, lists fifteen of them. Here is the complete list.
Definitions. A Pythagorean triple is a triple of positive integers with $a^{2} + b^{2} = c^{2}$. It is primitive when $\gcd(a, b, c) = 1$. Every triple is a multiple of a primitive one: $(6, 8, 10) = 2 \cdot (3, 4, 5)$.
Theorem. The primitive triples, with $b$ the even leg, are exactly $$a = m^{2} - n^{2}, \qquad b = 2mn, \qquad c = m^{2} + n^{2},$$ where $m > n > 0$, $\gcd(m, n) = 1$, and one of $m$, $n$ is even. Each primitive triple comes from exactly one such pair.
💡 Why it works
That these are triples is algebra: $(m^{2} - n^{2})^{2} + (2mn)^{2} = m^{4} + 2m^{2}n^{2} + n^{4} = (m^{2} + n^{2})^{2}$. That there are no others uses unique factorization. In a primitive triple exactly one leg is even (squares are $0$ or $1 \bmod 4$, so two odd legs would make $c^{2} \equiv 2 \pmod{4}$, impossible). Write $b^{2} = c^{2} - a^{2} = (c - a)(c + a)$. Both factors are even, and $\frac{c - a}{2}$ and $\frac{c + a}{2}$ are coprime; their product is the square $\left(\frac{b}{2}\right)^{2}$, so each is a square, $n^{2}$ and $m^{2}$. Then $c = m^{2} + n^{2}$ and $a = m^{2} - n^{2}$.
Divide by $c^{2}$: a triple is a point with rational coordinates on the unit circle. The line through $(-1, 0)$ with slope $\frac{n}{m}$ meets the circle again at $\left(\frac{m^{2} - n^{2}}{m^{2} + n^{2}}, \frac{2mn}{m^{2} + n^{2}}\right)$. Move the sliders; try $m = 3$, $n = 1$.
✏️ Worked example: From m and n
Find the triples for $(m, n) = (3, 2)$ and $(4, 1)$.
Which $m$ and $n$ give the primitive triple $(21, 20, 29)$?
The odd leg is $21 = m^{2} - n^{2}$ and $29 = m^{2} + n^{2}$.
Add: $2m^{2} = 50$, so $m = 5$. Subtract: $2n^{2} = 8$, so $n = 2$.
Check: $2mn = 20$.
Answer: $m = 5$, $n = 2$.
The primitive triples with hypotenuse below 42.
$(m, n)$
(2, 1)
(3, 2)
(4, 1)
(4, 3)
(5, 2)
(5, 4)
(6, 1)
triple
(3, 4, 5)
(5, 12, 13)
(15, 8, 17)
(7, 24, 25)
(21, 20, 29)
(9, 40, 41)
(35, 12, 37)
⚠️ Common mistake
Using $m$ and $n$ that are both odd, or that share a factor, and expecting a primitive triple. $m = 3$, $n = 1$ gives $(8, 6, 10) = 2 \cdot (4, 3, 5)$, and $m = 4$, $n = 2$ gives $(12, 16, 20) = 4 \cdot (3, 4, 5)$. Both conditions matter: coprime, and opposite parity. Check the result with $\gcd$.
🔑 Key idea
Every primitive Pythagorean triple is $(m^{2} - n^{2}, 2mn, m^{2} + n^{2})$ for coprime $m > n > 0$ of opposite parity, and every triple is a multiple of a primitive one.
Practice
Pass with 3 right answers, the last 2 in a row. Each right answer earns 2 XP.