# Give a basis for the ring of integers for K, a finite extension of Q in C

This question concerns the diophantine equation $$x^2+87y^2=47z^2$$ we set $K=\mathbb{Q}(\sqrt{-89})$. Define the ring of integers $o_{K}$ of K and give a $\mathbb{Z}$-basis of the form {$1,\alpha$} for $o_K$.

So far I have not fully gained an understanding of how I can get this basis, so any help is appreciated. I have defined the ring of integers of $K$, but I am not sure if it would be sufficient of me just to say ring of integers of $K$ is $o_{K} = K\cap\Omega$, the set of algebraic integers in $K$. Any help is appreciated.

In general, finding an explicit $\mathbb Z$-basis for $K$ can be very tricky. However, in this case, where $K$ is a quadratic (degree $2$) extension of $\mathbb Q$, we can write down a basis explicitly, in a form that will depend on $d\pmod 4$ if $K=\mathbb Q(\sqrt d)$.

In general, let $K = \mathbb Q(\sqrt d)$ where $d\ne 0,1$ is a square-free integer. Now $K$ has a $\mathbb Q$-basis $\{1, \sqrt d\}$. Let $x + y\sqrt d$ be a general element of $K$, and suppose that $x+y\sqrt d\in \mathcal O_K$. Then $$N_{K/\mathbb Q}(x+y\sqrt d) = \det\begin{bmatrix}x&yd\\y&x\end{bmatrix}=x-dy^2 \\ \mathrm{Tr}_{K/\mathbb Q}(x+y\sqrt d) = \mathrm{tr}\begin{bmatrix}x&yd\\y&x\end{bmatrix}=2x$$ The fact that $x+y\sqrt d \in\mathcal O_K$ implies that $2x, x-dy^2\in\mathbb Z$ and hence $$4dy^2\in\mathbb Z.$$

Since $d$ is squarefree, it follows that $x=\frac u2$, $y=\frac v2$ for some $u,v\in\mathbb Z$, and moreover, we have $$u^2-dv^2 \equiv 0 \pmod 4$$

1. If $d \not\equiv 1 \pmod 4$, then since the only squares modulo $4$ are $0,1$, $u,v$ must be even, and $\{1,\sqrt d\}$ must be an integral basis. So $\mathcal O_K = \mathbb Z[\sqrt d]$.
2. If $d\equiv 1 \pmod 4$, then we must have $u\equiv v\pmod 2$. Hence, $$x+y\sqrt d =a+b\frac{1+\sqrt d}2$$ for some $a,b\in\mathbb Z$, and since $\frac{1+\sqrt d}2$ is a root of $X^2-X+\frac{1-d}4$, it follows that $\{1, \frac{1+\sqrt d}2\}$ is an integral basis and that $\mathcal O_K = \mathbb Z[\frac{1+\sqrt d}2]$.