# Drawing balls from a bin with a color-specific probabilistic discard step

(I migrated this question here myself from MathOverflow since it might be too low level there.)

I have a bin with $N = (k_a + b_b)$ total balls, $k_r$ of which are red and $k_b$ of which are blue. I sequentially choose balls from the bin uniformly and randomly:

(1) If the ball I select is red, I discard it with probability $p$, and place it back into the bin with probability $(1 - p)$.

(2) If the ball I select is blue, I place it back into the bin.

What expectation and distribution should I expect for the total number of draws until I have only blue balls left in the bin? What if I ask for the expectation and distribution for the number of (specifically) blue balls I have to draw until only blue balls are left in the bin?

-

My answer deals (uptil now) only with the expectation.

Denote the original numbers of red balls and blue balls by $r$ and $b$ and let $D_{r,b}$ be the number of draws that must take place until you arrive for the first time in a situation in wich there are only blue balls left. Denote the event that the first ball drawn is red and is discarded by $RD$, the event that it is red and placed back by $RPB$ and the event that it is blue by $B$. If $r>0$ then

$E\left[D_{r,b}\right]=E\left[D_{r,b}\mid RD\right]P\left(RD\right)+E\left[D_{r,b}\mid RPB\right]P\left(RPB\right)+E\left[D_{r,b}\mid B\right]P\left(B\right)$ $E\left[D_{r,b}\right]=\left(1+E_{r-1,b}\right)\frac{pr}{r+b}+\left(1+E_{r,b}\right)\frac{\left(1-p\right)r}{r+b}+\left(1+E_{r,b}\right)\frac{b}{r+b}$.

This equation leads to $E\left[D_{r,b}\right]=\frac{r+b}{pr}+E\left[D_{r-1,b}\right]$ and consequently

$E\left[D_{r,b}\right]=\frac{1}{p}\sum_{i=1}^{r}\left(1+\frac{b}{i}\right)=\frac{r}{p}+\frac{b}{p}\sum_{i=1}^{r}\frac{1}{i}$.

If $B_{r,b}$ denotes the number of blue balls to be drawn then $B_{r,b}=D_{r,b}-r$ so:

$E\left[B_{r,b}\right]=E\left[D_{r,b}\right]-r$.

Second approach:

Let $X_{i,b}$ stand for the number of balls to be drawn to get from a situation with $i$ red balls into a situation with $i-1$ red balls. Then $D_{r,b}=X_{r,b}+\cdots+X_{1,b}$ and the $X_{i,b}$ are independent random variables with geometric distribution: $P\left[X_{i,b}=k\right]=\left(1-\frac{pi}{i+b}\right)^{k-1}\frac{pi}{i+b}$ so $EX_{i,b}=\frac{i+b}{pi}$ leading to $E\left[D_{r,b}\right]=\frac{r}{p}+\frac{b}{p}\sum_{i=1}^{r}\frac{1}{i}$

This also gives you some insight in the distribution of $D_{r,b}$. It can be written as sum of geometric random variables that do not have the same parameter. You can compute its moment-generating function.

-

I see no problem with drhab's answer to the first part of the question, but shouldn't the expectation for the number of blue balls drawn before having reaching the situation until only blue balls left be: $E\left[B_{r,b}\right]=E\left[D_{r,b}\right]-\frac{r}{p}$?

Numerical simulations do not appear to bear out $E\left[B_{r,b}\right]=E\left[D_{r,b}\right]-\frac{r}{p}$ as the correct expectation for the number of times blue balls are sampled prior to discard of all red balls.

-