# Sums of Partial Sequences of Squares

## Theorem

Let $n \in \Z_{>0}$.

Consider the odd number $2 n + 1$ and its square $\paren {2 n + 1}^2 = 2 m + 1$.

Then:

$\ds \sum_{j \mathop = 0}^n \paren {m - j}^2 = \sum_{j \mathop = 1}^n \paren {m + j}^2$

That is:

the sum of the squares of the $n + 1$ integers up to $m$

equals:

the sum of the squares of the $n$ integers from $m + 1$ upwards.

## Proof

First we express $m$ in terms of $n$:

 $\ds \paren {2 n + 1}^2$ $=$ $\ds 4 n^2 + 4 n + 1$ $\ds$ $=$ $\ds 2 \paren {2 n^2 + 2 n} + 1$ $\ds \leadsto \ \$ $\ds m$ $=$ $\ds 2 n^2 + 2 n$

We have:

 $\ds$  $\ds \sum_{j \mathop = 1}^n \paren {m + j}^2 - \sum_{j \mathop = 0}^n \paren {m - j}^2$ $\ds$ $=$ $\ds \sum_{j \mathop = 1}^n \paren {\paren {m + j}^2 - \paren {m - j}^2} - m^2$ $\ds$ $=$ $\ds \sum_{j \mathop = 1}^n 2 j \paren {2 m} - m^2$ Difference of Two Squares $\ds$ $=$ $\ds 4 m \times \frac {n \paren {n + 1} } 2 - m^2$ Closed Form for Triangular Numbers $\ds$ $=$ $\ds m \paren {2 n^2 + 2 n} - m^2$ $\ds$ $=$ $\ds m^2 - m^2$ $\ds$ $=$ $\ds 0$

Hence the result.

$\blacksquare$

## Examples

### Example: $3^2 = 4 + 5$

 $\ds 3$ $=$ $\ds 1 + 2$ $\ds 3^2$ $=$ $\ds 4 + 5$ $\ds 3^2 + 4^2$ $=$ $\ds 5^2$

### Example: $5^2 = 12 + 13$

 $\ds 5$ $=$ $\ds 2 + 3$ $\ds 5^2$ $=$ $\ds 12 + 13$ $\ds 10^2 + 11^2 + 12^2$ $=$ $\ds 13^2+ 14^2$

### Example: $7^2 = 24 + 25$

 $\ds 7$ $=$ $\ds 3 + 4$ $\ds 7^2$ $=$ $\ds 24 + 25$ $\ds 21^2 + 22^2 + 23^2 + 24^2$ $=$ $\ds 25^2 + 26^2 + 27^2$