# Expected number of coin tosses before obtaining at least 1 head

We have covered conditional probabilities and law of total expectation so far but I have a very poor understanding of those concepts. I have absolutely no clue on how to proceed with this question:

A fair die is thrown and a coin is tossed the number of times as the score shown on the die. If any heads are shown in the tosses of the coin, we stop, otherwise, we continue the experiment of throwing the die and coin toss until at least one head is shown. Find the expected number of coin tosses before we stop.

• What is the probability of stopping in the tosses after the first throw of the die? – Henry Jan 31 '18 at 16:09
• You need to find expectancy/mean. – prog_SAHIL Jan 31 '18 at 16:44

Let $q(k)$ be the probability that a head fails to appears when the die shows $k.\;\,$Then $$q(k)=\left({\small{\frac{1}{2}}}\right)^k$$ Let $p(k)$ be the probability that a head appears when the die shows $k.\;\,$Then $$p(k)=1 -q(k) = 1 - \left({\small{\frac{1}{2}}}\right)^k$$ Let $x$ be the expected number of tosses until the game ends.

Either a head appears in the first round, or if not, we are effectively starting a new game, with a prior toss count equal to the value of the roll in the first round.

It follows that $$x = \sum_{k=1}^6 \left({\small{\frac{1}{6}}}\right) \Bigl(p(k)(k) + q(k)(k+x)\Bigr)$$ which simplifies to $$x = \frac{7}{2}+\frac{2}{128}x$$ hence $$x = \frac{448}{107}\approx 4.186915888$$

• helpful answer ! Your thought process is clear but I have troubles understanding how to translate it into that equation. how can x be on both sides ? also, do you have any suggestions about books or online resources that could help me for probability, the materials presented in my course seem too advanced for me. – SKS Feb 1 '18 at 16:09
• @SKS: Let $x$ be the expected number of tosses for the game. Suppose the die in the first round shows $k$ (probability $\frac{1}{6})$. If a head appears (probability $p(k)$), the number of tosses is $k$, so the contribution to the expected number of tosses is $\frac{1}{6}p(k)(k)$. If a head does not appear (probability $q(k))$, the expected number of tosses starting at round $2$ is just $x$ again (it's effectively the start of a new game, but with $k$ tosses already used), so the contribution to the expected number of tosses is $\frac{1}{6}q(k)(k+x)$. – quasi Feb 2 '18 at 0:25

Let the expected number of tosses from the present time to stopping be $E$. If a 1 is rolled, which happens with probability $\frac16$, we flip the coin once. With probability $\frac12$ there are no heads and we spend an expected $E$ more flips from there.

The same situation happens with a roll of 2; because two flips are done, the $\frac12$ becomes $\frac14$. Similarly for a roll of 3, when it becomes $\frac18$, and so on.

All this can be encoded in a relation for $E$: $$E=\frac16\left(1+\frac12E\right)+\frac16\left(2+\frac14E\right)+\dots+ \frac16\left(6+\frac1{64}E\right)$$ $$6E=1+\frac12E+2+\frac14E+\dots+6+\frac1{64}E=21+\frac{63}{64}E$$ $$E=\frac{21\cdot64}{64\cdot6-63}=\frac{448}{107}=4.1869\dots$$

• Your help is much appreciated however I don't quite grasp how you get to the equation... lets consider the first term, you multiply the probability of obtaining a one to the sum of one and a "half multiple" of the expectation. why ? I understand that the probability of not obtaining a head is 1/2 but what does 1/2*E actually represent ? – SKS Feb 1 '18 at 15:30
• @KENNYMOURAT It represents that half of the time, no heads show up, making you start all over again (roll the dice, flip your coins). And this will take a further $E$ flips on average. – Parcly Taxel Feb 1 '18 at 15:32