The expected length of initial run

expected valueprobabilitystatistics

I want to solve following question on probability distribution:

A coin is tossed repeatedly and probability that a head appears at any toss is $p$ where $0<p<1$. What is the expected length of initial run ?


A run of length $r$ is $r$ consecutive toss that are all the same. (e.g. $HTTHH$ has a run of length $1$ and two runs of length $2$).

Let us assume, we need $r$ tosses until first head appears, then the probability distribution function $$m(r)=(1-p)^{r-1}p.$$
If $t$ be the time of first head, then expectation of head $H$ is $$E(t)=1 \cdot p+(1-p)p+\cdots.$$
If $r=1$, then always the length of run is $1$.

If $r=2$, then we have $HH,TT,TH,HT$, so there are two runs ($HH, TT$) of length $2$ half of the time and two runs $(HT,TH$) of length $1$ half of the time.

But I am confused with the term "initial run" in my question. What does mean it ?

Best Answer

"But I am confused with the term "initial run" in my question. What does mean it ?"

In e.g. $HHTHTT$ the initial run is $HH$, in e.g. $TTTHHT$ the initial run is $TTT$.

I hope that these examples are enough to make clear what is meant by "initial run".


Problems of this sort can often be solved without looking too much at distributions.

Let $\mu$ denote the expectation of the length of the first run.

Let $\mu_H$ denote the expectation of the length of the first run under condition that the first toss results in heads.

Let $\mu_T$ denote the expectation of the length of the first run under condition that the first toss results in tails.

Defining $q:=1-p$ we find:$$\mu_H=p(1+\mu_H)+q1=1+p\mu_H\text{ and }\mu_T=q(1+\mu_T)+p1=1+q\mu_T$$leading to:$$\mu_H=q^{-1}\text{ and }\mu_T=p^{-1}$$ Then finally we find:$$\mu=p\mu_H+q\mu_T=pq^{-1}+qp^{-1}$$Of course you can make it an expression in $p$ only by substituting $q=1-p$.