TITLE: All irreducible elements in Gaussian integers
QUESTION [6 upvotes]: I have shown that for $q \in \mathbb Z[i]$, if $N(q)=p$ ($p$ prime), or $N(q)=p^2$ ($p$ prime, $p \equiv 3 \pmod 4)$, then $q$ is irreducible ($(N(q)$ denotes the norm of $q$). But how can I prove that these are the only irreducible elements in $\mathbb Z[i]$?

REPLY [7 votes]: Let $\pi\in\mathbb Z[i]$ irreducible. As you know $N(\pi)\ne 1$, so $N(\pi)$ is a product of primes in $\mathbb Z_{>0}$.
If $N(\pi)$ is prime, you are done.
Suppose $N(\pi)$ is not prime.
If there is a prime $p\equiv 3\pmod 4$ such that $p\mid N(\pi)=\pi\bar{\pi}$ then $p\mid\pi$, so $\pi$ and $p$ are associates in $\mathbb Z[i]$ and therefore $N(\pi)=N(p)=p^2$. (Here I've used that any prime $p\equiv 3\pmod 4$ is prime in $\mathbb Z[i]$.)
Otherwise, $N(\pi)$ is a product of primes $p\equiv1\pmod 4$. Let $p$ be such a prime. We also know that $p=z\bar z$ where $z\in\mathbb Z[i]$ is a prime element. Then $z\mid \pi\bar{\pi}$ and therefore $\pi$ (or $\bar{\pi}$) and $z$ are associates, so $N(\pi)=N(z)=p$, a contradiction.