# Expected number of rolls on a dice?

You roll a die until you have seen a 5 on 4 of the rolls (e.g. ⟨5,3,2,5,4,1,6,5,2,5⟩. What is the expected number of rolls this will take?

I think that I am way overthinking how I should be going about doing this. I know that I need to use a geometric distribution because I roll until I have seen 4 "fives". (I edited it.)

My attempt: 1/5 * (6^n+1) = 1554. That cannot be right. Anyone who can help push me in the right direction would be appreciated.

Let $X_1$ be the number of rolls until the first $5$, $X_2$ the number of rolls between the first $5$ and the second (but not including the first $5$), and so on.

Then the number $Y$ of rolls until the fourth $5$ is given by $Y=X_1+X_2+X_3+X_4$. By the linearity of expectation $E(Y)=E(X_1)+\cdots+E(X_4)$.

Each of the $X_i$ is a geometric random variable, with parameter $p=\frac{1}{6}$. By a standard result, $E(X_i)=\frac{1}{p}=6$.

Thus $E(Y)=24$.

• Ok I didn't realize that it was as simple as summing up each but that does make perfect sense! Thank you. Oct 24, 2014 at 20:50
• You are welcome. The linearity of expectation is a powerful tool. Note for the future that linearity of expectation does not require independence (though in fact our $X_i$ here are independent). Oct 24, 2014 at 20:53

I think, your guess for using the geometric distribution is good.

The expected number of rolled dices before seeing 5 should be multiplied by 4, since after rolling your first 5, you simply continue with rolling, till your second 5, and so on.

Alternative route:

Let $\mu_{n}$ denote the expectation of the number of rolls needed to see a $5$ on $n$ of the rolls and let $E$ be the event that the first roll shows a $5$. Then $\mu_{0}=0$ and:

$$(*)\quad\mu_{n}=\left(1+\mu_{n-1}\right)P\left(E\right)+\left(1+\mu_{n}\right)\left(1-P\left(E\right)\right)=1+\frac{1}{6}\mu_{n-1}+\frac{5}{6}\mu_{n}$$ leading to:

$\mu_{1}=1+\frac{5}{6}\mu_{1}$ implying that $\mu_{1}=6$

$\mu_{2}=2+\frac{5}{6}\mu_{2}$ implying that $\mu_{2}=12$

$\mu_{3}=3+\frac{5}{6}\mu_{3}$ implying that $\mu_{3}=18$

$\mu_{4}=4+\frac{5}{6}\mu_{4}$ implying that $\mu_{4}=24$

In fact on base of $(*)$ with induction it can easily be proved that $\mu_{n}=6n$.

$6 * 4 = 24$ because on average you should roll a $5$ every $6$ rolls and you need to see $4$ of them for a winning sequence. You should have known your answer of $1554$ was way off because you gave an example of only $10$ rolls where you got a winning combination. A simple way to "solve" this is to just simulate "pseudorandom" rolls by assigning them the sequence $1,2,3,4,5,6,1,2,3,4,5,6$... How many rolls now to see four $5$s? $23$ is very close to the correct answer of $24$.

Moral of the story, in general, first look for a simple solution but if that doesn't work, then try something else.