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

There is a bag with N balls. Some of them are black and some are red. In the bag there can be 0 red balls or 1 red ball or 2 red balls or N red balls. It is given that each of these N+1 options is equally likely. Now, I pick up P balls from the bag and found that R of them are red. After this I pick up another ball from the bag, what is the probability that this ball is red?

share|cite|improve this question
Are you familiar with Bayes' Theorem? – Gerry Myerson Oct 7 '12 at 23:23
up vote 2 down vote accepted

Like Alex, I will assume sampling without replacement.

The probability of there having been X red balls out of N initially and R red were found when P were drawn is $$\frac{1}{N+1} \frac{\binom{X}{R} \binom{N - X}{P-R}}{\binom{N}{P}}$$ and, given that, the probability the next ball is red is $\frac{X-R}{N-P}$, which only makes sense (and is between $0$ and $1$) if $R \le X \le R+N-P$ so the result is:

$$\frac{\sum \left(\frac{X-R}{N-P}\right)\frac{1}{N+1} \frac{\binom{X}{R} \binom{N - X}{P-R}}{\binom{N}{P}} }{\sum \frac{1}{N+1} \frac{\binom{X}{R} \binom{N - X}{P-R}}{\binom{N}{P}}}$$

$$= \frac{\sum (X-R) \binom{X}{R} \binom{N - X}{P-R} }{(N-P)\sum \binom{X}{R} \binom{N - X}{P-R} }$$

where the sums are over the possible values of $X$, i.e. $\sum_{X=R}^{R+N-P}$.

share|cite|improve this answer
Thanks, Henry! I now understand the question. Yes, the balls are sampled without replacement. That's why I think the probability of there having been X red balls out of N initially and R were found when P were drawn would not be $$\frac{1}{N+1} {P \choose R}\left(\frac{X}{N}\right)^R\left(\frac{N-X}{N}\right)^{P-R}$$ It should be $$\frac{\binom{X}{R} \binom{N - X}{P-R}}{\binom{N}{P}}\cdot \frac{1}{N+1}$$ as @Alex said. – Rohit Agarwal Oct 8 '12 at 7:44
@Rohit: Answer edited accordingly – Henry Oct 8 '12 at 9:00

Try using conditional probability : $\mathrm{Pr}$(($P$+1)th is red) = $\mathrm{Pr}$(($P+1$)th is red | $R$ of $P$ were red)*$\mathrm{Pr}$($R$ of $P$ were red)

share|cite|improve this answer

This answer assumes you sample without replacement.

Denote $X_1$ the number of red balls before the first sampling. $X_1$ follows discrete Uniform distribution with parameter $\frac{1}{N+1}$ Now use Bayes law:

$P($sample $R$ red balls|$X_1$ red balls in the basket)$P$($X_1$ red balls in the basket)

For the conditional probability use Hypergeometric distribution: $$ \frac{\binom{X_1}{R} \binom{N - X_1}{P-R}}{\binom{N}{P}} $$ Hence, the probability to sample $R$ red balls in the first sample is $$ P(S_1)=\frac{\binom{X_1}{R} \binom{N - X_1}{P-R}}{\binom{N}{P}} \cdot \frac{1}{N+1} $$ After this we have $X_2 =(X_1-R)I_{R \leq X_1}$ red balls left in the basket (since obviously $R$ cannot be larger than $X_1$, hence the indicator function) . Using Bayes law again, the probability to sample one red ball ($S_2$) is
$$ P(S_2)=P(S_2|S_1)P(S_1)=\frac{(X_1-R)I_{R \leq X_1}}{N-P-(X_1-R)I_{R \leq X_1}} \cdot \frac{\binom{X_1}{R} \binom{N - X_1}{P-R}}{\binom{N}{P}} \cdot \frac{1}{N+1} \\ =\frac{X_2 I_{X_2 \geq 0}}{N-P-X_2 I_{X_2 \geq 0}} \cdot \frac{\binom{X_1}{R} \binom{N - X_1}{P-R}}{\binom{N}{P}} \cdot \frac{1}{N+1} $$

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.