essentially I would like to figure out how the infinite sum below is computed. Is there some generating function that allow me to compute $\sum_i^\infty i^2 k^i$ ?$$ \sum_{k=3}^{\infty}k\frac{k-2}{2^{k-1}} = 5$$
I know that I can rearrange this into $$\sum_{k=3} k^2/2^{k-1} - 2 \sum_{k=3} k/2^{k-1} = \sum_{k=3} k^2/2^{k-1} - 1$$ using the fact that the second summation is simply the expectation of geometric random variable parametrized by prob 1/2 substract something.