# Algebraic integers in quadratic extensions of rationals

I have this problem: if we have quadratic extension $\;\Bbb Q(\sqrt D)/Q\;$ and $\;D\in \Bbb N\;$ isn't divisible by squares, I know what is the ring of integer elements in extension depending of $\;D\;$ modulo $\;4\;$ , but I read the next: if $\;a+b\sqrt D\;$ is integer, then trace and norm are integers, so $$2a\in \Bbb Z\;,\;\;a^2-Db^2\in \Bbb Z$$

* This is good, but they say now that since $\;D\;$ has no squares then $\;a\in \Bbb Z\iff b\in\Bbb Z\;$ , and I can't understand this part *.

I know that $\;a\;$ must be a half integer, so $\;a=\frac n2\;,\;\;n\in\Bbb Z\;$ , but why $\;D\;$ isn't divisible by square gives us the above equivalence?

• Assuming $2a \in \mathbb{Z}, a^2-D b^2 \in \mathbb{Z}$ then $a \in \mathbb{Z} \Leftrightarrow b \in \mathbb{Z}$ – reuns Feb 14 '17 at 10:39

If $a$ is an integer, $a^2$ is also an integer, hence $Db^2$ is an integer. If $b$ is no integer, the denominator of $b^2$ contains a square, which cannot be canceled by the virtue of $D$, since $D$ is square-free by assumption. This is a contradiction.
The converse direction is even easier: If $b$ is an integer, $Db^2$ is an integher, hence $a^2$ is an integer. Then $a$ must be an integer, too.
• The property $\,D\left(\dfrac{m}n\right)^2\!\in \Bbb Z\,\Rightarrow\dfrac{m}n\in\Bbb Z\,$ characterizes squarefree numbers $\,D,\,$ see property (2) here. – Bill Dubuque Feb 14 '17 at 15:17