2 Ring of Integers of a Quadratic Field (Human-Oriented)
Let \(d\) be an integer different from \(0\) and \(1\). We also assume that \(d\) is squarefree. We write \(K\) for the subring of \(\mathbb {C}\) generated by \(\sqrt{d}\). By our assumptions on \(d\), we have that \(K = \mathbb {Q}(\sqrt{d})\) is a field.
We have that \(d = \pm 1 \bmod 4\) or \(d = 2 \bmod 4\).
If \(d = 0 \bmod 4\) then \(d\) would not be squarefree.
We have that \(\sqrt{d} \in \mathcal{O}_K\).
Clear since \(\sqrt{d}\) is a root of \(x^2-d\).
If \(d = 1 \bmod {4}\) then \(\frac{1+\sqrt{d}}{2} \in \mathcal{O}_K\).
Write \(d = 4a + 1\), with \(a \in \mathbb {Z}\). Then \(\frac{1+\sqrt{d}}{2}\) is a root of \(x^2 - x - a \in \mathbb {Z}[x]\).
Let \(t \in K\), so \(t = a + b \sqrt{d}\) for some \(a, b \in \mathbb {Q}\). We assume that \(t \notin \mathbb {Q}\), i.e. that \(b \neq 0\).
The minimal polynomial of \(t\) over \(\mathbb {Q}\) is
It’s clear that \(t\) is a root of \(P\) and that \(P \in \mathbb {Q}[x]\) is monic.
Irreducibility follows by the fact that \(P\) has a root that is not rational.
We have that the trace of \(t\) is \(2a\).
Clear by Lemma 30.
We have that the norm of \(t\) is \(a^2-db^2\).
Clear by Lemma 30.
We suppose now that \(t \in \mathcal{O}_K\).
We have that \(2a \in \mathbb {Z}\)
Since the trace of an algebraic integer is an integers, this follows by Lemma 31.
We have that \(a^2-db^2 \in \mathbb {Z}\)
Since the norm of an algebraic integer is an integers, this follows by Lemma 32.
We have that \((2a)^2 - d(2b)^2\) is an integer divisible by \(4\).
Clear since \((2a)^2 - d(2b)^2 = 4(a^2-db^2)\) and \(a^2-db^2 \in \mathbb {Z}\) by Lemma 34.
We have that \(2b \in \mathbb {Z}\).
If \(a \in \mathbb {Z}\) then \(b \in \mathbb {Z}\).
By Lemma 35 and our assumption, both \((2a)^2\) and \((2a)^2 - d(2b)^2\) are integers divisible by \(4\), so the same holds for \(d(2b)^2\). In particular \(db^2 \in \mathbb {Z}\) and \(b \in \mathbb {Z}\) since \(d\) is squarefree.
If \(a \not\in \mathbb {Z}\) then \(d = 1 \bmod {4}\).
Assume that \(d = 2 \bmod {4}\) or \(d = 3 \bmod {4}\). Then
By Lemma 28 we know that \(\mathbb {Z}[\sqrt{d}] \subseteq \mathcal{O}_K\). Let \(t = a + b \sqrt{d} \in \mathcal{O}_K\), with \(a, b \in \mathbb {Q}\). By Lemma 38 we have that \(a \in \mathbb {Z}\) (since by Lemma 27 we cannot have \(d = 1 \bmod {4}\)), and so by Lemma 37 we have \(b \in \mathbb {Z}\), so \(t \in \mathbb {Z}[\sqrt{d}]\).
Assume that \(d = 1 \bmod {4}\) and take \(t = a + b \sqrt{d} \in \mathcal{O}_K\) with \(a, b \in \mathbb {Q}\). If \(a \in \mathbb {Z}\) then \(t \in \mathbb {Z}\left[ \frac{1+\sqrt{d}}{2} \right]\).
By Lemma 37 we have that \(b \in \mathbb {Z}\) and so \(t \in \mathbb {Z}[\sqrt{d}] \subseteq \mathbb {Z}\left[ \frac{1+\sqrt{d}}{2} \right]\).
Assume that \(d = 1 \bmod {4}\). Then
By Lemma 29 we know that \(\mathbb {Z}\left[ \frac{1+\sqrt{d}}{2} \right] \subseteq \mathcal{O}_K\). Let \(t = a + b \sqrt{d} \in \mathcal{O}_K\), with \(a, b \in \mathbb {Q}\).
If \( a \in \mathbb {Z}\) we conclude by Lemma 39.
If \(a \notin \mathbb {Z}\), let us consider
\[ t' = t - \frac{1+\sqrt{d}}{2} = a - \frac{1}{2} + \left( b - \frac{1}{2} \right) \sqrt{d} \in \mathcal{O}_K \]Since \(2a \in \mathbb {Z}\) and \(a \notin \mathbb {Z}\), we have that \(a - \frac{1}{2} \in \mathbb {Z}\), so by Lemma 39, we have that \(t' \in \mathbb {Z}\left[ \frac{1+\sqrt{d}}{2} \right]\) and so \(t \in \mathbb {Z}\left[ \frac{1+\sqrt{d}}{2} \right]\).