5 distinct objects into 4 distinct boxes

combinationscombinatoricspermutations

We want to put 5 objects into 4 distinct boxes numbered from 1 to 4 with some different conditions.

  1. How many ways are possibile if we want that the boxes 3 and 4 are non empty?
  2. How many ways are possible if we want at least one object in each box?

I know that the solutions are 570 and 240 respectively, but I’m not able to reach the result.

Best Answer

For both, apply inclusion-exclusion

For 1) count the number of ways where box 3 or 4 was empty and subtract this away from the total.

There are $4^5$ ways total where we don't care about empty boxes. There are $3^5$ ways where box $3$ was empty. There are $3^5$ ways where box $4$ was empty. There are $2^5$ ways where both boxes were empty.

$$4^5-3^5-3^5+2^5 = 570$$

For 2) similarly approach, and organize the results a bit better to make it cleaner to write:

$$4^5-4\cdot 3^5+6\cdot 2^5 - 4\cdot 1^5 + 1\cdot 0 = 240$$

Alternatively, without inclusion-exclusion, recognize that for each box to get at least one object, with these numbers that directly implies that one of the boxes gets two and each remaining box gets one object.

Choose which two objects were place in which box together, then for each remaining box choose what object was placed in it.

$$\binom{5}{2}\cdot 4! = 240$$

Related Question