# Combinations Problem - Arranging People in Rooms [duplicate]

This question already has an answer here:

A hostel has four vacant rooms. Each room can accommodate a maximum of four people. In how many different ways can six people be accommodated in four rooms.

The answer is 4020.

My case by case analysis leads to a number in the 7000s:

Listing the rooms as so

4 2 0 0

4 1 0 0

3 3 0 0

3 2 1 0

3 1 1 1

2 2 2 0

2 2 1 1

Now for each of the above case I went (e.g for first case) 6C4 * 2C2 * 0C0 * 0C0 * 4!

## marked as duplicate by Lord Shark the Unknown, Claude Leibovici, Guy Fsone, hardmath, Stefan4024Dec 25 '17 at 21:25

Your calculations for the individual cases aren’t right. For the first case, for instance, there are $\binom64$ ways to choose the $4$ who share a room, and there are $4$ ways to choose their room; the other $2$ will share a room, and there are $3$ ways to choose their room, for a total of $\binom64\cdot4\cdot3=180$ possibilities.
The problem can certainly be solved that way, but there’s a much more efficient way. If the rooms were large enough to accommodate all $6$ people, there would be $4^6$ possible arrangements. However, $4$ of those arrangements have all $6$ in one room, and some have $5$ in one room and $1$ in another; all of those must be subtracted from $4^6=4096$. I leave it to you to count the $\langle5,1,0,0\rangle$ arrangements; the calculation is very much like the one for $\langle 4,2,0,0\rangle$ that I gave above.
• There are 4 possible rooms for each of the 6 persons, for a total of $4^6$ possibilities. – Derek Oct 15 '14 at 0:19