View Single Post
  #2  
Old 10-12-2005, 07:28 AM
pzhon pzhon is offline
Member
 
Join Date: Mar 2004
Posts: 66
Default Re: Probability of 4 dice (Not poker related)

[ 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.

[img]/images/graemlins/diamond.gif[/img] 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.

[img]/images/graemlins/diamond.gif[/img] 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.

[img]/images/graemlins/diamond.gif[/img] 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.
Reply With Quote