# show that 2016 can be written as a sum of 4 squares

Show that 2016 can be written as a sum of 4 squares. My Try:- As $2016=40^2+4^2+16^2+12^2$, we can prove the above result. But I need actual/real process.

• On some level, this is enough. You have shown that it can be done, and this is all that was asked. On another level, you can ask, well, how did you arrive at your answer? – user217285 Oct 15 '16 at 5:01
• I don't know how to do. Please help – sai saandeep Oct 15 '16 at 5:02
• – Cave Johnson Oct 15 '16 at 5:03
• How did you find the numbers 40,4,16 and 12? – sranthrop Oct 15 '16 at 5:04

Odd squares are all congruent to $1$ mod $8$, while even squares are congruent to $0$ or $4$ mod $8$. Consequently, the sum of four odd squares is congruent to $4$ mod $8$, while the sum of two odd and two even squares is congruent to $2$ or $6$ mod $8$. Since $2016\equiv0$ mod $8$, it can therefore only be the sum of four even squares, i.e., $2016=(2x)^2+(2y)^2+(2z)^2+(2w)^2$. (It cannot be sum the of one odd and three even, or three even and one odd, squares, for mod $2$ reasons.) This reduces to $504=x^2+y^2+z^2+w^2$. But since $504\equiv0$ mod $8$ also, the same reasoning applies again, so that we must have $504=(2a)^2+(2b)^2+(2c)^2+(2d)^2$, which reduces to $126=a^2+b^2+c^2+d^2$. This is now small enough that all solutions are easily found, i.e.,
$$126= \begin{cases}121+4+1+0\\ 100+25+1+0\\ 100+16+9+1\\ 81+36+9+0\\ 81+25+16+4\\ 64+49+9+4\\ 64+36+25+1\\ 49+36+25+16 \end{cases}$$
Taking $a$, $b$, $c$ and $d$ (in any order) from any of these solutions gives $2016=(4a)^2+(4b)^2+(4c)^2+(4d)^2$, e.g, $44^2+8^2+4^2+0^2$ (from the top) or $28^2+24^2+20^2+16^2$ (from the bottom).
First notice that if $n=a^2+b^2+c^2+d^2$, then $x^2n = (ax)^2+(bx)^2+(cx)^2+(dx)^2.$ So the first thing I'd do in this problem is factor 2016 and see what perfect squares I find. $2016 = 144\cdot 14$. Now express 14 as the sum of 4 squares: $14 = 3^2+2^2 + 1^2 +0^2$. Then $2016 = 36^2+24^2+12^2+0^0.$
If you don't like the $0^2$, then move some factor from the $144$ to the $14$: $2016 = 16\cdot 126$ and $126 = 10^2+4^2+3^2+1^2$. Multiply through by $4^2$ and this gives your answer.
We're lucky in this problem that there are lots of squares in $2016$ and that it's not too big.