I am dealing with a problem that resembles the following modeling:

Given a bag of $n$ balls constitute of $b$ black balls and $r$ red balls, we are choosing $\alpha$ many balls uniformly without replacement. What is the probability of having at most $k$ many black balls?

P.S: I know that the problem is broken down into the following formula. What we are seeking for is a very simplified version of the following formula to decide on $\alpha$ given $b$, $r$, $n$, and a target $p$.

$p = Pr(num_{black} < k) = \frac{\sum_{i=0}^{k-1} \binom{b}{i} \times \binom{r}{\alpha-i}}{\binom{n}{\alpha}}$

  • $\begingroup$ The formula is the prob. of less than k black balls, not at most k black balls. And, the second choice should be from $n-b$, not $b$ $\endgroup$
    – gunes
    Commented Sep 14, 2018 at 8:38
  • $\begingroup$ @gunes Thanks, edited, however, the second choice is correct I believe. $\endgroup$ Commented Sep 14, 2018 at 8:46
  • $\begingroup$ On the contrary, you've corrected the second choice from $b$ to $r = n-b$, so it is now correct. But, you still ask "What is the probability of having at most k many black balls?", which is not equal to the probability formula you wrote. You need $P(num_{black} \leq k)$ $\endgroup$
    – gunes
    Commented Sep 14, 2018 at 8:55

2 Answers 2


It depends a bit on your values for the parameters, but the normal approximation should work well here. The expected value and variance is

$$E(num_{black})=\alpha \frac{b}{n}=\mu$$ $$var(num_{black})=\alpha \frac{br}{n^2}\frac{n-\alpha}{n-1}=\sigma^2$$

You approximate the probaability as

$$Pr(num_{black}<k)=Pr(\frac{num_{black}-\mu}{\sigma}<\frac{k-\mu}{\sigma})\approx Pr(Z<\frac{k-\mu}{\sigma})=\Phi\left(\frac{k-\mu}{\sigma}\right)$$

(Note...$Z$ is a standard normal random variable). Now you want to set this equal to $p$ and you will get... $$p=\Phi\left(\frac{k-\mu}{\sigma}\right)$$ $$\Phi^{-1}(p)=\left(\frac{k-\mu}{\sigma}\right)$$

This is a non-linear function of $\alpha$. But you can get a good estimate by first assuming that $n>>\alpha$ which leaves you with quadratic formula...I.e. $\alpha=\frac{-b\pm\sqrt{b^2-4ac}}{2a}$ where $a,b,c$ will be functions of your parameters $n,r,b,p$.

You can check this solution by manually plugging in the $\alpha$ into your exact formula. If it works you should get around $p$ as your answer. Then you might find a small line search is needed.

  • $\begingroup$ @Price of Parse, if you're not seeking an exact formula, this is the best answer. $\endgroup$
    – gunes
    Commented Sep 14, 2018 at 9:10

This is actually Hypergeometric Distribution's CDF. Its closed form will not be as easy as you want, i.e. will include Generalized Hypergeometric Function.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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