PDA

View Full Version : Probability of 4 dice (Not poker related)


Sykes
10-11-2005, 06:28 PM
Figuring out the chance to get 4 or 24 in 4 dice is easy (1/6 to the 4th power x 2) However, How do I get numbers like 5, 14, 19, 12, 21?

pzhon
10-12-2005, 07:28 AM
[ QUOTE ]
Figuring out the chance to get 4 or 24 in 4 dice is easy (1/6 to the 4th power x 2) However, How do I get numbers like 5, 14, 19, 12, 21?

[/ QUOTE ]
Many techniques work.

/images/graemlins/diamond.gif A Generating Function

The probability the sum is n is the ceofficient of x^n in (1/6 x + 1/6 x^2 + 1/6 x^3 + 1/6 x^4 + 1/6 x^5 + 1/6 x^6)^4 = 1/1296 x^4 (x^6-1)^4 / (x-1)^4. You can use a computer algebra program to evaluate the product, and you can multiply it out by hand or use calculus.

/images/graemlins/diamond.gif Inclusion-Exclusion

Let's subtract one from each die and 4 from the total. The number of ways to have 4 ordered nonnegative integers add up to n is n+3 choose 3: You can imagine choosing the locations of 3 dividers among n objects + 3 dividers. You'd like to know the number of ways you can get a sum of n such that each number is 0-5, that is, so that none of the numbers is 6 or more. By inclusion-exclusion, the desired count is

the total count of sums
- the count with 1 particular die 6 or greater
+ the count with 2 particular dice 6 or greater
- the count with 3 particular dice 6 or greater
+ the count with 4 particular dice 6 or greater.

The total count of sum adding to n is n+3 choose 3.

The count of sums with one particular die greater than 6 is 4C1 [choosing one die to be 6 or greater] * the number of sums of 4 nonnegative numbers adding up to n-6, by subtracting 6 from the die known to be 6 or greater and the sum.
= 4 (n-6+3 choose 3).

For example, the count of dice adding up to 19 is

19-4+3 C 3
- 4 * (15-3 C 3)
+ 6 * (15-9 C 3)
- 4 * (15-15 C 3)
+ 1 * (15-21 C 3)

= 56

This needs to be divided by 6^4 to get the probability of rolling 19.

By the way, the same calculations are performed here as in the generating function method if you use the power series for (x-1)^-4 = Sum_n (n+3 C 3) x^n and multiply out (x^6-1)^4 = x^24-4x^18+6x^12-4x^6+1.

/images/graemlins/diamond.gif Fourier Analysis

The distribution of the sum of 4 dice is a convolution of 4 distributions that are each easy to describe, so you can take the Fourier transform, raise it to the 4th power, and take the inverse Fourier transform. This can be done quite rapidly numerically, and Fourier might be the best method if you are rolling many dice with different numbers of sides and only need an approximate answer, but can't use the Central Limit Theorem.

AaronBrown
10-12-2005, 11:35 AM
In addition to phzon's excellent answer, here are the numbers. The first column is the total of the four dice, the second is the number of ways out of 1,296 to get it. You'll notice that the number for X is the same as the number for 28 - X. You'll also notice that for X < 9, the answer for X + 1 is the answer for X times X/(X - 3).

That pattern holds up to 14, except that you have to multiply by K/(K - 3) where K = 10 for X = 9, K = 13 for X = 10, 17 6/7 for X = 11, K = 28 for X = 12 and K = 73 for X = 13.

4 1
5 4
6 10
7 20
8 35
9 56
10 80
11 104
12 125
13 140
14 146
15 140
16 125
17 104
18 80
19 56
20 35
21 20
22 10
23 4
24 1