# Probability of a certain run of dice rolls

OK, so here's a simple problem: Suppose I roll a D6 one hundred times. What is the probability of any number appearing exactly 50 times?

Now, the probability of rolling 50 ones is presumably given by the number of 100-roll sequences that contain exactly 50 ones divided by the total number of possible sequences. But I could roll 50 twos instead. Which suggests that you need to add up all six ways to meet the criteria... except that these cases are not mutually-exclusive. It's possible, for example, to roll 50 threes and 50 sixes. Freakishly unlikely, but possible.

So... um... how do I attack this?

• The solution quoted at stats.stackexchange.com/questions/10407/… is $p(100, 6, 50) - p(100, 6, 49)$ = $\frac{8473424541566438848424241044494401095413860748334784411104375}{21004328173227588287573632560379945361919486576419588205474278754163359744}$ which is approximately $8.22963054197003118712621974351591 31460490899570690189896043772762691815344035140089 \times 10^{-14}$. I found this by searching our site on multinomial maximum. – whuber Jun 17 '13 at 22:33

Calculate how often you roll exactly 50 ones. Multiply by six to account for rolling twos, threes etc. Finally, subtract everything you double-counted: the extremely rare case of rolling exactly 50 ones and 50 twos is counted twice, so you need to subtract 1. The same holds for all the other combinations, so you need to subtract 5+4+3+2+1=15. Which will really not make that much of a difference...

• Maybe I'm being dense, but surely there's more than one way to roll 50 ones and 50 twos. In fact, I would expect there to be 100 choose 50 ways to do that, which is about 10^29... – MathematicalOrchid Jun 18 '13 at 7:33
• No, of course you are right, the density is all mine... thank goodness we can still probably ignore double counting for all practical purposes, even if we are off by $10^{29}$... – Stephan Kolassa Jun 18 '13 at 7:38

Well, first you'd figure out the probability of 50 1's. Then multiply by 6. Then subtract the combinations where there are 50 of each of two numbers.

$PR = \binom{100}{50}.167^{50}.833^{50}$

or, if I pushed the right buttons, $1.49*10^{-14}$

6 times that is $8.91*10^{-14}$

the probability of 50 1's and then 50 2's is $.167^{100}$ and you have to multiply this by 30 but this is so tiny it can be ignored. (Multiply by 30, not 15, because it could be 11111 ....2222.... or 2222....1111.... etc.

Let's start off with a simplified version where we're just interested in the probability of getting exactly 50 1's. In R, you can get this probability using the dbinom function.

dbinom(50, size = 100, prob = 1/6)                    # about 10^-14


Multiplying by 6 gives the probability of 50 ones plus the probability of 50 twos, etc. As you pointed out, it's possible that you'd get 50 ones and 50 twos on the same run of 100 rolls, so this does a little bit of double-counting.

How much double-counting? Well, there are n-choose-two pairs of numbers that could each get 50 hits. There are 30 ways to do this (see below), so we're double-counting 30 instances out of the 6^100 possible sequences.

6 * dbinom(50, size = 100, prob = 1/6) - 30 * (1/6)^100


This gives me 8.229631e-14. According to Wikipedia, this is comparable to the probability of picking a given cell from the human body at random. As you expected, the double-counting issue is negligible.

I initially said there were 15 ways because there are 15 unique ways to pick two of the six sides to be rolled 50 times. As @PeterFlom pointed out, this is off by a factor of 2, since you could have ones and then twos or twos and then ones.