Skip to content

Stirling and Bell numbers

Count partitions of distinct objects into nonempty unlabelled groups, derive the Stirling recurrence, and separate Bell totals from named-group assignments.

Stirling numbers of the second kind count ways to divide nn distinct objects into exactly kk nonempty, unlabelled groups. The Bell number counts all such divisions, allowing any number of groups. They quantify the size of a grouping search space: for example, how many different clusterings of a fixed set of research signals could be considered before any data or clustering criterion is introduced.
The objects retain their identities; the groups have no names or order. Every object belongs to exactly one group. Thus {{A,B},{C,D}}\{\{A,B\},\{C,D\}\} and {{C,D},{A,B}}\{\{C,D\},\{A,B\}\} are the same partition of the set, while {{A,C},{B,D}}\{\{A,C\},\{B,D\}\} is different. Groups may have different sizes. These are the set partitions in NIST's definitions.

See every possibility for four signals

Take four distinct signal labels A,B,C,DA,B,C,D. Count partitions by their number of groups:

Groups kkSecond-kind count S(4,k)S(4,k)What is being counted
11All four labels together
27Four singleton–triple splits and three pair–pair splits
36Choose the one pair; the other two labels are singletons
41Every label on its own
For three groups, the binomial coefficient (42)=6\binom{4}{2}=6 chooses that pair. For two groups, a direct check is to put each label in one of two temporarily named boxes. There are 24=162^4=16 assignments, but two leave a box empty. Removing those and forgetting the box names gives (16−2)/2=7(16-2)/2=7.
All partitions of four distinct labels A, B, C, D, grouped by their number of nonempty unlabelled blocks. The counts for one, two, three and four blocks are 1, 7, 6 and 1, summing to Bell number 15.
All partitions of four distinct labels A, B, C, D, grouped by their number of nonempty unlabelled blocks. The counts for one, two, three and four blocks are 1, 7, 6 and 1, summing to Bell number 15.
Every row is a different grouping. Swapping the order in which its blocks are written does not create another one.
The Bell total adds the counts across all possible group numbers:
Bn=∑k=0nS(n,k),B4=1+7+6+1=15.B_n=\sum_{k=0}^{n}S(n,k),\qquad B_4=1+7+6+1=15.

The empty set has one partition with zero blocks, so S(0,0)=B0=1S(0,0)=B_0=1. For n>0n>0, S(n,0)=0S(n,0)=0; also S(n,k)=0S(n,k)=0 when k>nk>n.

Add one object, rather than list everything

S(n,k)=kS(n−1,k)+S(n−1,k−1),n,k≥1.S(n,k)=kS(n-1,k)+S(n-1,k-1),\qquad n,k\ge1.
Look at the block containing the last object. If that object is alone, remove its singleton block: the remaining objects have k−1k-1 blocks. Otherwise remove just the object: there are still kk blocks, and any one could receive it again. These disjoint cases give the two terms in NIST's recurrence.

For the two-group count above,

S(4,2)=2S(3,2)+S(3,1)=2⋅3+1=7.S(4,2)=2S(3,2)+S(3,1)=2\cdot3+1=7.

This builds a table of exact counts without explicitly constructing every partition.

A change in labels changes the answer

If the groups have distinct names, every unlabelled kk-block partition can be assigned those names in k!k! ways, where !! denotes factorial. Thus there are k!S(n,k)k!S(n,k) assignments to kk named groups when every group must be used. Hulpke's Twelvefold Way discussion makes this distinction explicit.
For the four labels and two named groups, that count is 2!S(4,2)=142!S(4,2)=14. Allowing empty groups instead gives 24=162^4=16. Neither is the unlabelled count of seven. Prescribing particular group sizes imposes another restriction; Counting and Combinatorics develops the multinomial count for named groups with specified sizes. Its public preview is available; the full lesson requires membership.

Counts alone also supply no probability model. Fifteen possible partitions need not be equally likely under a random assignment procedure, and a clustering algorithm does not necessarily search all fifteen or treat them equally.

Two other uses of “Stirling”

Unsigned Stirling numbers of the first kind, often written c(n,k)c(n,k), count permutations with exactly kk cycles. Cyclic arrangement within a block matters there: a set partition records only membership. For example, c(4,2)=11c(4,2)=11, whereas S(4,2)=7S(4,2)=7. A signed convention uses s(n,k)=(−1)n−kc(n,k)s(n,k)=(-1)^{n-k}c(n,k); check the convention before reading a table. NIST defines both kinds together.
Stirling approximation concerns the size of a factorial. It is a separate result from these exact partition counts.

Sources

Last updated
  • combinatorics
  • set partitions
  • stirling numbers
  • bell numbers
  • counting
← Back to the glossaryBack to top ↑