# Number of Set Partitions by Number of Components

## Contents

## Theorem

Let $S$ be a (finite) set whose cardinality is $n$.

Let $\map f {n, k}$ denote the number of different ways $S$ can be partitioned into $k$ components.

Then:

- $\displaystyle \map f {n, k} = {n \brace k}$

where $\displaystyle {n \brace k}$ denotes a Stirling number of the second kind.

## Proof

The proof proceeds by induction on $n$.

For all $n \in \Z_{\ge 0}$, let $\map P n$ be the proposition:

- $\displaystyle \map f {n, k} = {n \brace k}$

$\map P 0$ is the degenerate case:

- $\displaystyle \map f {0, k} = \delta_{0 k} = {0 \brace k}$

That is: the empty set can be partitioned one and only one way: into $0$ subsets.

Thus $\map P 0$ is seen to hold.

The remainder of the proof considers $n \in \Z_{> 0}$.

First we note that when $k < 1$ or $k > n$:

- $\displaystyle \map f {n, k} = 0 = {n \brace k}$

Hence, throughout, we consider only such $k$ as $1 \le k \le n$.

We define the representative set of cardinality $n$ to be:

- $S_n := \set {1, 2, \ldots, n}$

### Basis for the Induction

$\map P 1$ is the case $\map f {1, 1}$.

There is exactly one way to partition $\set 1$, and that is:

- $\set {\set 1}$

From Stirling Number of the Second Kind of Number with Self:

- $\displaystyle {1 \brace 1} = 1$

Thus $\map P 1$ is seen to hold.

This is the basis for the induction.

### Induction Hypothesis

Now it needs to be shown that, if $\map P m$ is true, where $m \ge 1$, then it logically follows that $\map P {m + 1}$ is true.

So this is the induction hypothesis:

- $\displaystyle \map f {m, k} = {m \brace k}$

from which it is to be shown that:

- $\displaystyle \map f {m + 1, k} = {m + 1 \brace k}$

### Induction Step

This is the induction step:

By definition, the number of partitions of $S_m$ into $k$ subsets is $\map f {m, k}$.

A partition of $S_{m + 1}$ can be generated by adding element $m + 1$ into one of the existing partitions of $S_m$.

There are two ways this can be done:

- $(1): \quad$ The subset $\set {m + 1}$ may be added, in one way, to one of the partitions of $S_m$ into $k - 1$ subsets.

- $(2): \quad$ The element $m + 1$ may be added to any one of the $k$ subsets in one of the partitions of $S_m$ into $k$ subsets.

Option $(1)$ gives $1$ partition of $S_{m + 1}$ for each partition of $S_m$ into $k - 1$ subsets, that is: $\map f {m, k - 1}$.

Option $(2)$ gives $k$ partitions of $S_{m + 1}$ for each partition of $S_m$ into $k$ subsets, that is: $k \map f {m, k}$.

Thus:

- $\map f {m + 1, k} = k \map f {m, k} + \map f {m, k - 1}$

By the induction hypothesis:

- $\displaystyle \map f {m + 1, k} = k {m \brace k} + {m \brace k - 1}$

So by definition of Stirling numbers of the second kind:

- $\displaystyle \map f {m + 1, k} = {m + 1 \brace k}$

So $\map P m \implies \map P {m + 1}$ and the result follows by the Principle of Mathematical Induction.

Therefore:

- $\displaystyle \forall n, k \in \Z_{\ge 0}: \map f {n, k} = {n \brace k}$

$\blacksquare$

## Examples

### $4$-Sets into $2$ Subsets

A set with $4$ elements $\set {1, 2, 3, 4}$ can be partitioned into $2$ subsets in $\displaystyle {4 \brace 2} = 7$ ways:

Let $T$ be the set with $3$ elements $\set {1, 2, 3}$.

The partition of $T$ into $1$ set is:

- $\set {1, 2, 3}$

to which $\set 4$ can be added in one way to achieve:

- $\set {1, 2, 3 \mid 4}$

The partitions of $T$ into $2$ sets are:

- $\set {1, 2 \mid 3}$
- $\set {1, 3 \mid 2}$
- $\set {2, 3 \mid 1}$

to which the element $4$ can be added in $2$ ways each:

- $\set {1, 2, 4 \mid 3}$
- $\set {1, 2 \mid 3, 4}$

- $\set {1, 3, 4 \mid 2}$
- $\set {1, 3 \mid 2, 4}$

- $\set {2, 3, 4 \mid 1}$
- $\set {2, 3 \mid 1, 4}$

Thus we have a total of $7$ ways of partitioning a $4$-element set into $2$ components.

## Sources

- 1997: Donald E. Knuth:
*The Art of Computer Programming: Volume 1: Fundamental Algorithms*(3rd ed.) ... (previous) ... (next): $\S 1.2.6$: Binomial Coefficients: Exercise $64$