TITLE: How to find the sum of the following series
QUESTION [5 upvotes]: How can I find the sum of the following series?
$$
\sum_{n=0}^{+\infty}\frac{n^2}{2^n}
$$
I know that it converges, and Wolfram Alpha tells me that its sum is 6 .
Which technique should I use to prove that the sum is 6?

REPLY [6 votes]: For $x$ in a neighborhood of $1$, let
$$
f(x) = \sum\limits_{n = 0}^\infty  {\frac{{x^n }}{{2^n }}} = \sum\limits_{n = 0}^\infty  {\bigg(\frac{x}{2}\bigg)^n }  = \frac{1}{{1 - x/2}} = \frac{2}{{2 - x}}.
$$
Thus, on the one hand,
$$
f'(x) = \sum\limits_{n = 0}^\infty  {\frac{{nx^{n - 1} }}{{2^n }}}  \;\; {\rm and} \;\; f''(x) = \sum\limits_{n = 0}^\infty  {\frac{{n(n - 1)x^{n - 2} }}{{2^n }}} ,
$$
and, on the other hand,
$$
f'(x) = \frac{2}{{(2 - x)^2 }} \;\; {\rm and} \;\; f''(x) = \frac{4}{{(2 - x)^3 }}.
$$
Hence,
$$
f'(1) = \sum\limits_{n = 0}^\infty  {\frac{n}{{2^n }}}  = 2  \;\; {\rm and} \;\; f''(1) = \sum\limits_{n = 0}^\infty  {\frac{{n(n - 1)}}{{2^n }}}  = 4.
$$
Finally, 
$$
\sum\limits_{n = 0}^\infty  {\frac{{n^2 }}{{2^n }}}  = f'(1) + f''(1) = 6.
$$
The idea here was to consider the Probability-generating function of the geometric$(1/2)$ distribution.