[Math] How many ways to choose n distinct objects if you must have at least one of each object.

combinationscombinatoricsdiscrete mathematics

I have a problem where I need to calculate how many different ways there are to select a number of bagels from a bagel shop which has 8 different kinds of bagels. I understand that if I want to calculate how many ways their are to choose for example, 12 bagels, I find:

C(n + k -1, k) or C(8 + 12 – 1, 12)

However, I do not understand how to calculate the number of ways to choose 12 bagels if for example, one must choose at least one of each kind or at least 3 of one kind and no more than 2 of another.

Best Answer

This answer to the balls in boxes problem will be helpful possibly. As long as you know how many total bagels you are choosing, you can use the given formula to calculate the probability of any set of choices.

The different types of bagels the bagel shop offers represent the boxes. Your choices of bagels represent the balls. Say the shop has plain, veggie, and poppy seed ($n=3$ boxes), and you are to buy 5 bagels ($k=5$): 2 plain, 3 veggie. Then $b_0=1$, $b_1=0$, $b_2=1$, $b_3=1$, $a_1=3$, and $a_2=2$ should work with the formula. $$P\left(\{1,0,1,1\}\right)= \frac{\left( \begin{array}{c} 3\\ 1,0,1,1 \end{array} \right) \left( \begin{array}{c} 5\\ 3,2 \end{array} \right)}{3^5}=\frac{3\cdot 2\cdot 5\cdot 2}{3^5}=\frac{20}{3^4}.$$

Related Question