# 100 Cars in a parking lot, k are lemons. We sample m. What's the probability of a lemon?

This is Problem 1.59 from Tsitsiklis, Bertsekas, Introduction to Probability, 2nd edition.

A parking lot contains 100 cars, k of which happen to be lemons. We select m of these cars at random and take them for a test drive. Find the probability that n of the cars tested turn out to be lemons.

I worked towards a solution and got stuck after I draw a series of branches for the different possible selects and didn't show how to express them mathematically.

branches

The solution book says

Clearly if n > m, or n > k, or m − n > 100 − k, the probability must be zero. If n ≤ m, n ≤ k, and m − n ≤ 100 − k, then we can find the probability that the test drive found n of the 100 cars defective by counting the total number of size m subsets, and then the number of size m subsets that contain n lemons. Clearly, there are 100 m different subsets of size m. To count the number of size m subsets with n lemons, we first choose n lemons from the k available lemons, and then choose m − n good cars from the 100 − k available good cars. Thus, the number of ways to choose a subset of size m from 100 cars, and get n lemons is

$${k \choose n} {{100 - k} \choose {m - n}}$$

And the desired probability is

$${ {k \choose n} {{100 - k} \choose {m - n}} \over {100 \choose m}}$$

This answer really doesn't make much sense to me at all.

One possible explanation is that they are treating the solution as a sequence where the first stage is select a lemon and the second stage is select a non-lemon and they are saying that there are $${k \choose n}$$ ways to select a lemon and, with the sequential rule, there are $${100 - k} \choose {m - n}$$ ways to choose a non-lemon and so to get the total we multiply them together.

The problem asks for the probability that $$n$$ cars among $$m$$ chosen cars are lemons.
• $$\binom{k}{n}$$ is the number of ways to choose $$n$$ lemons;
• $$\binom{100-k}{m-n}$$ is the number of ways to choose $$m-n$$ non-lemons.
$$\binom{k}{n}\binom{100-k}{m-n}$$ is the number of ways to choose $$m$$ cars so that $$n$$ of them are lemons.
• $$\binom{100}{m}$$ is the total number of ways to choose $$m$$ cars.