TITLE: show that:for every $x\in S$, there exsit $y,z,w\in S$, such $x=y^2+z^2+w^2$
QUESTION [5 upvotes]: Define $S=\{a+b\cdot\dfrac{-1+\sqrt{3}i}{2}|a,b\in Z\}$. Show that for every $x\in S$, there exit $y,z,w\in S$,such
$$x=y^2+z^2+w^2$$where $i$ such  $i^2=-1$
My attempt:
Since
$$\left(a+b\dfrac{-1+\sqrt{3}i}{2}\right)^2=\left(a^2-ab-\dfrac{1}{2}b^2\right)+\dfrac{\sqrt{3}}{2}b(a-b)i$$

REPLY [4 votes]: Let $\omega = e^{\frac{2\pi}{3}i} = \frac{-1 + \sqrt{3}i}{2}$ be the primitive cubic root of unity. It satisfies the identities
$$1 + \omega + \omega^2 = 0\quad\text{ and }\quad \omega^3 = 1$$
For any $x = a + b\omega \in S$, define $r$ according to following table.
$$\begin{array}{|cc:c:l|}
\hline
a & b & r & x + r^2\\
\hline
\text{even} & \text{ even } &  0 &  a + b\omega\\
\text{even} & \text{ odd }  & \omega^2 & a + (b+1)\omega\\
\text{odd} & \text{even} & 1 & (a+1) + b\omega\\
\text{odd} & \text{ odd} & \omega &(a-1) + (b-1)\omega\\
\hline
\end{array}$$
As one can see, independent of the parity of $a,b$, we have $x + r^2 = a' + b'\omega$ for some even $a'$ and $b'$. This means we can find a $\mu \in S$ such that $x + r^2 = 2\mu$. 
Now for any $p, q \in S$, define $y, z, w$ by
$$
\begin{cases}
y &= p + q - r\\
z &= p\omega + q\omega^2\\
w &= p\omega^2 - q\omega
\end{cases}
$$
It is easy to see
$$\begin{align} y^2 + z^2 + w^2 
&= (p+q)^2 + (p\omega+q\omega^2)^2 + (p\omega^2 - q\omega)^2 - 2r(p+q) + r^2\\
&= (p^2 + 2pq + q^2) + (p^2\omega^2 + 2pq + q^2\omega) + (p^2\omega -2pq + q^2\omega^2) - 2r(p+q) + r^2\\
&= p^2(1+\omega^2+\omega) + 2pq(1+1-1) + q^2(1+\omega+\omega^2)-2r(p+q)+r^2\\
&= 2pq -2r(p+q)+r^2\\
&= 2(p-r)(q-r)-r^2
\end{align}
$$
If we choose $q = r+1$ and $p = r+\mu$, this becomes
$$y^2 + z^2+w^2 = 2\mu - r^2 = (x+r^2)-r^2 = x$$
This is precisely the decomposition we seek.