Finite sum $\sum_{j=0}^{n-1} j^2$ How can I calculate this finite sum? Can someone help me?  

$$\sum_{j=0}^{n-1} j^2$$


Notice
$$\begin{align}
j^2 
&= \frac12[ j(j+1) + (j-1)j ]\\
&= \frac12\left[\frac{\color{red}{(j+2)}-\color{green}{(j-1)}}{3}j(j+1)
+ \frac{\color{blue}{(j+1)}-\color{magenta}{(j-2)}}{3}(j-1)j\right]\\
&= \frac16\left[\left(
\underbrace{j(j+1)\color{red}{(j+2)}}_A - \underbrace{\color{green}{(j-1)}j(j+1)}_B
\right) + \left(
\underbrace{(j-1)j\color{blue}{(j+1)}}_C - \underbrace{\color{magenta}{(j-2)}(j-1)j}_D
\right)\right]\\
&= \frac16\left[
\underbrace{j(j+1)(2j+1)}_{A+C} - 
\underbrace{(j-1)j(2j-1)}_{B+D}\right]
\end{align}
$$
The sum at hand is a telescoping sum with
$$\sum_{j=1}^{n-1}j^2 = \frac{(n-1)n(2n-1)}{6}$$
