Stirling Numbers of the First Kind
How many ways can you arrange 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 used in generating functions and the falling/rising factorials 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, , count set partitions into blocks. They convert powers into falling factorials. Stirling numbers of the first kind, (signed) or (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.
- (unsigned Stirling number of the first kind) counts permutations of elements having exactly cycles.
- The signed version is , chosen so that .
- Recurrence: , mirroring but dual to the Stirling Numbers of the Second Kind recurrence.
- Row sums: , since every permutation has some number of cycles.
- The matrices and (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 and falling factorials , 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 is (the -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 , 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 . In algebra and representation theory, the cycle type of a permutation determines its conjugacy class in , and 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 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 ) 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 and Stirling numbers of the second kind ?]
- 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?
Let be an integer. The falling factorial is
The signed Stirling numbers of the first kind , defined for , are the unique integers satisfying
The unsigned Stirling numbers of the first kind are
Combinatorially, for and ,
where is the symmetric group on and every element is written as a product of disjoint cycles in the usual way. Boundary values: , for , and for or .
Intuition
Think of 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 people at exactly (unlabeled, but nonempty and mutually distinguishable by membership) round tables is . The algebraic side of the story is a change of basis. The vector space of polynomials in of degree has (at least) two natural bases: the monomials , and the falling factorials . Passing from falling factorials to monomials uses the ; passing back uses the Stirling numbers of the second kind . 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.
Central theorems
Let be an integer. Then the following two statements hold and are equivalent formulations of the same combinatorial fact.
(A) Algebraic form. As polynomials in ,
where are uniquely determined, for or , and whenever .
(B) Combinatorial form. For , the unsigned value equals the number of permutations of whose disjoint cycle decomposition (fixed points counted as -cycles) has exactly cycles.
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 to match the algebraic recursion for .
Step 1: A recurrence for . Define for , as the number of permutations of with exactly cycles, and set , for , if or . We claim that for and ,
Proof of . Consider a permutation of with exactly cycles, and look at where element sits.
- Case 1: is a fixed point, i.e. contains the -cycle . Deleting leaves a permutation of with exactly cycles (we removed exactly one cycle, the singleton). This correspondence is a bijection between permutations of with exactly cycles fixing , and permutations of with exactly cycles: given any permutation of with cycles, adjoin the fixed point to get a permutation of with cycles fixing , and these two maps are mutually inverse. Hence there are exactly such permutations.
- Case 2: is not a fixed point. Then in the cycle containing , say appears as for some (the element that maps to ) — equivalently, occupies one of the "slots" immediately following some element in the cyclic order. Deleting from its cycle (and reconnecting directly to , i.e. replacing by ) yields a permutation of with the same number of cycles , since we only shortened one cycle without splitting or merging it (if the cycle containing had length , removing leaves a cycle of length , not zero, because is not the only element of its cycle in this case). Conversely, given any permutation of with cycles, we may insert immediately after any of the elements (in the cyclic reading of 's cycle structure), producing a permutation of with cycles in which is not a fixed point. These two constructions (deletion of ; insertion of after a chosen element) are mutually inverse bijections between {permutations of , cycles, not fixed} and {permutations of with cycles} {choice of }. Hence there are exactly such permutations.
Since Case 1 and Case 2 partition all permutations of with cycles, adding gives . (Step 1)
Step 2: The falling factorial satisfies the same recurrence, via its coefficients. Write . Then for , with . Suppose inductively that
for some integers (with outside ). Then
Re-indexing the first sum () and combining coefficients of gives
This is a well-defined recursion determining all from (since ), by induction on ; it uniquely determines the integers appearing in the statement, because the monomials are linearly independent, so the coefficients of any polynomial in the power basis are unique. This proves uniqueness of in (A), and gives an explicit recursive algorithm computing them.
Step 3: Matching signs, satisfies . Substitute into :
Now and . Substituting:
Dividing both sides by (nonzero) gives exactly
which is . Since the two sequences from Step 1 and from Step 2–3 satisfy the same recurrence and the same boundary conditions (; ; for or — the algebraic side's boundary conditions follow since forces and has degree exactly with no constant-in-... more precisely is the value of at up to the constant term, and for since one factor of is itself, forcing ), induction on shows they agree for all . This proves (B), and simultaneously confirms the sign claim in (A) whenever , since always (it's a cardinality) and .
Step 4: Conclusion. Combining Steps 1–3: the unique integer coefficients of in the monomial basis satisfy where is exactly the number of permutations of with cycles. This establishes both (A) and (B), and their equivalence.
∎For every ,
By Theorem (B), counts permutations of with exactly cycles. Every permutation has a well-defined number of cycles between and (a permutation of a nonempty finite set always decomposes into at least one and at most disjoint cycles, since the cycle decomposition partitions into nonempty blocks each of which is a single cycle). Summing the count over all possible values of therefore counts every permutation of exactly once, giving . Equivalently, algebraically, setting in and using gives which is for — so instead evaluate the unsigned version at : from the rising factorial identity (proved in the theorem below), setting gives , matching the combinatorial count.
∎Let denote the rising factorial, . Then for all ,
Moreover, let denote the Stirling numbers of the second kind (number of partitions of into nonempty blocks), and form the lower-triangular matrices and . Then
i.e. : the signed Stirling numbers of the first kind and the Stirling numbers of the second kind are inverse matrices.
Part 1: Rising factorial identity (C). Note , because
By the main theorem applied with ,
Hence
using and . 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 ,
This is the analogous expansion of ordinary powers in the falling-factorial basis, proved (elsewhere, as background) by the combinatorial fact that counts surjections from an -set onto a labeled -set, matching the standard basis-change identity — we take (D) as given, since it defines and is not part of what we are proving here. Now substitute the falling factorial expansion from the main theorem, , into (D):
Since are linearly independent polynomials, comparing coefficients of on both sides (the left side is , i.e. coefficient at and elsewhere) yields
In matrix terms, with and (both indexed , entries outside ), this says exactly , i.e. . Conversely substitute (C) into the falling factorial expansion. From (C) with we recovered (that is just the definition); instead substitute the defining expansion of into (D) the other way: start from
and substitute (this is (D) with renamed to ):
The falling factorials are also linearly independent as polynomials (each has a distinct degree , and a nonzero leading coefficient , 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 against the left side (coefficient at , else ) gives
i.e. , so . Both and hold for the truncated triangular matrices, for every ; hence and are inverse matrices.
∎Worked examples
Example 1: Computing two ways, and interpreting it. Via the recurrence. Using : , build the triangle up to :
Check the last row directly: (checked: ✓). ✓. . So : there are permutations of labeled elements that decompose into exactly disjoint cycles. Sanity check via cycle-type enumeration. Partitions of into exactly positive parts (cycle-type shapes) are:
The number of permutations of with a given cycle type is the classical formula
- Type (one -cycle, two fixed points): . Count .
- Type (one -cycle, one -cycle, one fixed point): . Count .
- Type (three -cycles): . Count .
Total: , matching 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 — equivalently, we want , evaluated by direct substitution into the definition, since the theorem says and we may just plug in on the left side instead of expanding the sum on the right. Direct evaluation: , since one of the six consecutive integer factors () is . Now verify this against the row of signed Stirling numbers, obtained from the unsigned row above via :
Then
Compute term by term: ; ; ; ; ; . Sum: ; ; ; ; . The sum is , matching 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 is one of the roots of .
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 , or — more concretely — suppose we drop disjointness and instead ask: "in how many ways can be written as a product of exactly cyclic permutations (of any lengths, possibly overlapping in support)?" This is a completely different and vastly larger count, unrelated to . Concrete instance: take and , the identity permutation on . Its disjoint cycle decomposition is , three fixed points, so in the correct sense, contributing to (indeed the identity is the only permutation of with disjoint cycles, since disjoint nonempty cycles on points must each be a singleton). But can also be written as a product of two non-disjoint transpositions, e.g. , or — both products of exactly cyclic factors that are not disjoint. If one incorrectly tried to count "" 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 "" (via infinitely many such factorizations, since one can insert any transposition twice), utterly destroying the clean recurrence and the finite well-defined count . 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 or of the falling-factorial identity survives.
Scope, edge cases & common traps
| Situation | What happens | Why |
|---|---|---|
| , | No permutation of a nonempty set has zero cycles; every element lies in some cycle. | |
| Only the identity permutation has cycles (all fixed points) on elements. | ||
| Counts the -cycles (full cyclic permutations); a standard fact provable from by induction. | ||
| a nonnegative integer in | Both sides equal | The falling factorial has an explicit integer factor equal to . |
| Confusing with | Sign errors in generating function manipulations | ; only is directly a "count." |
| Applying outside | Recurrence invalid / undefined | Boundary values must be imposed separately: (), . |
The mathematician behind it
Origins · 1 minJames Stirling and how this was discovered
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 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.
What is the difference between and ?
is the unsigned Stirling number of the first kind, defined combinatorially as the number of permutations of an -element set with exactly disjoint cycles; it is always a nonnegative integer. is the signed version, defined algebraically as the coefficient of in the falling factorial expansion . They are related by , so . 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 (sign ) to .
Why do these numbers satisfy a Pascal-triangle-like recurrence?
The recurrence comes from tracking one distinguished element, say , in a permutation of with cycles. Either is a fixed point, in which case removing it leaves a permutation of with cycles (this is the term), or sits inside a longer cycle, in which case removing shortens that cycle without changing the cycle count, and there are possible "slots" (positions after each of the other elements) where could have been inserted, giving the term. This is analogous in flavor to the Pascal recurrence for binomial coefficients but weighted by rather than , reflecting the extra combinatorial freedom in where to insert into an existing cycle.
How does this relate to Stirling numbers of the second kind?
Stirling numbers of the second kind count partitions of an -set into nonempty unordered blocks, and satisfy . Stirling numbers of the first kind do the reverse conversion, expanding back into powers of . Composing the two expansions and comparing coefficients (since both and 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 (rather than ) for these numbers?
Yes. Fixing and letting vary, the unsigned Stirling numbers of the first kind have the exponential generating function
which follows from the exponential formula in combinatorics applied to permutations viewed as sets of cycles (each cycle of length contributing exponential generating function per cycle, summed over to give for one cycle, then divided by to account for unordered collections of 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 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 the exact probability that a uniformly random sequence of distinct values has exactly 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 presumes that "the number of cycles of " is a well-defined single number attached to . 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 as generating a group action on 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 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.