# Probability of a probability to happen

I'm trying to solve this problem but I'm struggling to.

A university has 300 students enrolled. You sample 30 students and see that 20 are boys and 10 are girls. If the university had 150 male students and 150 females, what would be the probability of your observation? More generally, if there are N students enrolled in the university, B of which are boys and N − B girls, what is the probability that if you sample n (≤ N), then exactly b are boys and n − b are girls?

So from the sample we know that there are (approximating) 66% boys and 33% girls. But I don't know how to estimate the probability of this observation, what am I missing?

To solve this problem you can use the Hypergeometric distribution. With the variables

• $N$ the population size ($300$)
• $K$ number of success states in the population ($150$)
• $n$ the number of draws ($30$)
• $k$ the number of observed successes (boys, $20$)

Then if $X$ is the number of boys drawn in the sample then

$$P(X = k) = \frac{{K \choose k} {N-K \choose n-k}}{N \choose n}$$

Recall that ${n\choose k} = \frac{n!}{k!(n-k)!}$ is the binomial coefficient.

For your example of drawing $20$ boys in a sample of $30$, we have

$$P(X = 20) = \frac{{150 \choose 20} {300-150 \choose 30-20}}{300 \choose 30} \approx 0.0245$$

The solution with the binomial distribution provided by @Atvin is an estimation of the probability with a large population size ($N\to\infty$).

• In the P(X=20) calculation, you want C(150, 20), not C(300, 20) in the numerator. – ffao Oct 5 '17 at 21:21
• @ffao thanks for the heads up. :) – Therkel Oct 6 '17 at 15:57

If you can pick the same boy (or girl) twice, then this is the correct answer:

This can be solved using the binomial distribution:

You sample $30$ students, and the probability of choosing a boy is $\frac12$. Therefore, you have $Binom(30,\frac12$):

$$\mathbb{P}(X=20)=\binom{30}{20} \frac12^{20} \frac12^{10}=\mathbb{P}(X=10)=\binom{30}{10} \frac12^{10} \frac12^{20}$$

You can see that the result is the same, if you ask for the probability of sampling $10$ girls (right side of the equation), since if you know the numbers from one gender, you will automatically know the numbers from the other gender.

If you can't pick the same boy (or girl) twice, this is the correct answer (with credit to lulu):

$$\frac{\binom{150}{20} \cdot \binom{150}{10}}{\binom{300}{30}}=\frac{\binom{150}{10} \cdot \binom{150}{20}}{\binom{300}{30}}$$

since $\binom{300}{30}$ is the number of all possible samples, and from the $150$ boys, you choose exactly $20$ (or equivalently, from the $150$ girls, you choose exactly $10$).

This is called the hypergeometric distribution.

I will leave the general case for you to work out.

• well something that is not clear from the question is whether the random sample may pick the same boy (or girl) twice, if it is, then your answer is right.. otherwise it needs some modification.. – Yanko Oct 5 '17 at 11:08
• I will wait for the clarification. However, the other case is a lot harder, isn't it? – Atvin Oct 5 '17 at 11:09
• yes I assume it is the first case.. (+1) for the effort, and it is not a lot harder you just have to replace $1/2^{20}$ with something like $15/30\cdot 14/29\cdot...$.. – Yanko Oct 5 '17 at 11:11
• No, it isn't much harder. If you sample without replacement then the probability of getting the observed sample is $\frac {\binom {150}{20}\times \binom {150}{10}}{\binom {300}{30}}$. – lulu Oct 5 '17 at 11:12
• Typo in your edit. the numerator should use $150$ not $30$ as the boys (or girls) are chosen from a group of $150$. Worth noting that, as you'd expect, the two assumptions yield similar answers. $.28$ with replacement and $.25$ without. the latter is lower, of course, because as your sample starts to draw a lot of boys the odds of getting a girl next go up. Similar because $150$ is big enough. – lulu Oct 5 '17 at 11:19