# Expected value of number of throws of a dice to get element $1$ four times

Here is the question:

Find the expected value and variance of the number of times one must throw a dice until the element $$1$$ has been obtained $$4$$ times.

My attempt:

The minimum number of throws required to get $$4$$ ones is $$4$$ when each of the subsequent throws gives a result of $$1$$. Using binomial, the probability of this case is $${4 \choose 4}(\frac{1}{6})^4(\frac{5}{6})^0$$.

Similarly, for the case when we throw the dice $$5$$ times and obtain $$1$$ four out of the five times, the probability becomes $${4 \choose 4}(\frac{1}{6})^4(\frac{5}{6})^1$$.

I was able to generalize the expectation as: $$E(n) = \sum_{n=0}^{\infty}(n+4){n+4 \choose 4}(\frac{1}{6})^{4}(\frac{5}{6})^n$$

I'm stuck here and can't think of any way to go forward.

• There's an error in your formula: to achieve a fourth success on the $n$th turn, you need three previous successes out of $n-1$ attempts (in your case, the sequence $1, 1, 1, 1, 2$ would also be counted). – jvdhooft Feb 13 at 16:43
• Also, since there are three previous successes, the factor $\frac{5}{6}$ should not be raised to the power of $n$. – jvdhooft Feb 13 at 16:46
• I fixed the summation. @jvdhooft – Abhyudaya Sharma Feb 13 at 16:47
• Possible duplicate of What is the expected number of trials until x successes? – jvdhooft Feb 13 at 16:55
• My standard kvetch: You throw a single [b]die[/b]. "Dice" is the [I]plural[/I] or "die". – user247327 Feb 13 at 16:59

An easy way to get the expected number of trials is to use linearity of expectation. Let $$X_1$$ be the number of trials until the first $$1$$ is rolled, $$X_2$$ be the number of trials after the first $$1$$ until the second $$1$$, and define $$X_3$$ and $$X_4$$ similarly. Then $$X=X_1+X_2+X_3+X_4$$ is the number of rolls until the fourth $$1$$. We have $$E(X)=4E(X_1)=4\cdot6=24$$ since the number of Bernoulli trials with probability $$p$$ until the first success is $$1/p.$$

Also, since the $$X_i$$ are independent, the variance of the sum is the sum of the variances, and $$Var(X)=4Var(X_1).$$ I leave it to you to continue from here.

Notice that this is a negative binomial random variable for which we want to find the probability that it takes $$n$$ trials to get $$k$$ successes. Let's denote this by $$X$$. The pdf of $$X$$ is of the form

$$P(X=n)={n-1 \choose k-1}p^k (1-p)^{n-k}$$

since we want to get $$k-1$$ successes on the first $$n-1$$ trials and then another success of the $$n$$-th trial. Here, $$k$$ is fixed at $$4$$, and $$p=\frac{1}{6}$$ so we get

$$P(X=n)={n-1 \choose 3}\left(\frac{1}{6}\right)^4 \left(\frac{5}{6}\right)^{n-4}$$

Then the expected value would just be

$$E(X)=\sum_{n=4}^{\infty} n\cdot{n-1 \choose 3}\left(\frac{1}{6}\right)^4 \left(\frac{5}{6}\right)^{n-4}=24$$

since as you said, the support of $$X$$ is $$(4,5,...,)$$

Can you go from here to obtain the variance?

• Thanks for your answer! It makes sense. Could you please tell how you arrived at the value of $24$? – Abhyudaya Sharma Feb 13 at 16:57
• @AbhyudayaSharma If you require $r = 4$ successes, and the probability of success is $p = \frac{1}{6}$, we have: $E(X) = \frac{r}{p} = 24$. – jvdhooft Feb 13 at 17:01
• @jvdhooft Thanks! I'll study up on negative binomial distribution. – Abhyudaya Sharma Feb 13 at 17:04
• I would suggest accepting the above answer instead. – Remy Feb 13 at 17:09