An urn contains twelve balls numbered 1 to 12. We draw a ball, record its number, and replace it in the urn. We repeat this until we draw any number three times. What is the expected number of draws?
First post here. Anyhow, I can solve the variant with one repeat, but I am struggling to figure out how to solve it with two repeats.
My initial guess was to use a Geometric distribution with $E[X] = 1/p$, where $p = P(\text{three balls are} 1)+...+P(\text{three balls are} 12) = 12*(1/12^3)$. So $1/(12*(1/12^3)) = 144$.
It seemed a bit high, and I realized that this only works if we are drawing three at a time. Been stumped for a few hours now. I think I am overthinking this. Can anyone help?
Let's say the first time we have drawn the same number three times is on draw number $X$, so we want to find $E(X)$. Our approach is to find $P(X>n)$ for $n=0,1,2, \dots ,24$, and then apply the theorem $E(X) = \sum_{n>0} P(X>n)$.
$X>n$ if no number has been drawn more then two times by the $n$th draw. There are $12^n$ possible sequences of numbers in $n$ draws, all of which we assume are equally likely. We would like to count the sequences in which no number occurs more than twice; let's say this number is $a_n$. The exponential generating function for $a_n$ is $$\begin{align} f(x) &= \left( 1+x+\frac{1}{2}x^2 \right)^{12} \\ &= \left[ (1+x)+\frac{1}{2}x^2 \right]^{12} \\ &= \sum_{i=0}^{12} \binom{12}{i} (1+x)^i \left( \frac{1}{2} x^2 \right)^{12-i} \\ &= \sum_{i=0}^{12} \binom{12}{i} \left( \frac{1}{2} \right)^{12-i} x^{24-2i} \sum_{j=0}^i \binom{i}{j} x^j \\ &= \sum_{i=0}^{12} \sum_{j=0}^i \binom{12}{i} \left( \frac{1}{2} \right)^{12-i} \binom{i}{j} x^{24-2i+j} \end{align}$$ where we have applied the binomial theorem twice above.
So $a_n$ is the coefficient of $(1/n!) x^n$ in $f(x)$: $$a_n = n! \sum_{i=12-\lfloor n/2 \rfloor}^{12} \binom{12}{i} \left( \frac{1}{2} \right)^{12-i} \binom{i}{n-24+2i}$$ for $n=0,1,2, \dots ,24$, and $$P(X>n) = \frac{a_n}{12^n}$$
Finally, $$E(X) = \sum_{n=0}^{24} P(X>n) \approx 10.7821$$ which is in agreement with the Monte Carlo estimate given in a comment by Suzuteo.