Number Theory – Primitive Pythagorean Triple Generator

geometrynumber theorypythagorean triples

I was wondering how to prove the following fact about primitive Pythagorean triples:

Let $(z,u,w)$ be a primitive Pythagorean triple. Then there exist relatively prime positive integers $a,b$ of different parity such that $$z = a^2-b^2, \quad u = 2ab, \quad \text{and} \quad w = a^2+b^2.$$

I see how $z,u,w$ must form the sides of a triangle, where $c$ is the hypotenuse, but how do we show that $\gcd(z,u,w) = 1$ and that these generate all the triples?

Best Answer

It is easy to see that if $(z,u,w)$ is a primitive pythagorean triple, then $w$ is odd and either $z$ is odd and $u$ is even or $z$ is even and $u$ is odd. WLOG suppose that $u=2x$ is even, so $z$ is odd. Then

$$u^2=4x^2=w^2-z^2=(w+z)(w-z).$$

It is plain that $\gcd(w+z,w-z)=2$, so $y_1:=(w+z)/2$ and $y_2:=(w-z)/2$ are relatively prime positive integers. Thus

$$x^2=y_1y_2,$$

and therefore $y_1$ and $y_2$ are relatively prime divisors of $x^2$. This implies that $y_1$ and $y_2$ are perfect squares, so write $y_1=a^2$ and $y_2=b^2$. Hence,

$$u=2x=2ab,\quad z=y_1-y_2=a^2-b^2,\qquad\text{and}\qquad w=y_1+y_2=a^2+b^2.$$

This proves that every primitive triple has the form $(a^2-b^2,2ab,a^2+b^2)$, as wanted.

Of course, the condition $\gcd(a,b)=1$ is needed, otherwise $(a^2-b^2,2ab,a^2+b^2)$ won't be primitive.

Related Question