# Probability of rolling x dice

How do you calculate the probability of rolling something with x 6-sided dice?

• Example 1: Rolling exactly one 6 with three 6-sided dice.
• Example 2: Rolling exactly two 6s with three 6-sided dice.
• Example 3: Rolling exactly five 6s with ten 6-sided dice.

Also, out of curiosity, what would a function look like if it also had the amount of sides of the die as a variable (so an n-sided die as opposed to a 6-sided one)?

• If $x=3$, your formula $1-(\frac56)^x$ is the probability of rolling one or more $6$s. This does not appear to be the question you asked. So I think you need to edit the question and make it completely clear what you are asking. – David Jan 18 '18 at 4:12
• Done. I was thinking of it as "if there is a 6 in the throw", not as "if there is exactly one 6 in the throw". – Biosmosis Jan 18 '18 at 8:53
• Apparently, editing a question after answers have been posted is considered a bad murder. Woops. For this reason, I have posted the new, clarified question here. – Biosmosis Jan 19 '18 at 13:32

$B_{n,p}$, the count of successes among $n$ independent trials with identical success rate $p$ follows a Binomial Distribution. $$B_{n,p}\sim\mathcal {Binomial}(n,p) \iff \mathsf P(B_{n,p}=k)=\binom{n}{k}p^k(1-p)^{n-k}\mathbf 1_{k\in\{0,..,n\}}$$

This is the count of selections of $k$ from $n$ trials, times $k$ probabilities for successes and $n-k$ probabilities for failure.

If you wish the probability for exactly $1$ six among $3$ rolls of a six sided die, that is :

$$\mathsf P(B_{3,1/6}{=}1)=\dbinom 3 1 \dfrac {1^15^2}{6^3}=\dfrac{25}{72}$$

And such.

• I've edited the question to clarify that the function shouldn't calculate the probability of rolling exactly one 6, but rather the probability of there being a 6 (so rolling one or more 6s). – Biosmosis Jan 19 '18 at 6:46
• Please ignore the previous comment. I've rollbacked the question since a question should not be a moving target according to one of our site mods. – GNUSupporter 8964民主女神 地下教會 Jan 19 '18 at 8:01
• In any case, the same principle applies. The probability of rolling at least one six is either (a) the sum over, $k$ from $1$ to $6$, of the probabilities for rolling $k$ sixes, or (b) $1$ minus the probability for rolling $0$ sixes. Whichever you think is easier to calculate (hint: (b)) will give the same answer as the other.$$\mathsf P(B_{3,1/6}\geq 1) ~{=\sum_{k=1}^6 \mathsf P(B_{3,1/6}=k)\\= 1-\mathsf P(B_{3,1/6}= 0)}$$ – Graham Kemp Jan 19 '18 at 9:08

I like starting with choosing the right probability space. This helps understanding the problem. In a generalized problem of rolling $x$ 6s with $N$ $n$-sided dice:

• the sample space of a priori possible outcomes is $\Omega = \{1,\dots,n\}^N$
• ${\cal A} = {\cal P}(\Omega)$ since $|\Omega|=n^N<\infty$
• judge from the question context, the dice is assumed to be fair: $\mathbb{P} = \mathsf{Unif}(\Omega)$
• the event $A$ is rolling $x$ 6s is to choose $x$ components to place the outcome 6s from an $N$-tuple. For the remaining $N-x$ components, all outcomes are a priori possible except 6. There are $|A| = \binom{N}{x}(n-1)^{N-x}$

$${\Bbb P}(A) = \frac{|A|}{|\Omega|} = \frac{\binom{N}{x}(n-1)^{N-x}}{n^N}$$

We can now solve the three examples with $n=6$.

1. Take $N = 3, x = 1$, ${\Bbb P}(A) = \dfrac{25}{72}$
2. Take $N = 3, x = 2$, ${\Bbb P}(A) = \dfrac{5}{72}$
3. Take $N = 10, x = 5$, ${\Bbb P}(A) = \dfrac{262}{20117}$
• I've edited the question to clarify that the function shouldn't calculate the probability of rolling exactly one 6, but rather the probability of there being a 6 (so rolling one or more 6s). – Biosmosis Jan 19 '18 at 6:26
• @Biosmosis Such edit renders all existing wrong, and this is not accepted on Math.SE. As you're new here, I refer you to a question on meta about changing the question after receiving answers. You may see another meta question to know more. As a result, I rollbacked your question to #2. – GNUSupporter 8964民主女神 地下教會 Jan 19 '18 at 8:09
• I understand. I have edited the question so it's closer to what the answerers interpreted it as. – Biosmosis Jan 19 '18 at 12:40
• @Biosmosis I appreciate your effort to make your question clear. It'll be even better to do so before getting an answer. – GNUSupporter 8964民主女神 地下教會 Jan 19 '18 at 12:45
• I posted the new, clarified question here. Thanks for helping me out. – Biosmosis Jan 19 '18 at 13:27

Example 1: ${3\choose 1}\cdot {\frac 16}\cdot{\frac 56}^2$

Example 2: ${3\choose 2}\cdot(\frac 16)^2\frac 56$

Example 3: ${10\choose 5}\cdot(\frac 16)^5(\frac 56)^5$

In general: ${x\choose k}\cdot(\frac 16)^k(\frac 56)^{x-k})$

For $n$-sided dice, you get: ${x\choose k}\cdot ({\frac1n})^k \cdot {(\frac {n-1}n})^{x-k}$

For one or more sixes, say, we get: $\sum_{k=1}^x{x\choose k}\cdot \frac{{(n-1)}^{x-k}}{n^x }$

For $2$ or more subtract the probability of getting exactly $1$ six; for $3$ or more subtract the probabilities of getting exactly $1$ and that of exactly $2$ sixes, etc...

• I've edited the question to clarify that the function shouldn't calculate the probability of rolling exactly one 6, but rather the probability of there being a 6 (so rolling one or more 6s). – Biosmosis Jan 19 '18 at 6:26
• I'm sorry I'm going to invalidate your response to recent changes of the question by rolling back the question. – GNUSupporter 8964民主女神 地下教會 Jan 19 '18 at 7:57
• @GNUSupporter. You're probably right to do so... – Chris Custer Jan 19 '18 at 8:05
• @ChrisCuster Thanks for your comprehension. You'll probably be able to rollback questions after reaching 2000 reputation. – GNUSupporter 8964民主女神 地下教會 Jan 19 '18 at 8:11