# Consider a game with 2 stages. In the first stage, the player tosss a coin until a head is appears

Consider a game with 2 stages. In the first stage, the player tosss a coin until a head is appears. Say that it takes j flips to get a head. Then, in the second stage, he random draws an integer between 1 and $$2^j$$ to get his winnings (so for example if he draws 2,he gets 2 dollars). a) What is the average amount of dollars he gets? b)Given that he wins 4 dollars, what is the probability that the coin was flipped exactly 6 times,i.e,that j=6?
My work for question a is I have the probability $$\frac{1}{2^j}$$ until getting a head,and each time I have a head,i calculate the expected value of money in range from 1 to j,so:
$$$$E(X) = \sum_{j=1}^\infty \frac{1}{2^j}\sum_{i=1}^{j}i\frac{1}{2^j}$$$$ b) I call A is the event he gets 4 dollars and B is the event he flipped the coin exactly 6 times,so
$$$$P(B|A) = \frac{P(B \cap A)}{P(A)}$$$$ with
$$$$P(B \cap A) = \frac{1}{2^6} \ and \ P(A)=\sum_{i=2}^\infty \frac{1}{2^i}$$$$ is it a right way to do? if it's right, how can i calculate the sums?

• In your equation for the expected value did you mean to have the outer summation be over $j$ instead of $n$? Commented Jan 18, 2021 at 4:08
• oh,srry it's a typo Commented Jan 18, 2021 at 4:10

(a) Your inner summation should go from $$1$$ to $$2^j$$. You can also simplify the summations:
$$$$E(X) = \sum_{j=1}^\infty \frac{1}{2^j}\sum_{i=1}^{2^j}i\frac{1}{2^j} = \sum_{j=1}^\infty \left( \frac{1}{2^j}\cdot \frac{1+2^j}{2} \right) =\frac{1}{2}\sum_{j=1}^\infty \left( \frac{1}{2^j} + 1 \right) = +\infty$$$$
(b) How did you get $$P(B \cap A) = \frac{1}{2^6}$$? Isn't that $$P(B)$$? Since $$P(A)$$ and $$P(A \cap B)$$ are hard to computer I suggest computing the conditional this way:
$$$$P(flip=6|won=4) = \frac{P(won=4|flip=6)P(flip=6)}{\sum\limits_{i=1}^\infty P(won=4|flip=i)P(flip=i)}$$$$
• The expected value of a random variable does not need to converge and it can diverge to $-\infty$ or $+\infty$ as it did in this case. A simpler example where the expected value diverges to $+\infty$ is a game where you flip a coin until you get heads and you get $2^i$ dollars where $i$ is the number of flips. Commented Jan 18, 2021 at 6:50
• As for part (b) $\frac{12}{2^{12}}$ looks correct to me. Commented Jan 18, 2021 at 7:06