Die roll and coin flip – Bayes’ theorem

bayes-theoremcombinatoricsconditional probabilityprobability

I am thinking to the question posed here: Die roll and coin flip.

"Suppose I roll a 4-sided die, then flip a fair coin a number of times corresponding to the die roll. Given that i got three heads on the coin flip, what is the probability the die score was a 4?"

We are looking for $P(\textrm{die} = 4 | 3\ \textrm{heads})$. I wanted to verify Bayes' theorem by just counting the events.

Let's suppose that the order of the coin flipping matters:

  • if the die scores 1, the coin cannot score 3 heads, out of 2 possible events.
  • if the die scores 2, the coin cannot score 3 heads, out of 4 possible events.
  • if the die scores 3, the coin can score 3 heads in 1 way, out of 8 possible events.
  • if the die scores 4, the coin can score 3 heads in 4 ways, out of 16 possible events.

So, I count:
$$
P(3\text{ heads})= \frac{5}{30}\\
P(3\text{ heads}|\text{die}=4)=\frac{4}{16}\\
P(\text{die}=4)=\frac14$$

so, by Bayes' theorem, I compute
$$
P(\text{die=4}|3\text{ heads})=\frac{P(3\text{ heads}|\text{die}=4)P(\text{die}=4)}{P(3\text{ heads})}=\frac{4}{16}\frac14\frac{30}5=\frac38.
$$

If I just count the events, I see that there are 5 combinations with 3 heads, and 4 are possible if the die scores 4, so I expect $P(\text{die=4}|3\text{ heads})$ to be equal to 4/5 and not 3/8.

We can redo the exercise disregarding the order of the coin flips:

  • if the die scores 1, the coin cannot score 3 heads, out of 2 possible events.
  • if the die scores 2, the coin cannot score 3 heads, out of 3 possible events.
  • if the die scores 3, the coin can score 3 heads in 1 way, out of 4 possible events.
  • if the die scores 4, the coin can score 3 heads in 1 way, out of 5 possible events.

So, I count:
$$
P(3\text{ heads})= \frac{2}{14}\\
P(3\text{ heads}|\text{die}=4)=\frac15\\
P(\text{die}=4)=\frac14$$

so, by Bayes' theorem, I compute
$$
P(\text{die=4}|3\text{ heads})=\frac{P(3\text{ heads}|\text{die}=4)P(\text{die}=4)}{P(3\text{ heads})}=\frac15\frac14\frac{14}2=\frac{7}{20},
$$

which in turn, reasoning like above, is not the expected 1/2.

What am I missing?

Best Answer

I'll compute the probability of getting 3 heads ($h$). As you wrote, we only have two possibilities: either we got a roll of 3 from the die $d=3$, or $d=4$. So: $$ P(h=3) = P(h=3 \cap d = 3) + P(h=3 \cap d = 4) $$ $$ P(h=3) = P(h=3 | d = 3) \cdot P(d = 3) + P(h=3 | d = 4) \cdot P(d = 4) $$ $$ P(h=3) = \binom{3}{3} \cdot \frac{1}{2^3} \cdot \frac{1}{4} + \binom{4}{3} \cdot \frac{1}{2^4} \cdot \frac{1}{4} $$ $$ P(h=3) = \frac{1}{32} + \frac{2}{32} = \frac{3}{32} $$

With this, the computation of the answer is obtained by applying the conditional probability formula: $$ P(d=4 | h=3) = \frac{P(d=4 \cap h=3)}{P(h=3)} = \frac{\frac{2}{32}}{\frac{3}{32}} = \frac{2}{3} $$

So, this was like applying Bayes theorem step by step.

Note that your second and third approaches are not correct because you can't compute probabilities using the number of events if they are not equiprobable. In the second approach each event when $d=4$ is less probable than when $d=3$ and in the third approach it is the other way around.

Related Question