Defining $\mathcal{O}$ to be the set of all $x \in \mathbb{Q}(\sqrt{D})$, for $D$ a square-free integer, such that the minimal polynomial has coefficients in $\mathbb{Z}$.
I have to show that $\mathcal{O}$ = $\mathbb{Z}[\omega]$ for $$\omega = \begin{cases} \sqrt{D}, & \text{if $D \equiv 2,3 \pmod 4$} \\ \frac{1+\sqrt{D}}{2}, & \text{if $D \equiv 1 \pmod 4$} \end{cases}$$
I was wondering if there were any holes in my proof and any feedback would be appreciated.
Given the minimal polynomial $x^2 -2ax+(a^2-b^2 D)$ of an arbitrary element $a+b\sqrt{D} \in \mathbb{Q}(\sqrt{D})$, the definition requires $2a \in \mathbb{Z}$ and $a^2 -b^2 D \in \mathbb{Z}$. Therefore $a=\frac{i}{2}$ for some $i \in \mathbb{Z}$. We can replace the $a$'s equivalent in the second equation to get $\frac{i^2}{4} -b^2D= j$ for some $j \in \mathbb{Z}$, which after rearranging terms and multiplying both sides by $4$
$$i^2 -4j=4b^2D =k \in \mathbb{Z}$$
because $i,j \in \mathbb{Z}$. $D|k$. $b^2 = \frac{k'}{4}$ and $b=\frac{i'}{2}$ for some $i' \in \mathbb{Z}$, and $\mathcal{O} \subseteq \mathbb{Q}(\sqrt{D})$ must be elements of the form $\frac{i}{2}+\frac{i'}{2}\sqrt{D}$ for $i,i' \in \mathbb{Z}$.
For simplicity I switched $i$ and $i'$ to $a$ and $b\in \mathbb{Z}$, and then I calculated the minimal polynomial of $\frac{a}{2}+\frac{b}{2}\sqrt{D}$ $$x^2 -ax +\frac{a^2-b^2D}{4}$$ where the last term being in $\mathbb{Z}$ implies $a^2 \equiv Db^2 \pmod4$, and with the added knowledge that $z^2 \equiv 0,1 \pmod 4$ for $z \in \mathbb{Z}$:
- $D \equiv 1 \pmod 4$ then $a^2 \equiv b^2 \pmod 4$ $a,b$ are both even or odd.
- $D \equiv 2,3 \pmod 4$ then $a^2 \equiv (2,3) b^2 \equiv 0 \pmod 4$ since $a^2 \equiv 0,1 \pmod 4$ thus $a,b$ must both be even.
Thus if $D \equiv 2,3 \pmod 4$ then we must have elements of the form $a' + b'\sqrt{D}$ for $a',b' \in \mathbb{Z}$.
If $D\equiv 1 \pmod 4$ then we also have elements of that form $a' + b'\sqrt{D}$ but also elements of the form
$$\frac{2i+1}{2}+\frac{2i'+1}{2}\sqrt{D} = (i -i') +(2i'+1)\frac{1+\sqrt{D}}{2}$$
and noting that $$a'+b'\frac{1+\sqrt{D}}{2} = a'+\frac{b'}{2}+\frac{b'}{2}\sqrt{D} \equiv (c\in\mathbb{Z})+(d\in \mathbb{Z})\sqrt{D}$$ for $b$ even, every form is included in rewriting elements for $D \equiv 1 \pmod 4$ in the form $a'+b'\frac{1+\sqrt{D}}{2}$ for $a', b' \in \mathbb{Z}$.