Sum of Sequence of Squares

Theorem:

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

Proof by Induction
Base Case: $$n=1$$ So, when $$n=1$$, we have $$\sum_{i=1}^{1}i^2=1^2=1$$ Now, we have $$\frac{n(n+1)(2n+1)}{6}=\frac{1(1+1)(2 \cdot 1+1)}{6}=\frac{6}{6}=1$$ So, for the base case, we have shown the result. Induction Hypothesis: $$\sum_{i=1}^{k}i^2=\frac{k(k+1)(2k+1)}{6}$$ for some $$k>1$$ Inductive Step: Now consider the case of $$k+1$$. So we have $$\sum_{i=1}^{k+1}i^2$$ Now, using the properties of summation, we have $$\sum_{i=1}^{k+1}i^2=\sum_{i=1}^{k}i^2 + (k+1)^2$$ We can now apply our induction hypothesis, obtaining $$\sum_{i=1}^{k+1}i^2 = \frac{k(k+1)(2k+1)}{6} + (k+1)^2$$ $$ = \frac{k(k+1)(2k+1) + 6(k+1)^2}{6}$$ $$ = \frac{(k+1)[k(2k+1) +6(k+1)]}{6}$$ $$ = \frac{(k+1)(2k^2+7k+6)}{6}$$ $$ = \frac{(k+1)(k+2)(2(k+1)+1)}{6}$$ Thus, we have shown the result by induction.

QED