5

This problem is basically from MIT OCW probability section.

A fair coin is flipped until the number of heads exceeds the number of tails. What is the expected number of flips?

I tried this question and landed with 25/12 as the expected number of flips required. I want to check if this is correct.

  • Do you have familiarity with Catalan numbers? https://en.wikipedia.org/wiki/Catalan_number – JayTuma Jul 28 '20 at 12:08
  • yes, I've now. But, doesn't seem to help much :( – Saurabh Sharma Jul 28 '20 at 12:55
  • Observe that for each $n$ the probability $\Pr(X = 2n+1)$ is equal to $\frac{C_n}{2^{2n + 1}}$ while $\Pr(X = 2n) = 0$ where $X$ is the random variable representing the number of coin tosses needed to achieve for the first time more heads than tails. In particular just need to compute the series $\sum_{n = 0}^\infty \binom{2n+1}{n+1} 2^{-(2n+1)}$ – JayTuma Jul 28 '20 at 13:00
  • @JayTuma The sum you proposed diverges according to WolframAlpha. – Vishu Jul 28 '20 at 13:34
  • ok just noticed that too... i'll explain better how i got that sum, so maybe you can spot the mistake – JayTuma Jul 28 '20 at 13:38

1 Answers1

1

Replying to @Tavish, there is no way to get a sequence of even tosses where heads just became greater than tails (if heads are greater the difference is greater than two, so they where greater even before the last toss). Conversely for $2n + 1$ the sequences such that heads just became greater than head are such that the last toss is a head, before there were an equal number of heads and tails and tails were never strictly less than heads (that is $C_n$). So the probability that $X = 2n + 1$ should be $\frac{C_n}{2^{2n+1}}$. Hence $$\mathbb{E}(X) = \sum_{n = 0}^\infty \frac{1}{n+1} \binom{2n}{n} \frac{2n + 1}{2^{2n + 1}} = \sum_{n = 0}^\infty \binom{2n+1}{n+1} 2^{-(2n +1)}$$

Either I made a mistake somewhere or simply the expected value diverges, that anyway seems surprisingly

Edit: for completeness, the series diverges because the general term is asymptotically equivalent to $\binom{2n}{n} 2^{-2n}$ and by stirling approximation this is again asimptotically equivalent to $(\sqrt{\pi n})^{-1}$

JayTuma
  • 1,715
  • 1
    I don't see any mistakes here. Markov chain conditioned on first move also gives $H=1+\frac12\cdot 2H$ so mean hitting time $H$ is not finite. – user10354138 Jul 28 '20 at 14:46
  • 3
    If the expectation really is infinite, that would mean we also require an infinite number of moves to have more occurrences of tails than heads, by symmetry. This seems rather strange, as one of heads and tails must exceed after the first toss. – Vishu Jul 28 '20 at 16:32
  • Yeah, but when the expected value is infinite it does not mean you never get there (nor that is unlikely to get there soon) but that the chance to toss a lot of coins before actually having more heads than tails goes to zero quite slowly. – JayTuma Jul 28 '20 at 16:40
  • How about this approach !!??!! – Saurabh Sharma Jul 29 '20 at 03:20
  • Let E be the expected number of flips required to achieve the target. This is for sure that it will happen at some odd number of flips. We can write recursive equation - E = 1/2(1) + 1/4(E+2) + 1/16(E+4) + 1/64(E+6)........... 1st term if we get head in the 1st throw, 2nd term if we get tails in the 1st throw, and then we require 1 head, to reach to original situation with equal number of heads and tails, after which can write in terms of E with 2 additional flips (E+2). Similarly going on like this...... Summing this up leads to 25/12. – Saurabh Sharma Jul 29 '20 at 03:31
  • I'm not sure where the recursive equation comes from – JayTuma Jul 30 '20 at 15:52
  • anyway @Tavish - i made a simple implementation in python and what I've seen is that quite often the required number of steps is below 10, but once in a while you get enormous number (over one milion). So I don't have any further doubts and in my opinion the question is answered. – JayTuma Jul 30 '20 at 16:12
  • @JayTuma I see. Although, can you explain your third last comment? – Vishu Jul 30 '20 at 16:57
  • @Tavish what are you refering to in particular? – JayTuma Jul 30 '20 at 17:02
  • @JayTuma The comment in which you explain what an infinite expectation means. – Vishu Jul 30 '20 at 19:16
  • 1
    sure, you wrote that $\mathbb{E}(X) = \infty$ means you need infinite moves to get a sequence where heads are more than tails, but also that after the first move this is true either for tails or heads. I was pointing out that since $\mathbb{E}(X) = \sum_{n = 1}^\infty \Pr[X = n] \cdot n$, when this series diverges it only means that high value are not enough unlikely (namely - at least in this case - the probability decrases slower than $1/n$). In particular, there is no contraddiction. – JayTuma Jul 30 '20 at 19:45