Sum of Sequence of Squares/Proof using Bernoulli Numbers

Theorem

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

Proof

 $\displaystyle \sum_{i \mathop = 1}^n i^p$ $=$ $\displaystyle 1^p + 2^p + \cdots + n^p$ $\displaystyle$ $=$ $\displaystyle \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$:

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

Hence the result.

$\blacksquare$