How to find the sum of the following series 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?
 A: You can also apply the formula for the sum of a geometric series three times in a row :
$$\begin{array}{rcl}
\sum_{n=1}^\infty \frac{n^2}{2^n} 
&=& \sum_{n=1}^\infty (2n-1) \sum_{k=n}^\infty \frac{1}{2^k}  
= \sum_{n=1}^\infty \frac{2n-1}{2^{n-1}} \\
&=& \sum_{k=0}^\infty \frac{1}{2^k} + \sum_{n=1}^\infty 2 \sum_{k=n}^\infty \frac{1}{2^k} 
\\ &=& 2 + \sum_{n=1}^\infty \frac{2}{2^{n-1}} \\
&= & 2 + 2 \cdot 2 = 6 \end{array}$$
Also, if cutting up those geometric series is too hard, there is an easier way to do the same thing :
$$\begin{array}{rcl}
(1-\frac{1}{2})^3 \cdot \sum_{n=1}^\infty \frac{n^2}{2^n} & = &
(1-\frac{1}{2})^2 \cdot \sum_{n=1}^\infty \frac{n^2-(n-1)^2}{2^n} =
(1-\frac{1}{2})^2 \cdot \sum_{n=1}^\infty \frac{2n-1}{2^n} \\
&=& (1-\frac{1}{2}) \cdot \left(\frac{1}{2} + \sum_{n=2}^\infty \frac{(2n-1)-(2n-3)}{2^n} \right) \\
&=& (1-\frac{1}{2}) \cdot \left(\frac{1}{2} + \sum_{n=2}^\infty \frac{2}{2^n} \right) \\
&=& \frac{1}{4} + \frac{2}{4} = \frac{3}{4} = \left(1-\frac{1}{2} \right)^3 \cdot 6
\end{array}$$
A: 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.
A: It is equal to $f(x)=\sum_{n \geq 0} n^2 x^n$ evaluated at $x=1/2$.
To compute this function of $x$, write $n^2 = (n+1)(n+2)-3(n+1)+1$, so that $f(x)=a(x)+b(x)+c(x)$ with:
$a(x)= \sum_{n \geq 0} (n+1)(n+2) x^n = \frac{d^2}{dx^2} \left( \sum_{n \geq 0} x^n\right) = \frac{2}{(1-x)^3}$
$b(x)=\sum_{n \geq 0} 3 (n+1) x^n = 3\frac{d}{dx} \left( \sum_{n \geq 0} x^n \right) = \frac{3}{(1-x)^2}$
$c(x)= \sum_{n \geq 0} x^n = \frac{1}{1-x}$
So $f(1/2)=\frac{2}{(1/2)^3}-\frac{3}{(1/2)^2} + \frac{1}{1/2} = 16-12+2=6$.
The "technique" is to add a parameter in the series, to make the multiplication by $n+1$ appear as differentiation.
