Stirling Numbers of the First Kind

How many ways can you arrange nn people around several identical campfires? Assume you use all fires, with a fixed number of them. This question counts permutations by how many cycles they decompose into. It is answered exactly by the Stirling numbers of the first kind. They are the natural "structure constants" for a key translation. They convert between the ordinary powers xnx^n used in generating functions and the falling/rising factorials xn‾,xn‾x^{\underline{n}}, x^{\overline{n}} used to encode permutation structure. This mirrors how the Stirling Numbers of the Second Kind translate between powers and binomial-coefficient-type sums for set partitions. These numbers matter because permutations are not just bijections. They carry a canonical decomposition into disjoint cycles. Cycle type is a complete invariant under conjugation in the symmetric group. Counting permutations by number of cycles therefore touches representation theory and random permutation statistics. It also touches the analysis of algorithms (cycle sort, record statistics, hashing), and the theory of finite differences. The Stirling numbers of the first kind are precisely the coefficients that arise in a key expansion. They appear when you expand a falling factorial in the monomial basis. Dually, they appear when you expand ordinary powers in terms of rising factorials. The big picture is a duality. Stirling numbers of the second kind, S(n,k)S(n,k), count set partitions into kk blocks. They convert powers into falling factorials. Stirling numbers of the first kind, s(n,k)s(n,k) (signed) or c(n,k)=∣s(n,k)∣c(n,k) = |s(n,k)| (unsigned), count permutations by cycles. They convert falling factorials back into powers. The two families are matrix inverses of each other. This fact is itself a theorem worth stating precisely below. This article gives the rigorous definition of both the signed and unsigned versions. It proves the central combinatorial identity connecting them to falling factorials. It also proves the recurrence and the inverse relationship with Stirling numbers of the second kind. It then works through two nontrivial numerical examples. It closes by placing these numbers in the broader landscape of enumeration. This foreshadows The Twelvefold Way, where permutations, set partitions, and functions are unified into a single counting framework.

Key takeaways
  • c(n,k)c(n,k) (unsigned Stirling number of the first kind) counts permutations of nn elements having exactly kk cycles.
  • The signed version is s(n,k)=(−1)n−kc(n,k)s(n,k) = (-1)^{n-k} c(n,k), chosen so that xn‾=∑ks(n,k)xkx^{\underline{n}} = \sum_k s(n,k) x^k.
  • Recurrence: c(n,k)=c(n−1,k−1)+(n−1) c(n−1,k)c(n,k) = c(n-1,k-1) + (n-1)\,c(n-1,k), mirroring but dual to the Stirling Numbers of the Second Kind recurrence.
  • Row sums: ∑kc(n,k)=n!\sum_k c(n,k) = n!, since every permutation has some number of cycles.
  • The matrices [s(n,k)][s(n,k)] and [S(n,k)][S(n,k)] (signed Stirling of the second kind, appropriately signed) are inverse to one another — the algebraic heart of the falling-factorial/power-basis change of basis.
  • Key idea: Stirling numbers of the first kind are the change-of-basis coefficients between ordinary powers xnx^n and falling factorials xn‾x^{\underline{n}}, and simultaneously the exact count of permutations with a prescribed number of cycles.

Where this lives today

Stirling numbers of the first kind appear whenever a discrete structure's cycle statistics matter. In the analysis of algorithms, the expected number of cycles in a uniformly random permutation of [n][n] is ∑k=1nk c(n,k)/n!=Hn\sum_{k=1}^n k\, c(n,k)/n! = H_n (the nn-th harmonic number), a fact used in analyzing in-place cycle-sort, random shuffles, and the "cycle lemma" arguments for hashing and load-balancing schemes. In random permutation theory and probability, the distribution of the number of cycles in a random permutation (the Ewens sampling formula's uniform special case) is governed exactly by c(n,k)/n!c(n,k)/n!, connecting to population genetics models and to the Chinese restaurant process, where new "customers" join existing cycles or start new ones with probabilities mirroring the recurrence (∗)(\ast). In algebra and representation theory, the cycle type of a permutation determines its conjugacy class in SnS_n, and c(n,k)c(n,k) enumerates one natural cross-section (all permutations with a fixed number of cycles, summed over all cycle-type partitions with that many parts) used in character theory computations and in the cycle-index polynomial Z(Sn)Z(S_n) that underlies The Twelvefold Way and Pólya enumeration of colorings up to symmetry. In numerical and symbolic computation, the falling/rising factorial identity is the standard tool for converting finite-difference formulas (built from xn‾x^{\underline n}) into ordinary polynomial form, and vice versa, used in numerical interpolation (Newton's forward/backward difference formulas) and in symbolic summation algorithms (Gosper's algorithm and its descendants) that manipulate hypergeometric-type sums built from factorial ratios. In combinatorics on words and cryptographic permutation analysis, cycle-length statistics of permutations generated by block ciphers or pseudo-random permutation constructions are evaluated using exactly these numbers to estimate periods and mixing behavior.

:::quiz[Which matrix relationship connects [s(n,k)][s(n,k)] and Stirling numbers of the second kind [S(n,k)][S(n,k)]?]

  • They are equal matrices
  • They are transposes of each other
  • They are inverse matrices ✓
  • One is the square of the other

Ask the tutor: How does Foata's fundamental bijection turn cycle-counting into record-counting, and why does that make Stirling numbers of the first kind show up in the study of random permutation statistics?

DefinitionStirling numbers of the first kind

Let n≥0n \ge 0 be an integer. The falling factorial is

xn‾=x(x−1)(x−2)⋯(x−n+1),x0‾=1.x^{\underline{n}} = x(x-1)(x-2)\cdots(x-n+1), \qquad x^{\underline{0}} = 1.

The signed Stirling numbers of the first kind s(n,k)s(n,k), defined for 0≤k≤n0 \le k \le n, are the unique integers satisfying

xn‾=∑k=0ns(n,k) xk.x^{\underline{n}} = \sum_{k=0}^{n} s(n,k)\, x^k .

The unsigned Stirling numbers of the first kind are

c(n,k):=∣s(n,k)∣=(−1)n−ks(n,k).c(n,k) := |s(n,k)| = (-1)^{n-k} s(n,k).

Combinatorially, for n≥1n \ge 1 and 1≤k≤n1 \le k \le n,

c(n,k)=#{ π∈Sn:π has exactly k disjoint cycles (including fixed points) },c(n,k) = \#\{\, \pi \in S_n : \pi \text{ has exactly } k \text{ disjoint cycles (including fixed points)} \,\},

where SnS_n is the symmetric group on {1,…,n}\{1,\dots,n\} and every element is written as a product of disjoint cycles in the usual way. Boundary values: c(0,0)=1c(0,0)=1, c(n,0)=0c(n,0) = 0 for n≥1n \ge 1, and c(n,k)=0c(n,k) = 0 for k>nk > n or k<0k<0.

Intuition

Think of nn labeled people who must be split into groups and each group seated around its own circular table (a "cycle"). Two circular seatings are the same arrangement if one is a rotation of the other, but different tables are distinguishable only by who sits at them, not by any table label — the partition of people into tables together with the circular order at each table is exactly the data of a permutation's cycle decomposition. The number of ways to seat nn people at exactly kk (unlabeled, but nonempty and mutually distinguishable by membership) round tables is c(n,k)c(n,k). The algebraic side of the story is a change of basis. The vector space of polynomials in xx of degree ≤n\le n has (at least) two natural bases: the monomials 1,x,x2,…,xn1, x, x^2, \dots, x^n, and the falling factorials 1,x1‾,x2‾,…,xn‾1, x^{\underline 1}, x^{\underline 2}, \dots, x^{\underline n}. Passing from falling factorials to monomials uses the s(n,k)s(n,k); passing back uses the Stirling numbers of the second kind S(n,k)S(n,k). This is a genuinely dual picture to counting set partitions, and the picture below shows both the cycle-counting side and the triangular array side simultaneously.

Figure
Left: a permutation of {1,…,7}\{1,\dots,7\} drawn as its cycle decomposition (3 cycles). Right: the triangle of unsigned c(n,k)c(n,k) for n=0,…,5n=0,\dots,5.
Permutation (1 3 5)(2 7)(4 6) ∈ S₃, k=3 cycles 1 3 5 2 7 4 6 c(n,k) triangle, n=0..5 n=0: 1 n=1: 0 1 n=2: 0 1 1 n=3: 0 2 3 1 n=4: 0 6 11 6 1 n=5: 0 24 50 35 10 1 row sum of n=5 row: 24+50+35+10+1 = 120 = 5!

Central theorems

TheoremFalling factorial expansion and cycle-counting formula

Let n≥1n \ge 1 be an integer. Then the following two statements hold and are equivalent formulations of the same combinatorial fact.

(A) Algebraic form. As polynomials in xx,

xn‾=x(x−1)(x−2)⋯(x−n+1)=∑k=0ns(n,k) xk,x^{\underline{n}} = x(x-1)(x-2)\cdots(x-n+1) = \sum_{k=0}^n s(n,k)\, x^k,

where s(n,k)∈Zs(n,k) \in \mathbb{Z} are uniquely determined, s(n,k)=0s(n,k)=0 for k>nk>n or k<0k<0, and sign⁡(s(n,k))=(−1)n−k\operatorname{sign}(s(n,k)) = (-1)^{n-k} whenever s(n,k)≠0s(n,k)\neq 0.

(B) Combinatorial form. For 1≤k≤n1 \le k \le n, the unsigned value c(n,k)=(−1)n−ks(n,k)c(n,k) = (-1)^{n-k}s(n,k) equals the number of permutations of {1,…,n}\{1,\dots,n\} whose disjoint cycle decomposition (fixed points counted as 11-cycles) has exactly kk cycles.

Proof

We prove (B) directly by a combinatorial recurrence, then derive (A) from (B) via generating-function bookkeeping, and finally verify uniqueness and the sign pattern. The technique is combinatorial recurrence with a bijective insertion argument, followed by an induction on nn to match the algebraic recursion for xn‾x^{\underline n}.

Step 1: A recurrence for c(n,k)c(n,k). Define c(n,k)c(n,k) for n≥1n\ge 1, 1≤k≤n1\le k\le n as the number of permutations of [n]:={1,…,n}[n]:=\{1,\dots,n\} with exactly kk cycles, and set c(0,0)=1c(0,0)=1, c(n,0)=0c(n,0)=0 for n≥1n\ge1, c(n,k)=0c(n,k)=0 if k>nk>n or k<0k<0. We claim that for n≥2n \ge 2 and 1≤k≤n1\le k\le n,

c(n,k)=c(n−1,k−1)+(n−1) c(n−1,k).(∗)c(n,k) = c(n-1,k-1) + (n-1)\,c(n-1,k). \tag{$\ast$}

Proof of (∗)(\ast). Consider a permutation π\pi of [n][n] with exactly kk cycles, and look at where element nn sits.

  • Case 1: nn is a fixed point, i.e. π\pi contains the 11-cycle (n)(n). Deleting nn leaves a permutation of [n−1][n-1] with exactly k−1k-1 cycles (we removed exactly one cycle, the singleton). This correspondence is a bijection between permutations of [n][n] with exactly kk cycles fixing nn, and permutations of [n−1][n-1] with exactly k−1k-1 cycles: given any permutation of [n−1][n-1] with k−1k-1 cycles, adjoin the fixed point nn to get a permutation of [n][n] with kk cycles fixing nn, and these two maps are mutually inverse. Hence there are exactly c(n−1,k−1)c(n-1,k-1) such permutations.
  • Case 2: nn is not a fixed point. Then in the cycle containing nn, say nn appears as (… a n b … )(\dots\, a \, n \, b \,\dots) for some aa (the element that maps to nn) — equivalently, nn occupies one of the "slots" immediately following some element a∈[n−1]a \in [n-1] in the cyclic order. Deleting nn from its cycle (and reconnecting aa directly to bb, i.e. replacing a→n→ba\to n \to b by a→ba \to b) yields a permutation π′\pi' of [n−1][n-1] with the same number of cycles kk, since we only shortened one cycle without splitting or merging it (if the cycle containing nn had length ≥2\ge 2, removing nn leaves a cycle of length ≥1\ge 1, not zero, because nn is not the only element of its cycle in this case). Conversely, given any permutation π′\pi' of [n−1][n-1] with kk cycles, we may insert nn immediately after any of the n−1n-1 elements a∈[n−1]a \in [n-1] (in the cyclic reading of π′\pi''s cycle structure), producing a permutation of [n][n] with kk cycles in which nn is not a fixed point. These two constructions (deletion of nn; insertion of nn after a chosen element) are mutually inverse bijections between {permutations of [n][n], kk cycles, nn not fixed} and {permutations of [n−1][n-1] with kk cycles} ×\times {choice of a∈[n−1]a \in [n-1]}. Hence there are exactly (n−1) c(n−1,k)(n-1)\, c(n-1,k) such permutations.

Since Case 1 and Case 2 partition all permutations of [n][n] with kk cycles, adding gives (∗)(\ast). ■\blacksquare (Step 1)

Step 2: The falling factorial satisfies the same recurrence, via its coefficients. Write pn(x):=xn‾p_n(x) := x^{\underline n}. Then pn(x)=pn−1(x) (x−n+1)p_n(x) = p_{n-1}(x)\,(x-n+1) for n≥1n\ge 1, with p0(x)=1p_0(x)=1. Suppose inductively that

pn−1(x)=∑ka(n−1,k) xkp_{n-1}(x) = \sum_k a(n-1,k)\,x^k

for some integers a(n−1,k)a(n-1,k) (with a(n−1,k)=0a(n-1,k)=0 outside 0≤k≤n−10\le k\le n-1). Then

pn(x)=(x−(n−1))∑ka(n−1,k)xk=∑ka(n−1,k)xk+1−(n−1)∑ka(n−1,k)xk.p_n(x) = (x-(n-1))\sum_k a(n-1,k) x^k = \sum_k a(n-1,k) x^{k+1} - (n-1)\sum_k a(n-1,k) x^k.

Re-indexing the first sum (k→k−1k \to k-1) and combining coefficients of xkx^k gives

a(n,k)=a(n−1,k−1)−(n−1) a(n−1,k).(∗∗)a(n,k) = a(n-1,k-1) - (n-1)\, a(n-1,k). \tag{$\ast\ast$}

This is a well-defined recursion determining all a(n,k)a(n,k) from a(0,0)=1a(0,0)=1 (since p0(x)=1=x0p_0(x)=1=x^0), by induction on nn; it uniquely determines the integers a(n,k)=s(n,k)a(n,k) = s(n,k) appearing in the statement, because the monomials xkx^k are linearly independent, so the coefficients of any polynomial in the power basis are unique. This proves uniqueness of s(n,k)s(n,k) in (A), and gives an explicit recursive algorithm computing them.

Step 3: Matching signs, c(n,k):=(−1)n−ks(n,k)c(n,k) := (-1)^{n-k} s(n,k) satisfies (∗)(\ast). Substitute s(n,k)=(−1)n−kc(n,k)s(n,k) = (-1)^{n-k} c(n,k) into (∗∗)(\ast\ast):

(−1)n−kc(n,k)=(−1)(n−1)−(k−1)c(n−1,k−1)−(n−1)(−1)(n−1)−kc(n−1,k).(-1)^{n-k} c(n,k) = (-1)^{(n-1)-(k-1)} c(n-1,k-1) - (n-1)(-1)^{(n-1)-k} c(n-1,k).

Now (−1)(n−1)−(k−1)=(−1)n−k(-1)^{(n-1)-(k-1)} = (-1)^{n-k} and (−1)(n−1)−k=−(−1)n−k(-1)^{(n-1)-k} = -(-1)^{n-k}. Substituting:

(−1)n−kc(n,k)=(−1)n−kc(n−1,k−1)+(n−1)(−1)n−kc(n−1,k).(-1)^{n-k} c(n,k) = (-1)^{n-k} c(n-1,k-1) + (n-1)(-1)^{n-k} c(n-1,k).

Dividing both sides by (−1)n−k(-1)^{n-k} (nonzero) gives exactly

c(n,k)=c(n−1,k−1)+(n−1) c(n−1,k),c(n,k) = c(n-1,k-1) + (n-1)\,c(n-1,k),

which is (∗)(\ast). Since the two sequences (c(n,k))combinatorial\big(c(n,k)\big)_{\text{combinatorial}} from Step 1 and (c(n,k))algebraic:=(−1)n−ks(n,k)\big(c(n,k)\big)_{\text{algebraic}} := (-1)^{n-k}s(n,k) from Step 2–3 satisfy the same recurrence (∗)(\ast) and the same boundary conditions (c(0,0)=1c(0,0)=1; c(n,0)=0,n≥1c(n,0)=0, n\ge1; c(n,k)=0c(n,k)=0 for k<0k<0 or k>nk>n — the algebraic side's boundary conditions follow since p0(x)=x0p_0(x)=x^0 forces s(0,0)=1s(0,0)=1 and pn(x)p_n(x) has degree exactly nn with no constant-in-x0x^0... more precisely s(n,0)s(n,0) is the value of pnp_n at x=0x=0 up to the constant term, and pn(0)=0p_n(0)=0 for n≥1n\ge1 since one factor of xn‾x^{\underline n} is xx itself, forcing s(n,0)=0s(n,0)=0), induction on nn shows they agree for all n,kn,k. This proves (B), and simultaneously confirms the sign claim sign⁡(s(n,k))=(−1)n−k\operatorname{sign}(s(n,k))=(-1)^{n-k} in (A) whenever c(n,k)=∣s(n,k)∣≠0c(n,k) = |s(n,k)| \neq 0, since c(n,k)≥0c(n,k) \ge 0 always (it's a cardinality) and s(n,k)=(−1)n−kc(n,k)s(n,k) = (-1)^{n-k}c(n,k).

Step 4: Conclusion. Combining Steps 1–3: the unique integer coefficients s(n,k)s(n,k) of xn‾x^{\underline n} in the monomial basis satisfy s(n,k)=(−1)n−kc(n,k)s(n,k) = (-1)^{n-k}c(n,k) where c(n,k)c(n,k) is exactly the number of permutations of [n][n] with kk cycles. This establishes both (A) and (B), and their equivalence. ■\blacksquare

∎
CorollaryRow sum identity

For every n≥1n \ge 1,

∑k=0nc(n,k)=n!.\sum_{k=0}^n c(n,k) = n!.
Proof

By Theorem (B), c(n,k)c(n,k) counts permutations of [n][n] with exactly kk cycles. Every permutation has a well-defined number of cycles between 11 and nn (a permutation of a nonempty finite set always decomposes into at least one and at most nn disjoint cycles, since the cycle decomposition partitions [n][n] into nonempty blocks each of which is a single cycle). Summing the count over all possible values of kk therefore counts every permutation of [n][n] exactly once, giving ∑kc(n,k)=∣Sn∣=n!\sum_k c(n,k) = |S_n| = n!. Equivalently, algebraically, setting x=1x=1 in xn‾=∑ks(n,k)xkx^{\underline n} = \sum_k s(n,k)x^k and using s(n,k)=(−1)n−kc(n,k)s(n,k)=(-1)^{n-k}c(n,k) gives 1n‾=1⋅0⋅(−1)⋯1^{\underline n} = 1\cdot 0 \cdot(-1)\cdots which is 00 for n≥2n \ge 2 — so instead evaluate the unsigned version at x=1x=1: from the rising factorial identity xn‾=∑kc(n,k)xkx^{\overline n} = \sum_k c(n,k) x^k (proved in the theorem below), setting x=1x=1 gives 1n‾=n!=∑kc(n,k)1^{\overline n} = n! = \sum_k c(n,k), matching the combinatorial count. ■\blacksquare

∎
TheoremRising factorial form and matrix inversion with Stirling numbers of the second kind

Let xn‾:=x(x+1)(x+2)⋯(x+n−1)x^{\overline n} := x(x+1)(x+2)\cdots(x+n-1) denote the rising factorial, x0‾=1x^{\overline 0}=1. Then for all n≥0n \ge 0,

xn‾=∑k=0nc(n,k) xk.(C)x^{\overline n} = \sum_{k=0}^n c(n,k)\, x^k. \tag{C}

Moreover, let S(n,k)S(n,k) denote the Stirling numbers of the second kind (number of partitions of [n][n] into kk nonempty blocks), and form the (N+1)×(N+1)(N+1)\times(N+1) lower-triangular matrices A=[s(n,k)]0≤n,k≤NA = [s(n,k)]_{0\le n,k\le N} and B=[S(n,k)]0≤n,k≤NB = [S(n,k)]_{0\le n,k \le N}. Then

AB=BA=I,A B = B A = I,

i.e. A=B−1A = B^{-1}: the signed Stirling numbers of the first kind and the Stirling numbers of the second kind are inverse matrices.

Proof

Part 1: Rising factorial identity (C). Note xn‾=(−1)n(−x)n‾x^{\overline n} = (-1)^n (-x)^{\underline n}, because

(−x)n‾=(−x)(−x−1)(−x−2)⋯(−x−n+1)=(−1)n x(x+1)(x+2)⋯(x+n−1)=(−1)nxn‾.(-x)^{\underline n} = (-x)(-x-1)(-x-2)\cdots(-x-n+1) = (-1)^n\, x(x+1)(x+2)\cdots(x+n-1) = (-1)^n x^{\overline n}.

By the main theorem applied with x↦−xx \mapsto -x,

(−x)n‾=∑k=0ns(n,k)(−x)k=∑k=0ns(n,k)(−1)kxk.(-x)^{\underline n} = \sum_{k=0}^n s(n,k)(-x)^k = \sum_{k=0}^n s(n,k)(-1)^k x^k.

Hence

xn‾=(−1)n(−x)n‾=∑k=0n(−1)n(−1)ks(n,k) xk=∑k=0n(−1)n−ks(n,k) xk=∑k=0nc(n,k) xk,x^{\overline n} = (-1)^n (-x)^{\underline n} = \sum_{k=0}^n (-1)^n(-1)^k s(n,k)\, x^k = \sum_{k=0}^n (-1)^{n-k}s(n,k)\, x^k = \sum_{k=0}^n c(n,k)\, x^k,

using (−1)n(−1)k=(−1)n+k=(−1)n−k(-1)^n(-1)^k = (-1)^{n+k}=(-1)^{n-k} and s(n,k)=(−1)n−kc(n,k)⇒(−1)n−ks(n,k)=c(n,k)s(n,k)=(-1)^{n-k}c(n,k) \Rightarrow (-1)^{n-k}s(n,k) = c(n,k). This proves (C).

Part 2: Inversion. We use the standard defining property of Stirling numbers of the second kind (established independently, as a prerequisite result): for all n≥0n\ge0,

xn=∑k=0nS(n,k) xk‾.(D)x^n = \sum_{k=0}^n S(n,k)\, x^{\underline k}. \tag{D}

This is the analogous expansion of ordinary powers in the falling-factorial basis, proved (elsewhere, as background) by the combinatorial fact that S(n,k)⋅k!S(n,k)\cdot k! counts surjections from an nn-set onto a labeled kk-set, matching the standard basis-change identity — we take (D) as given, since it defines S(n,k)S(n,k) and is not part of what we are proving here. Now substitute the falling factorial expansion from the main theorem, xk‾=∑js(k,j)xjx^{\underline{k}} = \sum_{j} s(k,j) x^j, into (D):

xn=∑k=0nS(n,k)∑j=0ks(k,j) xj=∑j=0n(∑k=jnS(n,k) s(k,j))xj.x^n = \sum_{k=0}^n S(n,k) \sum_{j=0}^k s(k,j)\, x^j = \sum_{j=0}^n \left(\sum_{k=j}^n S(n,k)\, s(k,j)\right) x^j.

Since {xj}j=0n\{x^j\}_{j=0}^n are linearly independent polynomials, comparing coefficients of xjx^j on both sides (the left side is xnx^n, i.e. coefficient 11 at j=nj=n and 00 elsewhere) yields

∑k=jnS(n,k) s(k,j)=δn,j(0≤j≤n).\sum_{k=j}^n S(n,k)\, s(k,j) = \delta_{n,j} \qquad (0 \le j \le n).

In matrix terms, with B=[S(n,k)]B=[S(n,k)] and A=[s(n,k)]A=[s(n,k)] (both indexed n,k=0,…,Nn,k = 0,\dots,N, entries 00 outside 0≤k≤n≤N0\le k\le n\le N), this says exactly (BA)n,j=δnj(BA)_{n,j} = \delta_{nj}, i.e. BA=IBA = I. Conversely substitute (C) into the falling factorial expansion. From (C) with x↦−xx \mapsto -x we recovered xn‾=∑ks(n,k)xkx^{\underline n} = \sum_k s(n,k) x^k (that is just the definition); instead substitute the defining expansion of xn‾x^{\underline n} into (D) the other way: start from

xn‾=∑k=0ns(n,k)xkx^{\underline n} = \sum_{k=0}^n s(n,k) x^k

and substitute xk=∑j=0kS(k,j)xj‾x^k = \sum_{j=0}^k S(k,j) x^{\underline j} (this is (D) with nn renamed to kk):

xn‾=∑k=0ns(n,k)∑j=0kS(k,j)xj‾=∑j=0n(∑k=jns(n,k)S(k,j))xj‾.x^{\underline n} = \sum_{k=0}^n s(n,k) \sum_{j=0}^k S(k,j) x^{\underline j} = \sum_{j=0}^n \left(\sum_{k=j}^n s(n,k) S(k,j)\right) x^{\underline j}.

The falling factorials x0‾,…,xn‾x^{\underline 0}, \dots, x^{\underline n} are also linearly independent as polynomials (each has a distinct degree 0,1,…,n0,1,\dots,n, and a nonzero leading coefficient 11, so any linear dependence among finitely many of them with distinct degrees forces all coefficients to vanish by comparing leading terms degree by degree — a standard fact about polynomial bases graded by degree). Comparing coefficients of xj‾x^{\underline j} against the left side xn‾x^{\underline n} (coefficient 11 at j=nj=n, else 00) gives

∑k=jns(n,k) S(k,j)=δnj,\sum_{k=j}^n s(n,k)\, S(k,j) = \delta_{nj},

i.e. (AB)n,j=δnj(AB)_{n,j} = \delta_{nj}, so AB=IAB=I. Both AB=IAB=I and BA=IBA=I hold for the truncated (N+1)×(N+1)(N+1)\times(N+1) triangular matrices, for every NN; hence AA and BB are inverse matrices. ■\blacksquare

∎

Worked examples

Example 1: Computing c(6,3)c(6,3) two ways, and interpreting it. Via the recurrence. Using (∗)(\ast): c(n,k)=c(n−1,k−1)+(n−1)c(n−1,k)c(n,k)=c(n-1,k-1)+(n-1)c(n-1,k), build the triangle up to n=6n=6:

n\k0123456011012011302314061161502450351016012027422585151\begin{array}{c|ccccccc} n\backslash k & 0&1&2&3&4&5&6\\\hline 0&1&&&&&&\\ 1&0&1&&&&&\\ 2&0&1&1&&&&\\ 3&0&2&3&1&&&\\ 4&0&6&11&6&1&&\\ 5&0&24&50&35&10&1&\\ 6&0&120&274&225&85&15&1 \end{array}

Check the last row directly: c(6,1)=5!=120c(6,1)=5!=120 (checked: c(6,1)=c(5,0)+5⋅c(5,1)=0+5⋅24=120c(6,1)=c(5,0)+5\cdot c(5,1) = 0+5\cdot 24=120 ✓). c(6,2)=c(5,1)+5c(5,2)=24+5⋅50=24+250=274c(6,2) = c(5,1)+5c(5,2) = 24 + 5\cdot 50 = 24+250=274 ✓. c(6,3)=c(5,2)+5c(5,3)=50+5⋅35=50+175=225c(6,3) = c(5,2)+5c(5,3) = 50+5\cdot 35 = 50+175=225. So c(6,3)=225c(6,3) = 225: there are 225225 permutations of 66 labeled elements that decompose into exactly 33 disjoint cycles. Sanity check via cycle-type enumeration. Partitions of 66 into exactly 33 positive parts (cycle-type shapes) are:

4+1+1,3+2+1,2+2+2.4+1+1,\quad 3+2+1,\quad 2+2+2.

The number of permutations of [6][6] with a given cycle type 1m12m2⋯1^{m_1}2^{m_2}\cdots is the classical formula

n!∏iimimi!.\frac{n!}{\prod_i i^{m_i} m_i!}.
  • Type 4+1+14+1+1 (one 44-cycle, two fixed points): m1=2,m4=1m_1=2, m_4=1. Count =6!12⋅2!⋅41⋅1!=7202⋅4=90= \dfrac{6!}{1^2\cdot 2! \cdot 4^1\cdot 1!} = \dfrac{720}{2\cdot 4} = 90.
  • Type 3+2+13+2+1 (one 33-cycle, one 22-cycle, one fixed point): m1=1,m2=1,m3=1m_1=1,m_2=1,m_3=1. Count =6!1⋅2⋅3=7206=120=\dfrac{6!}{1\cdot 2\cdot 3} = \dfrac{720}{6} = 120.
  • Type 2+2+22+2+2 (three 22-cycles): m2=3m_2 = 3. Count =6!23⋅3!=7208⋅6=72048=15= \dfrac{6!}{2^3\cdot 3!} = \dfrac{720}{8\cdot 6} = \dfrac{720}{48}=15.

Total: 90+120+15=22590 + 120 + 15 = 225, matching c(6,3)=225c(6,3)=225 exactly. This cross-check via the cycle-index formula confirms the recurrence computation.

Example 2: Using the falling-factorial identity to evaluate a sum without expanding a product of six terms. Suppose we want ∑k=06s(6,k)⋅2k\sum_{k=0}^{6} s(6,k)\cdot 2^k — equivalently, we want 26‾=2⋅1⋅0⋅(−1)⋅(−2)⋅(−3)2^{\underline 6} = 2\cdot1\cdot0\cdot(-1)\cdot(-2)\cdot(-3), evaluated by direct substitution into the definition, since the theorem says x6‾=∑ks(6,k)xkx^{\underline 6}=\sum_k s(6,k)x^k and we may just plug in x=2x=2 on the left side instead of expanding the sum on the right. Direct evaluation: 26‾=2⋅1⋅0⋅(−1)⋅(−2)⋅(−3)=02^{\underline 6} = 2\cdot 1\cdot 0 \cdot(-1)\cdot(-2)\cdot(-3) = 0, since one of the six consecutive integer factors (2,1,0,−1,−2,−32,1,0,-1,-2,-3) is 00. Now verify this against the row n=6n=6 of signed Stirling numbers, obtained from the unsigned row above via s(6,k)=(−1)6−kc(6,k)s(6,k)=(-1)^{6-k}c(6,k):

s(6,0)=0, s(6,1)=−120, s(6,2)=274, s(6,3)=−225, s(6,4)=85, s(6,5)=−15, s(6,6)=1.s(6,0)=0,\ s(6,1)=-120,\ s(6,2)=274,\ s(6,3)=-225,\ s(6,4)=85,\ s(6,5)=-15,\ s(6,6)=1.

Then

∑k=06s(6,k)2k=0−120(2)+274(4)−225(8)+85(16)−15(32)+1(64).\sum_{k=0}^6 s(6,k) 2^k = 0 - 120(2) + 274(4) - 225(8) + 85(16) - 15(32) + 1(64).

Compute term by term: −120⋅2=−240-120\cdot2=-240; 274⋅4=1096274\cdot4=1096; −225⋅8=−1800-225\cdot8=-1800; 85⋅16=136085\cdot16=1360; −15⋅32=−480-15\cdot32=-480; 1⋅64=641\cdot64=64. Sum: −240+1096=856-240+1096 = 856; 856−1800=−944856-1800=-944; −944+1360=416-944+1360=416; 416−480=−64416-480=-64; −64+64=0-64+64=0. The sum is 00, matching 26‾=02^{\underline 6}=0 exactly. This example illustrates the practical power of the identity: rather than trusting six-term arithmetic on the coefficient side, the polynomial identity lets us cross-validate an entire signed row of the Stirling triangle against a trivial factorial computation — here forced to zero because x=2x=2 is one of the roots 0,1,2,3,4,50,1,2,3,4,5 of x6‾x^{\underline 6}.

CounterexampleDropping "disjoint" from the cycle decomposition breaks the count

The combinatorial half of the theorem, statement (B), crucially requires that we count disjoint cycles in the unique cycle decomposition of a permutation (every permutation of a finite set has one, and only one, decomposition into disjoint cycles, up to the order in which the cycles are written and the starting point within each cycle — this uniqueness is what makes "number of cycles" well-defined). Suppose instead we tried to define an analogous count using arbitrary (possibly overlapping, not-necessarily-a-partition) sequences of cyclic permutations whose product equals a given π\pi, or — more concretely — suppose we drop disjointness and instead ask: "in how many ways can π∈Sn\pi \in S_n be written as a product of exactly kk cyclic permutations (of any lengths, possibly overlapping in support)?" This is a completely different and vastly larger count, unrelated to c(n,k)c(n,k). Concrete instance: take n=3n=3 and π=id\pi = \mathrm{id}, the identity permutation on {1,2,3}\{1,2,3\}. Its disjoint cycle decomposition is (1)(2)(3)(1)(2)(3), three fixed points, so k=3k=3 in the correct sense, contributing to c(3,3)=1c(3,3)=1 (indeed the identity is the only permutation of [3][3] with 33 disjoint cycles, since 33 disjoint nonempty cycles on 33 points must each be a singleton). But id\mathrm{id} can also be written as a product of two non-disjoint transpositions, e.g. (1 2)(1 2)=id(1\,2)(1\,2) = \mathrm{id}, or (1 2 3)(1 3 2)=id(1\,2\,3)(1\,3\,2)=\mathrm{id} — both products of exactly 22 cyclic factors that are not disjoint. If one incorrectly tried to count "kk" as the number of cyclic factors in some factorization rather than the disjoint decomposition, the identity permutation alone would contribute to multiple different values of this alternative "kk" (via infinitely many such factorizations, since one can insert any transposition twice), utterly destroying the clean recurrence (∗)(\ast) and the finite well-defined count c(n,k)c(n,k). The theorem's combinatorial content depends essentially on the existence and uniqueness of the disjoint cycle decomposition of a permutation — without that structural fact, "number of cycles" is not even well-defined, and no analogue of (∗)(\ast) or of the falling-factorial identity survives.

Scope, edge cases & common traps

SituationWhat happensWhy
k=0k=0, n≥1n\ge 1c(n,0)=0c(n,0) = 0No permutation of a nonempty set has zero cycles; every element lies in some cycle.
k=nk=nc(n,n)=1c(n,n) = 1Only the identity permutation has nn cycles (all fixed points) on nn elements.
k=1k=1c(n,1)=(n−1)!c(n,1) = (n-1)!Counts the nn-cycles (full cyclic permutations); a standard fact provable from (∗)(\ast) by induction.
xx a nonnegative integer <n< n in xn‾=∑s(n,k)xkx^{\underline n}=\sum s(n,k)x^kBoth sides equal 00The falling factorial has an explicit integer factor equal to 00.
Confusing s(n,k)s(n,k) with c(n,k)c(n,k)Sign errors in generating function manipulationss(n,k)=(−1)n−kc(n,k)s(n,k)=(-1)^{n-k}c(n,k); only c(n,k)c(n,k) is directly a "count."
Applying (∗)(\ast) outside 1≤k≤n1\le k\le nRecurrence invalid / undefinedBoundary values must be imposed separately: c(n,0)=0c(n,0)=0 (n≥1n\ge1), c(0,0)=1c(0,0)=1.

The mathematician behind it

Origins · 1 minJames Stirling and how this was discovered
JS
James Stirling
1692–1770 · Scottish mathematician, Scotland and London

James Stirling worked in analysis, infinite series, and the theory of interpolation during the early flowering of calculus after Newton and Leibniz. His 1730 treatise Methodus Differentialis systematically studied the relationships between successive powers, differences, and factorial-type products of a variable — exactly the change-of-basis problem that the numbers bearing his name solve. Stirling was elected a Fellow of the Royal Society and later became a manager of Scottish mining operations, moving away from pure mathematics in his later career, but his early analytic work — particularly on asymptotic expansions (Stirling's approximation to n!n! is also his) and on these expansions of factorial products — left a permanent mark on discrete mathematics centuries before "combinatorics" existed as a named discipline.

History
- 1692: James Stirling is born in Garden, Stirlingshire, Scotland.
- 1730: Stirling publishes Methodus Differentialis, containing the coefficient tables that are the ancestors of both kinds of Stirling numbers.
- 1749: Stirling largely withdraws from mathematical research to manage the Scots Mining Company in Leadhills.
- 1770: James Stirling dies in Edinburgh.
- 20th century: The modern notation s(n,k)s(n,k), S(n,k)S(n,k) and the systematic "signed/unsigned" and cycle-counting interpretation are consolidated in the combinatorics literature (notably by writers such as Riordan, Comtet, and later Graham–Knuth–Patashnik), cementing the permutation-cycle reading of c(n,k)c(n,k) as standard.
What is the difference between s(n,k)s(n,k) and c(n,k)c(n,k)?

c(n,k)c(n,k) is the unsigned Stirling number of the first kind, defined combinatorially as the number of permutations of an nn-element set with exactly kk disjoint cycles; it is always a nonnegative integer. s(n,k)s(n,k) is the signed version, defined algebraically as the coefficient of xkx^k in the falling factorial expansion xn‾=∑ks(n,k)xkx^{\underline n} = \sum_k s(n,k)x^k. They are related by s(n,k)=(−1)n−kc(n,k)s(n,k) = (-1)^{n-k}c(n,k), so c(n,k)=∣s(n,k)∣c(n,k) = |s(n,k)|. The unsigned numbers are the ones with a direct combinatorial meaning (a count), while the signed numbers are the ones that make the falling-factorial identity hold as stated, with alternating signs down each row from k=nk=n (sign ++) to k=0k=0.

Why do these numbers satisfy a Pascal-triangle-like recurrence?

The recurrence c(n,k)=c(n−1,k−1)+(n−1)c(n−1,k)c(n,k) = c(n-1,k-1) + (n-1)c(n-1,k) comes from tracking one distinguished element, say nn, in a permutation of [n][n] with kk cycles. Either nn is a fixed point, in which case removing it leaves a permutation of [n−1][n-1] with k−1k-1 cycles (this is the c(n−1,k−1)c(n-1,k-1) term), or nn sits inside a longer cycle, in which case removing nn shortens that cycle without changing the cycle count, and there are n−1n-1 possible "slots" (positions after each of the other n−1n-1 elements) where nn could have been inserted, giving the (n−1) c(n−1,k)(n-1)\,c(n-1,k) term. This is analogous in flavor to the Pascal recurrence for binomial coefficients but weighted by (n−1)(n-1) rather than 11, reflecting the extra combinatorial freedom in where to insert nn into an existing cycle.

How does this relate to Stirling numbers of the second kind?

Stirling numbers of the second kind S(n,k)S(n,k) count partitions of an nn-set into kk nonempty unordered blocks, and satisfy xn=∑kS(n,k)xk‾x^n = \sum_k S(n,k)x^{\underline k}. Stirling numbers of the first kind do the reverse conversion, expanding xn‾x^{\underline n} back into powers of xx. Composing the two expansions and comparing coefficients (since both {xj}\{x^j\} and {xj‾}\{x^{\underline j}\} are bases of the polynomial space) shows the matrices of signed first-kind numbers and second-kind numbers are exact inverses of one another. Intuitively, first-kind numbers "unpack" cycle structure into linear order (powers), while second-kind numbers "pack" linear order into unordered block structure (partitions); inverting one operation recovers the other.

Is there a generating function in nn (rather than kk) for these numbers?

Yes. Fixing kk and letting nn vary, the unsigned Stirling numbers of the first kind have the exponential generating function

∑n≥kc(n,k) xnn!=1k!(ln⁡11−x)k,\sum_{n \ge k} c(n,k)\,\frac{x^n}{n!} = \frac{1}{k!}\left(\ln\frac{1}{1-x}\right)^k,

which follows from the exponential formula in combinatorics applied to permutations viewed as sets of cycles (each cycle of length m≥1m \ge 1 contributing exponential generating function (m−1)! xmm!=xmm\frac{(m-1)!\,x^m}{m!} = \frac{x^m}{m} per cycle, summed over mm to give ln⁡11−x\ln\frac{1}{1-x} for one cycle, then divided by k!k! to account for unordered collections of kk cycles). This generating function is a clean example of the "exponential formula" machinery used throughout enumerative combinatorics for labeled structures built from unordered collections of connected pieces.

Do Stirling numbers of the first kind appear in the study of records or extreme values?

Yes, closely. If a permutation of [n][n] is chosen uniformly at random, the number of cycles equals in distribution the number of "left-to-right minima" or equivalently the number of records in a related random sequence, via a classical bijection (the "fundamental bijection" of Foata) between permutations written in cycle notation and permutations written in one-line notation, under which cycles map to a statistic counting record values. This makes c(n,k)/n!c(n,k)/n! the exact probability that a uniformly random sequence of nn distinct values has exactly kk records, connecting Stirling numbers of the first kind directly to order-statistics and record-value theory in probability.

Why is uniqueness of the disjoint cycle decomposition essential to the theorem?

The combinatorial interpretation c(n,k)=#{π:k cycles}c(n,k) = \#\{\pi : k \text{ cycles}\} presumes that "the number of cycles of π\pi" is a well-defined single number attached to π\pi. This relies on the structural fact that every permutation of a finite set has one and only one decomposition into disjoint cycles (up to reordering the cycles and choosing a starting point within each), which follows from viewing π\pi as generating a group action on [n][n] whose orbits are exactly the cycles — orbits of a group action always partition the underlying set uniquely. Without this uniqueness, "number of cycles" would not be a function of π\pi at all, and no counting argument or recurrence could be built on it, as illustrated in the counterexample above.

What is the connection to The Twelvefold Way?

The Twelvefold Way organizes twelve counting problems by whether balls/domain elements are distinguishable, whether boxes/codomain elements are distinguishable, and what constraints (arbitrary function, injection, surjection) are imposed. Counting permutations by cycle number sits adjacent to this framework: it is a refinement of counting bijections from a set to itself, stratified by an extra invariant (cycle count) that is invisible in the coarser twelvefold classification but essential once one asks finer structural questions, such as counting permutations by cycle type or number of cycles rather than merely counting all bijections.

Before this

Where this leads