Suppose you flip a biased coin (probability of heads is , ). What is the expected number of flips to get consecutive heads, where is a positive integer?

Let be the number of flips until consecutive heads are observed. Let , . Clearly for and . For , we have

Let be the probability generating function of . Multiplying by and summing over , the left-hand side is

and the right-hand side

Reversing the order of summation ( implies ) yields

Equating the two, we have

and hence

Differentiating, we have

Hence

In particular, when , we have