Generalizing Probabilities for Summed Dice

I'm trying to build a formula that accurately describes the probabilities of each of the sums that can be produced from rollings dice together and adding up their results.

For example, if I roll 2d6, or two d6 dice with their values added up, the probabilities of each possible result can be described by this table:

$$\begin{array}{|l|l|} \hline Roll & Probability \\ \hline 2 & 1/36 \\ \hline 3 & 2/36 \\ \hline 4 & 3/36 \\ \hline 5 & 4/36 \\ \hline 6 & 5/36 \\ \hline 7 & 6/36 \\ \hline 8 & 5/36 \\ \hline 9 & 4/36 \\ \hline 10 & 3/36 \\ \hline 11 & 2/36 \\ \hline 12 & 1/36 \\ \hline \end{array}$$

Similarly, were I to roll 3d6, or three d6 dice with their values added up, these probabilities can be represented like this:

$$\begin{array}{|l|l|} \hline Roll & Probability \\ \hline 3 & 1/216 \\ \hline 4 & 3/216 \\ \hline 5 & 6/216 \\ \hline 6 & 10/216 \\ \hline 7 & 15/216 \\ \hline 8 & 21/216 \\ \hline 9 & 25/216 \\ \hline 10 & 27/216 \\ \hline 11 & 27/216 \\ \hline 12 & 25/216 \\ \hline 13 & 21/216 \\ \hline 14 & 15/216 \\ \hline 15 & 10/216 \\ \hline 16 & 6/216 \\ \hline 17 & 3/216 \\ \hline 18 & 1/216 \\ \hline \end{array}$$

The problem is that I arrived at these values manually, by building tables of possible rolls and accumulating the number of rolls that result in a given sum. This quickly becomes infeasible for larger numbers of rolls. So I'd like to know how to generalize this formula for arbitrary (but specific and predetermined) numbers of dice.

I'd also like to know this formula for non-cubic dice (rolling several regular d8 dice, for example), and, if possible, Heterogeneous Dice (like a d8 rolled with a d6, for example).

• math.stackexchange.com/questions/357442/… – Hongyu Wang Oct 1 '18 at 19:01
• For a large number of equal die you can apply the central limit theorem. For different situations I don´t see a general approach. – callculus Oct 1 '18 at 19:04
• @callculus I'm not sure how the CLT is useful here, given that I'm trying to build a table of probabilities, not merely approximate them. – Xirema Oct 1 '18 at 19:05
• But you want a general formula, right? This formula does not exist. If you want a table for a specific situation you have to look for a specific formula. Maybe it exists or not. – callculus Oct 1 '18 at 19:10
• Building these tables with pencil and paper alone is a chore, but a computer can easily build tables for large numbers of dice. Even a software spreadsheet can do it: math.stackexchange.com/a/2089001/139123 – David K Oct 1 '18 at 19:21

Generating functions will give you the probabilities. For example for a $$6$$-sided die, the coefficients in the expansion of $$\frac{x(1-x^6)}{6(1-x)} = \frac16 x^1 +\frac16 x^2 +\frac16 x^3 +\frac16 x^4 +\frac16 x^5 +\frac16 x^6$$ give the probabilities, and similarly for other dice for dice with other numbers of sides you get $$\frac{x(1-x^s)}{s(1-x)}$$
You can then find the probabilities of sums from throwing several independent dice by multiplying their generating functions, so in your example of the sum of three $$6$$-sided die the generating function is $$\left(\frac{x(1-x^6)}{6(1-x)}\right)^3$$ which you can then expand to find the coefficients