Dice Rolling A Given Sum 

Given a set of n dice, each with s faces numbered from 1 to s, what is the probability of rolling a specific total number T? The total number of distinct outcomes (including order) is simply s^{n}, so we need only determine how many of these equally probable outcomes give the sum T. Letting F_{s}(T,n) denote this number, we have the relation 



from which it follows that 



If it weren’t for the last term on the right side, this recurrence would be the simple recurrence for generating the terms of “Pascal’s triangle”. Therefore, the values of the first s+1 rows are simply the binomial coefficients. For example, with sixsided dice, the first several rows of values for F_{6}(T,n) are shown below. 



It’s easy to extend this table, but we would like to have an explicit formula for the terms of this array. We anticipate that the formula will consists of just the binomial coefficients for the first s+1 rows, and then there will be a subtractive term for the next s rows, and then, by inclusionexclusion, we expect alternating additive and subtractive terms for each new sequence of s rows. 

To determine this formula (which was first derived by Abraham de Moivre in the 1700s), note that the number of ways in which n dice, each with s sides, can be rolled (in order) to yield a given total number T is equal the coefficient of x^{T} in the expression 



This is called the generating function for the numbers of interest. The geometric series in the parentheses can be written 



Thus we have 


We can expand each of the binomials as follows 



Therefore, the generating function can be written as 



The coefficient c_{T} of x^{T} equals the sum of all the terms with T = n + αs + β. So, for any given values of T, n, s, and α there is only (at most) a single value of β (specifically, T – αs – n) that contributes to the sum. This means we can express the coefficient of x^{T} with just a single summation in the index α as follows 



The only nonzero values of the second binomial coefficient factor are with T−αs−1 £ n−1, which implies that we need consider only the terms in the summation with α £ (T−n)/s. Therefore, letting ëXû denote the greatest integer less than or equal to X, we have 



Also, since the total number of (ordered) throws of n dice, each with s sides, is s^{n}, the probability of throwing a total of T is 



Now suppose we want to determine the expected value of the lowest number appearing on the n dice (or n tosses of a single die). In other words, if we repeatedly throw the n dice, and record the lowest of the individual numbers on each trial, what is the longterm average of these recorded results? We know there are a total of s^{n} possible outcomes, and this is also the number of outcomes for which the number on each die is 1 or greater. The number of outcomes for which each die shows 2 or greater is (s−1)^{n}, and the number of outcomes for which each die shows 3 or greater is (s−2)^{n}, and so on. Now, the number of outcomes with a minimum showing of j equals the number for which each die shows j or more, minus the number for which each die shows j+1 or more. Therefore, the probability of having a minimum of j is 



It follows that the expected value of the minimum number showing for n ssided dice is 



However, it’s not always feasible to explicitly evaluate all the combinatorial possibilities in this way. Consider again the original problem, i.e., we have a set of n dice, each of which has s faces numbered 0 through s−1, and we wish to determine the number of different ways in which these dice give a particular sum T, but the number of dice and/or the number of sides are so large that it is difficult to directly compute the results. As before, assuming we regard the individual dice as distinct and ordered, there are obviously s^{n} different possible results, which could also be modeled as sequences of throwing a single ssided die n times, keeping track of the order of the results as well as the cumulative sum. If n and s are small the exact answer can easily be computed combinatorially for each possible sum, but for large values of n and s, such as n = s = 256, we compute approximate results by applying the central limit theorem and dealing with proportions rather than absolute numbers. 

Taking n = s = 256 as an example, we have 256 independent random variables, each of which has a flat (rectangular) distribution with a mean of 255/2 and a standard deviation of 255/2√3. Our "outcome population" is the sum of these individual populations, so it has a mean of 256(255/2) = 32640 and a variance given by 



Therefore, we have σ = 2040/√3 ≈ 1177.79. By the central limit theorem (also due to de Moivre), it follows that the density of sequences for a given sum x is 



For an interval of width 1 surrounding x = 32768, this gives the expected number of sequences equal to approximately (0.00034015)256^{256}, so about 1 out of every 2939.88 sequences would give the sum 32768. 
