Calculate the sum of infinite series with general term $\frac{n^2}{2^n}$. [duplicate]

Solution 1:

For $|x|<1,$ $$\sum_{r=0}^\infty x^r=\frac1{1-x}$$

Differentiate wrt $x,$ $$\sum_{r=0}^\infty rx^{r-1}=\frac1{(1-x)^2}$$

Multiply by $x$

Differentiate wrt $x$

Multiply by $x$

Can you recognize $x$ here?

Solution 2:

The answer below is (perhaps) not given with perfect seriousness, since in a sense it is on the complicated side. However, if one thinks in probabilistic terms, it is not completely unreasonable.

Imagine tossing a fair coin until we obtain a head. Let $X$ be the number of tosses. Then $$E(X^2)=\sum_1^\infty \frac{n^2}{2^n}.$$ Condition on the result of the first toss. The conditional expectation of $X^2$, given that we got a head on the first toss, is $1$.

The conditional expectation of $X^2$, given that we got a tail on the first toss, is $E(1+X)^2$, which by the linearity of expectation is equal to $1+2E(X)+E(X^2)$. It follows that $$E(X^2)=\frac{1}{2}\cdot 1+\frac{1}{2}(1+2E(X)+E(X^2)).$$ We conclude that $$E(X^2)=2+2E(X).$$ It remains to find $E(X)$. By a conditioning argument similar to the one above, but quite a bit simpler, we get that $E(X)=2$, giving $E(X^2)=6$.