A fun dice problem
Came across a fun dice problem:
On average, how many times must a 6-sided die be rolled until all sides appear at least once?
Suppose we have a 6-side-dice, Let’s first do a simple one to get you warmed up.
On average, how many times must a 6-sided die be rolled until a 6 turns up?
let’s first compute the Prob. of get the side-6 at the nth time. Let X be the random variable representing the number of rolls until a 6 appears.
so the Prob of X = n, P(X=n)
(5/6)^(n-1) * (1/6)
The expectation of X is (integrate the above Prob — sum):
E = sum_n=1-> n=inf_( n * P(X=n) )
This will give you:
So then come back to our original question. Let’s go through this step by step. Let’s suppose you roll the dice and get one side, then you need to roll the dice to get any one from the other left 5 sides. Since there are 5 sides, this takes, on average, it takes:
1/(5/6) = 6/5 rolls
Then keep going, we need to roll and get any one from the left 4 sides, this requires:
1/ (4/6) = 6/4 = 3/2 rolls.
Continuing this process, finally we get:
1 + (6/5) + (6/4) + (6/3) + (6/2) + (6/1) = 147/10 = 14.7
That is, on average, the expected no. of time you throw the dice to get all the 6 sides is 15.
Some good resources: