## Compute the discriminant of a basis for a given ideal in a quadratic integer ring

Let $\mathcal{O}$ be the ring of integers in $\mathbb{Q}(\sqrt{D})$. Find a basis for the ideal $(4)$ over $\mathbb{Z}$. Then compute the discriminant of this basis.

Suppose first that $D \not\equiv 1$ mod 4.

Note that $(4) = \{4a + 4b\sqrt{D} \ |\ a,b \in \mathbb{Z} \}$. We claim that $\{4,4\sqrt{D}\}$ is a basis for $(4)$. Certainly $(4,4\sqrt{D})_\mathbb{Z} = (4)$. Now if $4a+4b\sqrt{D} = 0$ and $b \neq 0$, then $\sqrt{D} = -a/b$ is rational, a contradiction. So $4a = 0$, and $a = b = 0$. So $\{4,4\sqrt{D}\}$ is a basis for $(4)$ over $\mathbb{Z}$. Evidently, the discriminant of this basis is $\Delta[4,4\sqrt{D}] = 1024D$. Recall from Theorem 6.11 in TAN that the discriminant of $\mathbb{Q}(\sqrt{D})$ is $\Delta_\mathcal{O} = 4D$. Thus $\Delta[4,4\sqrt{D}] = 16^2 \Delta_\mathcal{O}$.

Now suppose $D \equiv 1$ mod 4.

Now $(4) = \{ 4a + 2b(1+\sqrt{D}) \ |\ a,b \in \mathbb{Z}\}$. We claim that $\{4,2+2\sqrt{D}\}$ is a basis. Certainly $(4,2+2\sqrt{D})_\mathbb{Z} = (4)$. If $4a + 2b + 2b\sqrt{D} = 0$ and $b \neq 0$, then $-(2a+b)/b = \sqrt{D}$, a contradiction. So $b = 0$, and thus $a = b = 0$. Hence $\{4,2+2\sqrt{D}\}$ is a basis for $(4)$. Evidently the discriminant of this basis is $\Delta[4,2+2\sqrt{D}] = 256D$. Again recall from Theorem 6.11 in TAN that $\Delta_\mathcal{O} = D$; hence $\Delta[4,2+2\sqrt{D}] = 16^2 \Delta_\mathcal{O}$.