.
A store is selling 7 types of hard candies: cherry, strawberry, orange, pineapple, apricot, blackberry, and lemon.
How many ways are there to choose:
(a) 17 candies?
(b) 17 candies with at least a piece of each flavor?
(c) 17 candies with at least 2 cherry and at least 3 lemon?
~~~~~~~~~~~~~~~~~~~~
In this my post, I will solve parts (a) and (b), ONLY.
(a) In this problem, there are 7 boxes in the store, marked cherry, strawberry, orange, pineapple, apricot, blackberry, and lemon.
We take each kind of candies from the respective box. In this part (a), it is allowed do not take candies from some boxes.
So, we take n= 17 candies from k= 7 boxes according to their names and allowing to skip some boxes.
We want to know in how many different ways it is possible to collect 17 candies doing this way.
Notice that we distinct the candies only by their names. The boxes are different, since they carry different names.
Different collections of 17 selected candies distinct only by the number of identical candies of each kind.
It is a typical problem for "stars and bars" methodology. There is a general formula for the number of distinct selections
of this kind
N = = = = = 100947.
ANSWER. The number of distinct ways to select 17 candies in this problem (part (a) ) is 100947.
(b) This problem is very similar to part (a), but there is one VERY important difference:
+-------------------------------------------------------------+
| We MUST take at least one candy from each of 7 boxes; |
| it is NOT ALLOWED to skip any of boxes. |
+-------------------------------------------------------------+
Again, it is a typical problem for "stars and bars" methodology, but of the different kind.
There is a general formula for the number of distinct selections of this specific kind
N = = = = = 8008.
ANSWER. The number of distinct ways to select 17 candies in this problem (part (b) ) is 8008.
Parts (a) and (b) are completed.
-------------------------
For the stars and bars method see this Wikipedia article
https://en.wikipedia.org/wiki/Stars_and_bars_%28combinatorics%29
See also the lesson
- Stars and bars method for Combinatorics problems
in this site.
Learn the subject from there.