## A basis of algebraic integers need not be an integral basis

Exhibit a basis for an algebraic extension $\mathbb{Q}(\theta)$ which consists of integers but which is not integral.

Suppose $D$ is a squarefree integer congruent to 1 mod 4 and consider $\mathbb{Q}(\sqrt{D})$. Certainly $\{1, \sqrt{D}\}$ is a basis of this field extension of $\mathbb{Q}$. Moreover, both 1 and $\sqrt{D}$ are algebraic integers (trivially and via $x^2 - D$, respectively).

However, note that $\frac{1}{2} + \frac{1}{2} \sqrt{D}$ is an algebraic integer, since it is a root of $p(x) = x^2 - x + \frac{1-D}{4}$. It is not, however, a $\mathbb{Z}$-linear combination of $\{1,\sqrt{D}\}$. So this basis is not integral.