probability - pair of dice is rolled

A pair of dice is rolled and the sum is determined. The probability that a sum of 5 is rolled before a sum of 8 is rolled in a sequence of rolls of the dice is ____.

The given answer is 4/9. Probability sum of 5 before sum of 7 I have found this link as well but I want to know where I am going wrong. My approach: Here 2 events are independent. Getting a sum of 5 won't be dependent on getting sum of 8 in next roll. so the problem reduces to probability of getting a sum equal to 5. Hence the probability is equal to 4/36 = 1/9. Even if you assume P(A/B) where A is the the event where sum is 5 and B is the event sum of 8. then P(A/B) = P(A) —- events are independent.

why to apply bayes theorem? what mistake I am doing, aren't this 2 events independent?

• Your argument makes no sense. Why on earth should the probability of getting a $5$ first be the probability of getting a $5$? – lulu Dec 13 '18 at 19:07
• By your reasoning, the probability that you get the $8$ first would be the probability of getting an $8$, so $\frac 5{36}$. But note that $\frac 5{36}+\frac 4{36}<1$. – lulu Dec 13 '18 at 19:10
• "then $P(A\mid B)=P(A)$ --- events are independent" You should rethink this. Think hard about what "$A$" represents and what "$B$" represents here. If by thinking of $A$ as the event that a sum of five is rolled on the first attempt, and $B$ as the event that a sum of eight is rolled on the second attempt (and attempts continue even after the first time a sum of 8 is rolled) then yes $A$ will be independent of $B$. Neither of these events seem directly applicable to this problem though. – JMoravitz Dec 13 '18 at 19:12

Denote the events $$A=$$ {sum of $$5$$}, $$B=$$ {sum of 8} and $$C=$$ {sum of non-$$5$$ or non-$$8$$).

On the first roll: $$P(A)=\color{red}{\frac4{36}}; P(B)=\frac5{36}; P(C)=\frac{27}{36}$$. If the event $$A$$ happens, we stop at the first roll. If $$B$$ happens, we fail, so ignore it. If $$C$$ happens, we keep rolling.

On the second roll: $$P(C_1\cap A_2)=P(C_1)\cdot P(A_2|C_1)=P(C_1)\cdot P(A_2)=\color{blue}{\frac{27}{36}\cdot \frac4{36}}$$. Again as above, we act upon the results of the three events.

On the third roll: $$P(C_1\cap C_2\cap A_3)=\cdots=P(C_1)\cdot P(C_2)\cdot P(A_3)=\color{green}{\left(\frac{27}{36}\right)^2\cdot \frac4{36}}$$. And so on. We get the following geometric series: \begin{align}P(A \ \text{before} \ B)&=\color{red}{\frac4{36}}+\color{blue}{\frac{27}{36}\cdot \frac4{36}}+\color{green}{\left(\frac{27}{36}\right)^2\cdot \frac4{36}}+\cdots=\\ &=\frac4{36}\left(1+\frac{27}{36}+\left(\frac{27}{36}\right)^2+\cdots\right)=\\ &=\frac4{36}\cdot \frac{1}{1-\frac{27}{36}}=\\ &=\frac{4}{36}\cdot \frac{36}{9}=\\ &=\frac49.\end{align}

It certainly isn't true that the probability of getting a $$5$$ first is just the probability of getting a $$5$$. To see that, suppose you were asked for the probability of getting a $$5$$ before a $$9$$. You'd still get $$\frac 19$$ but since a roll of $$5$$ is just as likely as a roll of $$9$$ the answer must be $$\frac 12$$ by symmetry.

You can modify your argument to make it work. Ignore every roll other than an $$8$$ or a $$5$$. Then there are $$9$$ rolls which have meaning, and $$4$$ of those yield a $$5$$ so the answer is $$\frac 49$$.

• Yes, this make sense. I didn't consider the multiple rolls. "Then there are 9 rolls which have meaning, and 4 of those yield a 5 so the answer is 4/9". I didn't get this line could you please explain? and also when to apply bayes theorem. – swapnil Dec 14 '18 at 5:26
• The point is that you can ignore every throw that isn't an $8$ or a $5$. That only leaves $9$ throws (the ones that give either $8$ or $5$). Each of those are equally likely so the probability that any given meaningful throw (including the first meaningful throw) is a $5$ is $\frac 49$. I don't see this problem as a Bayes' problem. At no point am I revising my estimate of a probability. – lulu Dec 14 '18 at 12:12
• To elaborate: one uses Bayes when one gets new information which provides some evidence one way or another. That evidence then causes us to re-estimate the relevant probabilities and Bayes gives us a good way to do that. For this problem, there is never any evidence of anything until the game is decided. – lulu Dec 14 '18 at 12:14
• This time I got it. there exist 9 possibilities which gives either sum 5 or 8. We need to concentrate on that ignoring all other outcomes and among them getting sum 5 only matters which has 4 possibilities hence 4/9. Thank you so much. – swapnil Dec 15 '18 at 11:09
• Yes! that's the point exactly. If you want an exercise in using this principle try to answer the old gambler's question: "rolling a pair of dice sequentially, what's the probability that you'll get a $6$ and an $8$ before you get two $7's$?" – lulu Dec 15 '18 at 11:33

A general technique to solve such problems where we have infinitely many independent trials and two disjoint events $$A$$ and $$B$$, where each trial we have $$P(A)=p$$, and $$P(B)=q$$ with $$p+q \le 1$$. Let us denote the chance that doing trials until $$A$$ or $$B$$ occurs, we stop at event $$A$$ without having seen $$B$$.

Then conditioning on the outcome of the first trial $$X_1$$:

$$x = P(A \text{ before } B| X_1 \in A)P(X_1 \in A) + P(A \text{ before } B| X_1 \in B)P(X_1 \in B) + P(A \text{ before } B| X_1 \notin A \cup B)P(X_1 \notin A\cup B)$$

We can use that $$P(A \text{ before } B| X_1 \in A) = 1$$ (we immediately have $$A$$ happening so we "win") and $$P(A \text{ before } B| X_1 \in B)P(X_1 \in B) = 0$$ (we have event $$B$$ so we stop and "lose") and by definition $$P(X_1 \in A) = p$$, $$P(X_1 \in B)=q$$ and $$P(X_1 \notin A \cup B)$$ means that neither $$A$$ nor $$B$$ occurred, and this happens with chance $$1-p-q$$. Also the probability $$P(A \text{ before } B| X_1 \notin A \cup B)$$ is just $$x$$ again, because if the first trial gives no stop condition $$A$$ or $$B$$, it's just the same situation as we had before the very first trial, and so the same probability that $$A$$ occurs before $$B$$.

So $$x=p\cdot 1 + q\cdot 0+x(1-p-q)$$ or $$(p+q)x =p$$ or $$x=\frac{p}{p+q}$$ Similarly, the probability that $$B$$ occurs before $$A$$ is $$\frac{q}{p+q}$$, together $$1$$.

In your case $$A$$ is throwing a $$5$$ which has probability $$\frac{4}{36}$$ and $$B$$ is throwing $$8$$ which has probability $$\frac{5}{36}$$.

The formula then gives $$\frac{\frac{4}{36}}{\frac{4}{36} + \frac{5}{36}} = \frac{4}{9}$$ as it should.

• Thank you so much Henno. – swapnil Jan 31 '19 at 2:58

$$4/36$$ only accounts for the probability of getting $$5$$ on the first roll. This is not the only way to roll a $$5$$ before an $$8$$. You could also roll a $$5$$ on the second roll. This requires rolling something which is not an $$8$$ on the first roll, so this probability is $$(1-9/36)\cdot(4/36)$$ Your result is missing this factor, and more (seeing a $$5$$ for the first time on the third, fourth, etc roll).

The reason to apply Baye's theorem is that the last roll in this process, the roll where you finally see a $$5$$ or $$8$$, behaves like a single roll conditional on the result being either $$5$$ or $$8$$. That is, $$P(5\text{ before }8)=P(\text{first roll is }5|\text{ first roll is }5\text{ or }8)$$ which is where Baye's comes in.

• Okay I got it. I was only considering for the first roll, and never think of the fact that in first attempt if it doesn't occur then I need to keep on rolling till getting a 5 or 8. which makes both event dependent, can you please elaborate on this step how you got (1-5/56).(4/46)? – swapnil Dec 14 '18 at 5:05
• You have some typographical errors in your calculation. – N. F. Taussig Dec 14 '18 at 13:21
• @swapnil Fixed, does it make sense now? – Mike Earnest Dec 14 '18 at 15:37
• Yes got it. thank you. Even I had first though it might be a typographical error. – swapnil Dec 15 '18 at 11:04
• Also for the second roll sum can't be 5 or 8 in the first roll. hence it becomes (27/36) - for not getting 5 or 8 in the first roll. and now in the second roll it can get sum 5 so 4/36. Hence for second time it will be (27/36)(4/36). what you have done is (1-5/36) I think it should have been (1-9/36). because when won't get 5 or 8 in the first roll then only we will roll for the second time. – swapnil Dec 15 '18 at 11:16