3

This is a dice problem

1) I want to calculate the probability to have more than X throwing 3 dice of 6 faces. X = addition of the result of the 3 dice.

2) This is the first step but if you can also provide me a solution to calculate the probability to have more than X with Y dices of Z faces it would be really great.

EmCode
  • 169

2 Answers2

4

Your concrete problem is already solved here: If we throw three dice.

The general problem is equivalent to counting the number of ways of distributing $X-Y$ balls into $Y$ bins with limited capacity $Z-1$. This problem is solved at Balls In Bins With Limited Capacity using inclusion-exclusion. The result is

$$ \sum_{t=0}^Y(-1)^t\binom Yt\binom{X-tZ-1}{Y-1}\;, $$

where, contrary to convention, the binomial coefficient is taken to be zero for negative upper index.

This is the count of outcomes with sum exactly $X$; to get the probability of a sum of more than $X$, we need to sum from $X+1$ to $YZ$ and divide by the number $Z^Y$ of equiprobable outcomes:

$$ Z^{-Y}\sum_{x=X+1}^{YZ}\sum_{t=0}^Y(-1)^t\binom Yt\binom{x-tZ-1}{Y-1}=Z^{-Y}\sum_{t=0}^Y(-1)^t\binom Yt\left(\binom{YZ-tZ}Y-\binom{X-tZ}Y\right)\;. $$

For $Y=3$, $Z=6$, this is

\begin{align} &\frac1{216}\sum_{t=0}^3(-1)^t\binom 3t\left(\binom{18-6t}3-\binom{X-6t}3\right)\\ ={}&\frac1{216}\left(\binom{18}3-\binom X3-3\left(\binom{12}3-\binom{X-6}3\right)+3\left(\binom63-\binom{X-12}3\right)\right)\\ ={}&1-\frac1{216}\left(\binom X3-3\binom{X-6}3+3\binom{X-12}3\right)\;, \end{align}

where again binomial coefficients with negative upper index are taken to be zero. Distinguishing the three cases, we can write this as

$$ \frac1{1296}\begin{cases} -X^3+3X^2-2X+1296&3\le X\lt9\;,\\ 2X^3-60X^2+436X+288&6\le X\lt15\;,\\ -X^3+57X^2-1082X+6840&12\le X\le18 \end{cases} $$

(where I intentionally wrote the maximal overlapping ranges to exhibit the symmetry more clearly). As far as I checked, the results coincide with those of the concrete calculation linked to above.

Luan Nico
  • 321
joriki
  • 238,052
  • 2
    And with the method in the link you provided one can even compute the probability for different dice – YannickSSE May 31 '16 at 08:36
  • It becomes fully according to conventions if you write the second binomial of the first equation in the symmetric way, i.e. $\sum_{t=0}^Y(-1)^t\binom Yt\binom{X-tZ-1}{X-Y-tz};$ ,which is the preferrable way to write such formula – G Cab Jul 14 '16 at 00:46
0

In order to put @joriki's answer in a more "compact" and generalized way, let's put $$ \begin{gathered} N_{\,b} (s,\;r,\;m)\quad \left| {\;0 \leqslant \text{integers }s,m,r} \right.\quad = \hfill \\ = \text{No}\text{.}\;\text{of}\;\text{solutions}\;\text{to}\;\left\{ \begin{gathered} 0 \leqslant \text{integer}\;x_{\,j} \leqslant r \hfill \\ x_{\,1} + x_{\,2} + \; \cdots \; + x_{\,m} = s \hfill \\ \end{gathered} \right. = \hfill \\ = \sum\limits_{\left( {0\, \leqslant } \right)\,j\,\left( { \leqslant \,m} \right)} {\left( { - 1} \right)^j \left( \begin{gathered} m \hfill \\ j \hfill \\ \end{gathered} \right)\left( \begin{gathered} s + m - 1 - j\left( {r + 1} \right) \\ s - j\left( {r + 1} \right) \\ \end{gathered} \right)} \hfill \\ \end{gathered} $$

i.e., with the formula presented by @joriki but with the second binomial written in the symmetrical way, so that everything is according to the binomial defined as: $$ \left( \begin{gathered} x \\ q \\ \end{gathered} \right) = \left\{ \begin{gathered} \frac{{x^{\,\underline {\,q\,} } }} {{q!}}\;\;0 \leqslant \text{integer}\;q \hfill \\ 0\quad \;\;\text{otherwise}\, \hfill \\ \end{gathered} \right.\;\; $$

Refer to Problem of rolling dice for further considerations.

Note that we have better and consider dice numbered $0$ to $r$, because that simplifies dealing with the above formula and its paramters ranges.
So, in the general case 2) you proposed we have:
$m=Y=$ number of dices, $r=F-1$ because of considering the facets numbered $0$ to $r$, $s=X-m$ deducting $1$ from the value of each face. Then: $$ \begin{gathered} M_{\,b} (s,\;r,\;m)\quad \left| {\;0 \leqslant \text{integers }s,m,r} \right.\quad = \hfill \\ = \sum\limits_{0\, \leqslant \,i\, \leqslant \,s} {N_{\,b} (i,\;r,\;m)} = \hfill \\ = \sum\limits_{0\, \leqslant \,i\, \leqslant \,s} {\;\sum\limits_{\left( {0\, \leqslant } \right)\,j\,\left( { \leqslant \,m} \right)} {\left( { - 1} \right)^j \left( \begin{gathered} m \hfill \\ j \hfill \\ \end{gathered} \right)\left( \begin{gathered} i + m - 1 - j\left( {r + 1} \right) \\ i - j\left( {r + 1} \right) \\ \end{gathered} \right)} } = \hfill \\ = \sum\limits_j {\left( { - 1} \right)^j \left( \begin{gathered} m \hfill \\ j \hfill \\ \end{gathered} \right)\left( \begin{gathered} s + m - j\left( {r + 1} \right) \\ s - j\left( {r + 1} \right) \\ \end{gathered} \right)} \hfill \\ \end{gathered} $$ (note that $N_{\,b}$ and $M_{\,b}$ differ by just a $1$ in the upper term of $2$nd bin.c.)
and $$ N_{\,b} (mr < s,\;r,\;m) = 0\quad ,\quad M_{\,b} (mr \leqslant s,\;r,\;m) = \left( {r + 1} \right)^{\,m} $$

From that, the number of ways of obtaining a sum >= $s$, will be of course: $$ \sum\limits_{s\, \leqslant \,i\,\left( { \leqslant \,mr} \right)} {N_{\,b} (i,\;r,\;m)} = \left( {r + 1} \right)^{\,m} - \sum\limits_{0\, \leqslant \,i\, \leqslant \,s - 1} {N_{\,b} (i,\;r,\;m)} = \left( {r + 1} \right)^{\,m} - M_{\,b} (s - 1,\;r,\;m) $$

G Cab
  • 35,272