Determine $P(H|A)$ in a coin toss game

You and I play the following game: I toss a coin repeatedly. The coin is unfair and $$P(H) = p$$. The game ends the first time that two consecutive heads $$(HH)$$ or two consecutive tails $$(TT)$$ are observed. I win if $$(HH)$$ is observed and you win if $$(TT)$$ is observed. Given that I won the game, find the probability that the first coin toss resulted in head.

So far my attempt is:

Let A be the event that I win the game. Using the law of total probability:

$$P(A)$$=$$P(A|H)*P(H)+P(A|T)*P(T)$$

Where the probability is conditionally split between the first toss being Heads and Tails.

Now:

$$P(H)$$= $$p$$

$$P(T)$$ = $$1-p$$

$$P(A|H)=P({HH})+P({HTHH})....$$=$$p+p^2(1-p)$$+...= ???

$$P(A|T)=P({THH})+P({THTHH})....$$=$$p^2+p^3(1-p)$$+...= ???

I am unsure of how to continue from here. Can someone help?

2 Answers

I think you're on the right track!

Just one thing, notice that by Bayes:

$$P(H|A) = \frac{P(A|H)P(H)}{P(A)} = \frac{P(A|H)P(H)}{P(A|H)P(H) + P(A|T)P(T)}$$ Then from your calculations, you can notice that $$P(A|T) = p \cdot P(A|H)$$.

Now plugging things in $$P(H|A) = \frac{P(A|H)P(H)}{P(A|H)P(H) + p \cdot P(A|H)P(T)}$$ Notice you can cancel a lot of things and you should end up at a nice simple answer in terms of $$p$$

There is a way to do it without using (sums of) sequences.

Let $$\mu$$ denote the probability that you win.

Let $$\nu$$ denote the probability that you win if the first toss results in a head.

Let $$\rho$$ denote the probability that you win if the first toss results in a tail.

Then we have the following equalities:

• $$\mu=p\nu+\left(1-p\right)\rho$$
• $$\nu=p+\left(1-p\right)\rho$$
• $$\rho=p\nu$$

Solving this we find:

• $$\nu=\frac{p}{1-p\left(1-p\right)}$$
• $$\rho=\frac{p^{2}}{1-p\left(1-p\right)}$$
• $$\mu=\frac{p^{2}\left(2-p\right)}{1-p\left(1-p\right)}$$

If $$A$$ denotes the event that you win and $$H$$ denotes the event that the first toss results in a head then under condition $$p>0$$ we find:$$P\left(H\mid A\right)=\frac{P\left(A\mid H\right)P\left(H\right)}{P\left(A\right)}=\frac{\nu p}{\mu}=\frac{1}{2-p}$$