Set Partitions
Set Partitions
FELIX GOTTI
the partition π, and we write |π| = k when π consists of k blocks. In addition, S(n, k)
denotes the number of partitions of [n] having k blocks, and it is called a Stirling
number of the second kind (we will define Stirling numbers of the first kind in coming
lectures).
Let us take a look at some particular cases of the S(n, k). By convention, we assume
that S(0, 0) = 1. Observe that S(n, k) = 0 when k > n. In addition, there is only one
partition of [n] consisting of 1 block (as such a block must be the whole set [n]) and
there is only one partition of [n] consisting of n blocks (as each block is forced to have
size one). Thus, S(n, 1) = S(n, n) = 1.
Example 1. We claim that S(n, 2) = 2n−1 − 1. Indeed, each partition of [n] into
two blocks, namely π := {B1 , B2 }, can be constructed by first choosing the subset B1
in 2n − 2 ways (as B1 cannot be neither empty nor the whose set [n]), which forces
B2 = [n] \ B1 , and then dividing our number of choices, 2n − 2, by 2 to account
for the fact that the order of the blocks inside the partition π is irrelevant. Hence
S(n, 2) = 2n−1 − 1.
Example 2. Let us verify now that S(n, n − 1) = n2 . Indeed, every partition of [n]
into n − 1 blocks must contain exactly one block of size 2, which completely determines
the rest of the blocks, namely the remaining n − 2 blocks of size 1. Therefore the set
of partitions of [n] into two blocks is in bijection with the set of subsets of [n] of size 2.
Hence S(n, n − 1) = n2 .
We can compute the number S(n, k) recursively, as the following theorem indicates.
Proof. By the definition of the Stirling numbers of the second kind, the left-hand side
of (0.1) counts the set of partitions of [n] into k blocks. We will count the same set by
splitting it into two types of partitions: the partitions where n is itself a block and the
partitions where the block containing n has size at least two. To count the partitions
where n is a block by itself, we can take n out, choose a partition of [n − 1] into k − 1
blocks in S(n − 1, k − 1) ways, and enlarge the chosen partition to obtain a partition
of [n] into k blocks by adding {n} as the n-th block. To count the partitions where the
block containing n has size at least two, choose a partition of [n − 1] into k blocks in
S(n − 1, k) different ways, and for each of such choices create a partition of [n] into k
blocks in k different ways by placing n inside one of the k blocks. Putting all together,
we see that the number of partitions of [n] into k blocks is S(n − 1, k − 1) + kS(n − 1, k),
the right-hand side of (0.1).
We can express the number of surjective functions between finite sets in terms of the
Stirling numbers of the second kind.
Proposition 4. For every n, k ∈ N, the number of surjective functions f : [n] → [k] is
S(n, k)k!.
Proof. To count the surjective functions f : [n] → [k], we can first fix a partition
π = {B1 , . . . , Bk } of [n] into k blocks in S(n, k) ways, then make a linear arrangement
w1 w2 · · · wk with the elements of [k] in k! ways, and then set f −1 (wi ) = Bi . Hence
there are S(n, k)k! surjective functions f : [n] → [k].
Stirling numbers of the second kind satisfy the following polynomial identity.
Proposition 5. For every n ∈ N, the following polynomial identity holds:
X n
n
(0.2) x = S(n, k)(x)k ,
k=0
Proof. By the definition of a Bell number, the left-hand side of (0.3) counts the set of
partitions of [n + 1]. We can count the same set as follows. For each s ∈ J1, n + 1K,
we can count the partitions of [n + 1] where the block B containing {n + 1} has size s:
n
first choose in s−1 ways the elements in B that are different from n + 1, then create
a partition of [n + 1] \ B in B(n + 1 − s) ways. Therefore
n+1 n n
X n X n X n
B(n + 1) = B(n + 1 − s) = B(j) = B(j).
s=1
s − 1 j=0
n − j j=0
j
Practice Exercises
Exercise 1. For n ∈ N with n ≥ 3, find a formula for S(n, 3).
n n
Exercise 2. Prove that S(n, n − 2) = 3
+3 4
for every n ∈ N with n ≥ 2.
Exercise 3. Argue combinatorially that the number of partitions of [n] with no two
consecutive numbers in any block is B(n − 1).
References
[1] M. Bóna: A Walk Through Combinatorics: An Introduction to Enumeration and Graph Theory
(Fourth Edition), World Scientific, New Jersey, 2017.