## Dice probabilities

20 November, 2007 at 8:43 pm (dice, game design, mathematics, rpg theory)

First, a broad approach on the subject can be found here. I’ll tackle the specific case of rolling a bunch of dice and summing the result, but it’ll be an exact formula. I won’t prove it, because I can’t, as of yet. It will be a proof by induction and require rereading Generatingfunctionology by Herbert S. Wilf with thought.

A die is defined by a probability distribution. An n-sided die, where n is a positive integer, has propability of 1/n of giving each integer on the closed interval [1, n] when rolled. A die with n sides can be written as a polynomial (x + x^2 + x^3 + … +x^n). A general polynomial is of the form (a0*x^0 + a1*x^1 + a2*x^2 + … + an*x^n). To convert it into a propability distribution of a dice roll, take ak/(sum of ai for all i that are in the interval [0, n]) as the chance of the result being k.

An example: The polynomial that corresponds to d6 is (1*x + 1*x^2 + … + 1*x^6). The chance of rolling 2 is 1/(1+1+1+1+1+1) = 1/6.

If two arbitrary distributions are already known, they can be combined by multiplying the relevant polynomials. This corresponds to the sum of the two results signified by the two original distributions.

E.g. The distribution for 2d6 is that of d6 + d6. Hence it can be determined by multiplying the polynomials of d6. (x + x^2 + … + x^6)*(x + … + x^6) = (x^2 + 2*x^3 + 3*x^4 + 4*x^5 + 5*x^6 + 6*x^7 + 5*x^8 + 4*x^9 + 3*x^10 + 2*x^11 + x^12). The chance of rolling 6, 7 or 8 is (5+6+5)/(36) = 8/18 = 4/9.

Constant a can be represented as x^a. So, the distribution of d3+2 is (x^2)*(x + x^2 + x^3) = (x^3 + x^4 + x^5). Chance of rolling a five is 1/3.

These can be a bit cumbersome to count. It is possible to do with a handy table, which does look a bit more complicated than it really is.