Stirling Numbers and Partition Functions
Stirling numbers count the ways to partition or arrange sets, bridging factorials, powers, and combinatorics. The Stirling numbers of the first kind count permutations by cycles; the second kind count set partitions into blocks. Together with the Bell numbers and partition function , they form the backbone of enumerative combinatorics. Studied by James Stirling (1730), with deep ties to Euler, Bell, and Hardy–Ramanujan.
A power counts functions; a falling factorial counts injections. Stirling numbers are precisely the change-of-basis coefficients between these two natural polynomial bases. The combinatorial meaning (cycles, blocks) emerges automatically because the algebra of the bases encodes the act of "choosing and grouping." All of Stirling theory is the dictionary between this algebraic fact and its counting shadow.
Formal Statement
(also written ) is the number of ways to partition a set of distinguishable objects into exactly nonempty, unlabeled, disjoint blocks. By convention , for , and for .
Derivation hint: Count functions from to two ways — total functions give ; classify by the image of size , choose the image ( as ) and partition the domain ().
Derivation hint: Inclusion–exclusion on surjections from onto ; the number of surjections is , and we subtract maps missing chosen target elements.
The unsigned Stirling numbers of the first kind count the permutations of elements having exactly disjoint cycles. The signed version provides the inverse change of basis.
Derivation hint: Expand the rising factorial product; the coefficient of collects terms picking the "" factor from of the binomials, and the integer products correspond to cycle-counting via the cycle lemma.
Derivation hint: Replace in [3] and factor out ; matching signs forces .
The Bell number counts all set partitions of regardless of block count:
Derivation hint: First sum is by definition of total partitions; the recurrence classifies partitions by the block containing element , choosing its companions and partitioning the rest.
The partition function counts the unordered ways to write as a sum of positive integers (parts). Order does not matter: gives .
Derivation hint: Each factor chooses how many parts equal ; the product over all enumerates every partition exactly once by its part-multiplicities.
Both Stirling families satisfy Pascal-like recurrences:
Derivation hint: Element either joins one of the existing blocks () or forms a new singleton block ().
Derivation hint: Element either is inserted into one of positions within existing cycles () or starts its own 1-cycle ().
Why It Holds / Derivation
:::proof[Equation [2]: closed form for ] We count surjections in two ways. 1. Direct via partitions. A surjection is determined by a partition of into nonempty blocks (the fibers ) together with a bijection assigning blocks to the labeled targets. Thus the number of surjections equals . 2. Inclusion–exclusion. Let be the set of functions that miss target . The surjections are functions in none of the . Total functions number . By inclusion–exclusion,
since choosing forbidden targets leaves functions into the remaining values. 3. Equate and solve. Setting equal to the inclusion–exclusion sum and dividing by yields [2].
:::proof[Equation [7]: recurrence for ] 1. Take any partition of into blocks. Focus on the element . 2. Case A — is alone. Removing the singleton leaves a partition of into blocks: choices. 3. Case B — shares a block. Removing leaves a partition of into blocks; conversely could have been placed in any of these blocks: choices. 4. The cases are disjoint and exhaustive, giving [7].
A Scottish mathematician educated at Oxford and Venice, Stirling published Methodus Differentialis (1730), the work that introduced these numbers as coefficients in interpolation series. Though best remembered today for Stirling's approximation , his deeper contribution was the systematic study of the finite-difference calculus — the algebra of falling factorials in which his namesake numbers naturally appear. His career was marked by political exile (Jacobite associations) and later work managing Scottish mining operations.
Building Intuition
Think of and as two languages for the same combinatorial reality. The "power" language counts all functions from an -set into an -set — it allows collisions, repetitions, freedom. The "falling factorial" language counts injections — strict, no collisions. To translate "free" into "strict," you must account for collisions, and that bookkeeping is the Stirling number: tells you how many collision-patterns group your inputs into distinct output-classes. For the first kind, picture writing a permutation in cycle notation. Each permutation of decomposes uniquely into cycles, and simply tallies those with loops. The recurrence [8] is the act of "inserting the newest dancer" into a circle dance: either you slot them between two existing dancers (anywhere among the gaps) or you start a brand-new solo circle. For the integer partition , abandon labels entirely — the parts are indistinguishable lumps. This loss of structure is exactly why resists a clean formula while the labeled and have tidy ones.
Worked Examples
Given: How many ways can 5 distinct toys be distributed to 3 distinct children so that every child gets at least one toy?
Steps: 1. This is the number of surjections , which equals . 2. Compute via formula [2]:
3. Evaluate: , , . So 4. Multiply by to label the children: .
Answer:
Given: For , compute (a) the Bell number (set partitions) and (b) the integer-partition count .
Steps (a): Sum the row from the triangle: . So . Check via recurrence [5]: ✓
Steps (b): List partitions of the integer 4 (unlabeled): . That is 5.
Answer:
The dramatic gap — 15 versus 5 — quantifies how much information labels carry.
Common Misconceptions
Set partitions ≠ integer partitions. The Bell number counts ways to partition a labeled set into blocks; the partition function counts ways to break the integer into summands. They answer entirely different questions and grow at different rates ( super-exponentially, sub-exponentially). Confusing them is the single most common error in this topic.
Sign conventions for the first kind differ between texts. Some authors define as the signed Stirling number (used in [4]), others reserve for the unsigned count of permutations by cycles. Always verify which family a formula uses; the relation is , so signs alternate down each row.
" is symmetric like the binomial coefficient." False. Pascal's triangle is symmetric (), but Stirling triangles are not. For instance but — no symmetry. The reason: the recurrence [7] has the asymmetric weight on one term, breaking the left–right balance that produces binomial symmetry.
Connections
Stirling numbers are the hinge between several core areas. The change-of-basis equations [1]–[4] connect them to Finite Difference Calculus, where converts ordinary powers into falling factorials that the difference operator treats like derivatives. Their generating functions tie into Exponential Generating Functions: and . The first-kind numbers relate directly to the cycle structure studied in Symmetric Group and to the Gamma Function through rising factorials. The integer partition function opens into Generating Functions and the deep analytic theory of Modular Forms via Dedekind's eta function.
Real-World Applications
Historical Development
Subtleties & Limits
While and have explicit closed forms, the integer partition function does not — Rademacher's exact formula is an infinite convergent series, not a finite expression. Ramanujan's congruences (, , ) are now understood via modular forms, yet a full classification of all such congruences, and a transparent combinatorial (bijective) explanation of even the mod-5 case, remains an active research frontier. The deep mystery is why a purely additive counting problem should be controlled by the symmetry-rich world of modular forms — a connection still being mined.
See Also
Bell Numbers · Pentagonal Number Theorem · Catalan Numbers · Symmetric Group · Hardy–Ramanujan Asymptotics · Dobinski Formula · Falling and Rising Factorials