We'll pretend we have k
s
-sided dice and we are trying to find the probability to get n
specific different results. The first die roll we have an n/s
chance of getting a number we need and an (s-n)/s
chance we get a number we don't need. When we get a number we need we are looking to get n-1
numbers we need on k-1
different dice. When we get a number we don't need we are still looking to get n
numbers but with k-1
dice left to roll. The probability of getting n = 0
results is always 1
regardless of the number of dice. The probability of getting any more results when there aren't any dice left (k = 0
) is 0
.
prob s k 0 = 1
prob s 0 n = 0
prob s k n = (n*(prob s (k-1) (n-1)) + (s-n)*(prob s (k-1) n))/s
We can make a table to calculate these for s = 6
sided dice.
0 1 2 3 4 5 6 n
0 1 0 0 0 0 0 0
1 1 1/6 0 0 0 0 0
2 1 11/36 2/36 0 0 0 0
3 1 91/216 30/216 6/216 0 0 0
4 1 671/1296 302/1296 108/1296 24/1296 0 0
.
.
.
k
The problems you are interested in are getting n=2
specific different results with k=2
dice which has a probability of 2/36
, getting n=2
specific different results with k=3
dice, which has a probability of 30/216
, and getting n=3
specific different results with k=4
dice, which has a probability of 108/1296
.
There is probably a simpler non-recursive formula based on the factorial function.
We can check the above formula with counting arguments.
To get a 3 and a 4 rolling 2d6
there's 1
combination of dice that will work. We don't care if we roll the 3 first or the 4 first, so there are 2! = 2*1 = 2
orders we can roll the combination in. 2
of the 6^2
possible rolls result in a 3 and a 4. The probability of rolling a 3 and a 4 on 2d6
is 2/36
or 1/18
.
We can make a table of all the ways to roll a 3 and a 4 on 2
dice and count them to make sure this is correct
3 4 1 way
4 3 1 way
2 ways
2
ways out of 36
roll a 3
and a 4
.
There are more ways to roll a 3 and a 4 than there are ways to roll two 3s. Theres' only one way to roll two 3s. If we switch the order we roll the dice in it doesn't add another way to get two 3s. This will matter when we add extra dice.
3 3 1 way
3 3 0 ways! We already counted this.
1 way.
Let's write down all the ways we can roll a 3 and a 4 on 3d6
. We'll use *
to denote any result that is neither a 3 or a 4 (there are 4
possible such results: 1, 2, 5, and 6)
3 4 * 4 ways
3 4 3 1 way
3 4 4 1 way
4 3 * 4 ways
4 3 3 1 way
4 3 4 1 way
3 * 4 4 ways
3 3 4 1 way
3 4 4 0 ways! We already counted this.
4 * 3 4 ways
4 3 3 0 ways! We already counted this.
4 4 3 1 way
* 3 4 4 ways
3 3 4 0 ways! We already counted this.
4 3 4 0 ways! We already counted this.
* 4 3 4 ways
3 4 3 0 ways! We already counted this.
4 4 3 0 ways! We already counted this.
When one of the results isn't a 3 or 4 it's easy, there's 4
combinations that can be in 3! = 3*2*1 = 6
orders. When all of the results have a 3 or 4 then one of the numbers will be repeated. Instead of having 2
combinations that can be in 3! = 3*2*1 = 6
, half of the orders are duplicates, so there are only 30=6*4+2*3
ways to roll a 3 and a 4. The probability of rolling a 3 and a 4 on 3d6
is therefore 30/6^3
or 5/36
.
Counting results to check larger problems is tedious.