Let $D$ be a squarefree integer and consider the ring $\mathbb{Z}[\omega]=\{a+b\omega: a,b \in \mathbb{Z}\}$ with
$$\omega = \begin{cases}\sqrt{D} \quad D \equiv_4 2,3\\ 1/2(1+\sqrt{D}) \quad D \equiv_4 1\end{cases}$$
I'm trying to show that every element in this ring has a unique representation of the form $a+b\omega$. For this, it sufficies to show that
$$a+b\omega = 0 \implies a = 0 = b$$
Here is my proof:
Suppose $b \neq 0$ and thus also $a \neq 0$. By dividing out common factors, we may assume that $(a,b) = 1$ and $b \geq 1$. Let's consider the case $D \equiv_4 2,3$.
We then see that $a= -b\sqrt{D}$ and hence $D = (a/b)^2$. It is not possible that $b = 1$, or this would imply that $D$ is not squarefree. Thus $b > 1$ and $a/b$ is a real fraction (we can't divide out the denominator because $a$ and $b$ have no common factors). Hence, $(a/b)^2$ is a real fraction (squaring does not introduce new factors that can be canceled out). This contradicts the assumption that $D$ is an integer.
Is this correct? It looks like I'm overcomplicating things.
Let's now look at the case that $D \equiv_4 1$. Then we have
$$2a= -b(1+ \sqrt{D}) = -b -b\sqrt{D}\implies \left(\frac{2a+b}{b}\right)^2 = D$$
and then I'm stuck. Any ideas?