Calculating probability of success vs failure

diceprobability

Hoping I can get some help in understanding the raw math behind this. I understand basic probabilities, but sometimes these things are either a bit more complicated than I can work out – or I tend to overthink it and miss the obvious O.o

I'm playing a game, in which we roll a certain # of dice (all 6 sided – standard, fair dice).

In the simple case, if we roll a 1, that die is considered a failure.

So if we roll 1 die, the chances of getting 0 failures is: 5/6

If we roll 2 dice, chance of getting 0 failures is: (5/6)*(5/6) = 25/36

or if I have this right, in a general sense chances of no failures on n dice:

(5^n)/(6^n) or (5/6)^n

And hence getting any failures is: 1 – ( (5/6)^n )

I hope I have that correct so far ..

This much I understand .. however, where I get lost, is when there are different dice.

Let's say we have two types of dice: White and Red dice.

White dice, when rolled, fail on a roll of 1.
Red dice, when rolled, fail on a roll of 1 or 2.

So … given that I'm rolling n White dice, and k Red dice …

what's the odds of:

a) no failures on any dice
b) 1 failure only
c) 2 failures only
d) 3 or more failures.

Note: as I've perused some suggested threads as I post this .. i want to clarify – this question has no "order" – that is, I'm not asking for "2 failures in a row" … but rather just "2 failures .. period". so no order to the dice roll .. we just roll n dice all at once.

I saw this thread:
Probability of an event happening more times than at least one other event
It seemed .. "similar" .. but seems more complex than what i'm asking, I think?

I've tried setting up an xls to calc each set seperately, and "add them", however, I don't believe it's coming up with the proper answer.

Note: for those interested, my question stems from this game: https://boardgamegeek.com/boardgame/256589/rallyman-gt
and as I learn games, I like to really understand and dig into the underlying math of things and would really like to understand how to (properly) calculate the odds of hitting 3+ failures (ie to better understand my risk vs reward in the game) Hoping this is fine, as the question is purely about the math – the game is simply for background/understanding the question.

Best Answer

As JMoravitz has noted in the comments, what we have here is effectively two independent binomial distributions. In general, when you have multiple independent events, and want to know the probability of the outcome of both, we simply take the product of those probabilities. I'll show both these distributions separately, then show what they look like once we've multiplied them together.

Let's define the number of white dice as $w$ and the number of red dice as $r$. We'll define the number of white failures as $j$ and the number of red failures as $k$. We can calculate the probability of an arbitrary number of white dice failures as:

$$P(W=j)=\binom{w}{j}\left(\frac{1}{6}\right )^j\left(\frac{5}{6}\right )^{w-j}$$

Note that $\binom{w}{j}$ is the binomial coefficient, which is calculated as $\binom{w}{j}=\frac{w!}{j!(w-j)!}$. The probability of an arbitrary number of red dice failures is calculated as:

$$P(R=k)=\binom{r}{k}\left(\frac{2}{6}\right )^k\left(\frac{4}{6}\right )^{r-k}$$

Exactly the same equation, just with red's variables. So, the probability of $j$ white failures and $k$ red failures is just a matter of multiplying these two together:

$$P(R=k \cap W=j)=\binom{w}{j}\binom{r}{k}\left(\frac{1}{6}\right )^j\left(\frac{5}{6}\right )^{w-j}\left(\frac{2}{6}\right )^k\left(\frac{4}{6}\right )^{r-k}$$

Of course, the question you have is slightly different than this - we want to know the total failures, not an arbitrary combination. Let's define the total number of failures rolled as $f$. There's more than one combination of $j$ and $k$ that will get us any given total, so we'll need to do this calculation for each possibility, then sum all the probabilities together. In this case that's pretty straightforward - $j$ and $k$ both count for the same number of failures, so we can just set $k=f-j$, and use $j$ as our iterator (we could also do the opposite, and set $j=f-k$ and use $k$ as the iterator, it honestly doesn't matter here). We'll have run through all the possibilities of interest when $j$ has been either every value up to $f$, every value up to $r$, or every value up to $w$, so we'll set the end value of our iterator to be the lowest of those three. That looks like:

$$P(F=f)=\sum_{j=0}^{\min(w,r,f)}\binom{w}{j}\binom{r}{f-j}\left(\frac{1}{6}\right )^j\left(\frac{5}{6}\right )^{w-j}\left(\frac{2}{6}\right )^{f-j}\left(\frac{4}{6}\right )^{r-(f-j)}$$

Let's test it out! Let's look at the possibility of 2 failures with 5 white dice and 3 red dice. So, that's $f=2$, $w=5$ & $r=3$. Let's plug in those numbers and see what we get:

$$\begin{align*} P(F=2)=&\sum_{j=0}^{\min(5,3,2)}\binom{5}{j}\binom{3}{2-j}\left(\frac{1}{6}\right )^j\left(\frac{5}{6}\right )^{5-j}\left(\frac{2}{6}\right )^{2-j}\left(\frac{4}{6}\right )^{3-(2-j)}\\ =&\sum_{j=0}^{2}\binom{5}{j}\binom{3}{2-j}\left(\frac{1}{6}\right )^j\left(\frac{5}{6}\right )^{5-j}\left(\frac{2}{6}\right )^{2-j}\left(\frac{4}{6}\right )^{1+j}\\ =&\binom{5}{0}\binom{3}{2}\left(\frac{1}{6}\right )^0\left(\frac{5}{6}\right )^{5}\left(\frac{2}{6}\right )^{2}\left(\frac{4}{6}\right )^{1}+\binom{5}{1}\binom{3}{1}\left(\frac{1}{6}\right )^1\left(\frac{5}{6}\right )^{4}\left(\frac{2}{6}\right )^{1}\left(\frac{4}{6}\right )^{2}\\ &+\binom{5}{2}\binom{3}{0}\left(\frac{1}{6}\right )^2\left(\frac{5}{6}\right )^{3}\left(\frac{2}{6}\right )^{0}\left(\frac{4}{6}\right )^{3}\\ =&1\cdot 3 \cdot 1 \cdot \frac{3125}{7776}\cdot\frac{4}{36}\cdot \frac{4}{6}+5\cdot 3 \cdot \frac{1}{6}\cdot\frac{625}{1296}\cdot\frac{2}{6}\cdot\frac{16}{36}+10 \cdot 1 \cdot \frac{1}{36}\cdot\frac{125}{216}\cdot 1 \cdot \frac{64}{216}\\ =& \frac{3125}{34992}+\frac{6250}{34992}+\frac{625}{13122}=\frac{33125}{104976}\approx 0.3155483\\ \end{align*}$$

So, if you have 5 white dice and 3 red dice, you have around a 31% chance of 2 failures. This basic calculation will work for any single value of $f$, and if you're looking for a range, you'll need to repeat this calculation for every value of $f$ you're interested in, then add the whole thing together (so, for 3+ failures, you'll need to calculate $f=3$, $f=4$,$f=5$, etc. As a quick tip though, if you've included a larger range of failure values than you are excluding, you can save yourself some work by calculating the probabilities of items you are excluding instead, then subtracting those values from 1. In general, you should never have to calculate more than half the total possible range with this trick, although admittedly if it's a large number of dice, that can still be a lot of equation to calculate.

Related Question