<s>[INST] how to find this generating function this is the power series:
$$\sum_{i=0}^\infty n(n-1)^2 (n-2) z^n.$$
how can I find a generating function from it? I could use the third derivative but the $n-1$ is squared so I don't know what to do..
 [/INST] We can use
$$
\sum_{n=0}^\infty\binom{n}{k}z^n=\frac{z^k}{(1-z)^{k+1}}\tag{1}
$$
which follows from differentiating $\sum\limits_{n=0}^\infty z^n=\frac{1}{1-z}$ repeatedly $k$ times and multiplying by $\dfrac{z^k}{k!}$, and
$$
n(n-1)^2 (n-2)=n(n-1)(n-2)(n-3)+2n(n-1)(n-2)\tag{2}
$$
which is an example of the fact that any polynomial in $n$ can be written as a sum of $\binom{n}{k}$, we get
$$
\begin{align}
f(z)
&=\sum_{n=0}^\infty n(n-1)^2 (n-2) z^n\\
&=\sum_{n=0}^\infty n(n-1)(n-2)(n-3)z^n + 2n(n-1)(n-2)z^n\\
&=\sum_{n=0}^\infty 24\binom{n}{4}z^n + 12\binom{n}{3}z^n\\
&=\frac{24z^4}{(1-z)^5}+\frac{12z^3}{(1-z)^4}\\
&=\frac{12z^3(1+z)}{(1-z)^5}\tag{3}
\end{align}
$$
</s>