# What is the probability of the sum of four dice being 22?

## Question

Four fair six-sided dice are rolled. The probability that the sum of the results being $$22$$ is $$\frac{X}{1296}.$$ What is the value of $$X$$?

## My Approach

I simplified it to the equation of the form:

$$x_{1}+x_{2}+x_{3}+x_{4}=22, 1\,\,\leq x_{i} \,\,\leq 6,\,\,1\,\,\leq i \,\,\leq 4$$

Solving this equation results in:

$$x_{1}+x_{2}+x_{3}+x_{4}=22$$

I removed restriction of $$x_{i} \geq 1$$ first as follows-:

$$\Rightarrow x_{1}^{'}+1+x_{2}^{'}+1+x_{3}^{'}+1+x_{4}^{'}+1=22$$

$$\Rightarrow x_{1}^{'}+x_{2}^{'}+x_{3}^{'}+x_{4}^{'}=18$$

$$\Rightarrow \binom{18+4-1}{18}=1330$$

Now i removed restriction for $$x_{i} \leq 6$$ , by calculating the number of bad cases and then subtracting it from $$1330$$:

calculating bad combination i.e $$x_{i} \geq 7$$

$$\Rightarrow x_{1}^{'}+x_{2}^{'}+x_{3}^{'}+x_{4}^{'}=18$$

We can distribute $$7$$ to $$2$$ of $$x_{1}^{'},x_{2}^{'},x_{3}^{'},x_{4}^{'}$$ i.e$$\binom{4}{2}$$

We can distribute $$7$$ to $$1$$ of $$x_{1}^{'},x_{2}^{'},x_{3}^{'},x_{4}^{'}$$ i.e$$\binom{4}{1}$$ and then among all others .

i.e

$$\binom{4}{1} \binom{14}{11}$$

Therefore, the number of bad combinations equals $$\binom{4}{1} \binom{14}{11} - \binom{4}{2}$$

Therefore, the solution should be:

$$1330-\left( \binom{4}{1} \binom{14}{11} - \binom{4}{2}\right)$$

However, I am getting a negative value. What am I doing wrong?

EDIT

I am asking for my approach, because if the question is for a larger number of dice and if the sum is higher, then predicting the value of dice will not work.

• I am asking for my approach because if the question is for more number of dice and if the sum is even more , then predicting the value of dice won't work :) Jul 9, 2017 at 18:26
• check my answer for an approach based on what you wanted. Jul 9, 2017 at 18:49
• Jul 9, 2017 at 20:26

There aren't too many to just count.

Permutations of $6+6+6+4$: $\binom41=4$

Permutations of $6+6+5+5$: $\binom42=6$

These are the only options, so your numerator must be $4+6=10$

• Although you answered my question how to calculate this in the shortest most intuitive way, the original question "What am I doing wrong?" is not answered. Thank you anyways. Jul 11, 2017 at 11:30
• @TobiMcNamobi , I completely agree, and I've been thinking the same thing, even as the votes have been accumulating. I assume that's why the accepted answer was accepted instead of this one. I answered quickly, and realized your point after posting. Jul 11, 2017 at 13:07
• Well, now that this is the accepted answer, my comment has become obsolete. Please accept my apologies. Thanks again. Jul 12, 2017 at 6:41
• Why are permutations of 6 + 6 + 5 + 5 = 4C2 ? Mar 5, 2019 at 12:06
• To count those results, we need to count how many ways two of the four dice could show 6; the remaining two can both show 5. If the dice are labeled A, B, C, D, then choosing, say, A, C from that set corresponds to the roll: 6,5,6,5. Mar 5, 2019 at 13:12

$\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}$

The number of configurations that satisfies "the sum is $\ds{22}$" is given by:

\begin{align} X & = \sum_{d_{1} = 1}^{6}\sum_{d_{2} = 1}^{6}\sum_{d_{3} = 1}^{6}\sum_{d_{4} = 1}^{6} \bracks{z^{22}}z^{d_{1} + d_{2} + d_{3} + d_{4}} = \bracks{z^{22}}\pars{\sum_{d = 1}^{6}z^{d}}^{4} = \bracks{z^{22}}\pars{z\,{z^{6} - 1 \over z - 1}}^{4} \\[5mm] & = \bracks{z^{18}}{1 - 4z^{6} + 6z^{12} - 4z^{18} + z^{24}\over \pars{1 - z}^{4}} \\[5mm] & = \bracks{z^{18}}\pars{1 - z}^{-4} - 4\bracks{z^{12}}\pars{1 - z}^{-4} + 6\bracks{z^{6}}\pars{1 - z}^{-4} - 4\bracks{z^{0}}\pars{1 - z}^{-4} \\[5mm] & = {-4 \choose 18}\pars{-1}^{18} - 4{-4 \choose 12}\pars{-1}^{12} + 6{-4 \choose 6}\pars{-1}^{6} - 4 = {21 \choose 18} - 4{15 \choose 12} + 6{9 \choose 6} - 4 \\[5mm] & = 1330 -4 \times 455 + 6 \times 84 - 4 = \bbx{10} \end{align}

• Wow this is a cool method. Jul 9, 2017 at 19:03
• @JonathanDavidson Thanks. It's very general. Maybe, in the present case it looks like an 'overkill'. Jul 9, 2017 at 19:06
• I always appreciate the overkill comments though. These responses are what make this site very worthwhile to visit. Jul 9, 2017 at 19:08
• What is $z$ here? Or does $[z^k]$ have some specific meaning? Further, going to the second line, you seem to write $[z^{22}] z^4 = z^{18}$. Can you add some further details, explaining what's going on? Thanks :) Jul 9, 2017 at 20:48
• @SamT $\left[\,z^{m}\,\right]\mathrm{f}\left(\,z\,\right)$ denotes the coefficient of $z^{m}$ in $\mathrm{f}\left(\,z\,\right)$. Note that $\left[\,z^{\,i - j}\,\right]\mathrm{f}\left(\,z\,\right) = \left[\,z^{\,i}\,\right]z^{\,j}\,\mathrm{f}\left(\,z\,\right)$. Jul 9, 2017 at 21:15

The bad combinations criteria is atleast one $x_i \geq 7$.

The number of bad combinations when:

1. One of $x_i$ is forced to be greater than or equal to $7$ is $\binom{4}{1}\binom{12 + 4 - 1}{12} = 1820$.

2. Two of $x_i$'s are forced to be greater than or equal to $7$ is $\binom{4}{2}\binom{6+4-1}{6} = 504$.

3. Three of $x_i$'s are forced to be greater than or equal to $7$ is $\binom{4}{3}\binom{0+4-1}{0} = 4$.

4. Four of $x_i$'s are forced to be greater than or equal to $7$ is $0$.

So, total bad combinations $= 1820 - 504 + 4 - 0 = 1320$

I used $n(\cup_{i=1}^{4}A_i) = \sum_{i=1}^{4}n(A_i) - \sum_{i,j, i\neq j}n(A_i\cap A_j) + \ldots$

So, possible combinations $= 1330 - 1320 = 10$.

• One of $x_i$ is forced to be greater than or equal to $7$ is $\binom{4}{1}\binom{12 + 4 - 1}{12} = 1820$. shouldn't it be $\binom{4}{1} \binom{11 + 4 - 1}{12} ?$ Jul 9, 2017 at 19:30
• No. Number of integral solutions of $x_1+x_2+x_3+x_4=22$ and $x_1 \geq 7, x_i \geq 1, i \neq 1$ is equal to that of $x_1^{'} + x_2^{'} + x_3^{'} + x_4^{'} = 22 - 10 = 12, x_i^{'} \geq 0$. Jul 9, 2017 at 19:51
• How 1) one (at least) of the $x$ is forced to be $\ge 7$ can turn out to be higher than all compositions of $22$ = 1330? Jul 11, 2017 at 15:03
• Let the number of compositions when $x_i \geq 1, \ \forall i$ be $N$. Let the number of compositions when $x_1 \geq 7$ and $x_i \geq 1, \forall i \neq 1$ be $M$. Now, $M$ will be smaller than $N$ but why do you think that $4M$ will also be smaller than $N$. Note that $M$ will contain those compositions also which will allow $x_2 \geq 7$. Now, the number of compositions when $x_2 \geq 7$ and $x_i \geq 1, \forall i \neq 2$ (will be M) will also contain those compositions which allow $x_1 \geq 7$. So, same compositions are counted multiple times. Jul 11, 2017 at 15:14
• Ok, for your last sentence, but then you should better explain in your answer what is $1820$ counting. Jul 11, 2017 at 15:23

In order for the sum to equal 22, either three dice equal $6$ and one equals $4$, or two dice equal $6$ and two dice equal $5$. The number of valid outcomes thus equals:

$${4 \choose 1} + {4 \choose 2} = 4 + 6 = 10$$

As such, the probability of the four dice having a sum of $22$ equals:

$$\frac{{4 \choose 1} + {4 \choose 2}}{6^4} = \frac{10}{1296} = \frac{5}{648} \approx 0.00772$$

I am going to show you how you can reduce the given problem a simpler one by using symmetry.

You wish to find the number of solutions of the equation $$x_1 + x_2 + x_3 + x_4 = 22 \tag{1}$$ in positive integers not exceeding $6$. Since $x_k$, $1 \leq k \leq 4$, is a positive integer satisfying $x_k \leq 6$, then $y_k = 7 - x_k$ is also a positive integer not exceeding $6$. Substituting $7 - y_k$ for $x_k$, $1 \leq k \leq 4$, in equation 1 yields \begin{align*} 7 - y_1 + 7 - y_2 + 7 - y_3 + 7 - y_4 & = 22\\ -y_1 - y_2 - y_3 - y_4 & = -6\\ y_1 + y_2 + y_3 + y_4 & = 6 \tag{2} \end{align*} Equation 2 is an equation in the positive integers when the given restrictions are imposed. A particular solution of equation corresponds to placing an addition sign in three of the five spaces between successive ones in a row of six ones. For instance, $$1 + 1 1 + 1 + 1 1$$ corresponds to the solution $y_1 = 1$, $y_2 = 2$, $y_3 = 1$, and $y_4 = 2$ (or $x_1 = 6$, $x_2 = 5$, $x_3 = 6$, $x_4 = 5$) while $$1 1 1 + 1 + 1 + 1$$ corresponds to the solution $y_1 = 3$, $y_2 = y_3 = y_4 = 1$ (or $x_1 = 4$, $x_2 = x_3 = x_4 = 6$). Thus, the number of solutions of equation 2 in the positive integers is the number of ways of selecting which three of the five spaces between successive ones in a row of six ones will be filled by addition signs, which is $$\binom{5}{3} = 10$$

Note: If you prefer to work in the nonnegative integers, then we wish to find the number of solutions of the equation $$x_1' + x_2' + x_3' + x_4' = 18 \tag{1'}$$ subject to the restrictions that $x_k' = x_k - 1 \leq 6 - 1 = 5$ for $1 \leq k \leq 4$. Since $x_k'$, $1 \leq k \leq 5$, is a nonnegative integer not exceeding $5$, so is $y_k' = 5 - x_k'$. Substituting $5 - y_k'$ for $x_k'$ in equation 1' and simplifying yields $$y_1' + y_2' + y_3' + y_4' = 2 \tag{2'}$$ which is an equation in the nonnegative integers. A particular solution corresponds to the insertion of three addition signs in a row of two ones. For instance, $$+ + + 1 1$$ corresponds to the solution $y_1 = y_2 = y_3 = 0$, $y_4 = 2$ (or $x_1 = x_2 = x_3 = 6$, $x_4 = 4$), while $$1 + 1 + +$$ corresponds to the solution $y_1 = y_2 = 1$, $y_3 = y_4 = 0$ (or $x_1 = x_2 = 5$, $x_3 = x_4 = 6$). Thus, the number of solutions of equation 2 in the nonnegative integers is $$\binom{2 + 3}{3} = \binom{5}{3}$$ since we must choose which three of the five positions (two ones and three addition signs) will be filled with addition signs.

It is the coefficient of $x^{22}$ in the expansion of the generating function $$(x^6+x^5+x^4+x^3+x^2+x^1)^4=\left(\frac{x(1-x^6)}{1-x}\right)^4$$ which is $$1\cdot{{x}^{24}}+4\cdot {{x}^{23}}+10\cdot {{x}^{22}}+20\cdot {{x}^{21}}+35\cdot {{x}^{20}}+56\cdot {{x}^{19}}+80\cdot {{x}^{18}}\\+104\cdot {{x}^{17}}+125\cdot {{x}^{16}}+140\cdot {{x}^{15}}+146\cdot {{x}^{14}}+140\cdot {{x}^{13}}+125\cdot {{x}^{12}}+104\cdot {{x}^{11}}\\+80\cdot {{x}^{10}}+56\cdot {{x}^{9}}+35\cdot {{x}^{8}}+20\cdot {{x}^{7}}+10\cdot {{x}^{6}}+4\cdot {{x}^{5}}+1\cdot{{x}^{4}}$$

so the answer is $10$.

This generalises easily to more dice or even those with different numbers of faces

This is a method similar to @GTonyJacobs and @adhg's answers, but in this answer I use a slightly different way of thinking:

The maximum number possible is a set of six $4$'s $(6, 6, 6, 6)$, which totals $6 * 4 = 24$. To reach $22$, we need to take off $2$ in total from the set.

There are $2$ ways to do this:

– take off $1$ from $2$ numbers out of $4$.

– take off $2$ from $1$ number out of $4$.

Following this, the first method can be done in $4 \choose 2$ ways, while the second can be done in $4 \choose 1$ ways, which is $10$ ways in total.

Therefore, the probability of $4$ dice totalling $22$ is $\frac{10}{6^4}$, which is approximately $0.0077$.

We have that \eqalign{ & x_{\,1} + x_{\,2} + x_{\,3} + x_{\,4} = 22\quad \left| {\;1 \le x_{\,k} \le 6} \right.\quad \Rightarrow \cr & \Rightarrow \quad y_{\,1} + y_{\,2} + y_{\,3} + y_{\,4} = 18\quad \left| {\;0 \le y_{\,k} \le 5} \right. \cr} and \eqalign{ & {\rm N}{\rm .}\,{\rm of}\,{\rm solutions}\,{\rm without}\,{\rm upper}\,{\rm restriction} = \cr & = {\rm N}{\rm .}\,{\rm of}\,{\rm (strong)}\,4{\rm - elements}\,{\rm compositions}\,{\rm of}\,22 = \cr & = {\rm N}{\rm .}\,{\rm of}\,{\rm (weak)}\,4{\rm - elements}\,{\rm compositions}\,{\rm of}\,18 = \cr & = \left( \matrix{ 22 - 1 \cr 4 - 1 \cr} \right) = 1330 \cr}

Concerning bad compositions, we have that if you write for instance \eqalign{ & \overline {x_{\,1} } + x_{\,2} + x_{\,3} + x_{\,4} = 22\quad \left| \matrix{ \;7 \le \overline {x_{\,1} } \hfill \cr \;1 \le x_{\,k} \hfill \cr} \right.\quad \times \;\left( \matrix{ 4 \cr 1 \cr} \right)\quad \Rightarrow \cr & \Rightarrow \quad x_{\,1} + x_{\,2} + x_{\,3} + x_{\,4} = 16\quad \left| {\;1 \le x_{\,k} } \right.\quad \times \;\left( \matrix{ 4 \cr 1 \cr} \right) = \cr & = 4\;\left( \matrix{ 16 - 1 \cr 4 - 1 \cr} \right) = 1820 \cr} you get a number of bad compositions which is higher than the total number, and it is not the number of compositions with a least one term $\ge 7$. That is clearly due to the fact that , when adding $6$ to $x_1$ that could be already $\ge 7$.

And if you write $$\overline {x_{\,1} } + x_{\,2} + x_{\,3} + x_{\,4} = 22\quad \left| \matrix{ \;7 \le \overline {x_{\,1} } \hfill \cr \;1 \le x_{\,k} \le 6 \hfill \cr} \right.$$ you are back to the original problem, with one element less and one sum to apply.

So that is not the right approach to this problem.

$\ds{\bbox[#dfd,5px]{\ The\ general\ formula\ }}$ for getting a sum $s$ with $m$ dices each with $r$ faces is given in this post.

Divide the dice into two pairs. The way you can get 22 is by 10 and 12, 11 and 11, and 12 and 10. The ways are 3, 4, and 3, totaling 10. Or you have looked at the dice individually and listed the winning combinations (in lexicographic order to be sure you don't miss anything).

On an intuitive level, simply count how many ways are there to get 22. There are 2 ways to do so:

(A) 6,6,6,4 (B) 6,6,5,5

Each way can have different permutation (example 6,6,6,4, 6,6,4,6 etc) so for the first way (A), you can have 4 ways to arrange the result because: 4! / 3! = 24 / 6 = 4

and for (B) there are 6 ways to arrange the result because 4!/(2!*2!)=6.

So in total, you get 10 ways to get 22. So 10/1296

Although good answers have already been given, I'd like to provide an alternative way of coming up with this, which I found here on page 6.

Define $$f_i(s)$$ as the probability of having a sum $$s$$ with $$i$$ dice. Then we can find all the probabilities for any number of dice using recursion, starting at $$i = 1$$. We know, first of all, that

$$f_1(s) = \frac{1}{6}, s \in \{1,..,6\}$$

We can then use this to find all the reasonable values for $$f_2(n)$$. As an example,

$$f_2(3) = f_1(3-1)\cdot \frac{1}{6} + f_1(3-2)\cdot \frac{1}{6}$$

The general recursion formula can thus be considered

$$f_i(s) = \sum_{j=(i-1)}^{(i-1)\cdot 6}f_{j-1}(s - j)\frac{1}{6}$$

Supposing that $$f_{j-1}(s-j)$$ exists (important!). Some python code can be found below, generating all probabilities for the sum of all dice until 6 dice.

from fractions import Fraction

def get(s,f,n):
if n == 1:
return Fraction(1,6)
a = []
for i in range(1,7):
if (n-1, s - i) in f:
a.append(f[(n-1, s - i)]*Fraction(1,6))
return sum(a)
for n in range(1,6):
for s in range(n,6*n + 1):
f[(n,s)] = get(s,f,n)


Note that this can also be extended and generalised to an n-sided dice.