How to use nCr(n,k) with unordered sampling with replacement? You go to a bakery to select some baked goods for a dinner party. You need to choose a total of 12 items. The baker has 7 different types of items from which to choose, with lots of each type available. How many different boxfuls of 12 items are possible for you to choose?
The textbook used the formula $nCr(n+k-1, k)$, which is $nCr(7+12-1, 12) = 18564$. But I do not understand how that formula is derived. Any hint?
 A: If you can think of a story which tells you how to make the choice one step at a time, then often this can tell you how to count it too.
Let's see, suppose we have a list of the 7 types of items. We will go up to the first type of item, and we'll ask the baker to give us one of them, and then another, and then another, and so on until at some point we'll ask him to switch to the next type of item. Then we'll ask him for one of those, and then another and so on until we ask him to stop. And then tne next item. And so on. It may be that we'll get to an item and not ask him to give us one of those but simply to move on to the next item. At the end when we have enough of the last item we'll ask him to stop.
So our instructions might look like this:
"one of this item", "one of this item", "switch to next type of item", "one of this item", "one of this item", "switch to next type of item", "switch to next type of item", "one of this item", ..., "one of this item", "stop".
If we can count how many of these lists of instructions there are, this will count how many possible boxfuls there are.
Let's see, we have 12 instructions that say "one of this item", and six of them that say "switch to the next type of item", and one that says "stop". They all end in "stop" so we don't need to consider that. Therefore we have 12+6 = 18 instructions and we need to make sure that 12 of them are "one of this item". The number of ways to choose 12 out of 18 is CHOOSE(18,12).
This type of argument will always work when you have a situation where there are n types of objects and you want k objects in total, as long as you can have as many or as few of each type as you desire. You have k instructions that say "one of this type" and n-1 instructions that say "switch to the next type", so that's k + n-1 in total, with k that have to be "one of this type", so that's CHOOSE(k+n-1,k)
A: Perhaps to easiest way to solve this is to find the number of 'non-negative' solutions of the following equation:

$x_{1}+x_{2}+x_{3}......x_{7}=12$

There are two propositions that are worth remembering:

*

*The number of positive solutions of the equation:
$x_{1}+\dots+x_{r}=n$
$\forall x_{i}>0$
is $\left({n-1\\r-1}\right)$

*The number of 'non-negative' solutions to the equation of the form:
$x_{1}+\dots+x_{r}=n$
$\forall x_{i}\ge0$ is
$\left({n+r-1\\r-1}\right)$
In the question we are required to find the number of 'non-negative' solutions (since we can include $0$); therefore using $(2)$ it follows, that the required answer is:
$\left({12+7-1\\7-1}\right)$
or$\left({18\\6}\right)=18564$
To know more about the proposition visit this website (pg.13 topic number of integer solutions)
