# If $3\mid a,b,c$ and $n=a^2+b^2+c^2$, prove that there exist $x,y,z$ such that $n=x^2+y^2+z^2$, where $3\nmid x,y,z$.

If $3\mid a,b,c$ and $n=a^2+b^2+c^2$, prove that there exist $x,y,z$ such that $n=x^2+y^2+z^2$, where $3\nmid x,y,z$. Here $n\in\mathbb N$, $a,b,c,x,y,z\in\mathbb Z$.

This problem is originally stated as:

If a natural number $n$ can be expressed as a sum of $3$ squares of integers that are divisible by $3$, prove that it can be expressed as a sum of $3$ squares of integers that are not divisible by $3$ as well.

I'm not sure if $0$ is included in the set of natural numbers in this case but let's assume it is.

So I've checked divisibility by $9$ and it doesn't contradict the possibility. Divisibility by $3$ in this case guarantees the same remainders.

I've tried marking $a,b,c,x,y,z$ as $3k,3l,3m,3d\pm1,3e\pm1,3f\pm1$ respectively. This allows us to work with integers with no constraints. It brings me to this: $$9k^2+9l^2+9m^2=9(d^2+e^2+f^2)\pm6d\pm6e\pm6f+3=n$$

And now we can just prove that this equality $$9k^2+9l^2+9m^2=9(d^2+e^2+f^2)\pm6d\pm6e\pm6f+3$$

can always hold when all the variables are just integers.

Some ideas would be great. Thanks.

• A proof that it can be true: $3^2 + 3^2 + 3^2 = 5^2 + 1^2 + 1^2$. – TMM Jan 26 '14 at 14:21
• @TMM I've changed the way my problem is stated. It could've possible been stated wrong. The problem asks us for a proof that there are always those $x,y,z$ that make this true. – user26486 Jan 26 '14 at 14:28
• Here I list the "first" few "distinct" (i.e. not multiples of each other) examples, it may help in noticing patterns. $3^2 + 3^2 + 3^2 = 5^2 + 1^2 + 1^2$, $3^2 + 3^2 + 6^2 = 5^2 + 5^2 + 2^2$, $3^2 + 6^2 + 6^2 = 8^2 + 4^2 + 1^2$, $3^2 + 3^2 + 9^2 = 7^2 + 7^2 + 1^2$, $3^2 + 6^2 + 9^2 = 11^2 + 2^2 + 1^2$, So far (With exception to the first and last case) it looks like if two of $a, b, c$ are the same, then $n$ is subtracted from two terms and $2n$ is added to the other. This may help in finding an algebraic representation. – MCT Jan 26 '14 at 16:16
• Also, if I may ask, where are these problems from? You have been going on a spree posting competition-looking problems like these and I want to make sure that they're not from an open competition. – MCT Jan 26 '14 at 16:32
• They're given to me by my math teacher who trains me for olympiads. – user26486 Oct 25 '14 at 14:39

Look at identities like $$a^2+b^2+c^2 = \begin{cases} \, (2m-a)^2+(2m-b)^2+(2m-c)^2, &\text{if } a+b+c=3m,\\[0.5em] \, (m-a)^2+(m-b)^2+(2m-c)^2, &\text{if } a+b+2c=3m, \\[0.5em] \, (2m-a)^2+(4m-b)^2+(4m-c)^2, &\text{if } a+2b+2c=9m. \end{cases}$$ Using those (or similar identities), you can, I believe, find all possible residues for $a,b,c \pmod{3}$.
Take a look at pages 262-263 of Dickson's History of the Theory of Numbers, vol. 2, where the function $\phi(m)$ is introduced. It counts the number of "proper" representations of $m$ as a sum of three squares, "proper" meaning they have no common factor. The formula
$$\phi(m)= \begin{cases} 24\sum_{s=1}^{[m/4]}\left({s\over m}\right),\text{ if }m\equiv1\pmod4\\ \\ 8\sum_{s=1}^{[m/2]}\left({s\over m}\right),\text{ if }m\equiv3\pmod4\\ \end{cases}$$
appears on page 263. You need something along the lines of $\phi(9m)\gt0$ if $\phi(m)\gt0$.