# Sum of Sequence of Squares/Proof using Bernoulli Numbers

## Theorem

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

## Proof

 $\ds \sum_{i \mathop = 1}^n i^p$ $=$ $\ds 1^p + 2^p + \cdots + n^p$ $\ds$ $=$ $\ds \frac {n^{p + 1} } {p + 1} + \sum_{k \mathop = 1}^p \frac {B_k \, p^{\underline {k - 1} } \, n^{p - k + 1} } {k!}$

where $B_k$ are the Bernoulli numbers.

Setting $p = 2$:

 $\ds \sum_{i \mathop = 1}^n i^2$ $=$ $\ds 1^2 + 2^2 + \cdots + n^2$ $\ds$ $=$ $\ds \frac {n^{2 + 1} } {2 + 1} + \frac {B_1 \, p^{\underline 0} \, n^2} {1!} + \frac {B_2 \, p^{\underline 1} \, n^1} {2!}$ $\ds$ $=$ $\ds \frac {n^3} 3 + B_1 n^2 + B_2 n$ Definition of Falling Factorial and simplification $\ds$ $=$ $\ds \frac {n^3} 3 + \frac {n^2} 2 + \frac n 6$ Definition of Bernoulli Numbers $\ds$ $=$ $\ds \frac {n \left({n + 1}\right) \left({2 n + 1}\right)} 6$ after algebra

Hence the result.

$\blacksquare$