In the study of paritions, a Stirling number of the second type, \({n \brace k}\), denotes the number of ways to partition a set of \(n\) objects into \(k\) non-empty subsets.

The Stirling numbers of the second type can be calculated with the explicit formula:

Recursive form

The Stirling numbers of the second type can also be expressed in a recursive form:

with initial conditions

To understand this recurrence, observe that a partition of the \(n + \)1 objects into \(k\) nonempty subsets either contains the \({n + 1}^{th}\) object as a singleton or it does not. The number of ways that the singleton is one of the subsets is given by \({n \brace k - 1}\) , since we must partition the remaining \(n\) objects into the available \(k - 1\) subsets.

In the other case the \({n + 1}^{th}\) object belongs to a subset containing other objects. The number of ways is given by \(k {n \brace k}\) , since we partition all objects other than the \({n + 1}^{th}\) into \(k\) subsets, and then we are left with \(k\) choices for inserting object \(n + 1\).

Summing these two values gives the desired result.

Some more recurrences are as follows:

Proof of the explicit form

Following is the a combinatoric proof of the Stirling numbers of the second type:

In the proof, we count the number, \(\mathrm{N}\), of onto functions \(f\) from the set \(S_1 = \{1, 2, \cdots, n\}\) to \(S_2 = \{1, 2, \cdots, k\}\) in two ways.

First count. We will express this in terms of \({n \brace k}\). To do so, we partition \(S_1\) into \(k\) disjoint parts \(P_i\) and let \(f(x) = i\) for all \(x \in P_i\). By definition, this can be done in \({n \brace k}\) ways. Then we permute the \(k\) partitions \(P_i\), which gives us the following result: \(N = k!{n \brace k}\).

Second count. Count the number with the help of the inclusion exclusion principle.

Let \(\mathrm{X}\) be the set of all functions \(f: S_1 \rightarrow S_2\). Then it is clear that \(\lvert \mathrm{X} \lvert = k^n\), since for each of the \(n\) elements in \(S_1\), we have \(k\) choices. Now, for each \(j\) such that \(1 \leq j \leq k_1 \leq j \leq k\), let \(X_j = \{f: S_1 \rightarrow S_2 \text{ such that } f \text{ does not have } j \text{ in its range}\}\).

Since we want to count \(N\), the number of onto functions (that is, functions with all elements of \(S_2\) in their ranges),

By an argument similar to before, we have

and

Finally, by the principle of inclusion exclusion, we have

Equating. With two kinds of expression of \(\mathrm{N}\), we have

which is equivalent to

and with substituting \(j = k - i\), we have