# Expected number of coin flips for heads

The expected number of coin flips to get one heads is $2$. What is wrong with this argument?

There is a $1/2$ chance of getting $H$, $1/4$ chance of getting $TH$, $1/8$ chance of getting $TTH$, etc. so the expected value of flips is

$$\frac{1}{2} + \frac{2}{4} + \frac{3}{8} + ...\approx \ ?$$

Edit: incorrect value

• In your argument, what are you attempting to argue the expected number of flips for exactly? – miradulo Jul 15 '15 at 1:16
• @DonkeyKong Fixed – qwr Jul 15 '15 at 1:17
• Where do you get that value for the sum? – lulu Jul 15 '15 at 1:22
• The only thing wrong with the argument is the evaluation of the series. Not sure what you did but it really is: $2$ . Showing your working might help. – Graham Kemp Jul 15 '15 at 1:30
• After the edit, your formula is fine. It was only the valuation of that sum that was wrong as several answers below have valid computations which show that the sum is 2 which, as you point out, is the right answer. – lulu Jul 15 '15 at 1:35

you need to consider the event $A_k$ ={Head shows up in the $k$ flip}

$$P(A_k) = P(T(k-1 \text{times} ) H) = 2^{-k}$$

The expected value of $X = \sum_k k \chi_{A_k}$ which thakes the value $k$ when $A_k$ occurs is \begin{align}\Bbb{E}[X] = \sum_k k2^{-k} &= \frac{1}{2} + \frac{1}{4} + \frac{1}{8} + \ldots & = 1\\ & \qquad + \frac{1}{4} + \frac{1}{8} + \ldots &= \frac{1}{2} \\ & \qquad \qquad +\frac{1}{8} + \ldots &=\frac{1}{4}\\ &\qquad \qquad \qquad\vdots&\vdots\end{align}

So $\Bbb{E}[X] = 1 + \frac{1}{2} + \frac{1}{4} + \ldots = 2$

Addendum: If the format is a little unclear, try this:

\begin{align} \sum_{k=1}^\infty \frac k{2^k} & = \frac 1 2 + \frac 2 4 + \frac 3 8 +\cdots \\[2ex] & = \boxed{\begin{matrix} (\frac 1 2 & + \frac 1 4 &+ \frac 1 8 &+\cdots)+ \\ & (\frac 1 4 & + \frac 1 8 & +\cdots)+ \\ & & (\frac 1 8 & + \cdots) +\\&&& + \cdots \end{matrix}} \\[2ex] & = \boxed{\begin{matrix} (\frac 1 2 & + \frac 1 4 &+ \frac 1 8 &+\cdots)+ \\ & \frac 1 2(\frac 1 2 & + \frac 1 4 & +\cdots)+ \\ & & \frac 1 4(\frac 1 2 & + \cdots) +\\&&& + \cdots \end{matrix}} \\[2ex] & = 1 + \frac 1 2 + \frac 1 4 + \cdots \\[2ex] & = 2 \\[1ex]\Box \end{align}

• So why is the expected value not $1, 2, 3...$? – qwr Jul 15 '15 at 1:30
• @qwr The result is a geometric sum with a common ratio of $1/2$. Then the sum is equal to $\dfrac{1}{1-\frac{1}{2}} = 2$. – miradulo Jul 15 '15 at 1:32
• Why do you think there would be a $1,2,3,\ldots$ ? – Conrado Costa Jul 15 '15 at 1:34
• @DonkeyKong It is the way the solution is formatted. Conrado Costa has the two quarters on separate lines, the three eights on three lines, et cetera to show how they group to form the equality: $\frac 1 2 + \frac 2 4 + \frac 3 8 +\cdots = 1+ \frac 1 2 + \frac 1 4 + \cdots$ – Graham Kemp Jul 15 '15 at 1:39
• @GrahamKemp Ohhh I see how qwr got confused. Many thanks. – miradulo Jul 15 '15 at 1:42

Here is an alternate method for computing the sum (not better, just different).

To compute the sum, note that $$\frac{1}{1-x} = 1 + x + x^2 + x^3+...$$

Differentiate to get $$\frac{1}{(1-x)^2} = 1 + 2x + 3x^2 + 4x^3+...$$

Whence $$\frac{x}{(1-x)^2} = x + 2x^2 + 3x^3 + 4x^4+...$$

In particular, taking x = $\frac{1}{2}$ we have

$$2 = \frac{1}{2} + \frac{2}{4} + \frac{3}{8} + ...$$

as desired.

I think I get what you're trying to do, although the proof is much easier to show from a more direct definition.

The probability of having one coin flip result in heads is $1/2$. The probability of it taking two flips is $1/4$. In general the probability of it taking n flips is $2^{-n}$. So we automatically know you'll never have to flip the coin an infinite number of times.

To find the average number of flips required, simply take the weighted mean (expected value) of all the probabilities.

$$\sum_{n=1}^{\infty} 2^{-n} \cdot n$$

You'll get $2$. This is the average number of flips needed to get heads.

Just another way to get the expected value, if you want to consider probability distributions and avoid doing any summation.

As each toss is independent and identically distributed, we can consider the waiting time for the first "H" to be a Geometric random variable with $p = \frac{1}{2}$. Then for our Geometric random variable $X$, we know $$E(X) = \frac{1}{p} = 2$$