2
$\begingroup$

I'm in the process of making rules for a tabletop role playing game (rpg). When writing this I wanted to provide a table for probability of success.

The problem I'm trying to solve is the probability of getting at least one group of dice showing the same number. This number doesn't matter, it can range from $1-6$. What does matter is the size of the dice-group. In some cases I want to find the probability of at least two dice in a group, sometimes $19$ dice or anything in between, the number of dice rolled changes too. The number of dice rolled will range from $2-20$.

I have tried some different ideas. I'm pretty confident that the bottom of the fraction should be $6^x$, where $x$ is the number of dice required in the dice-group. The top of the fraction contains $6$ to account for all six possible numbers the dice-group could have. what puzzles me is how I account for different number of dice rolled. I tried the following formula where $y$ is the number of dice rolled: $$\frac{6*y}{6^x}$$ But it seems like the result is wrong when I test it.

What am I doing wrong, what should the formula look like, and why does it look like that?

$\endgroup$
  • $\begingroup$ Could you say what is a rpg (many non naive English speakers on this site). $\endgroup$ – Jean Marie Mar 7 '17 at 9:47
  • $\begingroup$ I'm not totally sure on the what exactly you want to calculate. I'll phrase what I think you mean, then you can tell if that is correct: You are throwing $n$ fair, 6-sided dice. You want to know the probability that at least $k \le n$ show the same (unspecified) value. Is that correct? $\endgroup$ – Ingix Mar 7 '17 at 10:38
  • $\begingroup$ there have to be inputs that give the answer 1, for example, if you roll 7 dice, then the probability of having at least 2 the same is 1 (if the fact of the value being the same means any number that is the same). 7 dice cannot all have a different value. $\endgroup$ – Cato Mar 7 '17 at 10:49
3
$\begingroup$

EDIT: It appears that I might have misinterpreted the problem. I solved the problem of "given $d$ fair $6$-sided dice, what is the probability that there will exist at least one dice value such that that dice value is rolled at least $k$ times?".

It occurred to me that you meant for the following problem to be solved: "given $d$ fair $6$-sided dice and a dice value $v$ from $1$ through $6$, what is the probability that $v$ will be rolled at least $k$ times?"

Below this paragraph is my original response. If you are looking for an answer to the latter problem, then you can simply look at the formula I have for $P(X_i \geq k)$.


Suppose you have $d$ dice and let $X_i = $"the number of $i$'s rolled" among the $d$ dice where $i \in \{1,2,3,4,5,6\}$.

Using the binomial distribution, you have the following for rolling $k$ $i$'s

$$P(X_i = k) = {d \choose k}\left(\frac{1}{6}\right)^k\left(\frac{5}{6}\right)^{d-k}.$$

The idea is we first look at the probability of the first $k$ dice being $i$'s and the rest being non-$i$'s. That's where the $\left(\frac{1}{6}\right)^k\left(\frac{5}{6}\right)^{d-k}$ comes from. The ${d \choose k}$ comes from the number of ways we can place the $i$'s among the $d$ dice.

Thus, if you are looking for rolling at least $k$ $i's$, $$P(X_i \geq k) = \sum_{j=k}^{d}{d \choose j}\left(\frac{1}{6}\right)^j\left(\frac{5}{6}\right)^{d-j}.$$

Notice that each of the $X_i$'s are not independent so you can't just add up the previous equation for each value of $n$, i.e., $$P\left(\bigcup_{i=1}^6 X_i \geq k\right) \neq \sum_{i=1}^6 P(X_i \geq k).$$

Thus, we need to use the inclusion-exclusion principle to occur for over- and under-counting. To make the notation less messy, I'm going to let $Y_i$ be the event that $X_i \geq k$.

$$P\left(\bigcup_{i=1}^6 X_i \geq k\right) =P\left(\bigcup_{i=1}^6 Y_i\right) =$$$$ \sum_{i=1}^6 P(Y_i) - \sum_{i<j} P(Y_i \cap Y_j) + \sum_{i<j<l} P(Y_i \cap Y_j \cap Y_l) - \sum_{i<j<l<m} P(Y_i \cap Y_j \cap Y_l \cap Y_m)+\sum_{i<j<l<m<n} P(Y_i \cap Y_j \cap Y_l \cap Y_m \cap Y_n)-\sum_{i<j<l<m<n<o} P(Y_i \cap Y_j \cap Y_l \cap Y_m \cap Y_n \cap Y_o).$$

Now let us consider these intersection of events. Suppose we want to find $P(Y_i \cap Y_j) = P(X_i \geq k \cap P \geq k)$. To help us find this, we will first look at $P(X_i = a \cap X_j = b)$ for some number of dice $a,b$. First, we calculate the probability that the first $a$ dice are $i$'s, the next $b$ dice are $j$'s, and the rest are non-$i$'s and non-$j$'s. This probability is, $$\left(\frac{1}{6}\right)^a\left(\frac{1}{6}\right)^b\left(\frac{5}{6}\right)^{d-a-b} = \left(\frac{1}{6}\right)^{a+b}\left(\frac{5}{6}\right)^{d-2k}.$$ Next, we consider the number of ways we can arrange the $i$'s and $j$'s. Notice there ${d \choose a}$ ways we can choose the $a$ $i$'s, after which there are ${d-a \choose b}$ ways we can choose $k$ $j$'s. So there are ${d \choose a}{d-a \choose b}$ ways to arrange the $i$'s and $j$'s. It follows that, $$P(X_i = a \cap X_j = b) = {d \choose a}{d-a \choose b}\left(\frac{1}{6}\right)^{a+b}\left(\frac{5}{6}\right)^{d-2k}.$$

To find $P(X_i \geq k \cap P \geq k)$, we just sum up over all the possibilities: $$P(Y_i \cap Y_j) = P(X_i \geq k \cap X_j \geq k) = \sum_{a=k}^n\sum_{b=k}^{n-a} {d \choose a}{d-a \choose b}\left(\frac{1}{6}\right)^{a+b}\left(\frac{5}{6}\right)^{d-2k}.$$

Now let us consider the more general event that is an intersection of $e$ of the $Y_i$'s, i.e., $P(\bigcap_{i=1}^e Y_{\alpha_i}).$ First, let us calculate the probability that we roll exactly $d_i$ $\alpha_i$'s for $i=1,\dots,e$. We'll first calculate the probability that the first $d_1$ dice are $\alpha_1$'s, the next $d_2$ dice are $\alpha_2$'s, etc. We see that the probability is, $$\prod_{i=1}^e \left(\frac{1}{6}\right)^{d_i} \cdot \left(\frac{5}{6}\right)^{n-\sum_{i=1}^e d_i} = \left(\frac{1}{6}\right)^{\sum_{i=1}^e d_i} \cdot \left(\frac{5}{6}\right)^{n-\sum_{i=1}^e d_i}.$$

Now we count the number of ways to arrange the $d_1$ $\alpha_1$'s, $d_2$ $\alpha_2$'s, etc amongst the $d$ dice. We'll do the same thing as before where we first pick $d_1$ dice amongst the $d$ dice, then we'll pick $d_2$ dice amongst the remaining $d-d_1$ dice, etc. Thus, the total number of ways ends up being, $$\prod_{i=1}^e {d-\sum_{j=1}^{i-1} d_i \choose d-d_i}.$$

Combining the probability from before and the number of arrangements, we have the following probability for rolling exactly $d_i$ $\alpha_i$'s for $i=1,\dots,e$: $$P\left(\bigcap_{i=1}^e X_{\alpha_i} = d_i\right) = \prod_{i=1}^e {d-\sum_{j=1}^{i-1} d_i \choose d-d_i} \cdot \left(\frac{1}{6}\right)^{\sum_{i=1}^e d_i} \cdot \left(\frac{5}{6}\right)^{n-\sum_{i=1}^e d_i}.$$

Then, to find the probability that at least $k$ dice are rolled for each $\alpha_i$, we just sum through the possibilities,

$$P(\bigcap_{i=1}^e Y_{\alpha_i}) = P\left(\bigcap_{i=1}^e X_{\alpha_i} \geq k\right) = \sum_{d_1,\dots,d_e \\ \sum_{i=1}^e d_i \leq n \\ d_i\geq k} \prod_{i=1}^e {d-\sum_{j=1}^{i-1} d_i \choose d-d_i} \cdot \left(\frac{1}{6}\right)^{\sum_{i=1}^e d_i} \cdot \left(\frac{5}{6}\right)^{n-\sum_{i=1}^e d_i},$$ where

$$\sum_{d_1,\dots,d_e \\ \sum_{i=1}^e d_i \leq n \\ d_i\geq k} := \sum_{d_1=k}^{n}\sum_{d_2=k}^{n-d_1}\dots\sum_{d_e=k}^{n-\sum_{i=1}^{e-1}d_i} $$

Now we have the probabilities we need to compute the equation that resulted from the inclusion-exclusion principle. Notice that the actual value rolled for the die doesn't change the probabilities, and thus, each probability in the sum is the same. Thus, for each sum, we only need to find the number of ways we can pick the events to intersect. Clearly, the first sum has 6 items we are summing. The second sum is based off of the number of ways to pick two dice values out of six, of which there are ${6 \choose 2}$ ways, so that sum has ${6 \choose 2}$ items to sum over. In general, the $i$th sum has ${6 \choose i}$ elements to sum over. Thus, our final formula is the following: $$P\left(\bigcup_{i=1}^6 X_i \geq k\right) =P\left(\bigcup_{i=1}^6 Y_i\right) =$$

$$$$

$$\sum_{e=1}^6\left[ (-1)^{e+1}{6 \choose i}\sum_{d_1,\dots,d_e \\ \sum_{i=1}^e d_i \leq n \\ d_i\geq k}\left[ \left(\prod_{i=1}^e {d-\sum_{j=1}^{i-1} d_i \choose d-d_i}\right) \left(\frac{1}{6}\right)^{\sum_{i=1}^e d_i} \cdot \left(\frac{5}{6}\right)^{n-\sum_{i=1}^e d_i}\right]\right].$$

The formula is a bit nasty, but that's what we have. If anyone has any ideas on ways to simplify this mess, that would probably be helpful to both the OP and also interesting to myself.

Cheers!

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.