I'm wondering if somebody could explain to me how the way my professor solved the number of coin flips until you get heads worked.

He goes as follows:

Let N = number of coin flips until you get head He then defines E[N] in terms of itself.

E[N] = 1 + 1/2 * E[N]

He says that the 1 comes from the fact that you for sure need at least one coin flip (the first flip), so that I understand. Then he says that the 1/2 represents the probability of tails and that E[N] (the one on the right side of the equal sign) represents the number of further coin flips needed in this case. He said that this is a "memory-less process, because when you start anew on the second coin flip having gotten to tails, it's as if you're in time 1 all over again." I....don't really understand. Why exactly does 1/2 have to be multiplied to E[N], and...why exactly does the equation defined in terms of itself like that work? Why are we allowed to do this?

I actually somehow found the proof in this answer (Expected value of the number of flips until the first head) better to understand than whatever my professor was trying to do.

  • $\begingroup$ Your prof is using the law of total expectation. You flip once. Then you have a $1/2$ chance of being done (in which case you flip, on average, 0 times) and a $1/2$ change of having to do the process again (in which case you flip, on average, $E[N]$ times). More generally we have $E[X] = E[X|A_1]P(A_1) + \cdots + E[X|A_n]P(A_n)$, where the $A_i$ are disjoint and their union is the sample space. $\endgroup$ – user369210 Sep 28 '16 at 3:37

The probability that the first head occurs on toss $n$ is $\left(\frac12\right)^n$: the coin must land tails on each of the first $n-1$ tosses and then land heads on the $n$-th toss, and each of those $n$ events has probability $\frac12$. Thus, by definition

$$\begin{align*} \Bbb E[N]&=\sum_{n=1}^\infty n\left(\frac12\right)^n\\ &=\frac12+\sum_{n=2}^\infty n\left(\frac12\right)^n\\ &=\frac12+\frac12\sum_{n=2}^\infty n\left(\frac12\right)^{n-1}\\ &=\frac12+\frac12\sum_{n=1}^\infty(n+1)\left(\frac12\right)^n\\ &=\frac12+\frac12\left(\sum_{n=1}^\infty n\left(\frac12\right)^n+\sum_{n=1}^\infty\left(\frac12\right)^n\right)\\ &=\frac12+\frac12\left(\Bbb E[N]+\frac{1/2}{1-1/2}\right)\\ &=1+\frac12\Bbb E[N]\;. \end{align*}$$

Your professor is trying to get you to see how we could have deduced this formula without running through the details. Clearly we must toss the coin at least once. With probability $\frac12$ we toss a head and are done at that point, and $N=1$. And with probability $\frac12$ we toss a tail, and we are then in effect starting from scratch all over again, but with one toss already made. That is, whatever the expected number of tosses was when we started, we now face that same expected number of tosses yet to come, and to that we have to add the one toss that we’ve already made. This means that $N=1$ with probability $\frac12$, and with probability $\frac12$ we’ve made $1$ toss and have an expectation of $\Bbb E[N]$ more. Thus,

$$\Bbb E[N]=\frac12\cdot1+\frac12\big(1+\Bbb E[N]\big)=1+\frac12\Bbb E[N]\;.$$


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.