# Confusing simplification of summation

WolframAlpha simplifies $$\sum_{z=n+1}^{a-3} {\frac{1}{2} (a - z - 2) (a - z - 1) (a - z)}$$ to $$\frac{1}{8} (a-n-3) (a-n) (a^2-a (2 n+3)+n^2+3 n+2)$$ which is equivalent to $$\frac{1}{8} (a-n-3) (a-n-2) (a-n-1) (a-n)=\frac{1}{8}\cdot\frac{(a-n)!}{(a-n-4)!}$$ but I am drawing a blank on how it was first simplified. Any insight would be greatly appreciated!

Putting $r=a-z$ helps simplify the summation.
\begin{align} &\quad \sum_{z=n+1}^{a-3} {\frac{1}{2} (a - z - 2) (a - z - 1) (a - z)}\\ &=\sum_{r=3}^{a-n-1}\frac 12 (r-2)(r-1)r\\ &=3\sum_{r=3}^{a-n-1}\binom r3\\ &=3\binom {a-n}4\\ &=\frac 18 (a-n)(a-n-1)(a-n-2)(a-n-3)\qquad\blacksquare \end{align}
Since $a$ is a constant and the summation is over $z$, let us expand $$A_z={\frac{1}{2} (a - z - 2) (a - z - 1) (a - z)}$$ $$A_z=\left(\frac{a^3}{2}-\frac{3 a^2}{2}+a\right)+\left(-\frac{3 a^2}{2}+3 a-1\right) z+\frac{3}{2} (a-1) z^2-\frac{z^3}{2}$$ So $$\sum_{z=n+1}^{a-3}A_z=\left(\frac{a^3}{2}-\frac{3 a^2}{2}+a\right)\sum_{z=n+1}^{a-3} 1+\left(-\frac{3 a^2}{2}+3 a-1\right)\sum_{z=n+1}^{a-3} z+\frac{3}{2} (a-1)\sum_{z=n+1}^{a-3} z^2-$$ $$\frac 12 \sum_{z=n+1}^{a-3} z^3$$ Now, use $$\sum_{z=n+1}^{a-3}z^k=\sum_{z=0}^{a-3}z^k-\sum_{z=0}^{n}z^k$$ I am sure that you can take it from here.
If your are concerned by the simplification of the term $a^2-a (2 n+3)+n^2+3 n+2$, compute the roots and show that they are $n+1$ and $n+2$ which make $$a^2-a (2 n+3)+n^2+3 n+2=(a-n-1)(a-n-2)$$