## Square Sum Is Square

#### Problem

It is well known that there exist pairs of distinct squares that add to make another square.

For example, $5^2 + 12^2 = 25 + 144 = 169 = 13^2$.

But this can be extended to any number of squares. For example, $2^2 + 5^2 + 14^2 = 15^2$.

Prove that there exists a sum of $n$ distinct squares that is also square.

#### Solution

Let $S$ denote the sum of $n-1$ arbitrarily chosen distinct even squares; clearly $S$ will be even. Thus the problem reduces to showing that $S + a^2 = b^2$.

$\therefore S = b^2 - a^2 = (b+a)(b-a)$

As $S$ is even, let $b - a = 2 \implies b + a = 2a + 2$.

$\therefore S = (b + a)(b - a) = 2(2a + 2) \implies a = \dfrac{S}{4} - 1$

For $a$ to be integer requires $S$ to be divisible by 4. But as each of the $n - 1$ squares are even then $S$ will be divisible by 4.

However, for the squares to be distinct we must ensure that $a$ has not appeared among the $n-1$ even squares. This can be achieved by ensuring that $a^2 \gt S$; that is, if the value of $a^2$ is greater than the sum of the $n-1$ squares then it must be greater than each of the squares making the sum.

Solving $a^2 = \left (\dfrac{S}{4} - 1 \right )^2 = S$ leads to the quadratic $S^2 - 24S + 16 = 0$.

The largest root, $S = 12 + 8 \sqrt{2} \approx 23.3$.

So for any value of $S \ge 24$ we will have $a^2 \gt S$.

Clearly for $n \ge 4$ the sum of the $n-1$ distinct even squares must exceed 24, as $2^2 + 4^2 + 6^2 = 56$.

For $n \le 3$ we need only ensure that one of the chosen squares is $6^2$.

Hence there exists a sum of $n$ distinct squares that is also square.

What would happen if the sum of the $n-1$ arbitrarily chosen distinct squares were odd?