# Showing by conditional expectation

Suppose flipping a coin with probability $p$ to get a head. Suppose we flip it until a head appear. What is the mean number of flip required getting a head? (Better to use conditional expectation to show the mean)

-
What do you mean by the last sentence? Is it a question? – Stefan Hansen Sep 29 '12 at 10:07
Ya, but i am asking if someone can use conditional expectation to solve the problem – Mathematics Sep 29 '12 at 10:20

If $E$ is the expected number of flips, then we have following relation $$E = p\cdot 1+ (1-p)\cdot(1+E)$$ because with probability $p$ we succeed at first try and with probability $1-p$ we have "wasted" one try and start again. Once we agree that $E$ is finite, this produces $$E = \frac1p.$$

-

It may be helpful to use a tree diagram and consider the various conditional probabilities. If you do this then you sum the following $E(X) = p + 2qp + 3q^2p + 4q^3p + \dots$

This can then easily be written as $E(X) = p\times(1 + 2q + 3q^2 + 4q^3 + \dots) = \frac{p}{(1-q)^2} = \frac{p}{p^2} = \frac{1}{p}$.

This result can be interpreted as follows:

$E(X) = 1\times p + (2qp + 3q^2p + 4q^3p + \dots)$

and the expression in brackets can be written as $(1 + \frac{1}{p})\times q$ so that we have

$E(X) = 1\times p + (1 + \frac{1}{p})\times q$

The first term is just $E(X|H) P(H)$ while the second term is $E(X|T) P(T)$.

-
It might be worth stating explicitly that $q:=1-p$, for the sake of a more immediate understanding. – G. Sassatelli Nov 15 '15 at 17:15