# finding the probability for coin toss and expected number of flips required, is this the right answer for this problem?

A coin having probability $$p$$ of coming up head is to be successively flipped until the first head appears.

1. find the probability that the first head occurs in odd number of tosses ?
2. find the expected number of flips required for the first head ?

the solution for number 1 $$p(1 + (1-p)^2 + (1-p)^4 + \ldots) = p\displaystyle\sum_{i=0}^\infty ((1-p)^2)^i = \frac{p}{1-(1-p)^2} = \frac{1}{2-p}.$$

the solution for number 2

$$\sum\limits_{i=1}^\infty i p (1-p)^{i-1}=\frac{1}{p}~~~~~~~$$

is this the right answer for this problem and thank you

Both are correct.

As a way to avoid the use of infinite series:

For the first note that we either win on the first roll, lose on the second, or reset. Thus, letting $$\Psi$$ denote the answer, we have $$\Psi=p+(1-p)p\times 0+(1-p)^2\Psi\implies \left(1-(1-p)^2\right)\Psi=p\implies \Psi=\frac p{1-(1-p^2)}$$

For the second note the recursive relation $$E=p\times 1 +(1-p)\times (E+1)\implies pE=1\implies E=\frac 1p$$

• thank you very much for confirming the answer and for explaining this more clear way to obtain it – green life Dec 16 '18 at 19:28

Let $$X =$$ number of tosses until a head appears.

Then $$X$$ ~ Geometric$$(\frac{1}{2})$$.

## Part 1

The probability we wish to calculate is,

$$\Pr(odd) = \sum_{k=0}^{\infty}{\Pr(X = 2k + 1)} = \sum_{k=0}^{\infty}{p(1 - p)^{2k}} = p\sum_{k=0}^{\infty}{((1-p)^{2})^{k}} = \frac{p}{1 - (1-p)^{2}} = \frac{1}{2-p}$$

## Part 2

Let $$Y =$$ heads was seen on the first flip.

Then $$Y$$ ~ Bernoulli$$(p)$$.

$$E[X] = E[E[X|Y]] = \Pr(Y = 1)E[X|Y=1] + \Pr(Y=0)E[X| Y=0] = p(1) + (1-p)(1 + E[X])$$

This then reduces to the equation, $$E[X] = 1 + (1-p)E[X]$$ And then solving for $$E[X]$$ we get $$E[X] = \frac{1}{p}$$

## Remarks

My calculations agree with yours, so I would conclude that your answers are correct.

• thank you very much for confirming the answer and for the explanation – green life Dec 16 '18 at 19:42