## If possible, exhibit an integral basis for a quadratic field whose elements are conjugate

If possible, exhibit and integral basis for $\mathbb{Q}(\sqrt{D})$ whose elements are conjugate for $D \in \{ -3,-1,5\}$.

Let $D$ be a squarefree integer, and let $\omega = \sqrt{D}$ if $D \not\equiv 1$ mod 4 and $(1+\sqrt{D})/2$ if $D \equiv 1$ mod 4. Recall that the integers in $\mathbb{Q}(\sqrt{D})$ have the form $a+b\omega$ where $a,b \in \mathbb{Q}$. Let $\overline{\omega} = -\sqrt{D}$ if $D \not\equiv 1$ mod 4 and $(1-\sqrt{D})/2$ if $D \equiv 1$ mod 4. Note that $\omega\overline{\omega} = -D$ if $D \not\equiv 1$ mod 4 and $(1-D)/4$ if $D \equiv 1$ mod 4 (so that $\omega\overline{\omega} \in \mathbb{Z}$), that $\omega + \overline{\omega} = 0$ if $D \not\equiv 1$ mod 4 and $1$ if $D \equiv 1$ mod 4, and that $\omega - \overline{\omega} = 2\omega$ if $D \not\equiv 1$ mod 4 and $2\omega - 1$ if $D \equiv 1$ mod 4.

Note that $p(x) = (x - (a+b\omega))(x - (a+b \overline{\omega})) = x^2 - 2ax + (a^2 + ab(\omega+\overline{\omega}) + \omega\overline{\omega}b^2 \in \mathbb{Z}[x]$. In particular, if $b \neq 0$ then $p(x)$ is the minimal polynomial of $a+b\omega$, so that the conjugates of $a+b\omega$ are itself and $a+b\overline{\omega}$.

Recall that the discriminant of $\mathbb{Q}(\sqrt{D})$ is $4D$ if $D \not\equiv 1$ mod 4 and $D$ if $D \equiv 1$ mod 4, and that any integral basis will have this discriminant.

Suppose now that $B = \{a+b\omega, a+b\overline{\omega}\}$ is an integral basis of $\mathbb{Q}(\sqrt{D})$, with $b \neq 0$ and $a \neq 0$. (Certainly if $b = 0$ then $B$ cannot be a basis, much less an integral basis; if $a = 0$, then (for example) we cannot generate 1.) Note that $a,b \in \mathbb{Z}$. Then we must have

$\mathsf{det} \left( \left[ \begin{array}{cc} a+b\omega & a + b\overline{\omega} \\ a + b\overline{\omega} & a+b\omega \end{array} \right] \right)^2 = \left\{ \begin{array}{crl} 4D & \mathrm{if} & D \not\equiv 1 \mod 4 \\ D & \mathrm{if} & D \equiv 1 \mod 4. \end{array} \right.$

Note that $(\omega - \overline{\omega})^2 = 4D$ if $D \not\equiv 1$ mod 4 and $D$ if $D \equiv 1$ mod 4. Evidently, this determinant is $(\omega - \overline{\omega})^2 b^2 (2a + b(\omega+\overline{\omega}))^2$, and so we have $(2a + b(\omega + \overline{\omega}))^2 = 1$.

If $D \not\equiv 1$ mod 4, then $\omega+\overline{\omega} = 0$, and we have $4a^2 = 1$. This equation has no solutions in $\mathbb{Z}$, and thus $\mathbb{Q}(\sqrt{D})$ does not have an integral basis whose elements are conjugate.

If $D \equiv 1$ mod 4, then $\omega + \overline{\omega} = 1$, and we have $(2a+b)^2 = 1$, so that $2a+b = \pm 1$. This gives a necessary condition on $a$ and $b$ if we wish $B$ to be an integral basis.

Recall that $\{1,\omega\}$ is an integral basis of $\mathbb{Q}(\sqrt{D})$. If $\{\alpha, \beta\}$ is another integral basis, then there is a (unique) invertible matrix $P$ such that $P[1\ \omega]^\mathsf{T} = [\alpha\ \beta]^\mathsf{T}$. Say $P = \left[ \begin{array}{cc} x & y \\ z & w \end{array} \right]$, $\alpha = a+b\omega$, and $\beta = a+b\overline{\omega}$; comparing coefficients, and recalling that $\overline{\omega} = 1 - \omega$ (since $D \equiv 1$ mod 4), we have $P = \left[ \begin{array}{cc} a & b \\ a+b & -b \end{array} \right]$. Computing the determinant, we have $-b(2a+b) = \pm 1$. Combined with our necessary condition, $b = \pm 1$. If $b = 1$, then $a = -1$, and if $b = -1$, then $a = 1$. Thus our only candidates for $B$ are $B_1 = \{ -1+\omega, -1+\overline{\omega}\}$ and $B_2 = \{ 1-\omega, 1-\overline{\omega}\}$. Or, in terms of $\omega$, $B_1 = \{-1+\omega,\omega\}$ and $B_2 = \{1-\omega,\omega\}$. It is easy to see that both $B_1$ and $B_2$ are integral bases.

To summarize, if $D \equiv 1$ mod 4, then $\pm B$ is an integral basis whose elements are conjugate, where $B = \{1-\omega,\omega\}$. If $D \not\equiv 1$ mod 4, then no such integral basis exists.