# f(x)=(1/2)^x, x=1,2,3,4, …find the mean [duplicate]

A fair coin is flipped successively at random until the first head is observed. Let the random variable X denote the number of flips of the coin that are required. Then the space of x is S={x: x=1,2,3,4, ....}. Later we learn that, under certain conditions, we can assign probabilities to these outcomes in S with the function $f(x)=(1/2)^x, x=1,2,3,4,...$ Compute the mean $\mu$.

I know $\mu =E(X)= \sum_{x=1}^ \infty x \cdot f(x)=1 \cdot (1/2)^1+2 \cdot(1/2)^2+3\cdot (1/2)^3+....=1/2+1/2+3/8+...$

I have thought about factoring 1/2 out, but I still could not figure out the mean. I know $\sum_{x=1} ^ \infty f(x)=1.$ I just need the help of rewriting the expected value in terms of $\sum_{x=1} ^ \infty f(x)$. Any help is appreciated. Thank you.

After looking at the multiple ways to solving this, I am going with the summation direction. This is what I have done so far, but I am still not there yet. Any correction of the following is appreciated.

New:

$\sum_{x=1}^\infty \frac {x}{2^x}= \sum_{x=0}^\infty \frac{x+1}{2^{x+1}}=\sum_{x=0}^\infty \frac {x}{2^{x+1}}+ \sum_{x=0}^\infty \frac {1}{2^{x+1}}= \frac {1}{2} \sum_{x=0}^ \infty \frac {x}{2^x}+ \frac {1}{2} \sum_{x=0}^ \infty \frac {1}{2^x}$

From here, I do not see how $\frac {1}{2} \sum_{x=0}^ \infty \frac {1}{2^x}=1$?

• how did you know that? – Lily Jun 11 '17 at 22:05
• @yanko: The two aren't equal, although the integral is a decent approximation. – anomaly Jun 11 '17 at 22:06
• @yanko: That shows that both converge, not that they're equal. The sum is exactly $2$; the integral is about $1.7620$. – anomaly Jun 11 '17 at 22:13
• As to the new part maybe this is helpful – kingW3 Jun 12 '17 at 0:30

Note that $F(x) = \sum_{n=0}^\infty x^n = \frac{1}{1-x}$ has $F'(x) = \sum n x^{n-1}$. Hence \begin{align*} \sum_{n=1}^\infty n\left(\frac{1}{2}\right)^n = \frac{1}{2}\sum_{n=1}^\infty n\left(\frac{1}{2}\right)^{n-1} = \frac{1}{2} F'\left(\frac{1}{2}\right) = 2. \end{align*} The same sort of argument can be used to compute similar sums of the form $\sum P(n) x^n$ for $P$ a polynomial.

• shouldn't it be $1/2 \sum_{n=1}^ \infty n^2 (1/2)^{n-1}$? – Lily Jun 11 '17 at 22:17
• No. The first equality is just pulling one $1/2$ term out of the sum. – anomaly Jun 11 '17 at 22:52

When you flip the coin once, you either get a heads, which means you're done, or you get tails, which means you're back where you began except you've used one coin flip. This means that $$E(X)=\frac12\cdot1+\frac12\cdot (E(X)+1)$$This is a direct application of the more general fact that for an event $A$ and a random variable $Y$, we have $$E(Y)=P(A)E(Y\mid A)+P(\bar A)E(Y\mid \bar A)$$

Here is a step-by-step method for solving series like this one, designed for those with limited background in calculus.

By Geometric Series formula and some rearrangment we have $$\sum_{k=1}^n x^{-k}= \frac{\sum_{k=1}^{n-1} x^k}{x^n} = \frac{x^n-x}{(x-1)x^n}$$ Differentiating with respect to $x$, we have $$\sum_{k=1}^n k\cdot x^{-k-1}= \frac{x^n - n x + n - 1}{x^n(x - 1)^2}$$ Multiplying that by $x$, we find $$\sum_{k=1}^n k\cdot x^{-k}= \frac{x^n - n x + n - 1}{x^{n-1}(x - 1)^2}$$ Setting $x=2$, we find $$\sum_{k=1}^n k\cdot 2^{-k}= \frac{2^n - n - 1}{2^{n-1}}$$ Now just note that $$\sum_{k=1}^\infty k\cdot 2^{-k}= \lim_{n \to \infty}\frac{2^n - n - 1}{2^{n-1}} = 2-\lim_{n \to \infty}\frac{n+1}{2^{n-1}}=\color{red}{2}$$

One can also compute this sum a different way: notice that $$n(1/2)^n = \underbrace{(1/2)^n + (1/2)^n + \dotsb + (1/2)^n}_{n \text{ times}},$$ so \begin{align} (1/2) + 2(1/2)^2 + 3(1/2)^3 + \dotsb \\ = (1/2) + (1/2)^2 + (1/2)^3 + \dotsb \\ + (1/2)^2 + (1/2)^3 + \dotsb \\ + (1/2)^3 + \dotsb \\ \ddots. \end{align} Hence $$\sum_{n=0}^{\infty} n(1/2)^n = \sum_{k=1}^{\infty} \sum_{n=k}^{\infty} (1/2)^n = \sum_{k=1}^{\infty} \frac{(1/2)^k}{1-1/2} = 2\sum_{k=1}^{\infty} (1/2)^k = 2.$$

• $\sum_{x=1}^\infty \frac {x}{2^x}= \sum_{x=0}^\infty \frac{x+1}{2^{x+1}}=\sum_{x=0}^\infty \frac {x}{2^{x+1}}+ \sum_{x=0}^\infty \frac {1}{2^{x+1}}= \frac {1}{2} \sum_{x=0}^ \infty \frac {x}{2^x}+ \frac {1}{2} \sum_{x=0}^ \infty \frac {1}{2^x}$ From here, I do not see how $\frac {1}{2} \sum_{x=0}^ \infty \frac {1}{2^x}=1$? – Lily Jun 12 '17 at 0:01
• It's a probability distribution, so the probabilities have to add up to 1. – Chappers Jun 12 '17 at 0:23