# How do I find the probability of getting specific, distinct, dice rolls on an unfair die in the same group of trials?

I play gacha games, and recently I've wanted to compare the rates of the one that I play compared to competitors in the market to warn some friends of mine from starting one with rates that I feel are extremely bad.

Because others may not be familiar with gacha games, I felt the best analogy was an unfair die.

Assume there is a 20-sided, unfair die. The probability of rolling a 1 is 4%, rolling a 3 is 2.5%, rolling a 7 is 1%.

I am trying to find the probability of rolling at least one 1, one 3, and one 7, out of some number of die rolls.

I unfortunately have basically zero background in statistics.

If it were just one specific result I wanted, from my Googling, I could just use a standard binomial probability formula from any graphing calculator. Needing "at least" one success, say, for landing on a 3 at least once in 10 rolls means I could just do $$1−binomcdf(10,0.025,0)$$

But once I need multiple specific results, I have no idea what to do. Say if I wanted to land on 1, 3, and 7 at least once in the same 50 rolls.

I initially thought I could just subtract the probability of getting none of the 3, finding the probability I want by doing $$1-binomcdf(50, 0.925, 50)$$

But then I realized that once one desired result was acquired, any further instances of that result would actually constitute a failure, as it would not be fulfilling the "at least once" of the other two necessary results, so the probability of a failure roll would be changing through the trial.

How should I approach this issue?

• Compute the chance of not rolling one of the target values, then subtract this from 1. – whuber Jan 20 at 15:49
• @whuber That's that I was thinking would work for one target value, but I'm trying to find the probability of rolling all target values within the same set of, say, 50 rolls. – ConfusedGachaGamer Jan 20 at 18:17

## 1 Answer

Apply the Principle of Inclusion-Exclusion ("PIE").

For $$i\in\{1,3,7\},$$ let $$A_i$$ be the event "at least one $$i$$ is rolled in $$n=50$$ rolls." You seek the chance of the event $$A_1\cup A_3\cup A_7.$$ This is hard to find directly because the individual events overlap. The PIE says

\begin{aligned} \Pr(A_1\cup A_3\cup A_7) &= \Pr(A_1)+\Pr(A_3)+\Pr(A_7) \\ &- \Pr(A_1\cap A_3) - \Pr(A_3\cap A_7) - \Pr(A_7\cap A_1) \\ &+ \Pr(A_1\cap A_3\cap A_7). \end{aligned}

The first line sums the chances of the individual events. Because these events overlap, this sum is too large: it accounts twice for each element in any overlap. The second line compensates this by subtracting off the chances in the overlaps. But that goes too far, because it overcompensates for anything occurring in all three events. The last line is the final adjustment.

The chances of these seven events on the right hand side are easily found by considering their complements:

1. $$\Pr(A_i) = 1-\Pr(\text{not }A_i) = 1 - (1-\Pr(A_i))^n.$$ This is a consequence of the (implicit) assumption that all rolls of the die are independent, which means the chance of something happening (namely, not rolling an $$i$$) on two rolls is the product of the chances of something happening on each roll. Applying this definition $$n-1=49$$ times gives the formula.
2. $$\Pr(A_i\cap A_j) = \cdots = 1 - (1-\Pr(A_i)-\Pr(A_j))^n$$ according to the same argument.
3. $$\Pr(A_1\cap A_3\cap A_7) = \cdots = 1 - (1 - \Pr(A_1)-\Pr(A_3)-\Pr(A_7))^n$$ according to the same argument.

The rest is arithmetic: you should obtain a value close to $$0.24291334932837.$$ I computed this in R by creating a general-purpose function for any number of events and any value of $$n.$$ It uses a slight modification of the PIE formula suitable for higher-precision calculations:

PIE <- function(p, n) {
1 - sum(unlist(sapply(seq_along(p),
function(i) (-1)^(i-1) * sum(apply(combn(p, i), 2,
function(p) (1 - sum(p))^n)))))
}
print(PIE(c(4, 2.5, 1)/100, 50), digits=15)

• Why would $n-1$ be used to calculate the probability to the individual steps, and not 50? From my understanding the probability of not $A_i$ would be the probability of failing to get $A_i$ across all 50 rolls. – ConfusedGachaGamer Jan 21 at 17:30
• Applying the definition 49 times accounts for 1+49 = 50 rolls. – whuber Jan 21 at 18:33