1

A die is rolled $n$ times. What is the probability that the sum of the $n$ outcomes is equal to $s$?

I want to know whether there is a closed form solution to this question.

I was given to solve the specific case $n=4, s=8$ and that's not too difficult (the answer comes out to be $35/1296$). This made me wonder whether there is a clever way to derive a formula for the general case where we can just put in the values of $n$ and $s$ and it spits out the answer.

Of course this requires a formula to count the number of solutions to $$x_1+\dots +x_n=s$$ with the extra condition that $1\le x_i\le 6$. And I do not know whether there are neat closed forms for these types of questions.

Sayan Dutta
  • 10,345
  • You can use a generating function such as $\left(\frac{x(1-x^6)}{6(1-x)}\right)^n$ and find the coefficient of $x^s$, e.g. by dividing its $s$th derivative at $0$ by $s!$. So here $$\frac{1}{8!}\left.\frac{d^8}{dx^8}\left(\frac{x(1-x^6)}{6(1-x)}\right)^4\right|_{x=0} = \frac{35}{1296}$$ – Henry May 13 '25 at 21:58
  • When $n\le s \lt n+6$ a simpler expression is ${s-1 \choose n-1}/6^n$ – Henry May 13 '25 at 22:09
  • @Henry did you calculate the eighth derivative of $(x^6+...+x)^4$ by hand? Also, the simple formula that you gave can probably be extended a little bit. For example, in the present case, it was equivalent to having four integers between $0$ and $5$ which sum to $4$. – Sayan Dutta May 14 '25 at 00:38
  • @Henry On the other hand, since the expected value of the sum is $3.5\times 4=14$, we can say that the probability that the sum is $20=14+6$ is same as that of $8=14-6$. So, that gives a way to control the other side of the curve. When none of these tricks work is when things are troublesome. – Sayan Dutta May 14 '25 at 00:38
  • Personally I would use a recurrence as I did over two decades ago at OEIS A061676. But today I checked your result and my expression using Maxima which I happened to have open. – Henry May 14 '25 at 01:08

1 Answers1

2

Requested from comments:

You can use a generating function such as $$\left(\frac{x(1-x^6)}{6(1-x)}\right)^n$$ and find the coefficient of $x^s$, e.g. by dividing its $s$th derivative at $0$ by $s!$. So here $$\frac{1}{8!}\left.\frac{d^8}{dx^8}\left(\frac{x(1-x^6)}{6(1-x)}\right)^4\right|_{x=0} = \frac{35}{1296}$$

When $n≤s<n+6$, a simpler expression is ${s−1 \choose n−1}/6n$.

Personally I would use a recurrence as I did over two decades ago at OEIS A061676. You could say $$p_{s,n}=\frac16\big(p_{s-1,n-1}+p_{s-2,n-1}+p_{s-3,n-1}+p_{s-4,n-1}+p_{s-5,n-1}+p_{s-6,n-1}\big)$$ starting with $p(0,0)=1$ and $p(0,n)=0$ for $n \not = 0$.

Henry
  • 169,616