# Clarification on how to find the solutions of the Pythagorean equation

I am reading a book (in Portuguese), and the author wants to find the integer solutions of the equation $x^{2}+y^{2}=z^{2}.$ He says that

the main goal of this section is to get a characterization of those prime numbers which are sum of two squares.

I do not understand why is enough to characterize only prime numbers which are sum of two squares. Why this is enough?

-
It isn't, not without something in addition to finding Pythagorean triples. – Henning Makholm Apr 21 '12 at 18:41

The identity

$$(a^2+b^2)(c^2+d^2)=(ac-bd)^2+(ad+bc)^2.$$

has been known since ancient times. Of course, today we view this formula as expressing simply that the norm of complex numbers is multiplicative, i.e. $$N((a+bi)(c+di))=N(a+bi)N(c+di).$$

From this formula we see that the set $S$ of integers which are sums of two squares is closed under products. Thus it makes a lot of sense to ask ourselves which primes belong to $S$, for then all products of these primes will also belong to $S$. It will turn out that the primes in $S$ are precisely the primes of the form $4n+1$, as well as the prime $2$. This was claimed by Fermat and proven by Euler after years of effort.

In fact a better question is this: which elements of $S$ are irreducible with respect to their membership in $S$? In other words, which elements of $S$ cannot be written properly as the product of two elements of $S$? Obviously the primes in $S$ are irreducible in this sense, being irreducible in the wider sense. We can see immediately that squares of primes of the form $4n+3$ (which obviously belong to $S$) are also irreducible, and that together with the other primes, these are all the irreducible elements of $S$. With this information we can see easily that every element of $S$ can be uniquely written as a product of irreducible elements of $S$, thus leading to the following characterization of $S$:

An integer $n$ is the sum of two squares if and only if every prime of the form $4n+3$ which divides $n$ does so with even multiplicity.

All of this is of course intimately tied to factorization in $\mathbf{Z}[i]$: primes of the form $4n+1$ "split" as $p=a^2+b^2=(a+bi)(a-bi)$ where $a+bi$ and its conjugate are now irreducible in $\mathbb{Z}[i]$, the prime $2$ "ramifies" as $-i(1+i)^2$ and primes of the form $4n+3$ are "inert", remain prime. The elements of $S$ can be identified with the orbits of complex conjugation on $\text{Spec }\mathbf{Z}[i]$.

-

The main result is that $p = x^2 + y^2$ iff and only iff $p \equiv 1 (\mod 4)$, for $p$ prime.

We can multiply such primes together to get another (composite) number that is the sum of two squares by the Fibonacci-Brahmagupta identity.

We can then multiply by squares of such primes, since $n = x^2 + y^2 \Rightarrow k^n = (kx)^2 + (ky)^2$.

We can also multiply by $2$, since if $n = x^2 + y^2$, consider $2n = (1 + 1)(x^2 + y^2)$and apply Fibonacci-Brahmagupta.

-
How do you propose to go from the above to finding Pythagorean triples? – Bill Dubuque Apr 21 '12 at 18:53