Using Gaussian integers $a+ib$ ($a,b\in\mathbb{Z}$), one can prove that a prime $p\in\mathbb{Z}$ is sum of two squares in $\mathbb{Z}$ if and only if $p\equiv 1\pmod 4$.
Question: Using Gaussian integers, is there any result which says about what integers can be expressed as sum of two (non-zero) squares in $\mathbb{Z}$?
I do not know how factorization of $m\in\mathbb{Z}$ into product of primes will help for this, since
-
$2$ is sum of two squares, but the product $2.2$ is not.
-
$4$ is not sum of two squares, $2$ is sum of two squares, but $4.2$ is sum of two squares.
Best Answer
Assume that the prime factorization of a natural number $n$ is
$$ n=2^a\prod_{i, p_i\equiv-1\pmod4}p_i^{s_i}\prod_{j,p_j\equiv1\pmod4}p_j^{r_j}.\qquad(*) $$
We need the multiplicativity of the norm $N(u+vi)=(u+vi)(u-vi)=u^2+v^2$ and the known splitting behavior of rational primes in $\Bbb{Z}[i]$. Namely:
Let's look at the three factors on the r.h.s. of $(*)$, call them $n_1,n_2,n_3$, individually.
We need to put these pieces together. Fermat's theorem (see the above link, but we actually got that as a by-product) states that $n$ is a sum of two squares, iff $n_2$ is a square. I claim that
If $n_1$ or $n_3$ (or both) is a sum of two non-zero squares, then using the multiplicativity of the norm gives rise to a presentation of $n$ as a sum of two non-zero squares. If $n_1=N(a_1+ib_1)$, $n_2=a_2^2$ and $n_3=N(a_3+ib_3)$, then then product $u+iv=(a_1+ib_1)a_2(a_3+ib_3)$ cannot be real or pure imaginary by the argument from item 3 above, and $N(u+iv)=n$. OTOH, if $n=N(u+iv)$ with $uv\neq0$, then the prime factorization of $u+iv$ must either contain a factor of $n_3>1$ or an odd power of $(1+i)$.