Jump to content

Dice problem


NeonBlack

Recommended Posts

I am having trouble with a probability problem:

 

On average, how many rolls of a pair of dice will it take until the sum of the two dice is four?

 

That is, I roll two dice. If the sum of the dice is not 4, I will roll again until it is 4. How many rolls should it take on average?

 

I know that there are two possible ways to get a sum of four: either one of the dice is a 1 and the other is 3, or both of them are 2.

 

There are 19 combinations of dice that do not results in a sum of 4, so the probability of getting a sum of 4 is 2/19.

 

Now how do I figure out the expected number of rolls it will take to get a sum of 4?

This problem is not even for a statistics class, so I have no idea what to do.

Link to comment
Share on other sites

Well, the first issue here is that you do not have the correct probability for getting a sum of 4. There are not 19 combinations from rolling 2 dice, there are in fact 36. That comes from 6*6. Your error comes from not recognizing that 3&1, 2&2, and 1&3 are 3 separate events. 3&1 and 1&3 are different.

 

For small set like the two dice, it can be very helpful to make up a table of all the possible events:

 

1&1 2&1 3&1 4&1 5&1 6&1

1&2 2&2 3&2 4&2 5&2 6&2

1&3 2&3 3&3 4&3 5&3 6&3

1&4 2&4 3&4 4&4 5&4 6&4

1&5 2&5 3&5 4&5 5&5 6&5

1&6 2&6 3&6 4&6 5&6 6&6

 

From the table, you can see all 36 possibilities, and how 3 possibilities yield a sum of 4 (I bolded those for you). So, the actual probability of rolling a sum of 4 is 3/36 or 1/12.

 

Now, in terms of how many rolls it would take, on average (which is a very key phrase here!), we know that on any one roll the probability of rolling a sum of 4 is 1/12.

 

Now, imagine if we rolled the two dice twice in a row. What are the chances that there is a sum of 4 on either roll? Well, you get 1/12 on the first roll, and 1/12 on the second roll. So 1/12 + 1/12 = 2/12 or 1/6.

 

I think you can see how 3 rolls of the pair of dice increases of rolling one sum to 4 is 1/4. And if you keep increasing the number of rolls, how you keep increasing the probability.

 

Finally, you have to recognize that when the probability is 1, that means on average you can expect that even to occur. So, I bet you can calculate how many rolls it would take, on average, until a sum to 4 occurs.

Link to comment
Share on other sites

Thank you, bignose. Your explaination was very helpful. I know that this is the correct answer because now my simulation agrees with the theoretical result (this was actually a simulation problem for a class), but I am still not sure why, if I have two identical dice, I should consider 3&1 and 1&3 to be two distinct events.

Link to comment
Share on other sites

Well, there are two different points of view, both valid so long as you take care of the details.

 

The first point of view is the one I advocated above, that 1&3 and 3&1 are seperate events. I find this point of view easier. Bascially, it treats each single die as it's own seperate event. Then 1&3 would be the probability that the first die reads 1 and the second die reads 3. The probability for each die to read any one number is 1/6, so the probability for the first die to read 1 and the second to read 3 is (1/6)*(1/6) = 1/36. And, the entry 1&3 is one of 36 entries on the table. So, it all comes out the same. So, the chances of 1&3 or 3&1 are just 2/36

 

I find this way the easiest and most straightforward way to think about the problems.

 

But, the second way would to treat each die as indeterminable. That is, you don't call one die the 'first' and the other the 'second'. So, one die needs to roll either a 1 or a 3, the chances of that is 2/6, and the other has to roll a specific number (a 3 or 1 resepctively), the chances of the other die rolling any specific number is 1/6. The product of these two is 2/36, the same as the above.

 

So, you can see how either way of thinking gets the same answer. It is good to know how to do either method, but each way, the 1&3 and 3&1 comes up with 2/36. The first method I think is by far the easiest to see, since, in effect, you just count the results off of the table like the one in my previous post. But, you can imagine how much more difficult it gets with larger numbers of random variables. The table above gets much more complicated if you roll 3 dice, just imagine how complicated it would be if you rolled 20 dice. That's where the second method can be more useful.

 

Here is a good test, do you see how 7 is the most common sum to roll? Can you caclucate the odds using both methods I listed above?

Link to comment
Share on other sites

Now, imagine if we rolled the two dice twice in a row. What are the chances that there is a sum of 4 on either roll? Well, you get 1/12 on the first roll, and 1/12 on the second roll. So 1/12 + 1/12 = 2/12 or 1/6.

 

I think you can see how 3 rolls of the pair of dice increases of rolling one sum to 4 is 1/4. And if you keep increasing the number of rolls, how you keep increasing the probability.

 

Finally, you have to recognize that when the probability is 1, that means on average you can expect that even to occur. So, I bet you can calculate how many rolls it would take, on average, until a sum to 4 occurs.

 

This is incorrect. A probability of 1 means it will definitely occur. You are correct that the probability on any given roll is 1/12, but you can't just add probabilities of successive rolls.

 

Instead:

 

First roll is 1/12. If you roll 4, you're done. However there is an 11/12 chance you have to roll again, with the same 1/12 probability. So, for two rolls, the P = 1/12 + (1/12)*(11/12) = 23/144, which is less than 1/6.

 

Or in other words, the probability of at least one roll of four is 1 - (11/12)^n, where n is the number of flips. You need 8 rolls in order to get a probability greater than 1/2.

 

As you can see, the probability will never reach one, because each successive roll adds 1/12 of the probability that it wasn't rolled before. This makes sense - no matter how many rolls you make, you can never guarantee a roll of 4.

 

If you're not convinced, look at a simple coin flip (the math is easier). What is the probability after 4 flips that you will get at least one heads?

Link to comment
Share on other sites

No, Sisyphus, you are not right here, because you've broken an independence assumption here. Namely, that each roll is brand new and not dependent upon the values before it. I think that the key assumption/phrase here is "on average"

 

You are assuming that the player is re-rolling until he gets his 4. Using F as a Failure (not rolling a 4) and S as a Success (rolling a 4), you are calculating the distribution of

 

FFFS, FFFFFFS, FS, FFFFS, FFFFFFFFS, FFFFS, FFFFFS

 

You are calculating the probability of each of those results, since you stop as soon as you get that S. And, you are right in that you cannot ever guarantee an S, i.e. there is a probability for the result FFF...100 billion more F's ...FFFS that is not zero.

 

Whereas my calculations are calculating

FFFFSFFFFSFFFFFFFFFFSFFFFSFFFFFFFFFFFFFFFFFFSFFFFFSFFFFFSFFFFSFFFFFFFFFFFFSFFFFFFFFFFS

and calculating the average number of F's between each S. Which will be 11 (=12-1) meaning, on average, you will have to roll the pair of dice 12 times to have one sum to 4. Or, put another way, if you look at any 12 letters in a row there, on average, it will contain at least one S. There will be 12 letter strings were there are no S's, and there will be strings where there are many S's, but on average, each 12 letter string will have 1 S.

 

I'll make you a friendly wager. I get 8 rolls (approx. your 50% point), and if I get 1 or more 4's in those 8 rolls, You give me 1 penny. If I don't get at least 1 4, I give you a penny. If we play this game long enough (thereby invoking the "on average" phrase), I will have much more money than you.

 

The independence of each roll allows me to add together the probabilities. Though, by invoking the phrase "on average" the word probabilities really shouldn't be used -- I should use the word frequencies. Maybe this is the source of the confusion. I have been casual with the use of the language, and for that I apologize, I should have been more careful. I shouldn't be so quick to mix the words since the difference between the words is subtle, but pertinent.

 

So, by invoking the phrase "on average" the frequencies can be summed together, and again I can state that on average it will only be 12 rolls until at least 1 sum of 4 has occured.

Link to comment
Share on other sites

No, Sisyphus, you are not right here, because you've broken an independence assumption here. Namely, that each roll is brand new and not dependent upon the values before it. I think that the key assumption/phrase here is "on average"

 

No, I'm not making that assumption. However, when success overall is defined as at least one, the situations are equivalent. Roll ten pairs of dice. What is the probability that at least one will be a four? Answer: the same as the probability that ALL of them will be NOT four. The probability for each pair is 11/12. So the total probability is (11/12)^10.

 

I'll make you a friendly wager. I get 8 rolls (approx. your 50% point), and if I get 1 or more 4's in those 8 rolls, You give me 1 penny. If I don't get at least 1 4, I give you a penny. If we play this game long enough (thereby invoking the "on average" phrase), I will have much more money than you.

 

It's slightly more than 50, but assuming it was exactly 50, there would be no advantage to either of us. Any given set of 8 rolls has a 50 percent chance of containing at least one roll of 4. If I give you 9 rolls, you will have the advantage.

 

Or, put another way, if you look at any 12 letters in a row there, on average, it will contain at least one S. There will be 12 letter strings were there are no S's, and there will be strings where there are many S's, but on average, each 12 letter string will have 1 S.

 

This is true, but it is not the same as saying that the probability of success for a 12 letter string is 50%. Why? Because both "1 success" and "multiple successes" count as "success." If the average is one, then necessarily you are more likely to get at least one than not. Again, look at coin flips. On average, a set of two will contain one heads. But any particular set of two has a 3/4 chance of containing a heads.

Link to comment
Share on other sites

On average, a set of two will contain one heads. But any particular set of two has a 3/4 chance of containing a heads.

 

Right, but you just said it yourself, a set of two will contain one heads. In other words, on average you will have to flip a coin 2 times to get at least one heads. The frequency of getting heads is 1 heads per two flips. Multiply that by 2 flips and you get one heads. (1 heads/2 flips)*(2 flips) = 1 heads

 

Just like the frequency of rolling two dice that sum to 4 is 1 sum to four per 12 rolls. Mulitply that by 12 rolls and you get, on average, one sum to four.

 

Write yourself a program in your favorite language, or you can even do this in Excel. Here is the psuedo code of the simulation I wrote:

 

begin dicerollingprogram

totalrolls=0

do i=1,number of trials

rolls=0

count=1

sumtofour=.false.

do while (sumtofour=.false.)

roll two dice, d1 & d2

if (d1+d2=4) then

sumtofour=.true.

rolls=count

else

count=count+1

endif

enddowhile

totalrolls=totalrolls+rolls

enddo

avgrollstofour=totalrolls/(number of trials)

 

I wrote this up in FORTRAN and ran it for 100000 trials several times

 

avgrollstofour? I got 11.994, 12.002, 12.001, 11.998, 11.989, 12.001, 12.002 when I kept re-running it.

 

It takes an average of 12 rolls to to get one roll where the dice sum to 4.

Link to comment
Share on other sites

Edit: I deleted this post since I had some pretty significant errors in it. I came back and fixed it later, but in terms of full disclosure, I wanted to let people know that this post is not the same as I posted before.

 

OK, Dug out my old statistics book, and really, what this situation is, is a negative binomial distribution. From my statistics book (Devore's Probability and Statisitcs for Engineering and the Sciences, 4th ed., 1995) The negative binomial random variable and distribution are based on an experiment satisfying the following conditions:

1) The experiment consists of a sequence of independent trials.

2) Each trial can result in either a success (S) or failure (F).

3) The probability of success is constant from trial to trial, so P(S on trial i) = p for i=1,2,3,...

4) The experiment continues (trials are performed) until a total of r successes have been observed, where r is a specificed positive integer.

 

This is exactly what we are trying to describe here, where Sucess S is defined as a roll of the dice where the sum is 4, p=1/12, and we are looking for r=1 success until the trials are stopped.

 

The negative binomial distribution is:

 

nb(x; r,p)= ( (x+r-1) choose (r-1) )*(p^r)*(1-p)^x (Sorry I didn't type this into Latex, I don't have the time to lok up how to do the x choose y properly, I'll try to come back and fix it later tonight)

 

The expected value of the negtive binomial is E(X) - r*(1-p)/p and the variance V(X)= r*(1-p)/p^2

 

Using the values from above, r=1 & p=1/12, E(x)=11, meaning there the expected number, or average number, of failures before a success occurs is 11. Meaning, 12 rolls, on average, are needed until rolling a 4. This is what I calculated above, but not from the distribution.

 

The difference between this calculation and what Sysiphus is calculating, is that this is the average number of rolls, and Sys is caclulating the probability of needing 12 rolls or less. The probabilty of needing 12 rolls or less is not 1, I agree with that, because there are very good chances it will take more than 12 rolls to get a 4. But, on average, it is 12 rolls.

Link to comment
Share on other sites

Right, but you just said it yourself, a set of two will contain one heads. In other words, on average you will have to flip a coin 2 times to get at least one heads.

 

No, that's not "in other words." Flipping two coins will give you a heads 75% of the time. Look:

 

On average, there will be 1 roll of 4 in every 12 rolls.

 

You will need at least 8 rolls to get at least one roll of 4 on average.

 

Both of the above statements are true. The first deals with the average number of successes. Sometimes you get zero, sometimes more than one, and it averages out. The second deals with the chance of any success at all.

 

Incidentally, your simulations prove me right. Are you aware of that? What was the point of them?

Link to comment
Share on other sites

On average, there will be 1 roll of 4 in every 12 rolls.

 

You will need at least 8 rolls to get at least one roll of 4 on average.

 

How can these two statements be compatible? They say the same thing, but with two different numbers in the key spot. How can it be both 8 rolls and 12 rolls, one has to be correct.

 

My vote is still for the 12, not only from my first posts, but also from the expected value of the negative binomial distribution, which describes this situation exactly.

 

And how does the simulation where it counts the number of rolls until a 4 is rolled, which resulted in 12 rolls being needed on average, prove you right, when I keep saying 12 and you keep saying 8?

Link to comment
Share on other sites

No, that's not "in other words." Flipping two coins will give you a heads 75% of the time.

 

This piece of information is correct, but you are not answering the question at hand. Which is, on average, how many coin flips will it take to get one heads. Or, in math-speak, what is the expected value of the number of flips until you get a head. That 75% number is correct, in that it is the cumulative probability for two flips. That is, 75% is the probability of taking 2 or less flips. You have to use the frequency to get the average number. That is 75% (for two flips) - 50% (for one flips) = 25% to take exactly two flips. Which can also be calculated since you have to go tails then heads on the flips, each of which is a 1/2 chance, so the chances of going tails then heads is 1/2*1/2 = 25%. Next, you have to weight each of these possibilities correctly to get the expected value:

 

The expected value of a discrete distribution is SUM x*p(x) where the sum is over the entire domain of all values of x. p(x) is the probability. One of the issues here is that you have been calculating the cumulative distributions. I.e. 0.75 is the probability that is takes at most 2 flips, i.e. the chances of it taking one flip PLUS the chances of it taking two flips. p(x) in the above expected value is the probability it takes exactly x flips to get one heads.

 

So the coin flip problem is the sum of

1*(probability it only takes 1 coin flip to get a heads=0.5)

+ 2*(probability it only takes 2 flips to get a heads = 0.75-0.50=0.25)

+ 3*(probability it only takes 3 flips to get a heads = 0.875-0.75=0.125 )

+ 4*(0.063) + etc.

 

This is SUM (from n=1 to inifnity) of n*(1/2)^n

 

Instead of infiinty, if we sum to a set number of terms, a pattern emerges:

 

Fisrt column=number of terms in the sum, second colunm = result of the sum

 

5 1.781

6 1.875

7 1.93

8 1.961

9 1.979

10 1.988

11 1.994

12 1.997

13 1.998

14 1.999

15 1.999

 

Now, if you keep adding more and more terms to that sum, it is going to converge to 2. Meaning that the average number of flips it is going to take until you get one heads is two. That is from the very definition of the expected value.

 

Now, let's do the exact same thing with the dice rolling

 

again, let's use the negative binomial distribution

nb(x; r,p) = ( (x+r-1) choose (r-1))*p^r*(1-p)^x

 

x in this case would be number of rolls before rolling that first four. That is, x=0 corresponds to rolling a 4 on the very first try. p=1/12, and r=1.

 

nb(0,1,1/12)=1/12=0.083 This is the change of rolling a 4 on the first try

nb (1,1,1/12)=0.076 (I'm going to skip typing the ,1,1/12 in the rest)

nb (2) = 0.07

nb (3) = 0.064

nb (4) = 0.059 This is the chance it takes exactly 5 rolls to roll the sum to 4 on the last roll.

nb(5) = 0.054 and so on...

 

Now, let's compute the expected value of this

 

E(x)= SUM (i=0 to infinity) of i*nb(i,1,1/2)

 

Again, we can't sum to infinity, so we take a discrete number of terms and see if a pattern emerges. This series is going to take a lot longer to converge than the coin flipping one, so I'm not going to write every term.

 

10 terms' SUM = 2.552

20 = 5.853

30 = 8.17

40 = 9.532

50 = 10.267

60 = 10.643

70 = 10.83

80 = 10.92

90 = 10.963

100 = 10.983

110 = 10.992

120 = 10.996

130 = 10.998

140 = 10.999

150 = 10.9999

 

I think we can see that this series is converging to 11. Meaning that the expected value is 11 failed rolls before 1 successful rolls, or 12 rolls in total to average 1 roll of 4 on the dice.

 

Again, taken from the exact definition of an expected value. On average, 12 rolls to get one roll that sums to 4 on two dice, and on average two flips to get one heads on a coin.

 

I don't know anything more I can do to convince you, Sisyphus. If you need more, please don't hesitate to ask, but this last post I hope is pretty conclusive.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.