Volume P2 · Concrete mathematics
Stirling numbers and Eulerian numbers
Draft. This chapter is written and checked by the tools of the project, and a person has not reviewed it yet. Read it with care.
Contents
Stirling numbers of the second kind
Statement
A power is a polynomial of degree , and Chapter 3 showed that the falling powers are a basis for the polynomials of degree at most . So is a combination of falling powers. The coefficients of this combination are integers, and they count the partitions of a set. This section defines these numbers by the count, proves their recurrence, proves the change of basis and gives an explicit formula.
Definition P2.8.1 (set partition). Let be a finite set. A partition of is a set of nonempty subsets of , called blocks, such that each element of is in exactly one block. For integers and , the Stirling number of the second kind is the number of partitions of into exactly blocks.
Example P2.8.2. The partitions of into two blocks are , , , , , and . So . The partitions into three blocks have one block of two elements, and there are choices for it, so .
Example P2.8.3. The empty set has exactly one partition, the empty set of blocks, so . For there is no partition into blocks, so . There is no partition into blocks, because each block has an element, and there is none into blocks. The first rows, for , are
Theorem P2.8.4 (recurrence of the second kind). For every integer and every integer ,
Lean: Mathlib Nat.stirlingSecond_succ_succ, and TAOCP.stirling2_succ_succ of TAOCP/Notation (tamnd/taocp-lean main), where Nat.stirlingSecond is defined by this recurrence (proved in Mathlib).
Proof. Split the partitions of into blocks into two classes. In the first class the block of is . Delete that block; the result is a partition of into blocks, and each such partition arises once. So the first class has members. In the second class the block of has other elements. Delete from its block; the result is a partition of into blocks. Each such partition arises exactly times, once for each block to which can be added. So the second class has members. For both sides are zero.
Theorem P2.8.5 (powers in falling powers). For every real and every integer ,
Lean: Mathlib Nat.pow_eq_sum_stirlingSecond_mul_descFactorial, for a natural number with Nat.descFactorial as the falling power (proved in Mathlib).
Proof. First let be a positive integer, and count the functions from to in two ways. There are of them, since each of the elements has choices for its value. On the other hand, each defines a partition of : two elements are in the same block when has the same value at them. If this partition has blocks, then gives distinct values to the blocks. Conversely, a partition into blocks and an assignment of distinct values to its blocks define one function. With the blocks in the order of their smallest elements, there are assignments. So the number of functions is . Both sides of the identity are polynomials in , and they agree at every positive integer, so they are the same polynomial (Section 6.4).
Theorem P2.8.6 (explicit formula for the second kind). For all integers and , the number of functions from an -element set onto an -element set is , and
Lean: not in Mathlib.
Proof. A function onto defines a partition of into blocks, as in the previous proof, and it gives distinct values to the blocks. Since every value is used, the blocks get the values in one of orders. So there are such functions. Call this number . Each function from to maps onto its image, a subset of , and for a fixed with elements there are such functions. So Binomial inversion (Section 7.2) gives .
The formula also follows from the difference formula of Section 7.2: the right side is at . The proof above is the method of inclusion and exclusion in the form of binomial inversion.
Theorem P2.8.7 (special values of the second kind). For every integer , and , while .
Lean: Mathlib Nat.stirlingSecond_one_right, Nat.stirlingSecond_succ_self_left, Nat.stirlingSecond_self and Nat.stirlingSecond_succ_zero (proved in Mathlib); the value for is not in Mathlib.
Proof. The only partition into one block is , and the only partition into blocks is the partition into single elements. A partition into blocks has exactly one block with two elements and blocks with one element, so it is fixed by the choice of the block of two elements, and there are choices. For two blocks, the explicit formula with gives . A direct count gives the same: the block that contains is together with a subset of that is not the whole set, and there are such subsets. The values for are in the example after the definition.
Proof
All the proofs of this section are counts. The recurrence follows the last element. The change of basis counts functions by the partition that they define, and the polynomial argument extends it from the positive integers to all real . The explicit formula counts the same functions by their image, which gives a binomial transform, and binomial inversion from Chapter 7 solves it.
Examples
Example P2.8.8. For the theorem on powers says . At this reads . At it reads .
Example P2.8.9. The explicit formula with and gives , so , as in the first example. With and it gives , so .
Example P2.8.10. The change of basis turns a sum of powers into a sum of falling powers, which Chapter 3 can sum: . For , For the right side is .
Example P2.8.11. The recurrence computes the table row by row. From the row , which is , it gives and .
Exercises
- [10] Compute the row of the numbers with the recurrence.
- [M15] Prove that for every .
- [M15] Five people enter three rooms, and no room stays empty. In how many ways can this happen, if the people and the rooms are distinguishable?
- [M20] The Bell number is the number of all partitions of , so . Prove that for , and compute .
- [M20] Use the change of basis and the sums of falling powers to write in falling powers of . Check the result for .
- [M20] Prove that for by a count of the sizes of the blocks.
- [M15] Prove that for every .
Lean
Mathlib defines Nat.stirlingSecond by the recurrence, with Nat.stirlingSecond_succ_succ as the main equation, and TAOCP/Notation (tamnd/taocp-lean main) has TAOCP.stirling2 as a thin alias, with TAOCP.stirling2_eq and TAOCP.stirling2_succ_succ. So the recurrence is in the library, but the count of partitions is not: a formal statement that Nat.stirlingSecond n k is the number of partitions of a set of elements into blocks, with Finpartition, is not yet stated in TAOCP/Notation. The change of basis is Nat.pow_eq_sum_stirlingSecond_mul_descFactorial for a natural number ; the form for a real follows by the polynomial argument. The Bell numbers of Exercise 4 are Nat.bell, with the recurrence Nat.bell_succ.
Notes and history
James Stirling introduced both kinds of numbers in his Methodus differentialis (1730), as the coefficients that change powers into falling powers and back; the link with partitions came later. The notation with braces is due to Jovan Karamata (1935), and Knuth made it standard in TAOCP and in GKP94. The Bell numbers carry the name of Eric Temple Bell, who wrote about them in the 1930s, although they are much older.
TAOCP states the change of basis as eq. 1.2.6(45), the recurrence as part of eq. 1.2.6(46), the special values as parts of eqs. 1.2.6(48) to 1.2.6(50) and the explicit formula as eq. 1.2.6(53). The theorem on powers is the reason that Chapter 3 can sum any polynomial: change it to falling powers, then sum each falling power. Section 1.2.9 gives the generating function , which P3 proves.
Stirling numbers of the first kind
Statement
Section 8.1 changed powers into falling powers. This section goes the other way: it writes the rising power and the falling power as polynomials in . The coefficients are again integers that count, and this time they count permutations by their cycles.
Definition P2.8.12 (cycle). Let be a permutation of a finite set . The cycle of an element is the list , which returns to after a finite number of steps because is finite and is one to one. The cycles of split into disjoint sets. A cycle is written , and it can start at any of its elements. A cycle of one element is a fixed point.
Example P2.8.13. The permutation of with , , , and has the cycles and . The identity permutation of has cycles, all of them fixed points.
Example P2.8.14. A permutation of with one cycle is or . The permutations with two cycles are , and . The identity has three cycles. These are the permutations of the set.
Definition P2.8.15 (Stirling number of the first kind). For integers and , the Stirling number of the first kind is the number of permutations of with exactly cycles. The empty permutation has no cycle, so , and for and for , and also for .
Example P2.8.16. The second example above shows , and . For and a permutation has either a cycle of three elements and a fixed point, with choices, or two cycles of two elements, with choices. So .
Example P2.8.17. The first rows, for , are Each row has the sum , since every permutation has some number of cycles.
Theorem P2.8.18 (recurrence of the first kind). For every integer and every integer ,
Lean: Mathlib Nat.stirlingFirst_succ_succ, and TAOCP.stirling1_succ_succ of TAOCP/Notation (tamnd/taocp-lean main), where Nat.stirlingFirst is defined by this recurrence (proved in Mathlib).
Proof. Split the permutations of with cycles into two classes. In the first class is a fixed point. Delete it; the result is a permutation of with cycles, and each one arises once. So the first class has members. In the second class for some . Delete from its cycle, that is, define and for the other . Then is a permutation of with cycles. Conversely, from and the choice of in , put in the cycle of right after . So each arises from exactly permutations , and the second class has members.
Theorem P2.8.19 (rising and falling powers in powers). For every real and every integer ,
Lean: not in Mathlib in this form; the falling power is descPochhammer, and descPochhammer_eval_eq_descFactorial is the bridge to Nat.descFactorial (proved in Mathlib).
Proof. Use induction on . For both sides of the first identity are . Assume it for . Then The coefficient of is , which is by the recurrence. For the second identity, note that . Put into the first identity and multiply by ; the term gets the sign .
Theorem P2.8.20 (special values of the first kind). For every integer , where . Also and , and .
Lean: Mathlib Nat.stirlingFirst_one_right, Nat.stirlingFirst_succ_self_left and Nat.stirlingFirst_self (proved in Mathlib); the value of with harmonic is not in Mathlib.
Proof. A permutation with one cycle is the cycle written from , where is any order of ; so there are of them. A permutation with cycles exchanges two elements and fixes the others, and there are choices of the two elements. The identity is the only permutation with cycles. The row sum is the number of all permutations. For the value with , the recurrence gives . Divide by : with this reads for , and . So by induction.
Theorem P2.8.21 (mean number of cycles). For every integer , . So a permutation of , chosen with all permutations equally likely, has cycles on average.
Lean: not in Mathlib.
Proof. Let . Then . On the other hand , and the product rule gives for . At this is .
Proof
The recurrence follows the largest element, as in Section 8.1, but now the element can enter an existing cycle in ways, one after each element, so the factor is and not . The expansion of the rising power is the recurrence in the language of polynomials: multiplication by shifts the coefficients and adds times them. The falling power differs from the rising power only by the signs. The special values are direct counts, and the value of comes from the recurrence divided by . The mean number of cycles is the derivative of at ; it equals , a fact that Section 8.3 explains.
Examples
Example P2.8.22. For the theorem on powers says and . At these read and .
Example P2.8.23. The value of for is , which is the number of the example after the definition. For it is , the entry of the table.
Example P2.8.24. For the mean number of cycles is .
Example P2.8.25. The recurrence computes the row from the row , which is : and .
Exercises
- [10] Compute the row of the numbers with the recurrence.
- [M20] Prove that for by a count of the lengths of the cycles.
- [M15] Prove that for every .
- [M15] Prove that for every . What is the sum for and ?
- [M15] List the cycle types of the permutations of with three cycles, count each type, and check the total against the table.
- [M22] Prove that for every , where .
- [M15] Prove that for every .
Lean
Mathlib defines Nat.stirlingFirst by the recurrence, as the unsigned numbers, with Nat.stirlingFirst_succ_succ as the main equation. TAOCP/Notation (tamnd/taocp-lean main) has TAOCP.stirling1 as a thin alias, with TAOCP.stirling1_eq and TAOCP.stirling1_succ_succ; the book's numbers are unsigned as well, so the alias needs no sign. The count of permutations by cycles, the expansion of and the formula with are not yet stated. A formal statement of uses harmonic of Mathlib, which is TAOCP.harmonicPow 1 by TAOCP.harmonicPow_one of TAOCP/Notation, and the sum of Exercise 6 is TAOCP.harmonicPow 2 n. The rising power is ascPochhammer in Mathlib, and the falling power is descPochhammer.
Notes and history
Stirling's tables of 1730 had the numbers of the first kind as the coefficients of , with signs. The link with cycles is due to Cauchy, who studied permutations by their cycles in the 1840s. Some authors use the signed numbers , which make the second identity of the theorem on powers free of signs. Knuth and GKP94 prefer the unsigned numbers with brackets, and so does Mathlib.
TAOCP states the expansion of the rising and falling powers as eq. 1.2.6(44), the recurrence as part of eq. 1.2.6(46) and the special values as parts of eqs. 1.2.6(48) to 1.2.6(50). Section 1.2.10 uses for the number of changes of the maximum in Algorithm M: the probability of changes is , and the mean is by the theorem on the mean number of cycles. Chapter 9 of this volume continues with the harmonic numbers.
Stirling inversion and identities
Statement
The two kinds of Stirling numbers change between the same two bases in opposite directions, so the two matrices are inverse to each other. This fact is the orthogonality of this section, and it gives an inversion formula, as orthogonality of binomial coefficients did in Section 7.2. The section then proves the sums that connect the Stirling numbers with the binomial coefficients, a formula for and as polynomials in , and the extension of both kinds to negative arguments, where they turn into each other.
Theorem P2.8.26 (orthogonality of the Stirling numbers). For all integers and ,
Lean: not in Mathlib.
Proof. Put the expansion of Section 8.2 into the expansion of Section 8.1: Two polynomials that agree for all real have the same coefficients, so the inner sum is . The terms with outside are zero. If the signs and agree, and if both sums are zero, so the sign may be written . For the first identity, put the expansion of Section 8.1 into that of Section 8.2 in the same way: The falling powers have the distinct degrees , so a polynomial has only one expansion in them, and the coefficient of is .
Theorem P2.8.27 (Stirling inversion). Let and be sequences indexed by the nonnegative integers. Then for every if and only if for every .
Lean: not in Mathlib.
Proof. Assume the first equations. Then by the first orthogonality relation; the sums are finite, so they may change places. The converse is the same computation with the second relation.
Theorem P2.8.28 (Stirling and binomial). For all integers and ,
Lean: not in Mathlib.
Proof. For the first identity, take a partition of into blocks, and let be the set of elements that are not in the block of . Then is a subset of , and the other blocks are a partition of . Conversely, a subset and a partition of into blocks give one such partition, with the block . There are subsets with elements. For the second identity, use the rising powers: The coefficient of on the left is by Section 8.2.
Corollary P2.8.29 (the inverse forms). For all integers and ,
Lean: not in Mathlib.
Proof. For the first identity, fix ; the theorem says that is the binomial transform of . Binomial inversion (Section 7.2) gives the claim. For the second, fix and let and , so that . Then by the orthogonality of binomial coefficients (Section 7.2), since .
Theorem P2.8.30 (a mixed sum). For all integers and ,
Lean: not in Mathlib.
Proof. Expand by the theorem on Stirling and binomial, and change the order of the finite sums: The inner sum is the second orthogonality relation, with the sign in place of ; as in its proof, the two signs agree when the sum is not zero.
Theorem P2.8.31 (sums along a column). For all integers and ,
Lean: not in Mathlib.
Proof. Use induction on . For the left sides are , and the right sides are . For the recurrence of Section 8.2 and the hypothesis for give In the same way the recurrence of Section 8.1 gives , and the factor raises each power to .
Theorem P2.8.32 (polynomials of degree 2m). Let be an integer. Let be the number of partitions of a -element set into blocks with no block of one element, and let be the number of permutations of a -element set with cycles and no fixed point. Then for every integer , So and are polynomials in of degree , with the leading coefficient . In particular
Lean: not in Mathlib.
Proof. Take a partition of into blocks, and let be the union of its blocks with at least two elements, with . The blocks inside are a partition of into blocks with no block of one element, and the elements outside are blocks of one element. Conversely, a set and such a partition of give one partition of into blocks. So . Each of the blocks inside has at least two elements, so , that is, . For all blocks have two elements, and : order the elements in a row and pair them in order, and each partition into pairs arises from rows. Since has the leading coefficient , the polynomial has the leading coefficient . The same argument with cycles and fixed points gives the second formula; for all cycles have two elements, so .
For the set has or elements. For the partition of is one block of three, so ; for it is two blocks of two, so . So . For cycles, a cycle of three elements can be written in ways and two cycles of two in ways, so . The addition formula turns these into the forms of the theorem.
Remark P2.8.33 (a sum with both kinds). For integers there is also the identity and the same identity with on the left and on the right. It expresses by the numbers of the theorem on polynomials. Its proof needs more of the theory of these polynomials than this chapter gives, and Exercise 4 checks the case .
Definition P2.8.34 (extended Stirling numbers). For all integers and , define and as follows. For and they are the numbers of Sections 8.1 and 8.2. For and let and . In all other cases both are . At the two rules give the same value , and on the rest of the axes they give .
Example P2.8.35. The definition gives , and . In the other direction, .
Example P2.8.36. The values of for and form a table that is the table of of Section 8.2, reflected:
Theorem P2.8.37 (extension and duality). The extended numbers satisfy the recurrences for all integers and . They are the only functions on pairs of integers that satisfy these recurrences for all and together with the conditions and . For all integers and ,
Lean: not in Mathlib.
Proof. The duality holds by the definition: for it is the rule for with nonpositive arguments, for it is the rule for , and in the other cases both sides are .
For the recurrence of , consider four cases. If and , all three terms have nonnegative arguments, and this is Section 8.1. If and , put and ; the three terms are , and , and the recurrence reads , which is Section 8.2. If and , the left side is , and each term on the right is : a term with first argument and second argument or can be nonzero only at , and , while the term at has the factor . If and , the left side is ; the terms on the right have the first argument , and they can be nonzero only if the second argument is , that is, only the term for ; it is since . The recurrence of follows in the same way, with the roles of the two kinds exchanged. The conditions on the axes hold by the definition.
For the uniqueness, let be the difference of two solutions of the recurrence of the second kind with the same conditions. Then satisfies the recurrence and is on both axes. For , the recurrence gives row of from row , so on the rows . Assume that row of is zero. The recurrence at gives for every . From this gives for step by step upward, and, with , ; then for step by step downward. So row is zero. For the first kind the same argument uses with .
Remark P2.8.38 (real upper arguments). By the theorem on polynomials of degree , the numbers and are values of polynomials in , so they have a meaning for every real . TAOCP uses this to define and for real , and to write them as sums of binomial coefficients with in the upper index. GKP94 Section 6.2 writes the same polynomials as sums with the second order Eulerian numbers.
Proof
The orthogonality relations come from the two changes of basis: going from powers to falling powers and back gives the identity, so the two matrices of Stirling numbers, with signs, are inverse. Inversion then follows by the same computation as in Section 7.2. The sums with binomial coefficients have one counting proof and one proof with rising powers, and their inverse forms follow from binomial inversion. The mixed sum combines both. The sums along a column unfold the recurrence. The theorem on polynomials of degree classifies the partitions and permutations by the elements that are not alone. The extension to negative arguments is a definition followed by a check of four cases, and the duality is then a property of the definition; the uniqueness shows that no other extension satisfies the same recurrences.
Examples
Example P2.8.39. The first orthogonality relation with and has the terms : .
Example P2.8.40. The theorem on Stirling and binomial with and gives . This is , as Section 8.1 says.
Example P2.8.41. The mixed sum with and is .
Example P2.8.42. The theorem on polynomials gives and , the entries of the tables.
Example P2.8.43. The recurrence of the second kind at and reads , that is, .
Exercises
- [M15] Check the second orthogonality relation for and .
- [M20] Find all sequences with for every .
- [M15] Compute with the sums along a column.
- [M18] Check the remark on a sum with both kinds for and every .
- [M15] Compute and , and check the second with the recurrence of the first kind at , .
- [M20] Use the sums along a column with to prove again.
- [M25] The Lah numbers are . Prove that , and that for .
Lean
None of the identities of this section is in Mathlib. They are statements about Nat.stirlingFirst and Nat.stirlingSecond, or about TAOCP.stirling1 and TAOCP.stirling2 of TAOCP/Notation (tamnd/taocp-lean main), with sums over Finset.range and signs in ; these statements are not yet in TAOCP/Notation. The orthogonality relations are the main step, and the other identities follow from them, from the recurrences and from the facts on binomial coefficients in Mathlib. The extended numbers need new definitions on , because the two Mathlib functions take natural numbers.
Notes and history
Stirling's book of 1730 has the tables of both kinds of numbers. The orthogonality relations and the inversion formula follow from those tables, but it is not clear how much of them Stirling stated. GKP94 Section 6.1 shows the extended table and the duality , and Knuth's paper "Two notes on notation" (1992) explains why the notation with brackets and braces makes such identities easy to see. GKP94 Section 6.2 relates the polynomials of degree to the second order Eulerian numbers.
TAOCP states the orthogonality relations as eq. 1.2.6(47), the theorem on Stirling and binomial with its inverse forms as eqs. 1.2.6(51) and 1.2.6(52), the mixed sum as eq. 1.2.6(55), the sums along a column as eq. 1.2.6(56), the case of the theorem on polynomials as eq. 1.2.6(57), the duality as eq. 1.2.6(58) and the forms for real arguments as eqs. 1.2.6(59) and 1.2.6(60). The remark on a sum with both kinds is eq. 1.2.6(54). The outline put that equation in Chapter 7, but it is an identity about Stirling numbers, so this section states it.
Eulerian numbers
Statement
A permutation written as a list goes up at some places and down at others. The Eulerian numbers count the permutations by the number of places where the list goes up. They give a third way to write , this time with binomial coefficients whose upper index is , and they are connected with the Stirling numbers of the second kind by a pair of inverse sums. TAOCP uses them in Section 5.1.3 for the runs of a permutation, and this section prepares that use.
Definition P2.8.44 (ascent and Eulerian number). Let be a permutation of written as a list. An ascent is an index with and , and a descent is an index with and . For integers and , the Eulerian number is the number of permutations of with exactly ascents.
Example P2.8.45. For the permutation has ascents, has none, and each of , , and has exactly one. So , and . The empty permutation has no ascent, so .
Example P2.8.46. A permutation of elements has between and ascents, so for and for . The first rows, for , are
Theorem P2.8.47 (recurrence of the Eulerian numbers). For every integer and every integer ,
Lean: TAOCP.eulerian of TAOCP/Notation (tamnd/taocp-lean main) is defined by this recurrence, with TAOCP.eulerian_zero_zero and TAOCP.eulerian_succ_zero; the count of permutations by ascents is not yet stated. Mathlib has no Eulerian numbers.
Proof. For the left side is , and the right side is . Let . Every permutation of comes from exactly one permutation of by the insertion of into one of the gaps: before , between two neighbors, or after . Let have ascents, and so descents. Insertion before adds a descent and keeps the number of ascents. Insertion into an ascent gives , so the ascent stays and a descent is added. Insertion into a descent gives , which adds one ascent. Insertion after adds one ascent. So gaps keep ascents and gaps give ascents. A permutation with ascents comes from with in ways and from with in ways.
Theorem P2.8.48 (symmetry and row sum). For every integer and every integer , , and .
Lean: not in Mathlib.
Proof. The map is a one to one map of the permutations onto themselves, and it turns each ascent into a descent and each descent into an ascent. A permutation has indices that are ascents or descents, so ascents become ascents. Each permutation has some number of ascents, so the row sum is .
Lemma P2.8.49 (a step for Worpitzky). For every real and all integers and ,
Lean: not in Mathlib.
Proof. Let . The addition formula gives , so the right side is . The factorial form gives . So the right side is .
Theorem P2.8.50 (Worpitzky's identity). For every real and every integer ,
Lean: not in Mathlib.
Proof. Use induction on . For the sum is . Assume the identity for , multiply it by and use the lemma: In the first part change to . The coefficient of becomes , which is by the recurrence.
Theorem P2.8.51 (explicit formula for the Eulerian numbers). For all integers and ,
Lean: not in Mathlib.
Proof. For the right side is for and for , as it should be. Let , and let be an integer. Worpitzky's identity at , with the symmetry and the change , gives because for the upper index lies between and . Put this with into the right side of the theorem: Let . For , negation of the upper index gives , and the right side is for . So the inner sum is by Vandermonde's convolution. Only remains, and the result is .
Theorem P2.8.52 (Eulerian and Stirling). For all integers and ,
Lean: not in Mathlib.
Proof. Vandermonde's convolution gives . Put this into Worpitzky's identity: By Section 8.1, also . A polynomial has only one expansion in falling powers, so the coefficients of agree, and this is the first identity. For the second, fix and let for , for , and . The first identity with says . The computation in the proof of the inverse forms in Section 8.3, which uses the orthogonality of binomial coefficients, gives . With this is the second identity.
Corollary P2.8.53 (sums of powers). For all integers and ,
Lean: not in Mathlib.
Proof. Sum Worpitzky's identity over . The sum on the upper index (Section 6.3) gives . For the terms with the index satisfies , so .
Proof
The recurrence comes from the insertion of the largest element, as for both kinds of Stirling numbers, and the symmetry from the reflection . Worpitzky's identity is an induction whose step is the lemma, a fact about one binomial coefficient. Everything else follows from Worpitzky's identity with tools of Chapter 7: the explicit formula from Vandermonde's convolution in the negated form, the link with Stirling numbers from the convolution and the uniqueness of the expansion in falling powers, and the inverse link from binomial inversion. The sums of powers follow from the sum on the upper index.
Examples
Example P2.8.54. Worpitzky's identity for is . At it reads , and at it reads .
Example P2.8.55. The explicit formula with and gives , and with it gives .
Example P2.8.56. The link with Stirling numbers for and reads , and indeed .
Example P2.8.57. The corollary on sums of powers for gives . For the right side is , as in Section 8.1.
Example P2.8.58. The recurrence computes the row from the row , which is : and .
Exercises
- [10] Compute the row of the Eulerian numbers with the recurrence, and check its sum.
- [M15] List the permutations of with exactly one ascent.
- [M15] Prove that for every .
- [M20] Use the corollary on sums of powers to find , and check that it equals .
- [M15] A run of a permutation is a maximal block of consecutive entries . Prove that the number of permutations of with exactly runs is for .
- [M20] Prove that for every . What is the mean number of ascents of a permutation?
- [M20] Use the second identity of the theorem on Eulerian and Stirling numbers to compute from the numbers .
Lean
TAOCP/Notation (tamnd/taocp-lean main) defines TAOCP.eulerian : ℕ → ℕ → ℕ by the recurrence of this section, with TAOCP.eulerian_zero_zero and TAOCP.eulerian_succ_zero. Its last case is eulerian (n+1) (k+1) = (k+2) * eulerian n (k+1) + (n-k) * eulerian n k, which is the recurrence with and in place of and ; the subtraction is truncated on , and the file notes that the truncation does not change the value. Mathlib has no Eulerian numbers of this kind; its Eulerian names are about Eulerian paths in graphs. The count of permutations by ascents, the symmetry, Worpitzky's identity and the link with Nat.stirlingSecond are not yet stated.
Notes and history
Euler met these numbers in 1755 in the sums , which are rational functions with the Eulerian numbers in the numerator: . The count of permutations by ascents came much later, in the twentieth century. Julius Worpitzky proved his identity in 1883. The notation with angle brackets is the one of TAOCP Section 5.1.3, and GKP94 Section 6.2 uses it as well.
TAOCP does not list the Eulerian numbers among the equations of Section 1.2.6; it uses them in Section 5.1.3, where the runs of a permutation and Worpitzky's identity appear. So no equation of TAOCP 1.2 maps to this section. This section ends the chapter. The table shows where the equations of TAOCP 1.2 that the outline gives to this chapter appear, together with eq. 1.2.6(54), which this chapter states although the outline gives it to Chapter 7.
| TAOCP 1.2 | Result of P2 |
|---|---|
| 1.2.6(44) | Theorem P2.8.19 (rising and falling powers in powers) |
| 1.2.6(45) | Theorem P2.8.5 (powers in falling powers) |
| 1.2.6(46) | Theorem P2.8.4 (recurrence of the second kind), Theorem P2.8.18 (recurrence of the first kind) |
| 1.2.6(47) | Theorem P2.8.26 (orthogonality of the Stirling numbers) |
| 1.2.6(48) to 1.2.6(50) | Theorem P2.8.7 (special values of the second kind), Theorem P2.8.20 (special values of the first kind) |
| 1.2.6(51) | Theorem P2.8.28 (Stirling and binomial), Corollary P2.8.29 (the inverse forms) |
| 1.2.6(52) | Theorem P2.8.28 (Stirling and binomial), Corollary P2.8.29 (the inverse forms) |
| 1.2.6(53) | Theorem P2.8.6 (explicit formula for the second kind) |
| 1.2.6(54) | Remark P2.8.33 (a sum with both kinds) |
| 1.2.6(55) | Theorem P2.8.30 (a mixed sum) |
| 1.2.6(56) | Theorem P2.8.31 (sums along a column) |
| 1.2.6(57) | Theorem P2.8.32 (polynomials of degree 2m) |
| 1.2.6(58) | Theorem P2.8.37 (extension and duality) |
| 1.2.6(59), 1.2.6(60) | Remark P2.8.38 (real upper arguments) |
Chapter 3 wrote polynomials in two bases, the ordinary powers and the falling powers , and it showed that sums are easy in the second basis. The numbers that change one basis into the other are the Stirling numbers. They have two kinds, written and , and each kind counts a natural set of objects: permutations with cycles and partitions of a set into blocks. This chapter defines both kinds by these counts, proves the change of basis, and proves the identities that connect the two kinds with each other and with the binomial coefficients. The last section adds a third family, the Eulerian numbers, which count permutations by their ascents.
Section 8.1 is about the numbers of the second kind. It proves their recurrence, the expansion of in falling powers and the explicit formula by binomial inversion. Section 8.2 is about the numbers of the first kind. It proves their recurrence, the expansion of the rising and falling powers in ordinary powers and the formula . Section 8.3 proves the two orthogonality relations and Stirling inversion, the sums that move between the kinds and between Stirling and binomial numbers, the fact that and are polynomials in of degree , and the duality for the numbers extended to all integers. Section 8.4 defines the Eulerian numbers, proves their recurrence and symmetry, and proves Worpitzky's identity and its link with the numbers of the second kind.
TAOCP uses these numbers from Section 1.2.6 on, where eqs. 1.2.6(44) to 1.2.6(60) list their main properties; the table at the end of Section 8.4 maps each of these equations to its item here. Section 1.2.9 meets the Stirling numbers in generating functions, Section 1.2.10 uses for the analysis of Algorithm M, and Section 5.1.3 counts permutations by their runs with the Eulerian numbers. The volume P3 proves the generating functions of all three families.
The chapter assumes P1 (induction, sets, functions and permutations) and the earlier chapters of P2. Chapter 3 gives the falling and rising powers and , the difference operator and the sums of falling powers. Chapter 6 gives the binomial coefficients, and Chapter 7 gives Vandermonde's convolution, the polynomial argument and binomial inversion. Chapter 9 treats the harmonic numbers in full; this chapter needs only their definition .
The source of this page. Something is wrong? Report it.