TITLE: Why isn't $\mathbb Z [\sqrt{pq}]$ a factorial domain
QUESTION [8 upvotes]: This is exercise 8 on page 147 of Jacobson's Basic Algebra:

Let $p$ be a prime of the form $4n+1$ and let $q$ be a prime such that $ \left( \frac{q}{p} \right) =-1$. Show that $\mathbb Z[\sqrt{pq}]$ is not factorial.

Here, $ \left( \frac{q}{p} \right) =-1$ means that $\overline{q}$ is not a quadratic number in the field $\mathbb Z / (p)$.
In the special case when $p=5$ and $q=2$, $9 = 3 \cdot 3 = (\sqrt{10} +1 )(\sqrt{10 }-1)$, with $3$ and $\sqrt{10} +1$ or $\sqrt{10} - 1$ nonassociates. But I have no idea what can I do with the general case.
I know that primes of the form $4n+1$ can be written in the form $m^2 + n^2$ with $m,n \in \mathbb Z$. But when $q$ is odd and not of the form $4n+1$, $pq$ is not the sum of two quadratic numbers. How can I use the fact $\left( \frac{q}{p} \right) =-1$?
Thanks~

REPLY [13 votes]: $p$ is irreducible: if not, then $x^2 - pqy^2 = \pm p$; cancel $p$ and use the assumption.
On the other hand, $p$ divides $\sqrt{pq} \cdot \sqrt{pq}$, but none of the factors: thus
it is not prime.

REPLY [7 votes]: I like Franz's answer better, but here is what I came up with before I saw his:
By discriminant considerations the prime ideal $p$ ramifies in $R = \mathbb{Z}[\sqrt{pq}]$, so there is a prime ideal $\mathfrak{p}$ of $R$ with norm $p$.  However there is no element of norm $p$: indeed, as in Franz's answer, suppose $x^2 - pqy^2 = \pm p$.  Then $x = pX$, so $pX^2 - qy^2 = \pm 1$.  Reducing modulo $p$ shows that $\pm q$ is a square modulo $p$, but by assumption $q$ is not a square modulo $p$ and since $p \equiv 1 \pmod{4}$, $-1$ is a square modulo $p$, hence also $-q = (-1)(q)$ is not a square modulo $p$.  This shows that $R$ is not a PID.  Since $R$ has dimension one, it is not a UFD.