Using generating functions to evaluate a sum I have to use generating functions to evaluate the following sum :
$$\sum_{k=0}^n (k-1)k(k+1)$$
I think that first we have to find the generating function C(x) = $\sum_{n=0}^\infty (n-1)n(n+1)x^n$.
I also computed the sum on WolframAlpha and know that the final result is $$\sum_{k=0}^n (k-1)k(k+1) = \frac{(n-1)n(n+1)(n+2)}{4}$$
Any help is appreciated.
 A: As @Winther already noted, let us define
$$f(x) = \sum\limits_{k=0}^{n} x^{k+1} = \dfrac{x(x^{n+1} - 1)}{x-1}$$
Then
$$f'''(x) = \sum\limits_{k=0}^{n} (k+1)k(k-1)x^{k-2}$$
You shall compute the third derivative of $f(x) = \dfrac{x(x^{n+1} - 1)}{x-1}$ and the answer would be $f'''(1)$.
A: A small addendum: it is enough to exploit the hockey stick identity.
$$\begin{eqnarray*}\sum_{k=0}^{n}(k-1)k(k+1) &=& 6\sum_{k=0}^{n}\binom{k+1}{3}\\&=& 6\binom{n+2}{4}\\&=&6\frac{(n+2)(n+1)n(n-1)}{4!}\\&=&\frac{(n+2)(n+1)n(n-1)}{4}.\end{eqnarray*}$$
A: $\newcommand{\bbx}[1]{\,\bbox[8px,border:1px groove navy]{\displaystyle{#1}}\,}
 \newcommand{\braces}[1]{\left\lbrace\,{#1}\,\right\rbrace}
 \newcommand{\bracks}[1]{\left\lbrack\,{#1}\,\right\rbrack}
 \newcommand{\dd}{\mathrm{d}}
 \newcommand{\ds}[1]{\displaystyle{#1}}
 \newcommand{\expo}[1]{\,\mathrm{e}^{#1}\,}
 \newcommand{\ic}{\mathrm{i}}
 \newcommand{\mc}[1]{\mathcal{#1}}
 \newcommand{\mrm}[1]{\mathrm{#1}}
 \newcommand{\pars}[1]{\left(\,{#1}\,\right)}
 \newcommand{\partiald}[3][]{\frac{\partial^{#1} #2}{\partial #3^{#1}}}
 \newcommand{\root}[2][]{\,\sqrt[#1]{\,{#2}\,}\,}
 \newcommand{\totald}[3][]{\frac{\mathrm{d}^{#1} #2}{\mathrm{d} #3^{#1}}}
 \newcommand{\verts}[1]{\left\vert\,{#1}\,\right\vert}$
\begin{align}
\sum_{k = 0}^{n}\pars{k - 1}k\pars{k + 1} & =
\sum_{k = 0}^{n}\pars{k + 1}^{\,\underline{3}} =
\left.{\pars{k + 1}^{\,\underline{4}} \over 4}\,\right\vert_{\ 0}^{\ n + 1} =
{\pars{n + 2}^{\,\underline{\,4}}\ -\ 1^{\,\underline{\,4}}\over 4}
\\[5mm] & =
\bbx{\ds{{\pars{n + 2}\pars{n + 1}n\pars{n - 1} \over 4}}}
\end{align}
