Units of Gaussian Integers

Theorem
Let $\left({\Z \left[{i}\right], +, \times}\right)$ be the Ring of Gaussian Integers.

The set of units of $\left({\Z \left[{i}\right], +, \times}\right)$ is $\left\{{1, i, -1, -i}\right\}$.

Proof
Let $a + bi$ be a unit of $\left({\Z \left[{i}\right], +, \times}\right)$.

Then $a$ and $b$ are not both $0$ as then $a + bi$ would be the zero of $\left({\Z \left[{i}\right], +, \times}\right)$.

Then:
 * $\exists c, d \in \Z: \left({a + bi}\right) \left({c + di}\right) = 1 + 0i$

This leads (after algebra) to:
 * $c = \dfrac a {a^2 + b^2}, d = \dfrac {-b} {a^2 + b^2}$

Let $a^2 + b^2 = n$.

We have that $n \in \Z, n > 0$.

If $c$ and $d$ are integers, then $a$ and $b$ must both be divisible by $n$.

Let $a = nx, b = n y$.

Then:
 * $n^2 x^2 + n^2 y^2 = n$

and so:
 * $n \left({x^2 + y^2}\right) = 1$

Thus $n = a^2 + b^2 = 1$ and so as $a, b \in \Z$ we have:
 * $a^2 = 1, b^2 = 0$

or:
 * $a^2 = 0, b^2 = 1$

from which the result follows.