# The prime number $p$ is prime in $\mathbb{Q}(\sqrt{d})$ iff $d$ is not a quadratic residue modulo p

Theorem. The prime number $$p$$ is prime in $$\mathbb{Q}(\sqrt{d})$$ iff $$d$$ is not a quadratic residue modulo p.

Since this theorem has two directions, we have to prove two things. One way to do that is to assume that $$d$$ is quadratic residue, and to get the contradiction. My question is about the second part, about assuming that $$p$$ is not prime. I found the proof where it is said the following:

Assume that $$p$$ is not prime. Then, $$p$$ is not irreducible, so, there are $$u,v \in \mathbb{Q}(\sqrt{d})$$ such that $$p=uv$$ and $$u,v$$ are not unit elements. I won't continue writing this proof if it's not necessary, I have only one question: how come we concluded: $$p$$ is not prime $$\Rightarrow$$ $$p$$ is not irreducible? I know about the theorem that says that any prime in $$\mathbb{Q}(\sqrt{d})$$ is irreducible, but not vice versa. Can vice versa work in $$\mathbb{Q}(\sqrt{d})$$? Thank you.

• Note: Prime implies irreducible, but in rings of the form $\mathbb{Q}(\sqrt{d})$, irreducible does not necessarily imply prime. A standard example is $1+\sqrt{-5}$ in $\mathbb{Z}(\sqrt{-5})$, since $2\times 3 = (1+\sqrt{-5})(1+\sqrt{-5})$, and all of the factors are irreducible in the ring of integers $\mathbb{Z}(\sqrt{-5})$. Aug 21, 2019 at 16:53
• I thought the same, then the proof is not right?
– user672596
Aug 21, 2019 at 16:54
• P.S. I assume it means “in the ring of integers of $\mathbb{Q}(\sqrt{d})$”.... Aug 21, 2019 at 16:54
• @karim-ashli: That’s related to my comment: in a field, every nonzero element is a unit, so nothing is a prime at all. So presumably the problem is actually asking about primes in the ring of integers of $\mathbb{Q}(\sqrt{d})$, rather than in $\mathbb{Q}(\sqrt{d})$ itself. Aug 21, 2019 at 17:01
• (@Karim-ashli: Note that you are missing “is not zero and is not a unit” in your definition of prime). Aug 21, 2019 at 17:01

$$\Bbb{Q}(\sqrt{d})$$ is a field it has no non-trivial (prime) ideal.
For $$d \in \Bbb{Z}, \not \in \Bbb{Z}^2$$ then $$(p)$$ is a prime ideal of $$R=\Bbb{Z}[\sqrt{d}] =\Bbb{Z}[x]/(x^2-d)$$ iff $$R/(p) = \Bbb{F}_p[x]/(x^2-d)$$ is an integral domain iff $$x^2-d \in \Bbb{F}_p[x]$$ is irreducible iff $$d$$ is a quadratic non-residue $$\bmod p$$.
With $$d = m^2 D$$ where $$D$$ is squarefree the ring of integers of $$\Bbb{Q}(\sqrt{d})$$ is $$\Bbb{Z}[\sqrt{D}]$$ or $$\Bbb{Z}[\frac{1+\sqrt{D}}{2}]$$, in the latter case there is the additional case of $$(2)$$ which is a prime ideal because $$x^2+x+1 \in \Bbb{F}_2[x]$$ is irreducible.