# Talk:TADM2E 1.11

From Algorithm Wiki

Instead of assuming that summation is true for $ n $, we can choose to assume it for $ n-1 $ that way it'll be easy to understand and more intuitive.

Anyway I'm writing the solution for same,

First we'll verify the base case for $ n = 1 $ :

- $ \sum_{i=1}^1 i^2 = 1^2 = \frac{1(1+1)(2+1)}{6} = 1 $

Now, we'll assume given statement is true up to $ n - 1 $.

So, following is true.

- $ \begin{align} \sum_{i=1}^{n-1} i^2 & = \frac{(n-1)(n-1+1)(2(n-1)+1)}{6} \\ & = \frac{n(n-1)(2n-1)}{6} \\ \end{align} $

To prove the general case $ n $,

- $ \begin{align} \sum_{i=1}^n i^2 & = \sum_{i=1}^{n-1} i^2 + n^2 \\ & = \frac{n(n-1)(2n-1)}{6} + n^2 \\ & = \frac{(n^2-n)(2n-1) + 6n^2}{6} \\ & = \frac{2n^3 + 3n^2 + n}{6} \\ & = \frac{n(2n^2 + 3n + 1)}{6} \\ & = \frac{n(2n^2 + 2n + n + 1)}{6} \\ & = \frac{n(2n(n + 1) + n + 1)}{6} \\ \sum_{i=1}^n i^2 & = \frac{n(n + 1)(2n + 1)}{6} \\ \end{align} $