# Expectation of repeated number 3 times on dice

Independent tosses of a loaded die with probabilities $p_i$ , $i$ = 1, ..., 6, are performed.

1. Let N denote the number of tosses until the initial outcome has occurred exactly 3 times. For instance, if the toss results are 4,3,4,5,1,6,2,4 then N = 8. Find E(N).
2. Find the expected number of tosses needed until both 1 and 6 appeared. Compute it when the die is fair.
• @Mark Fischler So far, Y = 1 if I get a number that has been rolled before, and Y = 0 if I get a new number. E(X) = p(E(X)|Y=1) + (1-p)(E(X)|Y=0) = this is where I get confused. – AmaC Oct 4 '17 at 22:35

The expected number of rolls until you get number $i$ once is $\frac1{p_i}$. So the answer to problem 1, where you need to roll whatever number comes up first two more times, is $$\sum_i p_i \left(1+2\frac1{p_i}\right) = \sum_i p_i + \sum_i 2\frac{p_i}{p_i} = 1 + 2\sum_{i=1}^6 1 = 13$$
For the second one, first either 1 or 6 has to appear, then the other. So we start with the expectation for the combined probabilities, then add the weighted average of the expectation for the individual probabilities. So we have $$\frac1{p_1+p_6} + \frac{p_1}{p_1+p_6}\frac1{p_6} + \frac{p_6}{p_1+p_6}\frac1{p_1} = \frac{p_1p_6+p_1^2+p_6^2}{(p_1+p_6)p_1p_6}$$ When the die is fair, this works out to be $9$