# What is the Name of Function for Probability of a Certain Sum on Random Die Rolls?

Hi.

I'm writing a book about using statistics for roleplaying game design and am using this equation for calculating the probability of rolling a particular sum "n" on "z" throws of an "a"-sided die

$$ {{1} \over {a^{z}}} \displaystyle \sum_{k=0}^{\lfloor (n - z) / a \rfloor } (-1)^{k} (_zC_k) (_{(n-a)(k-1)}C_{(z-1)})$$What is the name for this function? I'm trying to search for calculators to recommend that support it, and I can't think of the words to search for.

## 1 answer

I don't know some special name for exactly that sum, but it is closely related to what are known as **polynomial coefficients** or **extended binomial coefficients**. These are often written as ${n \choose j}_{k+1}$ and are defined indirectly via: $$\left(\sum_{i=0}^k x^i\right)^n = \sum_{j=0}^{nk} {n \choose j}_{k+1} x^j$$ with ${n \choose 0}_0 = 1$ and ${n \choose j}_{k+1} = 0$ for $j\notin \{0,\dots,nk\}$.

Polynomial coefficients and distribution of the sum of discrete uniform variables by Caiado, C.C.S. and Rathie, P.N. provides this definition and a recurrence relation to compute this number. As the title suggests, it also provides a direct solution to your probability problem. If $Y = \sum_{i=0}^n X_i$ where each $X_i$ is a discrete random variable uniformly sampled from $\{0,\dots,k\}$, then $$P(Y=y) = \frac{1}{(k+1)^n}{n \choose y}_{k+1}$$ This is the probability that rolling $n$ dice with values from $0$ to $k$ produces the sum $y$. The more usual case of dice with values $1$ to $k$ can be reproduced by noting this is equivalent to rolling $n$ dice with values from $0$ to $k-1$ to produce the sum $y-n$.

The aforementioned paper gives a summation expression in terms of gamma functions which probably does reduce to your sum, but a clearer expression is in Restricted Weighted Integer Compositions and Extended Binomial Coefficients by Steffen Eger. Table 1 in the conclusion (page 22) list various binomial identities and the corresponding extended binomial identities derived in that paper. (See also equation 15 in Example 33.) One of which is: $${k \choose n}_{l+1} = \sum_{j\geq 0}(-1)^j{k \choose j}{n + k - (l + 1)j - 1 \choose k-1}$$

Matching your notation and performing the adjustment as above gives: $${z \choose n-z}_a = \sum_{k\geq 0}(-1)^k{z \choose k}{n - ak - 1 \choose z-1}$$ This is almost exactly the sum you wrote except you have $(n-a)(k-1)$ where I have $n - ak - 1$. Checking the $n=3$ and $a=z=2$ case, the above formula gives the correct result of $2$ whereas your variant is $0$, so I'm going to assume that was just a typo.

Just for completeness, for the second binomial coefficient factor to be non-zero we need $n - ak - 1 \geq z - 1$ or $k \leq (n-z)/a$ giving $\lfloor (n-z)/a \rfloor$ as an upperbound to the summation assuming the other numbers make sense, i.e. that $z \leq n \leq az$.

## 0 comment threads