In how many ways can you divide $12$ people in $5$ distinct groups

combinatoricspermutations

Problem:
$12$ students are asked to go into the groups $A$, $B$, $C$, $D$, and $E$. In how many ways can this division be done if there must at least one person per group?

I tried to approach this problem first by going through each possible group size. So for example, there could be group sizes $8, 1, 1, 1, 1$. There are $5$ ways to have this type of division. Then there are $12\cdot11\cdot10\cdot9=\frac{12!}{8!}$ ways of dividing the students into this type of arrangement. So in total, we have $5\cdot\frac{12!}{8!}$ ways to do this.

However, this approach is problematic as it is quite cumbersome and bruteforcey as there are quite a lot of ways to do the group division (how many persons are in each group).

So, is there a more general way of doing/approaching this type of problem?

Best Answer

Apply inclusion - exclusion.

There are $5$ choices for each person, so $5^{12}$ total ways.

Applying inclusion-exclusion,

Total ways - at least one group empty + at least two groups empty -...

$5^{12} - \binom51 4^{12} + \binom52 3^{12} - \binom532^{12} + \binom541^{12}$