Problem
I want to distribute $n=3$ distinguishable items to $r=3$ distinguishable groups such that
- repetition of items is not allowed
- each group contains one or more items.
Solution
We follow inclusion-exclusion principle which, in turn, takes form of Stirling number of second kind.
- $3^3=27$ ways to distribute $3$ items to $3$ groups such that $3$ groups can contain zero or more items.
- (Subtract) $2^3\times\binom{3}{1}=24$ ways to distribute $3$ items to $2$ groups such that $2$ groups can contain zero or more items (i.e., $1$ group is guaranteed to be empty).
- (Add) $1^3\times \binom{3}{2}=3$ ways to distribute $3$ items to $1$ group such that $1$ group can contain zero or more items (i.e., $2$ groups are guaranteed to be empty).
Final answer $=27-24+3=6$. These six distributions corresponds to following distributions:
| Group 1 | Group 2 | Group 3 |
-------------------------------
| 1 | 2 | 3 |
| 1 | 3 | 2 |
| 2 | 1 | 3 |
| 2 | 3 | 1 |
| 3 | 1 | 2 |
| 3 | 2 | 1 |
Doubt
Though the answer seems to be correct, I am struggling to get to which distributions those components (27,24,3) corresponds to. I fully understand 27 corresponds to all the ways distributions can be done:
| | Group 1 | Group 2 | Group 3 |
|----|---------|---------|---------|
| 1 | 123 | | | 123 in one group
| 2 | | 123 | |
| 3 | | | 123 |
------------------------------------
| 4 | 12 | 3 | | 12 in one group
| 5 | 12 | | 3 |
| 6 | 3 | 12 | |
| 7 | | 12 | 3 |
| 8 | | 3 | 12 |
| 9 | 3 | | 12 |
------------------------------------
| 10 | 23 | 1 | | 23 in one group
| 11 | 23 | | 1 |
| 12 | 1 | 23 | |
| 13 | | 23 | 1 |
| 14 | | 1 | 23 |
| 15 | 1 | | 23 |
------------------------------------
| 16 | 13 | 2 | | 13 in one group
| 17 | 13 | | 2 |
| 18 | 2 | 13 | |
| 19 | | 13 | 2 |
| 20 | | 2 | 13 |
| 21 | 2 | | 13 |
------------------------------------
| 22 | 1 | 2 | 3 | All digits/items in different groups
| 23 | 1 | 3 | 2 |
| 24 | 2 | 1 | 3 |
| 25 | 2 | 3 | 1 |
| 26 | 3 | 1 | 2 |
| 27 | 3 | 2 | 1 |
I am particularly struggling to get what distributions that $24$ corresponds to.
- In solution, I said:
$2^3\times\binom{3}{1}=24$ ways to distribute $3$ items to $2$ groups such that $2$ groups can contain zero or more items (i.e., $1$ group is guaranteed to be empty).
But there are only $21$ distributions (first $21$ in above list) in which $1$ group is guaranteed to be empty.
Q1. Then why there is mismatch between $24$, which we get by formula, and $21$, which we get through example?
I understand this:
$1^3\times \binom{3}{2}=3$ ways to distribute $3$ items to $1$ group such that $1$ group can contain zero or more items (i.e., $2$ groups are guaranteed to be empty)
corresponds to first three groups.
Q2. Can someone explain this to me by telling which distributions correspond to different parts of classic inclusion and exclusion example of circles:
