Sign up ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

As Introduction to Algorithms (CLRS) describes, the problem is

Suppose you flip a fair coin $n$ times. What is the longest streak of consecutive heads that you expect to see?

The book claims that the expects is $\Theta(\log{}n)$, and proves that it is both $O(\log{}n)$ and $\Omega(\log{}n)$. I want generize the problem, and look into the $\Theta(\log{}n)$.

For example, we're flipping a biased coin with the probability $p$ for head and $q$ for tail, where $p+q=1$. Supposing that the length of the longest streak is $X$, we want to rewrite $EX = A\log{}n + O(1)$, or more precisely, $EX = A\log{}n + B + o(1)$, or something else. How to determine the asymptotics for $EX$?

There's something trivial. Supposing that $P_{n,m}=\textrm{ probability that }X<m$, we have $P_{n,m}=qP_{n-1,m}+pqP_{n-2,m}+\cdots+p^{m-1}qP_{n-m,m}$ for $n \ge m$, and $P_{n,m}=1$ for $n<m$, thus $P_{n,m}$ could be solved out (linear difference equation), but there might be no useful formulas to determine the roots of $1-z-\cdots-z^m=0$ where $m>0$.

Any help? Thanks!

share|cite|improve this question
Look at the paper linked to by karakfa in his answer here:… – Byron Schmuland Jun 11 '12 at 12:20
@ByronSchmuland Thanks! I'll try. – Frank Science Jun 12 '12 at 3:18

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.