33 Posts
BoardGameGeek» Forums » Board Game Design » Design Queries and Problems
Subject: Dice probability problem.
Your Tags:  Add tags 
Popular Tags:  View All]  [

I fail to resolve this urging problem.
What are the probabilities, on 4,5 and 6 dice rolls that I'll get any triple/ any quadruple?
 [+] Dice rolls

For four dice
1/6 x 1/6 x 1/6 x 5/6 = 5/1296 per number
so any number =6x5/1296 = 30/1296 = 0.023 = 2.3 % chance for a triple
Its a long time since I did any probability so if I were you I would wait for confirmation.

 Last edited Fri Jan 20, 2017 4:09 pm (Total Number of Edits: 1)
 Posted Fri Jan 20, 2017 4:07 pm
 [+] Dice rolls

First 2 dice establish initial pair so first 2 dice are 1/6 chance to be doubles ( 6 x 1/6 x 1/6 ) = 6/36 = 1/6
Thereafter each die is another ( x 1/6 )
So 1 divided by 6^(n1) is the equation
1 / (6^2) for 3 dice = 1/36
1 / (6^3) for 4 dice = 1/216
etc
For a particular number (vs any number) to be the initial pair, divide by 6 again.
 [+] Dice rolls

Some context may help.
But assuming that we're talking about sixsided dice, and that you're interested in getting three or more of the same, and four or more of the same, then:
We can reframe this as what is the probability that we can select three dice, all of which will be the same. The probability that three dice are all the same is (6/6)*(1/6)*(1/6) = 1/36. Since you don't caretri what face matters, the first die can be anything, but the second two dice must match.
So we multiple that by the number of ways we can select three dice from 4, 5 and 6. This is a combination: n choose k. Or, for example 4 choose 3 = 4! / (3! *(43)!). This works out to:
4 dice: 4 ways
5 dice: 10 ways
6 dice: 20 ways
(you might want to check my arithmetic, I did it in my head)
However, this will doublecount when there is a match of more than three. You could subtract out these, or adjust our equation above to be explicit in that the other dice do NOT match. I guess I'm changing my assumption above to be exactly 3 dice.
For getting a triple, this becomes:
4 dice: 4 * (1/36)*(5/6) ~= 0.0926
5 dice: 10 * (1/36)*(5/6)^2 ~= 0.193
6 dice: 20 * (1/36)*(5/6)^3 ~= 0.322
Okay, that last one wasn't quite right, because we double counted when we get two set of 3 the same. Which, similarly has a probability of (ask if unclear):
20 * (1/36)*(5/6)*(1/6)*(1/6) ~= 0.0129
EDIT: so 6 dice triple ~= 0.322  0.5*0.0129 ~= 0.322  0.007 = 0.315
You can follow the same method to get quadruples.
Did I make any mistakes?
(Edited to fix mistake.)

 Last edited Fri Jan 20, 2017 6:48 pm (Total Number of Edits: 1)
 Posted Fri Jan 20, 2017 5:47 pm
 [+] Dice rolls

This would be a Binomial problem.
For example 3 1's with 4 dice:
X~B(4,1/6)
p(X=3)= 4c3 x (1/6)^3 x (5/6)^1. Gives the chance of 3 1's
But you could get 3 2's etc so multiply the above by 6
Giving 5/54 or about 9%
4c3 as there are 4 ways of getting 3 1's on 4 dice.
Similar for 5 dice but 5c3 and change (5/6) power to 2
5c3 means number of ways of choosing 3 from 5 i.e. 10

 Last edited Fri Jan 20, 2017 6:28 pm (Total Number of Edits: 1)
 Posted Fri Jan 20, 2017 5:53 pm
 [+] Dice rolls
 You posted while I was typing....I agree with the post above.
 [+] Dice rolls

Okay. This is a very simple binomial distribution problem
4 dice:
Triples: 4c3 (1/6)^3(5/6) *6 = 9.26%
Quads: 4c4 (1/6)^4(5/6)^0 *6 = 0.46%
5 dice:
Triples: 5c3 (1/6)^3(5/6)^2 *6 = 19.29%
Quads: 5c4 (1/6)^4(5/6) *6 = 1.93%
6 dice:
Triples: 6c3 (1/6)^3(5/6)^3 *6 = 32.15%
Quads: 6c4 (1/6)^4(5/6)^2 *6 = 4.82%
In general it is nCr * p^r * (1p)^(nr)
N= number of dice
R = number of like dice (triples 3, quads 4)
P = probability of success (1/6 on fair d6)
The distribution is then multiplied by n because the like sets can occur six different ways (1 through 6)
Today's post was brought to you today by the Letters p, r and n as well as the number pi and e.
 [+] Dice rolls

timonkey wrote:
Okay, that last one wasn't quite right, because we double counted when we get two set of 3 the same. Which, similarly has a probability of (ask if unclear):
20 * (1/36)*(5/6)*(1/6)*(1/6) ~= 0.0129
so 6 dice triple ~= 0.309
You can follow the same method to get quadruples.
Did I make any mistakes?
I believe there is a mistake in your double counting computation. The method you are using would result in more double counting. The combinations for 111222 and 222111 for instance would be double counted.
Instead, consider that there are 6C2 = 15 possible unique pairings of triples (trip 1 and trip 2, trip 1 and trip 3, etc).
For a given pair of triples, there are 6C3 = 20 possible arrangements. That makes 300 possible outcomes. 300/6^6 ~= .0064
Edit: Or just halve your result

 Last edited Fri Jan 20, 2017 6:45 pm (Total Number of Edits: 1)
 Posted Fri Jan 20, 2017 6:08 pm
 [+] Dice rolls
 Tim. I didn't catch the "double counting argument". Can you elaborate? I do see the potential. But what are you eliminating and how do?
 [+] Dice rolls

Another way to think about the triple on 6 dice situation is find the probability of getting exactly one triple. For this, if we consider the last three dice, there are 5x5x5 possible outcomes. But 5 of those outcomes will be triples, so that leaves 120 outcomes. That means the probability of getting exactly one triple is:
1/6 x 1/6 x 1/6 x (120/6^3) x 20 x 6 ~= .308
(The 20 is for the 6C3 possible arrangements of the triples, the last six is because there are 6 possibilities for the triples)
Then to get the probability of getting at least one triple, add on the calculation I showed above for the probability of exactly two triples.
 [+] Dice rolls

http://anydice.com/program/a77b
Triples:
9.72% on 4d6
21.3% on 5d6
36.73% on 6d6 (0.66% of rolls include 2 sets of triples)
Quadruples:
0.46% on 4d6
2.01% on 5d6
5.22% on 6d6
You should be able to adjust the parameters on that program easily if you want to see other examples.

 Last edited Fri Jan 20, 2017 6:20 pm (Total Number of Edits: 1)
 Posted Fri Jan 20, 2017 6:19 pm
 [+] Dice rolls

electricalstorm wrote:Tim. I didn't catch the "double counting argument". Can you elaborate? I do see the potential. But what are you eliminating and how do?
I'm not Tim, but I can explain.
The idea of the initial calculation is that you think about "fixing" the first three dice to a triple, count the number of outcomes for the remaining 3 dice, and then calculate the number of ways the triple can be arranged among the dice. You then repeat this for the next possible initial triple value. In other words, for 5 dice, say, find all the outcomes and arrangements for 111XX, 222XX, 333XX, 444XX, 555XX and 666XX.
For the 5 dice case, there isn't a problem, but with six dice there is the possibility of rolling two triples. Lets look at an example.
say I "fix" the first three dice to 1. One possible outcome is
111345
When you look at all the arrangements of placing those three 1s, you won't run into any problems, it won't match any other outcome where you start by fixing some other triple. For instance, no arrangement of 111345 will match an arrangement of 222XXX for any values of X
Now consider the outcome 111333. When you look at all the possible arrangements of this initial value, one of those is 333111. But this outcome would be counted again when you looked at possibilities when you fix the first three dice to 3. So the result 333111 gets counted twice. Once as an arrangement of the initial result 111333, and once as an arrangement of the initial result 333111.

 Last edited Fri Jan 20, 2017 6:30 pm (Total Number of Edits: 1)
 Posted Fri Jan 20, 2017 6:29 pm
 [+] Dice rolls

Antistone wrote:http://anydice.com/program/a77b
Triples:
9.72% on 4d6
21.3% on 5d6
36.73% on 6d6 (0.66% of rolls include 2 sets of triples)
Quadruples:
0.46% on 4d6
2.01% on 5d6
5.22% on 6d6
You should be able to adjust the parameters on that program easily if you want to see other examples.
Does the triple number include cases where 4 match? The numbers don't match the calculations I and others have done.
 [+] Dice rolls

wilesps wrote:timonkey wrote:
Okay, that last one wasn't quite right, because we double counted when we get two set of 3 the same. Which, similarly has a probability of (ask if unclear):
20 * (1/36)*(5/6)*(1/6)*(1/6) ~= 0.0129
so 6 dice triple ~= 0.309
You can follow the same method to get quadruples.
Did I make any mistakes?
I believe there is a mistake in your double counting computation. The method you are using would result in more double counting. The combinations for 111222 and 222111 for instance would be double counted.
Instead, consider that there are 6C2 = 15 possible unique pairings of triples (trip 1 and trip 2, trip 1 and trip 3, etc).
For a given pair of triples, there are 6C3 = 20 possible arrangements. That makes 300 possible outcomes. 300/6^6 ~= .0064
I agree with your correction. I remove all the doubletriple cases. I should only have removed half of them, so that they are counted, just not doublecounted.
Also, thanks for the explanation of this in your other post.
 [+] Dice rolls

timonkey wrote:Does the triple number include cases where 4 match?Yes. But if you subtract the probability of matching 4, you should get the probability of matching exactly 3.
 [+] Dice rolls

Antistone wrote:timonkey wrote:Does the triple number include cases where 4 match?Yes. But if you subtract the probability of matching 4, you should get the probability of matching exactly 3.
Okay, but it means your matching 4 numbers are off, because they include matching 5 and 6, yes?
 [+] Dice rolls

timonkey wrote:The numbers I gave are for rolling three or more of a kind and for rolling four or more of a kind.Antistone wrote:timonkey wrote:Does the triple number include cases where 4 match?Yes. But if you subtract the probability of matching 4, you should get the probability of matching exactly 3.
Okay, but it means your matching 4 numbers are off, because they include matching 5 and 6, yes?
P(3 or more of a kind)  P(4 or more of a kind) = P(exactly 3 of a kind)
So if you take the numbers I gave for 3, and subtract the numbers I gave for 4, that will give you the probability of rolling exactly 3 of a kind.
If you want the probability for exactly 4 of a kind, you can follow that link I gave, change "4 of a kind" to "5 of a kind", and rerun the program to compute the probabilities for five or more of a kind, and then perform the same trick on the 4s that you did for the 3s. (Of course, for the case with 4 dice, the odds of rolling 5 of a kind are zero.)
Alternately, with some modest programming knowledge, you could probably modify my script to calculate probabilities of exact sets directly.
 [+] Dice rolls
 Your are right, it must be including matching 5 and 6. The probability of getting at least 4 matches on 6 dice (so allowing 5 or 6 matching) is .0522, which matches the empirical value that was given.
 [+] Dice rolls

Thank you all for your fast answers, and especially Jeremy for the link. I also got this done in python by someone. (100 000 trials). Forget those ), that's a smiley from somewhere else.
k = 3 ) 1/36
k = 4 ) 0.0925926...
k = 5 ) 0.192901...
k = 6 ) 0.31368
k = 7 ) 0.43729
k = 8 ) 0.54766
k = 9 ) 0.62342
k = 10 ) 0.6781
k = 11 ) 0.72279
k = 12 ) 0.75337
k = 13 ) 0.77614
k = 14 ) 0.78938
k = 15 ) 0.80181
k = 16 ) 0.8083
k = 17 ) 0.81194
k = 18 ) 0.80977
k = 19 ) 0.80665

 Last edited Sat Jan 21, 2017 12:05 am (Total Number of Edits: 1)
 Posted Sat Jan 21, 2017 12:04 am
 [+] Dice rolls

Mimolette wrote:Thank you all for your fast answers, and especially Jeremy for the link. I also got this done in python by someone. (100 000 trials). Forget those ), that's a smiley from somewhere else.
k = 3 ) 1/36
k = 4 ) 0.0925926...
k = 5 ) 0.192901...
k = 6 ) 0.31368
k = 7 ) 0.43729
k = 8 ) 0.54766
k = 9 ) 0.62342
k = 10 ) 0.6781
k = 11 ) 0.72279
k = 12 ) 0.75337
k = 13 ) 0.77614
k = 14 ) 0.78938
k = 15 ) 0.80181
k = 16 ) 0.8083
k = 17 ) 0.81194
k = 18 ) 0.80977
k = 19 ) 0.80665
At least for a small number of dice, it might be easier to just check all the cases rather than doing a set of random rolls. For example, with 6 dice there are only 6^6=46656 cases.
 [+] Dice rolls

timonkey wrote:At least for a small number of dice, it might be easier to just check all the cases rather than doing a set of random rolls. For example, with 6 dice there are only 6^6=46656 cases.More accurate? Yes. Easier? Probably not. Making every possible roll exactly once introduces a bunch of logistical complexity. Making a bunch of random rolls is just the code for one random roll inside of a loop.
 [+] Dice rolls

Antistone wrote:timonkey wrote:At least for a small number of dice, it might be easier to just check all the cases rather than doing a set of random rolls. For example, with 6 dice there are only 6^6=46656 cases.More accurate? Yes. Easier? Probably not. Making every possible roll exactly once introduces a bunch of logistical complexity. Making a bunch of random rolls is just the code for one random roll inside of a loop.
Actually, I did with Excel in about a half hour. Basically start with column A with 1,2, 3,4 ,5, 6, and B all 1's., Copy A to the next 6 cells and increment B repeat until B = 6. This gets all rolls of 2D6.
Repeat the same process again, for 3D6. Then 4D6, 5D6 & 6D6.
It may not be elegant, but these are the correct number:
3D6:
1 120 55.56%
2 90 41.67%
3 6 2.78%
216
4D6:
1 360 27.78%
2 810 62.50%
3 120 9.26%
4 6 0.46%
1296
5D6:
1 720 9.26%
2 5400 69.44%
3 1500 19.29%
4 150 1.93%
5 6 0.08%
7776
6D6:
1 720 1.54%
2 28800 61.73%
3 14700 31.51%
4 2250 4.82%
5 180 0.39%
6 6 0.01%
46656
The first column is the number of dice that equal the mode (most common number of each roll).
The second column is the number for each type of roll: all different, pair, 3 of a kind, 4 of a kind...
The third column is the percentage.

 Last edited Sat Jan 21, 2017 5:47 am (Total Number of Edits: 1)
 Posted Sat Jan 21, 2017 5:46 am
 [+] Dice rolls

Python code to reduce logistical complexity:
num_dice = 6
sides = 6
for i in xrange(sides**num_dice):
dice = [(i/sides**j)%sides+1 for j in xrange(num_dice)]
# process this roll as you would a random roll

 Last edited Sat Jan 21, 2017 7:45 am (Total Number of Edits: 1)
 Posted Sat Jan 21, 2017 7:43 am
 [+] Dice rolls

I didn't say it was impractical, I said it was not easier than the obvious Monte Carlo approach. Timothy seemed to be implying that the difficulty was proportional to the number of die rolls that would be made when running the program, which from the programmer's perspective is not even close to true.
For the record, anydice calculates exact results, so I actually posted an implementation of this before it even became a discussion point.
 [+] Dice rolls

rri1 wrote:Actually, I did with Excel in about a half hour. Basically start with column A with 1,2, 3,4 ,5, 6, and B all 1's., Copy A to the next 6 cells and increment B repeat until B = 6. This gets all rolls of 2D6.These numbers are the same from nanDECK. Since I don't want to hijack the thread, I wrote a blog entry for whoever is interested:
Repeat the same process again, for 3D6. Then 4D6, 5D6 & 6D6.
It may not be elegant, but these are the correct number:
...
nanDECK  Dice probability problem
 [+] Dice rolls