TITLE: Prove that the Gaussian Integer's ring is a Euclidean domain
QUESTION [38 upvotes]: I'm having some trouble proving that the Gaussian Integer's ring ($\mathbb{Z}[ i ]$) is an Euclidean domain. Here is what i've got so far.
To be a Euclidean domain means that there is a defined application (often called norm) that verifies this two conditions:

$\forall a, b \in \mathbb{Z}[i] \backslash {0} \hspace{2 mm} a \mid b \hspace{2 mm} \rightarrow N(a) \leq N (b)$
$\forall a, b \in \mathbb{Z}[i] \hspace{2 mm} b \neq 0 \rightarrow \exists c,r \in \mathbb{Z}[i] \hspace {2 mm}$ so that $\hspace{2 mm} a = bc + r \hspace{2 mm} \text{and} \hspace{2 mm} (r = 0 \hspace{2 mm} \text{or} \hspace{2 mm} r \neq 0 \hspace{2 mm} N(r) \lt N (b) )$

I have that the application meant to be the "norm" goes: $N(a +b i) = a^2 + b^2$, and I've managed to prove the first condition, given that N is a multiplicative function, but I can not find a way to prove the second condition. 
I've search for a similar question but I have not found any so far, please redirect me if there's already a question about this and forgive me for my poor use of latex.

REPLY [7 votes]: Here is an Elegant Proof
It is well known that $(\mathbb{Z}[i]=\{a+bi \mid a,b \in \mathbb{Z}\},+,\cdot )$ in integral domain. Consider, $N:\Bbb Z[i] \to \Bbb N$ defined by
$$\color{blue}{N(z) = z\bar{z}=|z|^2 =a^2+b^2~~~ \text{for}~~z= a+ib.}$$
We want to show that $N$ define an integral function for our Ring $\Bbb Z[i].$

$N(0) = 0$ and $N(z) \gt 0$ for $z\neq  0.$
$z,w,q\in \Bbb Z[i]\setminus\{0\} $ such that $z=wq$ i.e $w|z$ we have $N(q) \gt 0 \implies N(q) \ge 1$ since $N(q) \in \Bbb N$
Then, $$N(w) \le N(w)N(q) = |w|^2|q|^2 = |wq|^2 =N(wq) =N(z)$$

So, if  $w|z$ then  $N(w) \le N(z)$.

Now we want to show the Euclidean division property. we use the following


Lemma: for every $x\in \Bbb R$ there exists a unique $u\in \Bbb Z$ such that $\color{blue}{ |x-u|\le \frac{1}{2}}$
Proof: Let denote by  $\lfloor \ell \rfloor$ is the floor of $\ell$. Then We know that
$$\lfloor x+\frac{1}{2} \rfloor\le x+\frac{1}{2}  \lt \lfloor x+\frac{1}{2}\rfloor +1\implies-\frac{1}{2}\le x -\lfloor x+\frac{1}{2} \rfloor\lt \frac{1}{2} $$
Taking $ u= \lfloor x+\frac{1}{2}$
The uniqueness  follows from the uniqueness of the floor.

Now let  $z,w\in \Bbb Z[i]\setminus\{0\} $ then $\frac{z}{w}$ can be written as
$$\color{red}{ \frac{z}{w}= x+iy :=\frac{z\bar{w}}{|w|^2}~~~~~ \text{with }~~~x,y\in \Bbb Q.}$$
From the Lemma there exist $u,v\in \Bbb Z$ such that
$\color{blue}{ |x-u|\le \frac{1}{2}~~~~\text{and}~~~|y-v|\le \frac{1}{2}}.$
Then,we can write
$$\color{red}{ \frac{z}{w}= x+iy = q +t~~~~~ \text{with }~~~q\in \Bbb Z, t\in \Bbb Q.}$$
Where,  $ \color{blue}{q= u+iv ~~\text{and}~~~t =x-u+i(y-v)}$. Then we have, $$\color{blue}{ z= qw +tw \implies r:= tw = z-qw \in \Bbb Z.}$$
Hence $\color{red}{z= qw +r}$ with $q,r \in \Bbb Z$ with $r=tw$ where we have,
$$\color{blue}{ t =x-u+i(y-v),~~~|x-u|\le \frac{1}{2}~~~~\text{and}~~~|y-v|\le \frac{1}{2}}$$
Which means that, $$N(t) =|x-u|^2+|y-v|^2\le \frac{1}{2}$$
Therefore,
$$ N(r) =N(tw) =N(t)N(w) \le \frac12N(w) \lt N(w)$$
That is $$ \color{red}{N(r)  \lt N(w).}$$

conclusion N is divivion for the Ring $\Bbb Z[i].$