# boxes and stacking them options

If I have 5 different boxes, lets give them a letter A, B, C, D, E and I have to stack them. How many different ways are there to stack them. If I have to use them all it would be 5!, however if I do not have to use them all for a stacking. So A is a solution, B is a solution, etc.

Now to add to this question, if a stacking of AB is the same as stacking as BA what would be the total number of stacking possible?

Hope this is clear. Hope you can help! Thank you :)

I know that for 2 boxes, A and B the result would be: A, B, AB (AB=BA) I know that for 3 boxes, A, B and C the result would be: A, B, C, AB, AC, BC, ABC

Now I don't know how to continue.....

It looks as if the order of stacking does not matter. So line up the boxes in order, and decide for each YES or NO, depending on whether we will use the box or not. There are $2^5$ ways to make the decisions. But one of the decisions we have just counted is the decision to use no boxes. That is presumably not allowed, so the answer to your problem is $2^5-1$.

If order does matter, then we can choose to make a stack of $1$ box, $2$ boxes, $3$ boxes, $4$ boxes, or $5$ boxes.

There are as you observed $5!$ ways to stack $5$ boxes.

If we will use $4$ boxes, the boxes we use can be chosen in $\binom{5}{4}$ ways and then for each such choice they can be stacked in $4!$ ways, for a total of $\binom{5}{4}\cdot 4!$.

Similarly, for $3$ boxes there are $\binom{5}{3}\cdot 3!$ ways to do the job. And so on. Now add up.

• The order of the stacking does not matter in this case. Therefore your answer seems logical. If I understand correctly, if I were to have 500 boxes and wanted to stack them. the equation would be 2^500-1 different ways to place the boxes on top each other. Making sure that my ABC configuration is not also counted as BAC configuration. This isn't counted twice, as I see them as the same. Thank you for your answer. – Oli Oct 17 '12 at 20:06
• Yes, if order does not matter it is $2^n-1$. For your $n=5$ we could also argue (correctly) that the answer is $\binom{5}{1}+\binom{5}{2}+\cdots+\binom{5}{5}$. Of course this sum turns out to be $2^5-1$. – André Nicolas Oct 17 '12 at 20:07
• and this way when I have 500 boxes, I also consider the option of just stacking A being one stack? A AB ABC ............... right up to 500 boxes on top of each other. – Oli Oct 17 '12 at 20:10
• Yes, but it considers $ABD$ as different from $ABC$, so it assumes the boxes are distinct (maybe distinct contents). If we only care about the number of boxes, then the answer is clearly $500$ (one box, two boxes, and so on). That would apply if we are stacking identical bricks. – André Nicolas Oct 17 '12 at 20:14
• no that is exactly what I was looking for. Thank you – Oli Oct 17 '12 at 20:16

This smells like homework. Is it?

$5Cx$ gives the total number of combinations of 5 boxes taken $x$ at a time without caring for order. $$nCx = \dfrac{n!}{(n-x)!x!}$$ (Notice 5C2 = 10)

$5Px$ gives the total number of combinations of 5 boxes taken $x$ at a time but caring for order. $$nPx = \dfrac{n!}{(n-x)!}$$ (Notice 5P2 = 20)

In this case, $$5P2 = 2 \times 5C2$$

Helps?