10

Let's say I roll two 8-sided dice. I win if the sums '7' and '11' show up before we see the sum '9' TWICE. What is my probability of winning?

So this is my answer and please correct me if I am wrong:

Prob of getting either 7 or 9 —> 6/64 + 6/64 = 12/64 —> 18.75%

Prob of getting 9 twice —> 8/64 x 8/64 = 1/64 —> 1.6%

But now to find the probability of winning, would it be 18.75 - 1.6 = 17.15% ? Am I right or wrong?

Thanks!

EDIT

From the answers provided below, we have three different results:

84% 49% 60%

Which one would be the correct answer?

Tim Solor
  • 155
  • This is a good problem for Markov chains. There are six states. (It would be more states if $7$ or $9$ were not equally likely.) – Thomas Andrews Dec 09 '20 at 19:32
  • The calculations you made are correct, but are not as useful as you might think. You have calculated the probability of getting two consecutive $9$'s, but you need to think about the probability of getting two $9$'s in general. – Joe Dec 09 '20 at 19:55
  • @ThomasAndrews would it be smt like 'prob of getting 7 or 9 given not prob of getting 9 twice', so 'prob of 18.75% given not 1.68%' ? Could you elaborate more on Markov please? – Tim Solor Dec 09 '20 at 20:04
  • When you say “if the sums $7$ and $11$ occur before two $9$s, do you mean you need both $7$ and $11,$ or do you need just one to occur? – Thomas Andrews Dec 09 '20 at 21:50
  • Just one to occur I guess... I am not the originator of the question – Tim Solor Dec 09 '20 at 21:57
  • Well, we only have you to go on for what you mean. @TimSolor The use of “and” in “$7$ and $11$” implies both. If you want one, the question should be “$7$ or $11$” – Thomas Andrews Dec 09 '20 at 22:01
  • Okay yeah makes sense, so it would be the sum of '7' and '11' (meaning both of them) – Tim Solor Dec 09 '20 at 22:04
  • still we got three different answers, I am so confused now ahaha – Tim Solor Dec 09 '20 at 22:05
  • @TimSolor You do not have three different answers. You have two different answers. One (two answerer) assumes both sum of $7$ and $11$ before two $9$'s. The other (again two answerer) assumes either a sum of $7$ or $11$ before two $9$'s. – Math Lover Dec 10 '20 at 03:19

6 Answers6

9

This assumes you win if you get both $7$ and $11$ before the two $9$s. Some people seem to be reading as if you win if you get one of these. I also assume the two $9$s do not need to be consecutive.

We can ignore the rolls that are not $7,9,11.$ The next roll in $7,9,11$ has probability $3/10,2/5,3/10,$ respectively.

Let the states of a Markov process bet $s_1,\dots,s_6$ with

  • $s_1$ be the state where no $7,9,11$ has occurred.
  • $s_2$ has gotten one $9$ and no $7,11.$
  • $s_3$ has gotten one of $7,11$ and no $9$
  • $s_4$ has gotten one of $7,11$ and one $9$
  • $s_5$ has gotten two $9$s first
  • $s_6$ has gotten $7,11$ first.

Then the Markov chain’s transition matrix is:

$$T=\begin{pmatrix} 0&2/5&3/5&0&0&0\\ 0&0&0&3/5&2/5&0\\ 0&0&3/10&2/5&0&3/10\\ 0&0&0&3/10&2/5&3/10\\ 0&0&0&0&1&0\\ 0&0&0&0&0&1 \end{pmatrix}$$

I used Wolfram Alpha to get that:

$$\lim_{n \to\infty}(1,0,0,0,0,0)T^n =\left(0,0,0,0,\frac{604}{1225},\frac{621}{1225}\right)$$

So the probability of winning is $\frac{621}{1225}\approx 0.507.$


You can avoid the Markov chain if you let $p_i$ be the probability of winning starting at state $s_i.$ Then you get the equations:

$$\begin{align}p_1&=\frac{2}{5}p_2+\frac35p_3\\ p_2&=\frac35p_4+\frac25p_5\\ p_3&=\frac3{10}p_3+\frac25p_4+\frac3{10}p_6\\ p_4&=\frac3{10}p_4+\frac25p_5+\frac3{10}p_6\\ p_5&=0\\ p_6&=1 \end{align}$$

Solving for $p_1$ gives you your answer. This can be done by hand:

  1. $\frac7{10}p_4=\frac3{10}$ give $p_4=\frac37.$
  2. $\frac7{10}p_3=\frac25\cdot \frac37+\frac3{10}$ gives $p_3=\frac{33}{49}.$
  3. $p_2=\frac35\cdot\frac37=\frac9{35}.$
  4. $p_1=\frac25\cdot \frac9{35}+\frac35\frac{33}{49}=\frac{18}{5^2\cdot 7}+\frac{99}{5\cdot 7^2}=\frac{621}{1225}$

Getting the same results.

Thomas Andrews
  • 177,126
5

We can ignore all the other possible rolls and consider that we are given that we roll a $7$, with a $\frac6{64}$ chance, an $11$, also with a $\frac6{64}$ chance, or a $9$, with an $\frac8{64}$ chance.

Once we've rolled a $7$ or an $11$, we take it out of the denominator because it is now a race between the other and $9$.

Below, we compute the probability of the first of two equal outcomes, then double it.

$\overbrace{\ \ 7{\to}11\ \ \vphantom{\frac{\frac11}{\frac11}}}^{\rightarrow}\text{or }11{\to}7:2\cdot\overbrace{\frac{\frac6{64}}{\frac6{64}+\frac6{64}+\frac8{64}}}^{7\text{ before }9,11}\cdot\overbrace{\ \ \frac{\frac6{64}}{\frac6{64}+\frac8{64}}\ \ }^{11\text{ before }9}=2\cdot\frac3{10}\cdot\frac37=\frac9{35}$

$\overbrace{7{\to}9{\to}11\vphantom{\frac{\frac11}{\frac11}}}^{\rightarrow}\text{ or }11{\to}9{\to}7:2\cdot\overbrace{\frac{\frac6{64}}{\frac6{64}+\frac6{64}+\frac8{64}}}^{7\text{ before }9,11}\cdot\overbrace{\ \ \frac{\frac8{64}}{\frac6{64}+\frac8{64}}\ \ }^{9\text{ before }11}\cdot\overbrace{\ \ \frac{\frac6{64}}{\frac6{64}+\frac8{64}}\ \ }^{11\text{ before }9}=2\cdot\frac3{10}\cdot\frac47\cdot\frac37=\frac{36}{245}$

$\overbrace{9{\to}7{\to}11\vphantom{\frac{\frac11}{\frac11}}}^{\rightarrow}\text{ or }9{\to}11{\to}7:2\cdot\overbrace{\frac{\frac8{64}}{\frac6{64}+\frac6{64}+\frac8{64}}}^{9\text{ before }7,11}\cdot\overbrace{\frac{\frac6{64}}{\frac6{64}+\frac6{64}+\frac8{64}}}^{7\text{ before }9,11}\cdot\overbrace{\ \ \frac{\frac6{64}}{\frac6{64}+\frac8{64}}\ \ }^{11\text{ before }9}=2\cdot\frac25\cdot\frac3{10}\cdot\frac37=\frac{18}{175}$

Thus, the probability of winning is $\frac9{35}+\frac{36}{245}+\frac{18}{175}=\frac{621}{1225}$

robjohn
  • 345,667
2

This answer assumes the person wins if there is a sum of $\, 7\,$ or $\,11\,$ in any toss before a sum of $\,9\,$ appears twice.

Probability of winning in first toss $ = \frac{12}{64}$

a) If the person gets a sum of $9$ once, the chance of winning from there

$\displaystyle P(W1) = \frac{12}{64} + \frac{44}{64} \times (\frac{12}{64} + \frac{44}{64} \times ...)... = \frac{12}{64} (1 + \frac{44}{64} + (\frac{44}{64})^2 + ...)$

$\displaystyle = \frac{3}{5}$

[Using sum of infinite geometric series $a + ar + ar^2 + ... = \frac{a}{1-r}$]

b) If the first toss is any sum other than $7, 9, 11, \,$starting 2nd toss

$P(W2) = \frac{12}{64} + \frac{8}{64} \times P(W1) + \frac{44}{64} \times (\frac{12}{64} + \frac{8}{64} \times P(W1) + ...)... $

$$= (\frac{12}{64} + \frac{8}{64} \times P(W1))(1 + \frac{44}{64} + (\frac{44}{64})^2 + ...) = \frac{21}{25}$$

$\,$

So person's chance of winning $ \displaystyle = \frac{12}{64} + \frac{8}{64} \times P(W1) + \frac{44}{64} \times P(W2) = \frac{21}{25}$

Math Lover
  • 51,819
  • As I’m reading it, there is no way to win in one toss - the question asks for $7$ and $11$ before two $9$s. But I could be wrong. OP could be clearer. – Thomas Andrews Dec 09 '20 at 21:57
  • @ThomasAndrews This is not the probability of winning in one toss... what I am finding is exactly that - $7$ OR $11$ before two $9$'s (non-consecutive). – Math Lover Dec 10 '20 at 03:04
  • @ThomasAndrews ok I read everything now. AND vs. OR confusion. I will edit to clarify what I assumed. – Math Lover Dec 10 '20 at 03:31
1

Here is another approach, this time using an exponential generating function. Readers interested in learning about generating functions can find many resources in the answers to this question: How can I learn about generating functions?

We want to find the probability that a sequence of rolls by two 8-sided dice contains at least one 7 and at least one 11 before it contains two 9s. For now, let's assume that the final roll is a 7. Since 11 has the same probability of 7, the probability of ending in 11 is the same as the probability of ending in 7.

Consider a successful sequence of rolls just before rolling the final 7. Such a sequence must contain at least one 11, no 7, at most one 9, and any number of other rolls (not 7, 9, or 11). The probability of rolling a 7 is $6/64$, the probability of rolling an 11 is $6/64$, the probability of rolling 9 is $8/64$, and the probability of rolling anything else is $44/64$. So the exponential generating function for the probability of such a sequence is $$f(x) = (e^{(6/64) x} -1) \;(1+ (8/64)x)\; e^{(44/64)x}$$ Then the next roll must be a 7. So the EGF for a successful sequence of $n+1$ rolls ending in 7 is $$g(x) = (e^{(6/64) x} -1) \;(1+ (8/64)x)\; e^{(44/64)x}\;(6/64) \tag{1}$$ That is to say, $$g(x) = \sum_{n=0}^{\infty} p_n \frac{x^n}{n!}$$ where $p_n$ is the probability of a successful series of $n+1$ rolls ending in 7. We want to know the sum of all the $p_n$'s. The trick here is that $$\sum_{n=0}^{\infty} p_n = \int_0^{\infty} e^{-x}g(x) \;dx \tag{2}$$ which is based on the identity $$\int_0^{\infty} e^{-x} x^n \;dx = n!$$ Substituting $(1)$ into equation $(2)$ and evaluating the integral, we find $$\sum_{n=0}^{\infty} p_n = \frac{621}{2450}$$ This is the probability of a successful sequence of rolls ending in 7. The probability of a successful sequence ending in either 7 or 11 is twice that, $$\frac{621}{1225}$$

awkward
  • 14,736
1

EDIT: Thanks to the comment by @robjohn it was confirmed that my code was rolling D7 not D8. I have corrected the code and the results below.


I decided to test it empirically, writing a C# code snippet to do the rolls and test whether or not I won.

A "trial" starts with rolling the dice and ends with either winning (7 and 11 both seen at least once) or losing (9 seen twice).
A "run" consists of 100,000 trials.
The experiment consisted of 30 runs.

Results:

run 1: 50616 wins on 100000 trials: 50.616% win percentage
run 2: 50674 wins on 100000 trials: 50.674% win percentage
run 3: 50653 wins on 100000 trials: 50.653% win percentage
run 4: 50781 wins on 100000 trials: 50.781% win percentage
run 5: 50967 wins on 100000 trials: 50.967% win percentage
run 6: 50512 wins on 100000 trials: 50.512% win percentage
run 7: 50758 wins on 100000 trials: 50.758% win percentage
run 8: 50549 wins on 100000 trials: 50.549% win percentage
run 9: 50740 wins on 100000 trials: 50.74% win percentage
run 10: 50905 wins on 100000 trials: 50.905% win percentage
run 11: 50253 wins on 100000 trials: 50.253% win percentage
run 12: 50578 wins on 100000 trials: 50.578% win percentage
run 13: 50592 wins on 100000 trials: 50.592% win percentage
run 14: 50699 wins on 100000 trials: 50.699% win percentage
run 15: 50771 wins on 100000 trials: 50.771% win percentage
run 16: 50557 wins on 100000 trials: 50.557% win percentage
run 17: 50454 wins on 100000 trials: 50.454% win percentage
run 18: 50826 wins on 100000 trials: 50.826% win percentage
run 19: 50724 wins on 100000 trials: 50.724% win percentage
run 20: 50677 wins on 100000 trials: 50.677% win percentage
run 21: 50576 wins on 100000 trials: 50.576% win percentage
run 22: 50599 wins on 100000 trials: 50.599% win percentage
run 23: 50694 wins on 100000 trials: 50.694% win percentage
run 24: 50740 wins on 100000 trials: 50.74% win percentage
run 25: 50720 wins on 100000 trials: 50.72% win percentage
run 26: 50934 wins on 100000 trials: 50.934% win percentage
run 27: 50539 wins on 100000 trials: 50.539% win percentage
run 28: 50825 wins on 100000 trials: 50.825% win percentage
run 29: 50738 wins on 100000 trials: 50.738% win percentage
run 30: 50488 wins on 100000 trials: 50.488% win percentage

C# code:

Random rnd = new Random();
int rollDice() => rnd.Next(1,9) + rnd.Next(1,9);

bool doTrial() { int saw7 = 0; int saw11 = 0; int saw9 = 0;

while (true) {
    var roll = rollDice();
    //Debug.Write($"{roll} ");
    switch (roll) {
        case 7: saw7++; break;
        case 9: saw9++; break;
        case 11: saw11++; break;
    }
    if (saw7>=1 && saw11>=1) 
        return true;
    if (saw9>=2) 
        return false;
}

}

for (int run = 1; run <= 30; ++run) {

int wins = 0;
int trials = 100000;
for (int i = 0; i &lt; trials; ++i)
{
    if (doTrial()) { wins++; }
}
Debug.WriteLine($&quot;run {run}: {wins} wins on {trials} trials: {(double)wins / (double)trials * 100.0}% win percentage&quot;);

}

  • 1
    I think that Random.Next(1,8) returns a random integer in $[1,8)$, so you probably need to use Random.Next(1,9). The probability of winning the game with $7$ sided dice is $\frac{849}{1600}=53.0625%$, which matches your results better than $\frac{621}{1225}=50.6938%$. – robjohn Dec 10 '20 at 19:26
  • You were correct -- maxValue Int32 The **exclusive** upper bound of the random number returned. I have corrected the code and posted new results. – Ross Presser Dec 10 '20 at 21:08
0

Lemma: if you repeat an experiment with probability $P$ for event $A$ and probability $Q$ for event $B$ (constant in each repetition) then the probability that you will see an $A$ before a $B$ is $\tfrac{P}{P+Q}$.

Based on the above lemma, let $A$ be the event of getting 7 or 11, and $B$ the event of getting 9. The desired probability is

$$\tfrac{P}{P+Q}+\tfrac{Q}{P+Q}\tfrac{P}{P+Q}$$

The first term is getting 7 or 11 before the first occurrence of 9. The second term is that the first 9 came before the first 7 or 11, but then the second 9 came after. The idea is that you can after the first 9 restart the rolls, waiting for only one 9.

YJT
  • 4,621