Solve Pythagorean Triplets


Positive integer solutions to the equation $a^2 + b^2 = c^2$ are termed as Pythogorean triplets. Usually, we will focus on those so-called primitive triplets which require $a$, $b$, $c$ are relative co-prime. (Please see Indeterminate Equation for more information.)

There are different ways to derive such solutions, one of which is presented here. This approach can also be used to solve other similar indeterminate equations such as $a^2 + 3b^2 = c^2$.

First, we note that the given equation is equivalent to $$\left(\frac{a}{c}\right)^2+\left(\frac{b}{c}\right)^2=1$$

Hence, every primitive triplet has a one-to-one relationship with a rational point on the unit circle. A rational point means that bot of its coordinates are rational numbers. It follows that solving a Pythagorean equation is equivalent to finding all the rational points on the unit circle.

Let's draw a line $y=k(x+1)$ from the point $(-1, 0)$ and intersect with the unit circel at $(m, n)$, where both $m$ and $n$ are rational numbers. Then $(m, n)$ must be one solution to the following system: $$\left\{\begin{align}y&=k(x+1)\\1&=x^2+y^2\end{align}\right.$$

Replacing $y$ in the second equation with $k(x+1)$ from the first one gives: $$x^2 + \left(k(x+1)\right)^2 = 1\implies (k^2+1)x^2 + 2k^2x + (k^2-1)=0$$

As we know $(-1, 0)$ is one solution to the above quadrantic equation, applying the Vieta theorem gives the other root as $$x=\frac{1-k^2}{1+k^2}\implies y=k(x+1)=\frac{2k}{1+k^2}\implies (m, n) = \left(\frac{1-k^2}{1+k^2}, \frac{2k}{1+k^2}\right)$$

The last part above gives a parameteric solution of all rational points on the unit circle. Correspondingly, $$(a, b, c) = \left((1-k^2)p^2,  2kp^2, (1+k^2)p^2\right)$$

gives a parametric solution to all Pythogoran triplets where integer $p$ is a scale factor. Further more, if we let $q=kp$, the above solution will be simplified into the usual form: $$(a, b, c) = \left(p^2 - q^2,  2pq, p^2 + q^2\right)$$

(Note: some technical details have been omitted in order to keep this article concise and be focused.)


back to list