Question: Evaluate
$$ \sum_{i=0}^n i^2 2^{n-i}$$
In the previous questions on my question paper I have got:
$$\sum_{i=1}^n a^i = \frac{a(1-a^n)}{1-a}$$ and $$\sum_{i=1}^nia^i=\frac{a(1-a^n)}{1-a}-na^{n+1}$$
My step for this evaluation is below:
Let $ 2^{n-1} \rightarrow a^{n-i}$
$$\therefore \sum_{i=1}^ni^2a^{n-i}$$ $$a^n\sum_{i=1}^ni^2a^{-i}$$
Let $b = {1 \over a}$
$$\therefore S_n=({1 \over b})^n\sum_{i=1}^ni^2b^i$$
I am trying to use the "multiply b by both sides" method and eliminate $S_n-bS_n$
The result is like this:
$bS_n-S_n=(b-1)S_n=(b^2+2^2b^3+3^2b^4+\cdots+n^2b^{n+1})-(b+2^2b^2+3^2b^3+\cdots+n^2b^n)$
Which is
$$b+(2^2-1)b^2+(3^2-2^2)b^3+\cdots+(n^2-(n-1)^2)b^n-n^2b^{n+1}$$ Expand: $$b+2^2b^2-b^2+3^2b^3-2^2b^3+\cdots+n^2b^n-(n-1)^2b^n-n^2b^{n+1}$$
I am now stuck at this step. Did I do anything wrong?
PS: I heard that we could use the answers in the previous questions but I couldn't see the patterns. Would anyone help? Thanks.
Here is a convenient trick: if $|x| < 1$ you have the finite geometric series $$\sum_{k=0}^n x^k = \frac{x^{n+1} - 1}{x-1}.$$ Then $$\sum_{k=1}^n k x^k = x \sum_{k=0}^n k x^{k-1} = x \cdot \frac{d}{dx} \left( \frac{x^{n+1} - 1}{x-1} \right).$$ You can repeat this argument (after computing the derivative explicitly) to get a closed form for $\displaystyle \sum_{k=1}^n k^2 x^k$. Then observe $$\sum_{i=0}^n i^2 2^{n-i} = 2^n \sum_{i=1}^n i^2 \left( \frac 12 \right)^i.$$