TITLE: $-1$ as the sum of three squares of algebraic integers in $\mathcal{O}_{\mathbb{Q}(\sqrt{-7})}$
QUESTION [7 upvotes]: Following the result of Ivan Niven, in his paper
http://www.ams.org/journals/tran/1940-048-03/S0002-9947-1940-0003000-5/S0002-9947-1940-0003000-5.pdf 
That is whenever $d\equiv 3 \pmod 4$, every algebraic integer of the form $a + 2b\sqrt{-d}$ can be expressed as the sum of three squares. Which means that $-1$ can be expressed as $s^2 + t^2 + u^2$ in $\mathcal{O}_{\mathbb{Q}(\sqrt{-7})}$. Can someone show me the representation? 

Following Jyrki Lahtonen's answer, I have edited this question (adding the condition $d = 4k + 3$).

REPLY [4 votes]: This answer explains an earlier comment in more detail, as requested by Jyrki Lahtonen.  I'll write $\mathbf{Z}_8$ for $\mathbb{Z}/8\mathbb{Z}$.  First, as Jyrki remarked, the equation $a^2+b^2+c^2=-1$ has no solution in $\mathbf{Z}_8$. This follows by inspection from the fact that $x^2 \in \{0,1,4\}$ for all $x\in \mathbf{Z}_8$.  Now let $d$ be a square free positive integer such that $d \equiv 7 \ (\bmod 8)$. Then $d \equiv 3\ (\bmod 4)$ and I'll just state the fact that in this case the ring of integers $\mathcal{O}_d$ in $\mathbb{Q}(\sqrt{-d})$ is a lattice:
$$
\mathcal{O}_d = \mathbb{Z} + \mathbb{Z} \alpha, \textrm{ where } \alpha =\frac{1+\sqrt{-d}}{2}.
$$
Define $k := (d+1)/4 \in 2\mathbb{Z}$. Then the minimum polynomial of $\alpha$ is $X^2-X+k$. The next step is to show that this polynomial has two roots in $\mathbf{Z}_{2^m}$ for all $m \geq 1$.  This follows by induction.
First note that $0,1$ are both roots in $\mathbf{Z}_2$.  Now suppose that $x \in \mathbf{Z}_{2^m}$ is a root, so $x^2-x+k=y2^m$ for some integer $y$. Then
$$
(x+y2^m)^2-(x+y2^m)+k = xy2^{m+1} + y^22^{2m} \equiv 0\ (\bmod 2^{m+1})
$$
and in particular the minimum polynomial has a root $x' \in \mathbf{Z}_{2^{m+1}}$ such that $x' \equiv x\ (\bmod 2^m)$.  In fact closer inspection of this procedure shows that there are exactly two roots in $\mathbf{Z}_{2^m}$.
Fix a root $x \in \mathbf{Z}_8$ and define a map $\varphi: \mathcal{O}_d \rightarrow \mathbf{Z}_8$ by
$$
\varphi: a + b \frac{1+\sqrt{-d}}{2} \mapsto a + bx.
$$
It is easy to check explicitly that $\varphi$ is in fact a homomorphism.  Multiplication works out because both $x \in \mathbf{Z}_8$ and $\alpha \in \mathcal{O}_d$ satisfy an identical quadratic relation. Now we can conclude that for any $a,b,c \in \mathcal{O}_d$
$$
\varphi(a^2+b^2+c^2) = \varphi(a)^2+\varphi(b)^2+\varphi(c)^2 \neq -1
$$
and therefore $a^2+b^2+c^2 \neq -1$.