Why is $\mathbb{Z}[\sqrt{-4}] = \mathbb Z[2i]$ not a UFD? 
Why is $\mathbb{Z}[\sqrt{-4}] = \mathbb Z[2i]$ not a UFD?   

$\mathbb Z[2i] = {a+bi}$ where $b$ is even. How do I show this since $4$ is not square-free? 
 A: Alternatively, you can exhibit an irreducible element which is not prime. It is easy to check that $2i$ is irreducible, but it is not prime, since $2i\mid 4=2\times 2$ but $2i\nmid 2$. 
A: $$-4=-2*2$$
$$-4=2i*2i$$
First, we need to show these are irreducible factorizations, so we need to show $2$, $-2$, and $2i$ are irreducible. Notice that $\lvert z \rvert=2$ is true for all of these complex numbers, so we'll simply prove it for that case. Let's say we have the following for $a, b, c, d \in \Bbb{Z}$:
$$z=(a+2bi)(c+2di)$$
We need to show that either $a+2bi$ or $c+2di$ is a unit. Take the modulus of both sides:
$$2=\sqrt{a^2+4b^2}\sqrt{c^2+4d^2}=\sqrt{a^2c^2+4a^2d^2+4b^2c^2+16b^2d^2}$$
Square both sides.
$$4=a^2c^2+4a^2d^2+4b^2c^2+16b^2d^2$$
If both $b$ and $d$ are non-zero, then clearly, the right side is going to greater than $4$ because of the $16b^2d^2$, so either $b=0$ or $d=0$. Without loss of generality, say $b=0$.
$$4=a^2c^2+4a^2d^2=a^2(c^2+4d^2)$$
If $\lvert d \rvert > 1$, then $4d^2 > 4$, making the whole right side greater than $4$, so either $d=0$ or $d=\pm 1$. If $d=0$, then we have $4=a^2c^2$, so $\pm 2=\pm ac$. Since $\pm 2$ are prime in $\Bbb{Z}$, $\pm ac$ must be a trivial product. On the other hand, if $d=\pm 1$, then we have $4=a^2(c^2+4)=a^2c^2+4a^2$. Clearly, $4a^2 \geq 4$, but the left-hand side equals $4$, we also have $4a^2 \leq 4$, meaning $4a^2=4$ and $a=1$. Thus, this is also a trivial product. This shows that all cases lead to a trivial product, so $2$, $-2$, and $2i$ are irreducible in $\Bbb{Z}[2i]$.
Now, we need to show that these factorizations are different up to associates. We can show this by contradiction. Assume $2ia=-2$ and $2ib=2$ for some units $a, b \in \Bbb{Z}[2i]$. If this is generalized to $\Bbb{Q}[i]$, we can use the properties of a field to show that $a=i$ and $b=-i$ are the only possibilities. However, these elements have odd coefficients of $i$ and are therefore not in $\Bbb{Z}[2i]$. Thus, we have a contradiction and these two factorizations must be different.
Since $-4$ has multiple factorizations that are not associates of each other, $\Bbb{Z}[2i]$ is not a UFD.
(Also, the first factorization is only possible because $4$ is a perfect square.)
A: One can show that a UFD is integrally closed in its field of fractions (see here for a proof).  Note that the field of fractions of $\mathbb{Z}[2i]$ is $\mathbb{Q}(i)$.  Since $i \in \mathbb{Q}(i)$ satisfies the monic polynomial $x^2 + 1$, then it is integral over $\mathbb{Z}[2i]$ (and even over $\mathbb{Z}$).  However, $i \notin \mathbb{Z}[2i]$ so $\mathbb{Z}[2i]$ is not integrally closed, hence is not a UFD.
