If you roll five dice your chances of getting all five matching is $\frac{1}{6^5} = \frac{1}{7776} \approx 0.08\%$.
I recently learned the binomial probability formula: $P = nCr \times p^r \times (1 - p)^{n-r}$.
- $nCr = \frac{n!}{r!(n-r)!}$ << The different possible combinations
- $r$ is the number of dice you need to match
- $n$ is the number of dice you're rolling
- I use $\frac{1}{6}$ in the formula because that's dice probability
Because I am rolling 5 dice and need 5 matches, I set $r = 5$ and $n = 5$ and came up with this equation: $P=\frac{5!}{(5-5)!5!}\times(\frac{1}{6})^{5}\times(1-\frac{1}{6})^{5-5}\approx0.012\%$
But when I set $r = 4$, $n = 4$ with the formula below I do get the desired result. $P=\frac{4!}{(4-4)!4!}\times(\frac{1}{6})^{4}\times(1-\frac{1}{6})^{4-4}\approx0.08\%$
Why is this? Shouldn't $r$ and $n$ be 5 because I'm rolling 5 dice and need 5 matches?
First off, note that $$\frac{1}{6^5} = \frac{1}{7776} \approx 0.013\%$$ so your first computation is incorrect. It is true that $\approx 0.08\%$ of the time that all five dice rolls will match one another, but this isn't given by $1/6^5$. Rather, it's given by $6/6^5 = = 1/6^4$.
The reason for this has been given in the comments, but in short, it's because there are $6$ ways for all five dice rolls to match. That is, all five could come up 1, all five could come up 2, all five could come up 3, and so on for each of the six faces. Therefore, out of the $6^5$ total equally likely results for the five dice rolls, $6$ result in all five matching, giving the correct probability of $6/6^5 = 1/6^4$.
Now I'll address the major issue in your formulation of the binomial probability: Your definition of $r$ is deficient.
to match... what? To be correct, it should be
For instance, you could define $r$ as the number of dice that come up $6$. Then the probability that all $5$ rolls come up $6$ would be given as the binomial probability $$P=\frac{5!}{(5-5)!5!}\times(\frac{1}{6})^{5}\times(1-\frac{1}{6})^{5-5}\approx0.012\%$$ with no error.