# How to compute this infinite sum? [duplicate]

I'm trying to compute the infinite sum

$\sum_{n=1}^{\infty}n(\frac{1}{2})^n$

which I believe should represent the expected amount of coin flips needed to get a head. Can someone remind me how to do this?

## marked as duplicate by Clement C., Martin R, Hans Lundmark, kingW3, Lord Shark the UnknownAug 15 '17 at 19:17

• see $\frac{x}{1-x} = x\frac{d}{dx} \sum_{n=1}^{\infty} x^n = \sum_{n=1}^{\infty} n x^n$ for$|x|<1$ – Guy Fsone Aug 15 '17 at 12:19
• @GuyFabrice It's $\frac{x}{(1-x)^2}$. You forgot the square. – Thomas Andrews Aug 15 '17 at 12:35
• @kurt Peek you are right – Guy Fsone Aug 15 '17 at 12:50

The key is that the infinite sum $\sum x^n$ converges to $\frac 1{1 - x}$ under certain conditions on $x$, and differentiating the resulting inequality gives that $\sum nx^{n-1}$ is convergent to the derivative of $\frac 1{1 - x}$, under the same conditions. Multiplying this by $x$ gives the sum $\sum nx^{n}$, which is the result you are looking for with $x = \frac 12$, which does fall under the set for which the first equality holds.
For $|x|<1$: $\sum_{n=1}^{\infty}nx^n=x\sum_{n=1}^{\infty}nx^{n-1}=x(\sum_{n=1}^{\infty}x^{n})'$.
For $|r|<1$, \begin{align} \sum_{n=1}^n nr^n=S&=r+2r^2+3r^3+4r^4+\cdots+nr^n+\cdots \tag{1}\\ rS&=\quad\;\;\; r^2+2r^3+3r^4+\cdots+(n-1)r^n+\cdots\tag{2}\\ (1)-(2):\\ (1-r)S&= r\;+r^2\;+r^3\;+r^4\ +\cdots\; +r^n+\cdots\\ &=\frac r{1-r}\\ S&=\color{red}{\frac r{(1-r)^2}} \end{align} Putting $r=\frac 12$ gives $S=\color{red}2$.
$S=\sum_{n\geq 1}\frac{n}{2^n}$ is an absolutely convergent series, so we may apply the following manipulations: $$S = 2S-S = \sum_{n\geq 1}\frac{n}{2^{n-1}}-\sum_{n\geq 1}\frac{n}{2^n}=\sum_{n\geq 0}\frac{n+1}{2^n}-\sum_{n\geq 1}\frac{n}{2^n}=1+\sum_{n\geq 1}\frac{1}{2^n}$$ and since $\sum_{n\geq 1}\frac{1}{2^n}=1$, $\color{red}{ S=2}$ easily follows.