TITLE: Unique factorization in $\mathbb Z(\sqrt{-19})$
QUESTION [7 upvotes]: An elementary confusion about class number: 
In $\mathbb Z(\sqrt{-19})$ we have $N(1+\sqrt{-19}) = (1+\sqrt{-19})(1-\sqrt{-19}) = 2^2\cdot 5.$ 
I see that 2 and 5 are irreducible, 4 is not. 
In a UFD a non-zero, non-unit element can be factored uniquely (up to associates) as a finite product of irreducibles. What is it about the two factorizations of 20 above that prevents them from being non-trivial distinct factorizations into a finite product of irreducibles? 
Thank you.

REPLY [4 votes]: I'm going to try to take your question more literally than the others who've answered so far. I'm going to assume that by "$\mathbb{Z}(\sqrt{-19})$" you mean only the numbers of the form $a + b \sqrt{-19}$, where $a$ and $b \in \mathbb{Z}$. (I can't remember if it's in Stewart & Tall's book on the Fermat-Wiles theorem or maybe Watkins that there's a similar exercise with numbers of the form $a + b \sqrt{5}$, but the notation used for the ring is definitely not "$\mathbb{Z}(\sqrt{5})$").
In "$\mathbb{Z}(\sqrt{-19})$", the $\mathbb{Z}$-primes $2, 3, 5, 7, 11, 13, 17$ must be inert, $19$ ramifies (as $(-1)(\sqrt{-19})^2$, $23$ splits as $(2 - \sqrt{-19})(2 + \sqrt{-19})$ and after that the others might either split or stay inert. The factorization of $20$ from $\mathbb{Z}$ carries over to "$\mathbb{Z}(\sqrt{-19})$": $20 = 2^2 \times 5$, with three prime factors.
But as you noticed, $20$ also splits as $(1 - \sqrt{-19})(1 + \sqrt{-19})$. These two factors are irreducible in "$\mathbb{Z}(\sqrt{-19})$". I leave this to you to check, but I will tell you that they are not associates of either $2$ or $5$: $\frac{1 - \sqrt{-19}}{2}$ is outside of "$\mathbb{Z}(\sqrt{-19})$", as is $\frac{1 - \sqrt{-19}}{5}$.
The inescapable conclusion here is that this "$\mathbb{Z}(\sqrt{-19})$" is not a unique factorization domain and its class number can't be $1$ (or $2$ for that matter). Understandably confusion will arise when you look up $-19$ in a table of class numbers for quadratic rings and see a $1$ rather than $3$ or higher.
That's because they're not talking about "$\mathbb{Z}(\sqrt{-19})$". They're talking about all numbers of the form $n = a + b \sqrt{-19}$, where $a$ and $b \in \mathbb{Q}$ (not just $\mathbb{Z}$) such that $n$ is an algebraic integer. This concept of algebraic integers is very important in algebraic number theory.
The ring of algebraic integers within $\mathbb{Q}(\sqrt{-19})$ may be notated a few different ways: $\mathcal{O}_{\mathbb{Q}(\sqrt{-19})}$, $\textbf{Z}\left[ \frac{1 - \sqrt{-19}}{2} \right]$, $\mathbb{Z}\left[ \frac{1}{2} + \frac{\sqrt{-19}}{2} \right]$, etc. Some may first define $K = \mathbb{Q}(\sqrt{-19})$ and then refer to $\mathcal{O}_K$. Others may define $u = \frac{1 + \sqrt{-19}}{2}$ and then refer to $\mathbb{Z}[u]$. The important point is to show that you're aware of numbers of the form $\frac{a}{2} + \frac{b \sqrt{-19}}{2}$.