# Probability that the sum of $k$ dice is $n$

The probability of two dice summing to k is simple enough, make a diagram of the throws,

$$\begin{array}{c} &|&1&2&3&4&5&6\\\hline 1&|&2&3&4&5&6&7\\ 2&|&3&4&5&6&7&8\\ 3&|&4&5&6&7&8&9\\ 4&|&5&6&7&8&9&\color{green}{10}\\ 5&|&6&7&8&9&\color{green}{10}&11\\ 6&|&7&8&9&\color{green}{10}&11&12\\ \end{array}$$

and the probability of a sum is just the length of the corresponding diagonal divided by $36$. For instance, $\mathrm{P}(\mathrm{sum} = 10) = \frac{3}{36} = \frac{1}{12}$. However, it's not as easy to draw a diagram for three dice or more, so how would a general formula look?

• @Masacroso The answer to this question is contained in that answer, but the question is different (general case vs specific case), so I'm not sure if this counts as a duplicate or what... Anyway, thanks! – Frank Vel May 21 '17 at 8:23

Following the notation and steps of this previous answer: let $n$ fair dice of $D$ sides each one numbered from $1$ to $D$, then we can represent the throw of these dice as
\begin{align}f(x)&=(x^1+x^2+\ldots+x^D)^n=\left(x\sum_{k=0}^{D-1} x^k\right)^n=\left(x\frac{1-x^D}{1-x}\right)^n\\&=x^n\sum_{k=0}^n(-1)^k\binom{n}{k}x^{kD}\sum_{j=0}^\infty\binom{n+j-1}{n-1}x^j\tag{1}\end{align}
Hence we want to get a formula for the coefficient of $x^S$ in $f$, denoted by $[x^S]f(x)$, that represent the different combinations that the sides of the dice add up to $S$. From $(1)$ we can see that $S$ will have the form $S=n+kD+j$, thus
$$\bbox[5px,border:2px solid gold]{[x^S]f(x)=\sum_{k=0}^M(-1)^k\binom{n}{k}\binom{S-kD-1}{n-1},\quad M:=\left\lfloor \frac{S-n}{D}\right\rfloor}$$