2
$\begingroup$

This question already has an answer here:

Find the probability of rolling ten different, standard 6-sided dice simultaneously and obtaining a sum of 30?

I started to answer this question by setting up an equation like this:

x1+x2+...+x10=30 with 0 less than or equal to xi less than or equal to 6 But we know the die will have values 1-6 so we have y=x+1 so that y1+y2+...+y10=20 Now I know we can have at most 4 6's, 5 5's, 6 4's, 10 3's, 10 2's, 10 1's.

I was not sure if I am heading in the right direction or should I just find all possible outcomes of the die and use the inclusion-exclusion method to find all the permutations in which the sum will be 30?

$\endgroup$

marked as duplicate by Mike Earnest, amd, NCh, Leucippus, TheBridge Apr 6 at 5:24

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • $\begingroup$ Also, that note aside - are you required to use a particular method? For example, for solving $x_1 + ... + x_{10} = 30$, I don't see at all why you can't just go straight into a generating function approach, unless that's for some reason off the table. $\endgroup$ – Eevee Trainer Apr 4 at 0:15
1
$\begingroup$

Say that $n$ represents the number of dices, $x$ the total sum and $f(n, x)$ the total number of different ways in which this sum can be obtained.

We have the following recurrence relation:

$$f(n,x)=\sum_{i=1}^6 f(n-1, x-i)\tag{1}$$

...which baciscally says that you can calculate $f$ by assuming that the first dice can roll 1,2,3,4,5 or 6 and by adding the number of ways in which you can roll the sums $x-1,x-2,\dots x-6$ by using one dice less.

We have the following exit conditions:

$$x \lt 0 \implies f(n,x)=0\tag{2}$$

$$f(0,0)=1\tag{3}$$

In this particular problem you want to calculate $f(10, 30)$ and then divide the result with the total number of different rolls (which is $6^{10}$). You can complete the task with this miniscule Python script:

cache = dict()

def f(n, x):
    if x < 0: return 0
    if x == 0 and n == 0: return 1
    key = (n, x)
    if key in cache: return cache[key]
    cache[key] = sum([f(n - 1, x - i) for i in range (1, 7)])     
    return cache[key]

count = f(10, 30)
prob = count / (6 ** 10)
print("Number of ways to roll 30 with 10 dices:", count)
print("Probability:", prob)

And the result is:

Number of ways to roll 30 with 10 dices: 2930455
Probability: 0.048464367913724195
$\endgroup$
1
$\begingroup$

As suggested by Eevee Trainer, here is a solution using a generating function.

There are $6^{10}$ possible outcomes of rolling the $10$ dice, all of which we assume are equally likely. We would like to count the number of outcomes in which the sum is $30$, or equivalently, the number of solutions in integers of $$x_1+x_2+x_3+\dots+x_{10}=30 \tag{1}$$ where $1 \le x_i \le 6$ for all $i$.

More generally, we would like to know the number of solutions where the right-hand side is $r$ for an arbitrary non-negative integer $r$. The generating function for the number of solutions is $$\begin{align} f(x) &= (x+x^2+x^3+x^4+x^5+x^6)^{10} \\ &= x^{10} (1+x+x^2+x^3+x^4+x^5)^{10} \\ &= x^{10} \left( \frac{1-x^6}{1-x} \right)^{10} \tag{2}\\ &= x^{10} (1-x^6)^{10} (1-x)^{-10} \\ &= x^{10} \cdot \sum_{i=0}^{10}(-1)^i \binom{10}{i} x^{6i} \cdot \sum_{j=0}^{\infty} \binom{10+j-1}{j} x^j \tag{3} \end{align}$$ At $(2)$ we applied the formula for the sum of a geometric series, and at $(3)$ we applied the Binomial Theorem twice, once for a negative exponent. The coefficient of $x^r$ when $f(x)$ is expanded is the number of solutions to $(1)$ with right-hand side $r$.

We are especially interested in the coefficient of of $x^{30}$, which we can see from $(3)$ is $$[x^{30}]f(x) = \sum_{i=0}^3 (-1)^i \binom{10}{i} \binom{10+20-1-6i}{20-6i} = 2,930,455$$

Finally, the probability of rolling a sum of $30$ is $$\frac{[x^{30}]f(x)}{6^{10}} = 0.048464$$

If you are not familiar with generating functions, you might read this question and its answers: How Can I Learn About Generating Functions? (One of the answers has an anecdote about Frederick Mosteller which is relevant to the OP.)

An After-Thought

An alternative approach which is often useful with "large" numbers of dice, for some definition of large, is to apply the Central Limit Theorem and use a Normal approximation. The mean roll for a single die is $\mu = 7/2$, and the variance is $\sigma^2 =(6^2-1)/12$; so the mean of the total for $10$ dice is $10 \mu$ and the variance is $10 \sigma^2$. If we approximate the total of $10$ dice by a random variable $z$ having a Normal distribution with mean $10 \mu$ and variance $10 \sigma^2$, we find $P(29.5 < z < 30.5) = 0.04811$, so the approximation is pretty good.

$\endgroup$

Not the answer you're looking for? Browse other questions tagged or ask your own question.