Given $d \equiv 5 \pmod {10}$, prove $\mathcal{O}_{\mathbb{Q}(\sqrt{d})}$ never has unique factorization

With the exception of $d = 5$, which gives $\mathbb{Z}[\phi]$, of course (as was explained to me in another question). I'm not concerned about $d$ negative here, though that might provide a clue I have overlooked.

What I thought about was the fact that $2, 3, 7$ are irreducible in such a domain. But that does not necessarily guarantee that at least one of $6, 14, 21$ is going to have an alternate distinct factorization. I also have this vague inkling that $5$ being prime has something to do with it.


EDIT: Oops, sorry, I forgot to specify $d$ is squarefree. Thank you for forgiving this little mistake.


The following proof uses ideas due to Ennola (Two elementary proofs concerning simple quadratic fields) and Redei (Über die quadratischen Zahlkörper mit Primzerlegung) and can be used to show that a necessary condition for ${\mathbb Q}(\sqrt{m})$ to have unique factorization is that its discriminant is prime or a product of two negative prime discriminants.

Assume that $K = {\mathbb Q}(\sqrt{5m})$ has unique factorization and consider the ideal $P = (5,\sqrt{m})$. Then $P^2 = (5)$. Since $K$ has unique factorization, $P$ is principal, hence there exists $\pi \in {\mathcal O}_K$ with $P = (\pi)$. From $P^2 = (\pi^2) = (5)$ we deduce that there exists a unit $\eta \in {\mathcal O}_K$ with $\pi^2 = 5\eta$.

If $m < 0$, then $\eta = \pm 1$, hence $\sqrt{5} \in K$ or $\sqrt{-5} \in K$: contradiction.

If $m > 0$, then either $\eta = 1$ and $m = 1$, i.e., $K = {\mathbb Q}(\sqrt{5})$, or $\eta \ne 1$. In the second case we have $m > 1$, and we may assume that $\eta$ is the fundamental unit (squares of units may be subsumed into $\pi$). Then there is a prime $q \mid m$, and as above we find that $q\eta = \lambda^2$. This implies $\sqrt{5q} \in K$, hence $K$ is the product of two prime discriminants. In addition, $25N(\eta) = N(5\eta) = N(\pi^2) = 25$ implies that $N\eta = +1$, so the fundamental unit has norm $+1$.

Since $q \equiv 1 \bmod 4$ (discriminants are never $\equiv 3 \bmod 4$) we can write $5q = a^2 + b^2$ with $a$ odd. Setting $\alpha = b + \sqrt{5q}$ and $Q = (a,\alpha)$ we find from $\alpha \alpha' = -a^2$ that $Q^2 = (a^2,2a\alpha,\alpha^2) = (\alpha\alpha',2a\alpha,\alpha^2) = (\alpha)(\alpha',2a, \alpha) = (\alpha)$ since $\alpha$ and $\alpha'$ are coprime as ideals. Since $Q = (\omega)$ is principal, the element $\omega^2/\alpha$ is a unit with negative norm: contradiction.

In the proof we have used that unique factorization holds if and only if $h = 1$. If $P = (5,\sqrt{5m})$ is not principal, then $5 \cdot m = \sqrt{5m} \cdot \sqrt{5m}$ is an example of non-unique factorization. If $P$ is principal (e.g. when $m = 41$), then $-a^2 = (b+\sqrt{5m})(b-\sqrt{5m})$ should give rise to an example of non-unique fasctorization, but I haven't checked the details.


[Now fixed and completed :-)]

I think the following roundabout argument works when $d\equiv 5\pmod{10}$ is square-free.

Assume $d>0$. My solution needs some facts from class field theory, because the basic idea is to show that $K=\Bbb{Q}(\sqrt{d},\sqrt5)$ is a quadratic, unramified, totally real extension of $L=\Bbb{Q}(\sqrt d)$. As $K/L$ is abelian, class field theory then implies that $K$ is contained in the Hilbert class field $H$ of $L$. But it is known that $[H:L]=h$ is the class number of $L$, so we get as a by-product that the class number of $L$ is even. The immediate corollary is that $\mathcal{O}_L$ cannot be a UFD.

Write $d=5a$. The claim follows from a calculation of discriminants, but the details of the calculation differ according to the residue class of $a$ modulo $4$.

Case I. I assume first that $a\equiv-1\pmod4$, or that $d\equiv-5\pmod{20}$. It is well known that $\Delta_{L/\Bbb{Q}}=4d=20a$, because $d\not\equiv1\pmod4$. On the other hand $K$ contains $\Bbb{Q}(\sqrt{5})$ and $\Bbb{Q}(\sqrt{a})$ as subfields. So if we denote $\phi=(1+\sqrt{5})/2$ we know that the $\Bbb{Z}$-span of $S=\{1,\phi,\sqrt a,\phi\sqrt a\}=\{s_1,s_2,s_3,s_4\}$ is contained in $\mathcal{O}_K$. Therefore the determinant of the matrix $A=(tr(s_is_j)_{1\le i,j\le 4})$ has the discriminant $D=\Delta_{K/\Bbb{Q}}$ as a factor. But, unless I made a mistake $$ A=\left(\begin{array}{cccc} 4&2&0&0\\ 2&6&0&0\\ 0&0&4a&2a\\ 0&0&2a&6a\end{array}\right), $$ and this has determinant $400a^2=(4d)^2$. Because the relative discriminant $\Delta_{K/L}$ (necessarily viewed as an ideal) satisfies the relation $$ D=N_{L/\Bbb{Q}}(\Delta_{K/L})(\Delta_{L/\Bbb{Q}})^2=16d^2 N_{L/\Bbb{Q}}(\Delta_{K/L})\mid\det A= 16d^2, $$ we can conclude that $S$ must be an integral basis and that the relative discriminant is $1$. The claim follows.

Case II. Assume next that $a\equiv 1\pmod 4$, $a\neq1$. This time $d\equiv1\pmod4$, and we know that $d(L/\Bbb{Q})=d=5a$. Again $K$ has the subfields $\Bbb{Q}(\sqrt 5)$ and $\Bbb{Q}(\sqrt a)$, but this time both of them have "smaller" algebraic integers. If we abbreviate $\theta=(1+\sqrt a)/2$, we know that $S=\{s_1,s_2,s_3,s_4\}=\{1,\phi,\theta,\phi\theta\}$ is a set of algebraic integers of $K$, linearly independent over $\Bbb{Z}$. This time the matrix $$ A=(tr^K_{\Bbb{Q}}(s_is_j))_{1\le i,j\le4} =\left(\begin{array}{cccc} 4&2&2&1\\ 2&6&1&3\\ 2&1&1+a&\frac{1+a}2\\ 1&3&\frac{1+a}2&\frac{3(1+a)}2\end{array}\right). $$ Again we are lucky, and $\det A=25a^2=d(L/\Bbb{Q})^2.$ The claim follows as in Case I.


A similar argument shows that $\Bbb{Q}(\sqrt{d},i)/\Bbb{Q}(\sqrt d)$ is unramified at all finite primes. Initially I mistakenly thought that this again implies that the Hilbert class field of $\Bbb{Q}(\sqrt d)$ contains $\Bbb{Q}(\sqrt{d},i)$. However, the infinite primes fail here unless we also have $d<0$, so this does not follow (unless $d<0$ which was excluded in the question).


But, the claim also holds when $d<0$. The above calculations of discriminants are immune to the sign of $d$. The only change is in the class field theoretical parts. Because $\Bbb{Q}(\sqrt d)$ is now totally imaginary, the question about the ramification of the infinite prime does not arise at all! The claim holds for all $d\equiv5\pmod {10}, d\neq 5.$


This is an attempt to translate the argument of my "class field theoretic" answer to more elementary language. Leaving both answers here for future reference (mostly for my own benefit, but if you take this as an advertisement, and are encouraged to study class field theory, that will bring joy to my heart). This answer relies on the fact that it suffices to show that the ring of integers is not a PID. For a proof of this fact on-site see this answer.

Dirichlet's result of infinitude of primes in an arithmetic progression is also used - in the much weaker form - I need the existence of a single prime in the progression.

Starting out with the case of a square-free positive $d$, $d\equiv -5\pmod{20}$ - again first an answer that covers only half the possibilities for $d$.

Write $d=5a$. The assumption $d\equiv-5\pmod{20}$ means that $a\equiv3\pmod4$. I claim that there exists a prime $p$ such that both $5$ and $a$ are quadratic non-residues modulo $p$. To this end we need the existence part of Dirichlet's theorem.

Let the prime factorization of $a$ be $a=p_1p_2\cdots p_k$. Because $d=5a$ is square-free, all primes $p_i$ are odd, distinct and $\neq5$. At least one of them is $\equiv 3\pmod4$, so w.l.o.g. we can assume that $p_1\equiv 3\pmod 4$. Consider the following system of congruences $$ \begin{aligned} p&\equiv1\pmod 4,\\ p&\equiv 2\pmod5,\\ p&\equiv -1\pmod {p_1},\\ p&\equiv 1\pmod {p_i},\ \text{for all $i=2,3,\ldots,k$.} \end{aligned} $$ The moduli in this system are pairwise coprime, so by the Chinese Remainder Theorem they are satisfied by a single residue class modulo $20a$. That residue class is clearly coprime to all prime factors of $20a$, so Dirichlet applies. We can thus infer that a prime $p$ satisfying all these congruences exists.

Given all those congruences the law of quadratic reciprocity implies that $5$ and $p_1$ are quadratic non-residues modulo $p$, and all the primes $p_2,p_3,\ldots,p_k$ are quadratic residues modulo $p$ (the first congruence is there simply to ensure that $(-1)^{(p-1)/2}=1$, and hence quadratic reciprocity plays out nicely). By the multiplicativity of the Legendre symbol we then get our claim: $$ \left(\frac5p\right)=-1,\qquad\left(\frac{a}p\right)=-1. $$ A consequence of these is that $\left(\dfrac dp\right)=1$.

This last fact implies that the rational prime ideal $(p)$ splits in $L=\Bbb{Q}(\sqrt d)$. Let $\mathfrak{p}$ be one of the prime ideals of $\mathcal{O}_L$ lying above $p$. I claim that $\mathfrak{p}$ cannot be a principal ideal.

The ring of integers $\mathcal{O}_L$ consists of numbers $z=x+y\sqrt d$ with $x,y\in\Bbb{Z}$. If we make the contrapositive assumption that $\mathfrak{p}=\langle z\rangle$, then a calculation of norms implies that $$ N(z)=x^2-dy^2=x^2-5ay^2=\pm p. $$ But reducing this equation modulo $5$ we get the congruence $$ x^2\equiv\pm2\pmod 5, $$ which we know to be impossible. This is a contradiction, so $\mathfrak{p}$ is not principal, and $\mathcal{O}_L$ is not a PID.