Splitting square into squares

For a given perfect square, there is a set of five integers such that the sum of the squares of the integers in the set is ten times the given perfect square and the smallest positive difference between any pair of integers in the set is maximum. What do we get when we subtract the square of this difference from the given perfect square?

[SOLVED]

John Grint solved this puzzle:

Below, I'll prove that if the smallest positive difference between any pair of integers in the set of five integers is $$n$$ then the sum of their squares is at least $$10n^2$$. It follows from this that if the sum of their squares is $$10n^2$$ then the maximum possible value of the smallest positive difference between any pair of integers in the set is $$n$$.

Let the five integers be $$a$$, $$b$$, $$c$$, $$d$$ and $$e$$, where $$a \geqslant b \geqslant c \geqslant d \geqslant e$$ and the difference between any adjacent pair is greater than or equal to $$n$$ where $$n \geqslant 0$$. Then the difference between $$b$$ and $$d$$ is at least $$2n$$ and the difference between $$a$$ and $$e$$ is at least $$4n$$.

If the difference between two real numbers is $$2x$$ then the sum of their squares is at least $$2x^2$$. Let the numbers be $$r$$ and $$r + 2x$$. Then the sum of their squares is

\begin{align*} & r^2 + (r + 2x)^2 \\ & = r^2 + r^2 + 4rx + 4x^2 \\ & = 2(r^2 + 2rx + x^2) + 2x^2 \\ & = 2(r + x)^2 + 2x^2 \\ & \geqslant 2x^2 \end{align*}

Therefore, $$b^2 + d^2 \geqslant 2n^2$$ and $$a^2 + e^2 \geqslant 8n^2$$. So, $$a^2 + b^2 + c^2 + d^2 +e^2 \geqslant 10n^2 + c^2 \geqslant 10n^2$$. When $$a = 2n$$, $$b = n$$, $$c = 0$$, $$d = -n$$ and $$e = -2n$$, $$a^2 + b^2 + c^2 + d^2 +e^2 = 10n^2$$.

So, we have shown that if the sum of the squares of five integers in the set is $$10n^2$$ then the maximum possible value of the smallest positive difference between any pair of integers in the set is $$n$$. So, if the given perfect square is $$n^2$$, the maximum possible value of the smallest positive difference between any pair of the five integers is $$n$$ and we get $$0$$ when we subtract the square of this difference from the given perfect square.

We can prove a couple of general theorems pertaining to this problem.

Theorem 1. For real numbers $$a_i$$ where $$1 \leqslant i \leqslant n$$, and $$a_i \leqslant a_{i+1}$$ for integers $$1 \leqslant i \lt n$$, if $$d$$ is the smallest number in the set $$\{a_{i+1} - a_i : 1 \leqslant i \lt n\}$$, $d \leqslant \sqrt{\frac{12 \sum_{i=1}^n a_i^2}{n(n^2 - 1)}}$

Proof. Since $$d$$ is the smallest number in the set $$\{a_{i+1} - a_i : 1 \leqslant i \lt n\}$$, $$a_j \geqslant a_{i} + (j - i)d$$ for $$i \leqslant j$$.

When $$n$$ is even,

\begin{align*} \sum_{i=1}^n a_i^2 & = \sum_{i=1}^{\frac{n}{2}} a_i^2 + \sum_{i=\frac{n}{2} + 1}^{n} a_i^2 \\ & = \sum_{i=1}^{\frac{n}{2}} a_i^2 + \sum_{j=1}^{\frac{n}{2}} a_{n+1-j}^2 \\ & = \sum_{i=1}^{\frac{n}{2}} (a_i^2 + a_{n+1-i}^2) \\ & \geqslant \sum_{i=1}^{\frac{n}{2}} \left( a_i^2 + (a_i + (n + 1 - 2i)d)^2 \right) \\ & = \sum_{i=1}^{\frac{n}{2}} \left( 2 a_i^2 + 2 a_i(n + 1 - 2i) d + (n + 1 - 2i)^2 d^2 \right) \\ & = \sum_{i=1}^{\frac{n}{2}} 2 \left(a_i^2 + 2 a_i(n + 1 - 2i) \frac{d}{2} + 2 (n + 1 - 2i)^2 \frac{d^2}{4}\right) \\ & = \sum_{i=1}^{\frac{n}{2}} \left( 2 \left(a_i + (n + 1 - 2i) \frac{d}{2}\right)^2 + (n + 1 - 2i)^2 \frac{d^2}{2}\right) \\ & \geqslant \frac{d^2}{2} \sum_{i=1}^{\frac{n}{2}} (n + 1 - 2i)^2 \\ & = \frac{d^2}{2} \sum_{j=1}^{\frac{n}{2}} (2j - 1)^2 \\ & = \frac{d^2}{2} \left(\sum_{j=1}^{n} j^2 - \sum_{j=1}^{\frac{n}{2}} (2j)^2\right) \\ & = \frac{d^2}{2} \left(\sum_{j=1}^{n} j^2 - 4 \sum_{j=1}^{\frac{n}{2}} j^2\right) \\ & = \frac{d^2}{2} \left( \frac{n(n + 1)(2n + 1)}{6} - \frac{\frac{4n}{2}\left(\frac{n}{2} + 1\right)(n + 1)}{6} \right) \\ & = \frac{d^2}{2} \left(\frac{n(n + 1)(2n + 1)}{6} - \frac{n(n + 2)(n + 1)}{6} \right) \\ & = \frac{d^2}{2} \cdot \frac{n(n + 1)(n - 1)}{6} \\ & = \frac{d^2 n(n^2 - 1)}{12} \end{align*}

When $$n$$ is odd,

\begin{align*} \sum_{i=1}^n a_i^2 & = \sum_{i=1}^{\frac{n-1}{2}} a_i^2 + a_{\frac{n+1}{2}}^2 + \sum_{i=\frac{n+3}{2}}^n a_i^2 \\ & \geqslant \sum_{i=1}^{\frac{n-1}{2}} a_i^2 + \sum_{i=\frac{n+3}{2}}^{n} a_i^2 \\ & = \sum_{i=1}^{\frac{n-1}{2}} a_i^2 + \sum_{j=1}^{\frac{n-1}{2}} a_{n + 1 - j}^2 \\ & \geqslant \sum_{i=1}^{\frac{n-1}{2}}\left( a_i^2 + (a_i + (n + 1 - 2i)d)^2 \right) \\ & \geqslant \frac{d^2}{2} \sum_{i=1}^{\frac{n-1}{2}} (n + 1 - 2i)^2 \\ & = 2 d^2 \sum_{i=1}^{\frac{n-1}{2}} \left(\frac{n + 1}{2} - i\right)^2 \\ & = 2 d^2 \sum_{j=1}^{\frac{n-1}{2}} j^2 \\ & = 2 d^2 \left( \frac{1}{6} \right) \left( \frac{n - 1}{2} \right) \left( \frac{n + 1}{2} \right) (n) \\ & = \frac{d^2 n(n^2 - 1)}{12} \end{align*}

So, we see that in both cases,

$\sum_{i=1}^n a_i^2 \geqslant \frac{d^2 n(n^2 - 1)}{12}$

The above inequality can be rewritten as

$d \leqslant \sqrt{\frac{12 \sum_{i=1}^n a_i^2}{n(n^2 - 1)}}$

Theorem 2. For real numbers $$a_i = \left( i - \frac{n + 1}{2} \right)d$$ where $$1 \leqslant i \leqslant n$$, $d = \sqrt{\frac{12 \sum_{i=1}^n a_i^2}{n(n^2 - 1)}}$

Proof. The proof for this can be obtained from the proof of the previous theorem by replacing all inequalities with equalities. This can be justified as follows. For $$i \leqslant j$$,

$a_j = a_{i} + (j - i)d$

Also,

\begin{align*} a_i = \left( i - \frac{n + 1}{2} \right)d \\ a_i + (n + 1 - 2i)\frac{d}{2} = 0 \end{align*}

Only the differing steps are highlighted below.

When $$n$$ is even,

\begin{align*} \sum_{i=1}^n a_i^2 & = \sum_{i=1}^{\frac{n}{2}} a_i^2 + \sum_{i=\frac{n}{2} + 1}^{n} a_i^2 \\ & = \sum_{i=1}^{\frac{n}{2}} (a_i^2 + a_{n+1-i}^2) \\ & = \sum_{i=1}^{\frac{n}{2}} \left( a_i^2 + (a_i + (n + 1 - 2i)d)^2 \right) \\ & = \sum_{i=1}^{\frac{n}{2}} \left( 2 \left(a_i + (n + 1 - 2i) \frac{d}{2}\right)^2 + (n + 1 - 2i)^2 \frac{d^2}{2}\right) \\ & = \frac{d^2}{2} \sum_{i=1}^{\frac{n}{2}} (n + 1 - 2i)^2 \\ & = \frac{d^2}{2} \sum_{j=1}^{\frac{n}{2}} (2j - 1)^2 \\ & = \frac{d^2 n(n^2 - 1)}{12} \end{align*}

When $$n$$ is odd, $$a_{\frac{n+1}{2}} = 0$$. So,

\begin{align*} \sum_{i=1}^n a_i^2 & = \sum_{i=1}^{\frac{n-1}{2}} a_i^2 + a_{\frac{n+1}{2}}^2 + \sum_{i=\frac{n+3}{2}}^n a_i^2 \\ & = \sum_{i=1}^{\frac{n-1}{2}} a_i^2 + \sum_{i=\frac{n+3}{2}}^{n} a_i^2 \\ & = \sum_{i=1}^{\frac{n-1}{2}} a_i^2 + \sum_{j=1}^{\frac{n-1}{2}} a_{n + 1 - j}^2 \\ & = \sum_{i=1}^{\frac{n-1}{2}}\left( a_i^2 + (a_i + (n + 1 - 2i)d)^2 \right) \\ & = \frac{d^2}{2} \sum_{i=1}^{\frac{n-1}{2}} (n + 1 - 2i)^2 \\ & = 2 d^2 \sum_{j=1}^{\frac{n-1}{2}} j^2 \\ & = \frac{d^2 n(n^2 - 1)}{12} \end{align*}

In both cases, we see that

$d = \sqrt{\frac{12 \sum_{i=1}^n a_i^2}{n(n^2 - 1)}}$

From these two theorems we can obtain the solution to this problem. When $$\sum_{i=1}^5 a_i^2 = 10k^2$$ for some integer k, the maximum possible value of the smallest positive difference between any pair of integers in the set of five numbers is

$d = \sqrt{\frac{12 \cdot 10k^2}{5(5^2 - 1)}} = k.$

Thus, $$k^2 - d^2 = 0$$.

Credit

This is an original puzzle from cotpi.