0

Suppose we tossed a coin with probability of tails $p$ until we got $n$-th tails. What is the expected length of the longest consecutive string on heads under this condition?

Let’s denote the length of the streak of heads, that is exactly before $i$-th tails as $X_i$. It is not hard to see, that all $X_i$ are i.i.d. and are distributed geometrically with parameter $p$. Thus our question can be reworded in the following way:

Suppose $X_1, … , X_n$ are i.i.d. random variables, geometrically distributed with parameter $p$. What is $E[\max(X_1, … , X_n)]$?

If the exact answer is too complicated, then asymptotic is also OK.

Chain Markov
  • 15,564
  • 6
  • 36
  • 116

2 Answers2

2

Let's work with the reworded version of your problem and let $Y = \max(X_1, \ldots, X_n).$ For discrete random variables having range $\{0,1,\ldots\}$ we have $\mathbb{E}[Y] = \sum_{y=0}^{\infty} \mathbb{P}(Y>y).$ We have the chain of equalities:

$$ \mathbb{P}(Y>y) = 1- \mathbb{P}(Y \leq y) = 1- \mathbb{P}(X_1\leq y, \ldots, X_n \leq y) = 1 - \mathbb{P}(X_1 \leq y)^n$$

and $\mathbb{P}(X_1 \leq y) = 1 - \mathbb{P}(X_1 > y) = 1 - (1-p)^y,$ so

$$ \mathbb{E}[Y] = \sum_{y=0}^{\infty} \left( 1 - (1-(1-p)^y)^n \right) =\sum_{y=0}^{\infty} \sum_{k=1}^n (-1)^{k+1} \binom{n}{k} (1-p)^{yk} $$ $$= \sum_{k=1}^n (-1)^{k+1} \binom{n}{k} \cdot \frac{1}{1-(1-p)^k}$$

Ragib Zaman
  • 35,127
0

Based on the answer by @RagibZaman, we can get the following asymptotics for our expectation:

$$\sum_{y=0}^{\infty} (1 - (1-(1-p)^y)^n) = O(1) +\int_0^\infty(1 -(1-(1-p)^y)^n) = O(1) + \lim_{x \to \infty} (x - x - \frac{1}{\ln(1-p)}\sum_{k = 1}^n\frac{(1 - (1 - p)^x)^k}{k}) = O(1) - \frac{1}{\ln(1-p)}\sum_{k = 1}^n\frac{1}{k} = \frac{\ln(n)}{\ln((1-p)^{-1})} + O(1)$$

Chain Markov
  • 15,564
  • 6
  • 36
  • 116