# Probability of flipping a coin

Assume there is a probability $p$ the have a head when we tossing a coin. Now we would keep on tossing the coin until there are at least one head one tail appeared. What is the expect number of flip that land on head? Now i can actually find out the expected number of flip is required but not sure whether it is useful for this question.

-

Assume that $p\ne 0$ and $p\ne 1$.
If we get a tail on the first toss (probability $1-p$), the expected number of heads is $1$. That is because in this case, the game stops as soon as we get a head.
If we get a head on the first toss, then we already have one head. The expected number of additional tosses until we get a tail is $\dfrac{1}{1-p}$. That is by the standard formula for the mean of a geometrically distributed random variable. All but one of these are additional tosses are heads.
So in that case the expected number of heads is $1+\dfrac{1}{1-p}-1=\dfrac{1}{1-p}$. Thus the required expectation is $$(1-p)(1)+p\dfrac{1}{1-p}.$$
If we wish, we can simplify this to $\dfrac{1-p+p^2}{1-p}$. It may be a little prettier to multiply top and bottom by $1+p$, obtaining $\dfrac{1+p^3}{1-p^2}$.