Probability and cookies

6.5k Views Asked by At

If a bakery makes four different types of cookies (chocolate, peanut butter, ginger snaps and oatmeal).

How many different bags of 12 cookies can the bakery offer ?

This is a combinations with repetitions problem so we have the formula $${n + r -1 \choose r}$$ and here we have $n = 4, r = 12$ and so we have $${4 + 12 - 1 \choose 12} = {15 \choose 12}$$ different bags of 12 cookies.

Now What is the probability that a random bag of those 12 cookies will contain at least one of each type of cookie?

Now we need to subtract the number of bags that do not contain all the different types of cookies from ${15 \choose 12}$

Now how many ways can a bag do not contain all types of cookies ?

It can contain the first three types and exclude the last one, which I think is ${3 + 12 - 1 \choose 12} = {14 \choose 12}$

There are also ${4 \choose 3}$ number of ways to select those three types and so we multiply $${4 \choose 3}{14 \choose 12}$$

Now we do the same thing for a bag that contains two different types of cookies to get $${4 \choose 2}{13 \choose 12}$$

And now the last thing is the bags that contain only one type of cookies which is $${4 \choose 1}{12 \choose 12}$$

Now the probability should be equal to $$\frac{{15 \choose 12} - \big({4 \choose 3}{14 \choose 12}+ {4 \choose 2}{13 \choose 12} + {4 \choose 1}{12 \choose 12} \big)}{15 \choose 12}$$

Is that logical and correct reasoning ?

2

There are 2 best solutions below

6
On BEST ANSWER

No, this reasoning is not correct. You're subtracting some of the possibilities multiples times. Check out inclusion-exclusion. To count each possibility exactly once, you need alternating signs:

$$ \binom{15}{12}-\binom43\binom{14}{12}+\binom42\binom{13}{12}-\binom41\binom{12}{12}=165\;. $$

But there's also a much simpler approach: The types of $4$ cookies are already given (one of each), so we now only have $8$ cookie types to choose, yielding

$$ \binom{4+8-1}8=\binom{11}8=165 $$

possibilities.

0
On

The question seems ill-posed. What is meant by a "random bag"? In other words, by what process are the $12$ cookies chosen? We can imagine the bakery has a big box containing all four types of cookie, and that $12$ cookies are selected at random from the box. But the answer will depend on how many cookies of each type are in the box.

If we suppose that the box contains equal numbers of each type of cookie, and that the total number of cookies in the box is extremely large, so that depletion of one type when a cookie of that type is selected can be neglected, then the probability is $$ \frac{4^{12}-\binom{4}{3}3^{12}+\binom{4}{2}2^{12}-\binom{4}{1}1^{12}}{4^{12}}=\frac{4!\left\{ {12 \atop 4}\right\}}{4^{12}}\approx0.87. $$ Here $\left\{ {12 \atop 4}\right\}$ is a Stirling number of the second kind.

In your approach to the problem, you are assuming that all compositions of a bag are equally likely, which does not seem to me a very natural thing to assume. With joriki's result, this assumption produces the probability $165/455\approx0.36,$ a much lower value than the one the box model gives.