<s>[INST] 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?
 [/INST] Yet another take. Start with the definition of falling factorial powers:
$\begin{align}
  x^{\underline{r}}
    = x (x - 1) \dotsm (x - r + 1)
\end{align}$
so that:
$\begin{align}
  \Delta n^{\underline{r}}
    &= (n + 1)^{\underline{r}} - n^{\underline{r}} \\
    &= r n^{\underline{r - 1}} \\
  \sum_{0 \le k < n} k^{\underline{r}}
    &= \frac{n^{\underline{r + 1}}}{r + 1}
\end{align}$
(the last one is also easy to prove by induction, or otherwise).

Now note that:
$\begin{align}
  n^2
    = n^{\underline{2}} + n^{\underline{1}}
\end{align}$
so we can write:
$\begin{align}
   \sum_{0 \le k \le n} k^2
     &= \sum_{0 \le k < n + 1}
          \left( k^{\underline{2}} + k^{\underline{1}} \right) \\
     &= \frac{(n + 1)^{\underline{3}}}{3}
          + \frac{(n + 1)^{\underline{2}}}{2} \\
     &= \frac{(n + 1) n (n - 1)}{3} + \frac{(n + 1) n}{2} \\
     &= \frac{(2 n + 1) (n + 1) n}{6}
\end{align}$
</s>