I have an urn with $N$ red balls and $m$ blue balls. I sample with replacement from this urn until I encounter a blue ball, which I then discard. What is my expectation and variance for the number of total sampling events (with and without replacement) before all $m$ blue balls are discarded?
1 Answer
This answers half of the question.
Let $X_0$ be $1$ more than the number of red balls drawn before the first blue ball is drawn. For $k=1,\dots,m-1$ let $X_k$ be $1$ more than the number of red balls drawn after the $k$-th blue ball but before the $(k+1)$-st blue ball. Then $X=\sum_{k=0}^{m-1}X_k$ is the total number of draws needed to get rid of the blue balls.
When there are $k$ blue balls, the probability of drawing a blue ball is $\frac{k}{N+k}$, so the expected number of draws up to and including the first draw of a blue ball is $\frac{N+k}k=\frac{N}k+1$. Thus,
$$\Bbb E(X_k)=\frac{N}{m-k}+1$$
for $k=0,\dots,m-1$, and by linearity of expectation
$$\Bbb E(X)=\sum_{k=0}^{m-1}\Bbb E(X_k)=\sum_{k=0}^{m-1}\left(\frac{N}{m-k}+1\right)=N\sum_{k=1}^m\frac1k+m=NH_m+m\;,$$
where $H_m$ is the $m$-th harmonic number. Thus,
$$\Bbb E(X)\approx N\left(\ln m+\gamma+\frac1{2m}-\frac1{12m^2}\right)+m\;,$$
where $\gamma\approx0.5772156649$ is the Euler-Mascheroni constant.