How do you calculate the probability of getting an integer $s$ of the sum of $n$ dice, each with $m$ sides numbered $0$ to $m-1$? (Assuming $0\leq s \leq m-1$).
Probability density function of the sum of $n$ dice, each with $m$ sides numbered $0$ to $m-1$?
151 Views Asked by Bumbble Comm https://math.techqa.club/user/bumbble-comm/detail AtThere are 2 best solutions below
On
$\newcommand{\bbx}[1]{\,\bbox[15px,border:1px groove navy]{\displaystyle{#1}}\,} \newcommand{\braces}[1]{\left\lbrace\,{#1}\,\right\rbrace} \newcommand{\bracks}[1]{\left\lbrack\,{#1}\,\right\rbrack} \newcommand{\dd}{\mathrm{d}} \newcommand{\ds}[1]{\displaystyle{#1}} \newcommand{\expo}[1]{\,\mathrm{e}^{#1}\,} \newcommand{\ic}{\mathrm{i}} \newcommand{\mc}[1]{\mathcal{#1}} \newcommand{\mrm}[1]{\mathrm{#1}} \newcommand{\pars}[1]{\left(\,{#1}\,\right)} \newcommand{\partiald}[3][]{\frac{\partial^{#1} #2}{\partial #3^{#1}}} \newcommand{\root}[2][]{\,\sqrt[#1]{\,{#2}\,}\,} \newcommand{\totald}[3][]{\frac{\mathrm{d}^{#1} #2}{\mathrm{d} #3^{#1}}} \newcommand{\verts}[1]{\left\vert\,{#1}\,\right\vert}$ \begin{align} \sum_{d_{1} = 0}^{m - 1}{1 \over m}\ldots\sum_{d_{n} = 0}^{m - 1} {1 \over m}\braces{\bracks{z^{s}}z^{\sum_{i = 1}^{n}d_{i}}} & = {1 \over m^{n}}\bracks{z^{s}}\pars{\sum_{d = 0}^{m - 1}z^{d}}^{n} = {1 \over m^{n}}\bracks{z^{s}}\pars{z^{m} - 1 \over z - 1}^{n} \\[5mm] & = {1 \over m^{n}}\bracks{z^{s}}\pars{1 - z^{m}}^{n}\pars{1 - z}^{-n} \\[5mm] & = {1 \over m^{n}}\bracks{z^{s}}\sum_{i = 0}^{n}{n \choose i}\pars{-z^{m}}^{i} \sum_{j = 0}^{\infty}{-n \choose j}\pars{-z}^{\,j} \\[5mm] & = {1 \over m^{n}}\sum_{i = 0}^{n}\sum_{j = 0}^{\infty}{n \choose i} {-n \choose j}\pars{-1}^{i + j}\, \bracks{s = mi + j} \\[5mm] & = {1 \over m^{n}}\sum_{i = 0}^{n}{n \choose i}{-n \choose s - mi}\pars{-1}^{i + \pars{s - mi}}\, \bracks{s - mi \geq 0} \\[5mm] & = {1 \over m^{n}}\sum_{i = 0}^{n}{n \choose i} {-n \choose s - mi}\pars{-1}^{\pars{m - 1}i + j}\,\bracks{i \leq {m \over s}} \\[5mm] & = \bbx{{1 \over m^{n}} \sum_{i = 0}^{\left\lfloor\,{m/s}\,\right\rfloor}{n \choose i} {-n \choose s - mi}\pars{-1}^{\pars{m - 1}i + j}} \end{align}
The answer to this question is a bit nasty, unfortunately, and there isn't a super nice answer to the question.
Let's first realize that any set of outcomes $d_1, d_2,\ldots, d_n$ satisfying $0 \leq d_i \leq m-1$ with $d_1 + \cdots + d_n = s$, we have probability $(1/m)^n$ the dice reading out these values. If we let $a_{n,k,s}$ be the number of possible choices of $d_i$'s, then the probability is $a_{n,k,s}/m^n$. The formula for $a_{n,k,s}$ is nasty, but can be found here to be $$a_{n,k,s} = \sum\limits_{r + tm = s} (-1)^t \binom{n + r - 1}{r}\binom{n}{t}.$$
Perhaps an easier way of thinking of $a_{n,k,s}$ is the coefficient of $x^s$ in $$\left(1 + x + \ldots + x^{m-1}\right)^n.$$