Roll a die repeatedly until you roll a 5. What is the expected value of the minimum rolled value?

538 Views Asked by At

I came across this interview question recently, but can't quite find a generalized way of setting this up.

Now, we know that if $X$ denotes the minimum value rolled, then $X$ cannot be 6, since the rolls do not finish until a 5 is rolled. Therefore $E[X] = \sum_{i=1}^{5} xP(X=x)$.

For $P(X=5)$, it is required that a 5 appeared before a 1, 2, 3, or a 4. Since the probability of this occurring is $\frac{1}{5}$, we can say that $P(X=5) = \frac{1}{5}$.

How would I go about calculating $P(X=x)$ for the remaining numbers? I have seen the following formula with respect to this question, but cannot understand how it's derived:

$P(X=x) = \frac{1}{x(x+1)}$.

Thanks in advance!

2

There are 2 best solutions below

2
On

The minimum value is $1$ if and only if the first $1$ comes before the first $5$, and the probability of this is $\frac12$. The minimum value is $2$ if and only if the first $1$, $2$, and $5$ come in the order $2,5,1$ which has probability $\frac1{3!}$ The minimum value is $3$ if and only if the first $1,2,3,5$ come in the order $3,5,1,2$ or the order $3,5,2,1$. Can you continue now?

0
On

$X=x$ if and only if, out of the set $\{1,\ldots, x,5\}$, $x$ is the first number to be rolled and 5 the second. (If something else in the set came before 5, it would replace $x$ as the minimum.) Every number in the set is equally likely to be first, and the set has size $x+1$ for each $x<5$, so $x$ has probability $\frac1{x+1}$ of being first. If it is, the remaining $x$ numbers are equally likely to be second, so the probability 5 is second is $\frac1x$. Overall that gives $\frac1{x(x+1)}$.

For example, to have $X=2$ we need 2 to be rolled before a 1 or 5 ($1/2$ chance), then 5 to be rolled before 1 ($1/3$ chance given that 2 came first).