So I was doing this question,

When $4$ dice are rolled, then find the probability of $16$ as a sum.

I was able to obtain the answer using the binomial theorem. However, I found this Answer which utilised combinatorics to solve the question and talked of removing bad combinations. But, I couldn't understand the logic behind them.

I also found this Quora Post wherein another person utilised combinatorics to solve it and came up with a formula for it too and I could to an extent understand that logic but was unable to translate it. I understood how the idea that we could max out the four dices at $6$ to get $24$ and then take out a few numbers until it became our desired sum but I couldn't understand how did he come up with the formula or how the formula actually worked.

Please help me understand how this works.

  • $\begingroup$ Your question is a special case of this one. Do you find the answers there helpful? $\endgroup$ Commented May 2 at 17:09
  • $\begingroup$ Yes. Thank you very much. I will spend some time understanding the answers. $\endgroup$ Commented May 2 at 17:31
  • $\begingroup$ If you have access to a computer algebra system (CAS), one quick way is to use generating functions—we simply read off the coefficient of $x^{16}$ in $\left(\frac{x+x^2+x^3+x^4+x^5+x^6}{6}\right)^4$. ETA: WolframAlpha will do it nicely. $\endgroup$
    – Brian Tung
    Commented May 3 at 0:19

2 Answers 2


The question is equivalent to the following: how many ways are there to write $16=d_1+d_2+d_3+d_4$ where $d_1,\ldots,d_4$ are integers between $1$ and $6$ (corresponding to the values on the four dice, in order)? If we know this we just need to multiply by the probability of any particular configuration actually occurring, $1/1296$, to get the probability we want.

There is a standard formula for the number of ways to write $n=d_1+\cdots+d_k$, where $d_1,\ldots,d_k$ are positive integers: it is $\binom{n-1}{k-1}$. This can be shown using the method of stars and bars. For $n=16,k=4$ this gives $455$.

The problem is that this includes sums like $16=3+3+3+7$, which are not possible results on the dice. So to get the right answer from here, you would have to work out how many possible sums there are that have at least one number bigger than $6$, and subtract them. This is slightly fiddly, since you need to avoid counting sums like $7+7+1+1$ twice.

Actually, it's easier to use this method to work out the number of ways of rolling $12$ with four dice. This is the same as the probability of rolling $16$, because if the faces on top add up to $12$, the faces on the bottom add up to $16$.

Now the formula gives $165$ ways to write $12$ as the sum of $4$ positive integers $d_1,\ldots,d_4$. How many of these have $d_1>6$? Well, by replacing $d_1$ by $d_1-6$, this is the number of ways to write $6$ as the sum of $4$ positive integers, for which the formula gives $10$. Similarly there are $10$ ways with $d_2>6$, and so on, and there is no overlap. So the answer is $165-4\times 10=125$.

[If you tried doing exactly the same steps for $16$, you would get $455-4\times 84=119$. This is off by $6$, because you have subtracted exactly the $6$ arrangements of $1,1,7,7$ twice.]

  • $\begingroup$ Thank you very much. Your method was a lot easier to understand. Can you please elaborate on how you understood that while applying the method directly for 16 we would count 6 arrangments of 1,1,7,7 twice? $\endgroup$ Commented May 2 at 17:09
  • $\begingroup$ Also can you please help me understand the method in the quora post as to my understanding removing 8 pips should be the same as adding 8 pips in the four dice and using the formula provided should be $\binom {7}{3}$ but that is not the case in both terms in the numerator while subtracting the bas cases. $\endgroup$ Commented May 2 at 17:12

The basic idea is to treat "four dice sum to 16" as a "16 balls into 4 bins" problem so that we can use the familiar stars-and-bars machinery to do the counting for us.

Sticks-and-stones says that there are $\binom{n+k-1}{k-1}$ ways to put $n$-many indistinguishable balls into $k$-many bins.

Alternatively, I personally find it easier to remember as $n$-many balls separated by $d$-many dividers: $\binom{n+d}{d}$. This is the same as above with $d=k-1$. I find this more intuitive as the identity $\binom{n+d}{d}=\frac{(n+d)!}{n!d!}$ shows that we are just counting the total $(n+d)!$ possible ways to permute $(n+d)$ characters, and then dividing that by the $n!$ permutations of the $n$ balls (since they're supposed to be indistinguishable) and likewise for the $d!$ permutations of $d$ dividers. Let's use this version for the problem at hand.

We have 16 dots to draw onto 4 dice faces. We can imagine this as 16 balls split by 3 dividers. For example: $$ oooooo|ooo|ooooo|oo $$ would correspond to a roll of 6-3-5-2. If we use the dots-and-dividers machinery, the total number of ways to arrange this many balls and dividers is: $\binom{16+3}{3}=969$.

Unfortunately, that machinery includes things like the following: $$ oooooo|ooo||ooooooo $$ which would correspond to a roll of 6-3-0-7 that is physically impossible for the "standard 6-sided dice" of our problem because we can neither roll 0 nor anything above 6.

So how do we fix things? Firstly, we get rid of the "roll zero" problem by taking away four balls and adding one back to each bin after the counting. That way, something like: $$ oooo||ooo|ooooo $$ which would be 4-0-3-5 becomes 5-1-4-6 and our sticks-and-stones count all the possible ways to distribute the remaining dots above and beyond the first dot on each die. Now we have $\binom{16-4+3}{3}=455$ which shows we really got rid of a lot of irrelevant cases.

But that still leaves the impossible "rolls above 6" problem. How do we account for that?

For an impossible roll we know that one die must have a 7 or higher showing. Similar to how we fixed the "roll zero" problem, we're going to pull out some balls before stars-and-bars and then add them back at the end. Now, instead of pulling 1+1+1+1 balls out, we're pulling 1+1+1+7 out to account for having one guaranteed "too high" die. That way, something like: $$ ooo|o|oo| $$ which would be 3-1-2-0 but becomes 4-2-1-7. There are $\binom{16-10+3}{3}=84$ ways to get these specifically impossible rolls. But we also have to account for the fact that the bad die could have been any one of the four! It could have been the last die like our 1+1+1+7 above, but it could also be 1+7+1+1 for the second die, etc. There were $\binom{4}{1}$ different possible ways to choose. So, that means there were $\binom{4}{1}\binom{16-10+3}{3}=336$ possible ways to make those impossible rolls.

So, did we count every impossible roll without overcounting? Not quite. If you consider when we had six balls and three dividers, after taking out 1+1+1+7 that still left possibilities like: $$ oooooo||| $$ which turns from 6-0-0-0 to become 7-1-1-7. But that would be a double-count as this 6-0-0-0 result in the 1+1+1+7 case AND a 0-0-0-6 result in the 7+1+1+1 case would both give this same 7-1-1-7 result!

So, we have to account specifically for these "two bad dice" scenarios that were over-counted in order to subtract them off. No big deal, same as before, we'll pull balls out ahead of time and add them back in, this time with two high dice. That's 1+1+7+7 to pull out ahead of time: $\binom{16-16+3}{3}=1$. And there are $\binom{4}{2}=6$ ways to pick which two dice are the bad dice.

Do we have to worry about adding back a subtracted off an "three bad dice" scenario? It is correct to consider that possibility, but luckily it does not happen in this example. We're summing 16 dots and the 7+7+1+1=16 two-overhigh-dice can just barely happen, but we do not have enough dots for 7+7+7+1=22 to ever happen.

That means our total count for die rolls with impossibly-high die values comes to: $$ \binom{4}{1}\binom{16-10+3}{3}-\binom{4}{2}\binom{16-16+3}{3}=330 $$ Which means that our total count for "sums to 16 with no 0s" minus these impossibly-high-die rolls is: $$ \binom{16-4+3}{3}-\bigg[\binom{4}{1}\binom{16-10+3}{3}-\binom{4}{2}\binom{16-16+3}{3} \bigg]=125 $$ Which means the overall probability of rolling 16 with four dice is $125/6^4=125/1296\approx 9.6\%$


Not the answer you're looking for? Browse other questions tagged .