# Sum of Sequence of Squares/Proof by Summation of Summations

## Theorem

$\ds \forall n \in \N: \sum_{i \mathop = 1}^n i^2 = \frac {n \paren {n + 1} \paren {2 n + 1} } 6$

## Proof

We can observe from the above diagram that:

$\ds \forall n \in \N: \sum_{i \mathop = 1}^n i^2 = \sum_{i \mathop = 1}^n \paren {\sum_{j \mathop = i}^n j}$

Therefore we have:

 $\ds \sum_{i \mathop = 1}^n i^2$ $=$ $\ds \sum_{i \mathop = 1}^n \paren {\sum_{j \mathop = i}^n j}$ $\ds$ $=$ $\ds \sum_{i \mathop = 1}^n \paren {\sum_{j \mathop = 1}^n j - \sum_{j \mathop = 1}^{i - 1} j}$ $\ds$ $=$ $\ds \sum_{i \mathop = 1}^n \paren {\frac {n \paren {n + 1} } 2 - \frac {i \paren {i - 1} } 2}$ $\ds \leadsto \ \$ $\ds 2 \sum_{i \mathop = 1}^n i^2$ $=$ $\ds n^2 \paren {n + 1} - \sum_{i \mathop = 1}^n i^2 + \sum_{i \mathop = 1}^n i$ $\ds \leadsto \ \$ $\ds 3 \sum_{i \mathop = 1}^n i^2$ $=$ $\ds n^2 \paren {n + 1} + \sum_{i \mathop = 1}^n i$ $\ds \leadsto \ \$ $\ds 3 \sum_{i \mathop = 1}^n i^2$ $=$ $\ds n^2 \paren {n + 1} + \frac {n \paren {n + 1} } 2$ Closed Form for Triangular Numbers $\ds \leadsto \ \$ $\ds 6 \sum_{i \mathop = 1}^n i^2$ $=$ $\ds 2 n^2 \paren {n + 1} + n \paren {n + 1}$ $\ds$ $=$ $\ds n \paren {n + 1} \paren {2 n + 1}$ $\ds \leadsto \ \$ $\ds \sum_{i \mathop = 1}^n i^2$ $=$ $\ds \frac {n \paren {n + 1} \paren {2 n + 1} } 6$

$\blacksquare$