Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

(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?

share|cite|improve this question

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


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


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.

share|cite|improve this answer

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.

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.