+ a^2 - nb^2. \] You need the coefficients $-2a$ and $a^2 - nb^2$ to lie in $\mathbf Z$. (You might recognize these as the trace and norm .) If this is the case, then as $(2a)^2 - n(2b)^2$ is an integer (divisible by $4$) and $n$ is squarefree, it follows