0
$\begingroup$

What is the expected value of the longest run of heads or tails observed in $N$ flips of a fair coin?

I'd like to consider this for any $N$, small or large.

$\endgroup$
  • $\begingroup$ Please write your problem specifically, instead of pasting links. $\endgroup$ – sam wolfe Dec 5 '19 at 20:23
  • $\begingroup$ A very similar question with an accepted answer about the expected longest run of heads (instead of heads or tails): math.stackexchange.com/questions/1409372 $\endgroup$ – joriki Dec 5 '19 at 20:28
  • $\begingroup$ Thank you, I have had a look at that post, however, I am not sure how to generalise it to consider heads or tails. $\endgroup$ – gb4 Dec 5 '19 at 20:30
0
$\begingroup$

Following the approach suggested in What is the expected length of the largest run of heads if we make 1,000 flips?, we expect $N_k=2n(1-p)p^k=n\left(\frac12\right)^k$ runs of heads or tails of length $\ge k$ (twice as many as if we only counted runs of heads). So a rough estimate of the expected maximum length is the solution for $k$ of $N_k=n\left(\frac12\right)^k=1$, which is $k=\log_2n$. Thus, the expected length is roughly the same as if we only count runs of heads, just $\log_22=1$ more.

Here's code that simulates this difference. For $n=1000$, the difference is about $0.998$, in good agreement with the approximation. Thus, you can basically use the answers to the above question and add $1$.

$\endgroup$

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.