Sum of First $n$ Squares Equals $\frac{n(n+1)(2n+1)}{6}$ I am just starting into calculus and I have a question about the following statement I encountered while learning about definite integrals:
$$\sum_{k=1}^n k^2 = \frac{n(n+1)(2n+1)}{6}$$
I really have no idea why this statement is true. Can someone please explain why this is true and if possible show how to arrive at one given the other?

Another method:
$$\begin{align}
\sum_{k=1}^nk^2&=\frac 12\sum_{k=1}^n k(k+1)+(k-1)k\\
&=\frac 12 \left[\sum_{k=1}^n k(k+1)+\sum_{k=1}^{n-1}k(k+1)\right]\\
&=\color{lightgrey}{\frac 12} \left[ \color{lightgrey}2\sum_{k=1}^n \binom {k+1}2+\color{lightgrey}2\sum_{k=1}^{n-1}\binom {k+1}2\right]\\
&=\binom {n+2}3+\binom {n+1}3\\
&=\frac{\color{blue}{(n+2)}(n+1)n}6+\frac{(n+1)n\color{blue}{(n-1)}}6\\
&=\frac {n(n+1)\color{blue}{(2n+1)}}6\quad\blacksquare
\end{align}$$
