1

$p$ is the probability of getting a Head.
So the expected number of coin tosses before getting $h$ consecutive heads for the first time is:

$E(x) = hp^h + (1-p)[E(x)+1] + p(1-p)[E(x)+2] + p^2(1-p)[E(x)+3]+ ... + p^{h-1}(1-p)[E(x)+h]$

$E(x) = hp^h + (1-p)\sum_{i=0}^{h-1}p^i[E(x)+i+1]$ --------> (2)

$E(x) = (1-p^h)E(x)+\sum_{i=0}^{h-1}p^i$ --------> (3)

$E(x) = (1-p^h)E(x)+\frac{1-p^h}{1-p}$ --------> (4)

$E(x)=\frac{1-p^h}{p^h(1-p)}$ --------> (5)

I got this from the answer here. I dont understand how we get expression 3 from expression 2. Can someone please explain that.

1 Answers1

2

Hints: The coefficient of $E(x)$ is $(1-p)\sum\limits_{i=0}^{h-1} p^{i}$ and this is same as $1-p^{h}$ by the formula for a geometric sum. For the second term you will have to calculate $\sum\limits_{i=0}^{h-1} ip^{i}$. For this let $f(t)=\sum\limits_{i=0}^{h-1} p^{i}t^{i}$. Then $\sum\limits_{i=0}^{h-1} ip^{i}=f'(1)$. $f(t)$ is defined by a geometric sum with common ratio $pt$. Write down the value of this sum and differentiate to get that value of $\sum\limits_{i=0}^{h-1} ip^{i}$. The rest of the calculation is straightforward.