We have 40 people from city A and 60 people from city B. In total we have $N=100$

Now we take a random sample $n=20$. In this sample we got 5 people from city A and 15 people from city B.

But if we calculate the expected value from people which are from city A then we get

$$E[X]=n\cdot\frac{M}{N}$$ $$E[X]=20\cdot\frac{40}{100}=8$$

$M$ are the people from city A

No we want to calculate the probability of the deviation from the expected value


I just searched a little bit in the web and I found the Chebyshev's inequality

$$\mathbb{P}(|X-\mu|\ge\epsilon)\le \frac{\sigma^2}{\epsilon^2}$$

I calculated the variance ${\sigma^2}$ of the hypergeometric distribution



Now we can use this values for the Chebyshev's inequality

$$\mathbb{P}(|X-8|\ge 3)\le \frac{\frac{128}{33}}{3^2}=\frac{128}{297}\approx 0,4309$$

Is my approach correct and are there better ways to get the probability instead of using the Chebyshev's inequality?

  • 1
    $\begingroup$ You might get a better bound by using the fact that $$ \mathbb{P}(|X - \mu| \geq \lambda ) \leq z^{-\lambda}\mathbb{E}[z^{|X-\mu|}], \quad \forall z >1.$$ $\endgroup$ – ChargeShivers Nov 15 '17 at 19:16

This question has an exact answer which is about .2012

enter image description here

You'd then sum this over all integer values of y that meet the criteria. Some computer algebra programs can calculate this directly. Here it is done both ways in Mathematica.


1-Sum[(Binomial[M,y] Binomial[-M+NN,n-y])/Binomial[NN,n],{y,6,10}]/.{n->20,M->40,NN->100}

Try it online!

The closed form solution below appears to be much more complex than the summation.

enter image description here

  • 1
    $\begingroup$ Thank you this helped me a lot. But how do I write this formally correct. This is just some code. $\endgroup$ – Anil Nov 15 '17 at 16:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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