Home › Combinatorics › Lesson 7

Stirling Numbers and Bell Numbers

Lesson 7 of 13

Key idea of this section

xⁿ = ∑ₖ S(n, k) (x)ₖ          x⁽ⁿ⁾ = ∑ₖ c(n, k) xᵏ
Bₙ = ∑ₖ S(n, k) = (1/e) ∑ₘ≥₀ mⁿ/m!

Stirling numbers of the second kind

S(n, k) is the number of partitions of [n] into k nonempty blocks; by convention S(0, 0) = 1 and S(n, 0) = 0 for n ≥ 1. Classifying partitions of [n] according to whether n forms a singleton block gives

S(n, k) = S(n − 1, k − 1) + k S(n − 1, k),

because otherwise n is inserted into one of the k blocks of a partition of [n − 1]. From Lessons 1 and 3 we also have the explicit formula S(n, k) = (1/k!) ∑ⱼ (−1)ʲ C(k, j)(k − j)ⁿ. Row n = 6 is 1, 31, 90, 65, 15, 1, and row n = 7 is 1, 63, 301, 350, 140, 21, 1. Special values: S(n, 2) = 2ⁿ⁻¹ − 1 and S(n, n − 1) = C(n, 2).

Theorem 7.1. For every n ≥ 0, xⁿ = ∑ₖ S(n, k)(x)ₖ as polynomials.

Proof. For a positive integer x, count functions [n] → [x]. Directly there are xⁿ. Alternatively, classify a function by its image: the kernel partition (the nonempty fibres) has some number k of blocks, which may be chosen in S(n, k) ways, and the blocks are then mapped injectively into [x] in (x)ₖ ways. Both sides are polynomials in x agreeing at infinitely many points, so they are equal. ∎

Stirling numbers of the first kind

The unsigned Stirling number c(n, k) is the number of permutations of [n] with exactly k cycles. Inserting n into a permutation of [n − 1], either as a fixed point or immediately after one of the n − 1 elements in its cycle, gives c(n, k) = c(n − 1, k − 1) + (n − 1)c(n − 1, k). Row n = 5 is 24, 50, 35, 10, 1, summing to 5! = 120.

Theorem 7.2. x⁽ⁿ⁾ = x(x + 1)⋯(x + n − 1) = ∑ₖ c(n, k) xᵏ.

Proof. Both sides equal 1 for n = 0, and multiplying by (x + n − 1) reproduces the recurrence for c(n, k): x⁽ⁿ⁾ = x⁽ⁿ⁻¹⁾(x + n − 1) = ∑ₖ [c(n − 1, k − 1) + (n − 1)c(n − 1, k)] xᵏ. ∎

The signed numbers s(n, k) = (−1)ⁿ⁻ᵏ c(n, k) satisfy (x)ₙ = ∑ₖ s(n, k) xᵏ, obtained by replacing x by −x. Since {xⁿ} and {(x)ₙ} are both bases of ℂ[x], Theorems 7.1 and 7.2 say that the infinite lower-triangular matrices [S(n, k)] and [s(n, k)] are mutually inverse: ∑ₖ S(n, k) s(k, m) = [n = m].

Generating functions

Column generating functions follow from the symbolic method: a partition into k blocks is a set of k nonempty sets, so ∑ₙ S(n, k) xⁿ/n! = (eˣ − 1)ᵏ/k!. Ordinarily, iterating the recurrence gives ∑ₙ S(n, k) xⁿ = xᵏ/((1 − x)(1 − 2x)⋯(1 − kx)). For the first kind, ∑ₙ,ₖ c(n, k) uᵏ xⁿ/n! = (1 − x)⁻ᵘ, which is the exponential formula with each cycle weighted by u.

Bell numbers

The Bell number Bₙ = ∑ₖ S(n, k) counts all partitions of [n]: B₀, …, B₁₀ = 1, 1, 2, 5, 15, 52, 203, 877, 4140, 21147, 115975. Classifying a partition of [n + 1] by the block containing n + 1, which consists of n + 1 together with some k of the other elements, gives Bₙ₊₁ = ∑ₖ C(n, k) Bₙ₋ₖ = ∑ₖ C(n, k) Bₖ. The EGF is exp(eˣ − 1).

Theorem 7.3 (Dobinski, 1877). Bₙ = (1/e) ∑ₘ≥₀ mⁿ/m!.

Proof. Let X be a Poisson random variable of mean 1, so Pr(X = m) = e⁻¹/m!. Its factorial moments are E[(X)ₖ] = ∑ₘ (m)ₖ e⁻¹/m! = e⁻¹ ∑ₘ≥ₖ 1/(m − k)! = 1. Taking expectations in Theorem 7.1 gives E[Xⁿ] = ∑ₖ S(n, k) · 1 = Bₙ, and E[Xⁿ] is the stated series. ∎

So Bₙ is the n-th moment of the Poisson(1) distribution. A further arithmetic property is Touchard's congruence Bₚ₊ₙ ≡ Bₙ + Bₙ₊₁ (mod p) for primes p; for example B₅ = 52 ≡ B₀ + B₁ = 2 (mod 5). Asymptotically, log Bₙ = n(log n − log log n − 1 + o(1)), which grows faster than any exponential but slower than n!.

Exercise

  • (a)
    Compute S(7, 3) from the explicit formula.
  • (b)
    Compute c(5, 2) and check that the row c(5, k) sums to 5!.
  • (c)
    Compute B₆ from B₀, …, B₅.
Show solution

Answers: (a) (3⁷ − 3·2⁷ + 3)/6 = (2187 − 384 + 3)/6 = 301. (b) c(5, 2) = c(4, 1) + 4c(4, 2) = 6 + 4·11 = 50, and 24 + 50 + 35 + 10 + 1 = 120. (c) B₆ = 1·1 + 5·1 + 10·2 + 10·5 + 5·15 + 1·52 = 203.

V.3.1