What's the sum of the series $\sum _{n=0}^{\infty }\left(n^2a^n\right)$ $\sum _{n=0}^{\infty }\left(n^2a^n\right)$, I have seen a similar sum with just $n$ instead of the $n^2$, yet I'm not sure how to solve this one.
 A: I assume $0<|a|<1$. Let $S = \sum_n a^n$, $T = \sum_n n^2 a^n$. Observe that $S(n) = \frac{1}{1-a}$ (geometric series) which implies $\frac{d}{da} S = \frac{1}{(1-a)^2}$ and $\frac{d}{da} S = \frac{-2}{(1-a)^3}$. Then 
$$\frac{d^2}{da^2} S = \sum_n n(n-1)a^{n-2} = \frac{1}{a^2} \underbrace{\sum_n n^2 a^n}_{=T}- \frac{1}{a}\underbrace{\sum_n n a^{n-1}}_{=\frac{d}{da} S} = \frac{1}{a^2} T-\frac{1}{a} \frac{d}{da}S.$$ Now let us replace $\frac{d}{da} S$ and $\frac{d^2}{da^2} S$ with the terms we calculated above and we get:
$$\frac{-2}{(1-a)^3} = \frac{1}{a^2} T - \frac{1}{a} \frac{1}{(1-a)^2}$$
This can now easily be solved for $T$.
A: Just as Watson commented, the usual trick is to write $$n^2=n(n-1+1)=n(n-1)+n$$ Similarly  for $n^3$ the idea would be to write $$n^3=n(n-1)(n-2)+an(n-1)+bn$$ Develop the rhs and group similar powers $$n^3=n^3+(a-3) n^2+n (-a+b+2)$$ Comparing coefficients gives two equations $$a-3=0\qquad -a+b+2=0$$ so $a=3$ and $b=1$ which makes $$n^3=n(n-1)(n-2)+3n(n-1)+n$$ If you want to do it for $n^4$, it is the same story $$n^4=n(n-1)(n-2)(n-3)+an(n-1)(n-2)+bn(n-1)+cn$$  and do the same to identify $a,b,c$.
Now, just play with the successive derivatives of $x^n$.
