For which $d \in \mathbb{Z}$ is $\mathbb{Z}[\sqrt{d}]$ a unique factorization domain?

Is there a general criterion which tells me whether $\mathbb{Z}[\sqrt{d}]$, $d \in \mathbb{Z}$ is a unique factorization domain?

$\mathbb{Z}[\sqrt{-5}]$ is a frequent example for non-unique factorization domains because 6 has two different factorizations. $\mathbb{Z}[\sqrt{-1}]$ on the other hand is a Euclidean domain. But I'm not even sure about simple examples like $\mathbb{Z}[\sqrt{2}]$.


The general criterion is that no number can be found with more than one valid, distinct factorization. This might sound like I'm merely rephrasing the question, but it's actually a reframing of the question.

Plenty of numbers (infinitely many, to be precise) in $\mathbb{Z}[\sqrt{-5}]$ have more than one factorization. $6$ is just the easiest to find. To oversimplify matters, your main concern is with the "natural" primes from 2 to $p < 4|d|$ or $p \leq d$ as needed.

Now, the case of $\mathbb{Z}[\sqrt{2}]$ is actually more complicated than you might realize. Part of the complication is that $\sqrt{2}$ is a real number and so $\mathbb{Z}[\sqrt{2}]$ has infinitely many units. This sets up the trap of infinitely many factorizations that are not distinct because they involve multiplication by units, e.g., $$7 = (3 - \sqrt{2})(3 + \sqrt{2}) = (-1)(1 - 2\sqrt{2})(1 + 2\sqrt{2}) = (5 - 3\sqrt{2})(5 + 3\sqrt{2}) = \ldots$$

But $7$ really does have only one distinct factorization in $\mathbb{Z}[\sqrt{2}]$, as you can see by dividing these numbers by $1 + \sqrt{2}$, and $\mathbb{Z}[\sqrt{2}]$ really is a UFD. But the full explanation may require me to make several assumptions about what you know.

Let's look at a "simpler" domain, $\mathbb{Z}[\sqrt{10}]$, though it certainly has some of the same traps as $\mathbb{Z}[\sqrt{2}]$: $$31 = (-1)(3 - 2\sqrt{10})(3 + 2\sqrt{10}) = (11 - 3\sqrt{10})(11 + 3\sqrt{10}) = (-1)(63 - 20\sqrt{10})(63 \ldots$$

You have to look at numbers that are already composite in $\mathbb{Z}$ to begin with. And if $d = pq$, where $p$ and $q$ are distinct primes, the choice of where to look first is obvious: $$10 = 2 \times 5 = (\sqrt{10})^2.$$

Verify that $$\frac{\sqrt{10}}{2} \not\in \mathbb{Z}[\sqrt{10}], \frac{\sqrt{10}}{5} \not\in \mathbb{Z}[\sqrt{10}], \frac{2}{\sqrt{10}} \not\in \mathbb{Z}[\sqrt{10}], \frac{5}{\sqrt{10}} \not\in \mathbb{Z}[\sqrt{10}].$$ This means that $\mathbb{Z}[\sqrt{10}]$ is not UFD and we didn't need to compute any logarithms or sines to come to this conclusion. (You're starting to see why integral closure matters in making these determinations, right?)

Contrast $\mathbb{Z}[\sqrt{6}]$: $$6 = (2 - \sqrt{6})(2 + \sqrt{6})(3 - \sqrt{6})(3 + \sqrt{6}) = (\sqrt{6})^2$$ but $$\frac{\sqrt{6}}{2 + \sqrt{6}} = 3 - \sqrt{6}$$ and so on and so forth. This means that $6 = (\sqrt{6})^2$ is an incomplete factorization, just as, say, $81 = 9^2$ is in $\mathbb{Z}$. But this is not enough to prove that $\mathbb{Z}[\sqrt{6}]$ is or is not UFD.

As it turns out, both $\mathbb{Z}[\sqrt{2}]$ and $\mathbb{Z}[\sqrt{6}]$ are UFDs, and what is probably the simplest, most common way of proving this requires a full understanding of ideals. Adapting the proof that $\mathbb{Z}$ is a UFD to these domains can be done, but that has its own pitfalls.


Yes, there is. But first there is the matter of integral closure (I prefer to think of it as "completeness") to attend to. If $d \equiv 1 \pmod 4$, then you need $\frac{1 + \sqrt{d}}{2}$ instead of $d$. For example, with $d = 13$, $1 + \sqrt{13}$ is an algebraic integer, but so is $\frac{1 + \sqrt{13}}{2}$. For fun, try this in your calculator: $$\left(\frac{1 - \sqrt{13}}{2}\right)\left(\frac{1 + \sqrt{13}}{2}\right) = ?$$


The criterion is $h(4d) = 1$ if $d \not \equiv 1 \pmod 4$, $h(d) = 1$ if so. $h(d)$ is a function that tells you the class number of $\mathcal{O}_{\textbf{Q}(\sqrt{d})}$. I now quote the formula for $h(d)$ from Mathworld: if $d$ is positive, $$h(d) = -\frac{1}{2 \log \eta(d)} \sum_{r = 1}^{d - 1} \left(\frac{d}{r}\right) \log \sin \left(\frac{\pi r}{d}\right),$$ see http://mathworld.wolfram.com/ClassNumber.html for a full explanation of this, make sure to substitute $4d$ as needed. That also gives the formula for $d$ negative, but since there are only nine such values...