# integral basis of quadratic field

Let $m$ be a squarefree integer $\neq 1$. All numbers of the quadratic field $\mathbb{Q}(\sqrt{m})$ may be written in the form

 $\displaystyle\alpha\;=\;\frac{j+k\sqrt{m}}{l},$ (1)

where $j,\,k,\,l$ are integers with  $\gcd(j,\,k,\,l)=1$  and  $l>0$.  Then $\alpha$ (and its algebraic conjugate$\alpha^{\prime}=\frac{j-k\sqrt{m}}{l}$) satisfies the equation

 $\displaystyle x^{2}+px+q\;=\;0,$ (2)

where

 $\displaystyle p\;=\;-\frac{2j}{l},\qquad q\;=\;\frac{j^{2}-k^{2}m}{l^{2}}.$ (3)

We will find out when the number (1) is an algebraic integer, i.e. when the coefficients $p$ and $q$ are rational integers.

Naturally, $p$ and $q$ are integers always when  $l=1$.  We suppose now that  $l>1$.  The latter of the equations (3) says that $q$ can be integer only when

 $(\gcd(j,\,l))^{2}=\gcd(j^{2},\,l^{2})\mid k^{2}m$

(see divisibility in rings).  Because  $\gcd(j,\,k,\,l)=1$,  we have by Euclid’s lemma that  $\gcd(j,\,l)\mid m$.  Since $m$ is squarefree, we infer that

 $\displaystyle\gcd(j,\,l)=1.$ (4)

In order that also $p$ were an integer, the former of the equations (3) implies that  $l=2$.

So, by the latter of the equations (3),  $4\mid j^{2}\!-\!k^{2}m$, i.e.

 $\displaystyle k^{2}m\equiv j^{2}\pmod{4}.$ (5)

Since by (4),  $\gcd(j,\,2)=1$,  the integer $j$ has to be odd.  In order that (5) would be valid, also $k$ must be odd.  Therefore,  $j^{2}\equiv 1\pmod{4}$  and  $k^{2}\equiv 1\pmod{4}$,  and thus (5) changes to

 $\displaystyle m\equiv 1\pmod{4}.$ (6)

If we conversely assume (6) and that $j,\,k$ are odd and  $l=2$, then (5) is true, $p,\,q$ are integers and accordingly (1) is an algebraic integer.

We have now obtained the following result:

• When  $m\not\equiv 1\pmod{4}$,  the integers of the field $\mathbb{Q}(\sqrt{m})$ are

 $a+b\sqrt{m}$

where $a,\,b$ are arbitrary rational integers;

• when  $m\equiv 1\pmod{4}$,  in to the numbers $a+b\sqrt{m}$, also the numbers

 $\frac{j+k\sqrt{m}}{2},$

with $j,\,k$ arbitrary odd integers, are integers of the field.

Then, it may be easily inferred the

If we denote

 $\omega:=\begin{cases}&\frac{1+\sqrt{m}}{2}\quad\mbox{when }m\equiv 1\pmod{4},% \\ &\sqrt{m}\quad\mbox{ when }m\not\equiv 1\pmod{4},\end{cases}$

then any integer of the quadratic field $\mathbb{Q}(\sqrt{m})$ may be expressed in the form

 $a\!+\!b\omega,$

where $a$ and $b$ are uniquely determined rational integers.  Conversely, every number of this form is an integer of the field.  One says that 1 and $\omega$ form an integral basis of the field.

## References

• 1 K. Väisälä: Lukuteorian ja korkeamman algebran alkeet.  Tiedekirjasto No. 17. Kustannusosakeyhtiö Otava, Helsinki (1950).