# Roll above target number with n six-sided die?

Couldn't find this on the site, despite the number of die questions.

If I have n six-sided die, how can I find the probability of rolling above x (some target number) with the total sum?

Examples for clarification:

example 1. If I have 3 die, I want to roll equal to or greater than a total sum of 12. What is the probability that I would roll equal to or over it?

example 2. If I have 4 die, I want to roll equal to or greater than a total sum of 5. What is the probability that I would roll equal to or over it?

Just for full disclosure... I am not the most "mathy" person.

• No problem. Did you check the article? Were you able to follow it, or did you get stuck somewhere? – Antoni Parellada Dec 17 '16 at 16:09
• Yeah... the word "moment"... I'll read up on it before trying to figure out if I really don't understand it – Jeff Dec 17 '16 at 16:13
• 4 die and want to hit 3 and over, what it means? – Kanwaljit Singh Dec 17 '16 at 16:36
• Sorry, is that better? – Jeff Dec 17 '16 at 16:39
• In response to your last question, which had gone unanswered about the $\Pr(S\geq 8)$, you had the calculation right. And since I tend to make rookie mistakes from lack of formal training, here I can prove it to you with a line of code for one million simulations: > mean(colSums(replicate(10^6, sample(1:6 ,2, replace=T))) > 7)  0.416771 > 15/36  0.4166667 – Antoni Parellada Dec 18 '16 at 3:06

You can use the moment generating function as illustrated nicely in this online document.

Then PMF of the sum of $n$ six-sided fair die can be retrieved like out of a clothesline from:

$$M_X(t)=\frac{1}{6^n}(e^t+e^{2t}+\cdots+e^{6t})^n\tag 1$$

My attempt at giving an intuition of what MGF are can be found here. The way to look at it is ignoring the exponential part, and just regarding it as some sort of placeholder that is intended to give us back (taking advantage of the rules of exponents) all the possible combinations of throws that add up to the value you are interested in in a systematic way. The "magic" is that that number ends up conveniently placed in front of the exponent ready to be culled.

So in the case of $2$ fair dice $(k=2)$ the probability of each possible sum is given by the numbers in red, and the sum ($X=x$) by the blue-coded exponents:

\begin{align}\small M_X(t)&=\color{red}{\frac{1}{36}}(e^t+e^{2t}+\cdots+e^{6t})^2\\&\small=\left(\color{red}{\color{red}{\frac{1}{36}}\,}e^{\color{blue}{2}t} + \color{red}{\frac{2}{36}}e^{\color{blue}{3}t} + \color{red}{\frac{3}{36}}e^{\color{blue}{4}t} + \color{red}{\frac{4}{36}}e^{\color{blue}{5}t} + \color{red}{\frac{5}{36}}e^{\color{blue}{6}t}+ \color{red}{\frac{6}{36}}e^{\color{blue}{7}t}+ \color{red}{\frac{5}{36}}e^{\color{blue}{8}t}+ \color{red}{\frac{4}{36}}e^{\color{blue}{9}t}+ \color{red}{\frac{3}{36}}e^{\color{blue}{10}t}+ \color{red}{\frac{2}{36}}e^{\color{blue}{11}t}+ \color{red}{\frac{1}{36}}e^{\color{blue}{12}t}\right)\end{align}

You can directly read out that the probability of throwing two fair dice and the result adding up to $6$ is the same as the outcomes adding up to $8$, and in both cases it is $\frac{5}{36}.$

Regarding Eq. 1, some details:

1. MGF of a discrete random variable is:

$$M_X(t)= E\left[e^{tX}\right]=\sum_{i=1}^{\infty}p_i \, e^{tx_i}$$

1. In the case of a single die, the mgf is:

$$M_X(t)=\mathbb E\left[e^{tX}\right]=\sum_{i=1}^{6}\frac{1}{6} \, e^{tx_i}=\frac{1}{6}(e^t + e^{2t} + e^{3t}+\cdots+e^{6t})$$

1. The random variable defined on the sum $S$ of $n$ dice will be the multiplication of the mgf for one single die (independent):

$$M_s(t)=\mathbb E\left[e^{t(X_1+\cdots+X_n)}\right]=\prod_{i=1}^n \mathbb E[e^{tX_i}]$$

PARALLEL SOLUTION WITH PROBABILITY GENERATING FUNCTIONS (PGF):

As in the comment, for a single die roll:

$$G(z) =\mathbb E[z^X] =\sum_{x=1}^6 \frac{1}{6}z^x =\frac{1}{6}(z + z^2 + z^3 + z^4 + z^5 + z^6) =\frac{1}{6} z \, \frac {1 - z^6}{1-z}$$

And for $n$ dice the PGF will be:

$$G(z)=\frac{1}{6^n}\,z^n\,(1-z^6)^n\,(1-z)^{-n}$$

... and continuing with the comments:

the probability for a given sum (s) will be found in front of $z^s$ once we expand this expression. However, I get stuck here, and find this resource online, where the pgf is finally expressed as (I'm transcribing what follows to be consistent with the notation so far):

$$G(z)=\frac{1}{6^n}\left(z^n\left[\sum_{s=0}^{n} \binom{n}{s}(-1)^s x^{6s} \right]\color{blue}{\left[\sum_{j\geq 0}\binom{-n}{j} (-1)^j x^j\right]} \right)$$

where the negative exponent part is a Taylor series.

The coefficient for each possible sum $s = m$ will be given by:

$$\sum_{6s+j=m+n}\binom{n}{s}\binom{n+j-1}{j}(-1)^s$$

• Using this formula (it is possible i did it wrong) I got 2.97278E+91 for n=3 die and t=12 (my target?) That seems unlikely to be correct? – Jeff Dec 17 '16 at 16:31
• @Jeff $t$ is not the target. In fact you should not put in any value for $t$ at all. What you do, if your target is $12,$ is find the term that looks like $\text{something}\times e^{12t},$ and then the "something" (called the "coefficient") is your probability to roll exactly $12.$ To get the probability of rolling $12$ or more, you have to add up the coefficients of $e^{12t},$ $e^{13t},$ $e^{14t},$ etc. – David K Dec 17 '16 at 17:09
• @DavidK Wonderful! Thank you for explaining. – Antoni Parellada Dec 17 '16 at 17:10
• Sorry... e is eulers number, right? – Jeff Dec 17 '16 at 19:06
• Yes. But here it doesn't even matter, except for the inner workings of the final result. I was in the process of adding more information, but I would suggest that you listen to the Kahn academy videos on Taylor series. I'm a self-learner, so I have treaded the path... – Antoni Parellada Dec 17 '16 at 19:09

Let's calculate the mean and variance of a single dice throw: mean = 3.5 (easy), and the variance comes to 35/12 after some calculation. Hence if you throw n dice, the mean total will be 3.5n and the variance will be 35n/12. So using the normal distribution as an approximation,

prob{Total >x} = Prob {z > (x - 3.5n)/sqrt(35n/12) }

where z is a standard normal variable. You can plug in the x and the n, but you will have to consult a normal distribution table to get the answer.

Remember this is an approximation so works best if n is large