taocp

This site has no text of the book. Keep your own copy of TAOCP next to it. See what is checked.

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
  1. Stirling numbers of the second kind
  2. Stirling numbers of the first kind
  3. Stirling inversion and identities
  4. Eulerian numbers

Stirling numbers of the second kind

Statement

A power xnx^n is a polynomial of degree nn, and Chapter 3 showed that the falling powers x0‾,x1‾,…,xn‾x^{\underline{0}}, x^{\underline{1}}, \dots, x^{\underline{n}} are a basis for the polynomials of degree at most nn. So xnx^n 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 SS be a finite set. A partition of SS is a set of nonempty subsets of SS, called blocks, such that each element of SS is in exactly one block. For integers n≥0n \ge 0 and kk, the Stirling number of the second kind {nk}{n \brace k} is the number of partitions of {1,2,…,n}\{1, 2, \dots, n\} into exactly kk blocks.

Example P2.8.2. The partitions of {1,2,3,4}\{1, 2, 3, 4\} into two blocks are {1}{2,3,4}\{1\}\{2,3,4\}, {2}{1,3,4}\{2\}\{1,3,4\}, {3}{1,2,4}\{3\}\{1,2,4\}, {4}{1,2,3}\{4\}\{1,2,3\}, {1,2}{3,4}\{1,2\}\{3,4\}, {1,3}{2,4}\{1,3\}\{2,4\} and {1,4}{2,3}\{1,4\}\{2,3\}. So {42}=7{4 \brace 2} = 7. The partitions into three blocks have one block of two elements, and there are (42)=6\binom42 = 6 choices for it, so {43}=6{4 \brace 3} = 6.

Example P2.8.3. The empty set has exactly one partition, the empty set of blocks, so {00}=1{0 \brace 0} = 1. For n≥1n \ge 1 there is no partition into 00 blocks, so {n0}=0{n \brace 0} = 0. There is no partition into k>nk > n blocks, because each block has an element, and there is none into k<0k < 0 blocks. The first rows, for 0≤k≤n0 \le k \le n, are nk=0123456011012011301314017615011525101601319065151\begin{array}{c|ccccccc} n & k=0 & 1 & 2 & 3 & 4 & 5 & 6 \\ \hline 0 & 1 \\ 1 & 0 & 1 \\ 2 & 0 & 1 & 1 \\ 3 & 0 & 1 & 3 & 1 \\ 4 & 0 & 1 & 7 & 6 & 1 \\ 5 & 0 & 1 & 15 & 25 & 10 & 1 \\ 6 & 0 & 1 & 31 & 90 & 65 & 15 & 1 \end{array}

Theorem P2.8.4 (recurrence of the second kind). For every integer n≥0n \ge 0 and every integer kk, {n+1k}=k{nk}+{nk−1}.{n+1 \brace k} = k{n \brace k} + {n \brace k-1}.

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 {1,…,n+1}\{1, \dots, n+1\} into kk blocks into two classes. In the first class the block of n+1n + 1 is {n+1}\{n+1\}. Delete that block; the result is a partition of {1,…,n}\{1, \dots, n\} into k−1k - 1 blocks, and each such partition arises once. So the first class has {nk−1}{n \brace k-1} members. In the second class the block of n+1n + 1 has other elements. Delete n+1n + 1 from its block; the result is a partition of {1,…,n}\{1, \dots, n\} into kk blocks. Each such partition arises exactly kk times, once for each block to which n+1n + 1 can be added. So the second class has k{nk}k{n \brace k} members. For k≤0k \le 0 both sides are zero. □\square

Theorem P2.8.5 (powers in falling powers). For every real xx and every integer n≥0n \ge 0, xn=∑k{nk}xk‾.x^n = \sum_k {n \brace k} x^{\underline{k}}.

Lean: Mathlib Nat.pow_eq_sum_stirlingSecond_mul_descFactorial, for a natural number xx with Nat.descFactorial as the falling power (proved in Mathlib).

Proof. First let xx be a positive integer, and count the functions ff from {1,…,n}\{1, \dots, n\} to {1,…,x}\{1, \dots, x\} in two ways. There are xnx^n of them, since each of the nn elements has xx choices for its value. On the other hand, each ff defines a partition of {1,…,n}\{1, \dots, n\}: two elements are in the same block when ff has the same value at them. If this partition has kk blocks, then ff gives distinct values to the kk blocks. Conversely, a partition into kk 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 x(x−1)⋯(x−k+1)=xk‾x(x-1)\cdots(x-k+1) = x^{\underline{k}} assignments. So the number of functions is ∑k{nk}xk‾\sum_k {n \brace k}x^{\underline{k}}. Both sides of the identity are polynomials in xx, and they agree at every positive integer, so they are the same polynomial (Section 6.4). □\square

Theorem P2.8.6 (explicit formula for the second kind). For all integers n≥0n \ge 0 and m≥0m \ge 0, the number of functions from an nn-element set onto an mm-element set is m!{nm}m!{n \brace m}, and m!{nm}=∑k(mk)(−1)m−kkn.m!{n \brace m} = \sum_k \binom{m}{k}(-1)^{m-k}k^n.

Lean: not in Mathlib.

Proof. A function onto {1,…,m}\{1, \dots, m\} defines a partition of {1,…,n}\{1, \dots, n\} into mm blocks, as in the previous proof, and it gives distinct values to the blocks. Since every value is used, the mm blocks get the mm values in one of m!m! orders. So there are m!{nm}m!{n \brace m} such functions. Call this number g(m)g(m). Each function from {1,…,n}\{1, \dots, n\} to {1,…,m}\{1, \dots, m\} maps onto its image, a subset TT of {1,…,m}\{1, \dots, m\}, and for a fixed TT with kk elements there are g(k)g(k) such functions. So mn=∑k(mk)g(k)for every m≥0.m^n = \sum_k \binom{m}{k} g(k) \quad \text{for every } m \ge 0. Binomial inversion (Section 7.2) gives g(m)=∑k(mk)(−1)m−kkng(m) = \sum_k \binom{m}{k}(-1)^{m-k}k^n. □\square

The formula also follows from the difference formula of Section 7.2: the right side is Δmxn\Delta^m x^n at x=0x = 0. 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 n≥1n \ge 1, {n1}=1,{n2}=2n−1−1,{nn−1}=(n2),{nn}=1,{n \brace 1} = 1, \qquad {n \brace 2} = 2^{n-1} - 1, \qquad {n \brace n-1} = \binom{n}{2}, \qquad {n \brace n} = 1, and {n0}=0{n \brace 0} = 0, while {00}=1{0 \brace 0} = 1.

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 k=2k = 2 is not in Mathlib.

Proof. The only partition into one block is {S}\{S\}, and the only partition into nn blocks is the partition into single elements. A partition into n−1n - 1 blocks has exactly one block with two elements and n−2n - 2 blocks with one element, so it is fixed by the choice of the block of two elements, and there are (n2)\binom{n}{2} choices. For two blocks, the explicit formula with m=2m = 2 gives 2{n2}=2n−22{n \brace 2} = 2^n - 2. A direct count gives the same: the block that contains 11 is {1}\{1\} together with a subset of {2,…,n}\{2, \dots, n\} that is not the whole set, and there are 2n−1−12^{n-1} - 1 such subsets. The values for k=0k = 0 are in the example after the definition. □\square

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 xx. 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 n=3n = 3 the theorem on powers says x3=x3‾+3x2‾+x1‾x^3 = x^{\underline{3}} + 3x^{\underline{2}} + x^{\underline{1}}. At x=4x = 4 this reads 64=24+36+464 = 24 + 36 + 4. At x=−1x = -1 it reads −1=−6+6−1-1 = -6 + 6 - 1.

Example P2.8.9. The explicit formula with n=4n = 4 and m=2m = 2 gives 2{42}=−(21)⋅1+(22)⋅16=142{4 \brace 2} = -\binom21 \cdot 1 + \binom22 \cdot 16 = 14, so {42}=7{4 \brace 2} = 7, as in the first example. With n=5n = 5 and m=3m = 3 it gives 6{53}=35−3⋅25+3=1506{5 \brace 3} = 3^5 - 3 \cdot 2^5 + 3 = 150, so {53}=25{5 \brace 3} = 25.

Example P2.8.10. The change of basis turns a sum of powers into a sum of falling powers, which Chapter 3 can sum: ∑0≤x<Nxk‾=Nk+1‾/(k+1)\sum_{0 \le x < N} x^{\underline{k}} = N^{\underline{k+1}}/(k+1). For n=3n = 3, ∑0≤x<Nx3=N4‾4+N3‾+N2‾2.\sum_{0 \le x < N} x^3 = \frac{N^{\underline{4}}}{4} + N^{\underline{3}} + \frac{N^{\underline{2}}}{2}. For N=4N = 4 the right side is 6+24+6=36=0+1+8+276 + 24 + 6 = 36 = 0 + 1 + 8 + 27.

Example P2.8.11. The recurrence computes the table row by row. From the row n=4n = 4, which is 0,1,7,6,10, 1, 7, 6, 1, it gives {53}=3⋅6+7=25{5 \brace 3} = 3 \cdot 6 + 7 = 25 and {54}=4⋅1+6=10{5 \brace 4} = 4 \cdot 1 + 6 = 10.

Exercises

  1. [10] Compute the row n=7n = 7 of the numbers {nk}{n \brace k} with the recurrence.
  2. [M15] Prove that {n3}=16(3n−3⋅2n+3){n \brace 3} = \frac16(3^n - 3 \cdot 2^n + 3) for every n≥1n \ge 1.
  3. [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?
  4. [M20] The Bell number ϖn\varpi_n is the number of all partitions of {1,…,n}\{1, \dots, n\}, so ϖn=∑k{nk}\varpi_n = \sum_k {n \brace k}. Prove that ϖn+1=∑k(nk)ϖk\varpi_{n+1} = \sum_k \binom{n}{k}\varpi_k for n≥0n \ge 0, and compute ϖ0,…,ϖ6\varpi_0, \dots, \varpi_6.
  5. [M20] Use the change of basis and the sums of falling powers to write ∑0≤x<Nx4\sum_{0 \le x < N} x^4 in falling powers of NN. Check the result for N=3N = 3.
  6. [M20] Prove that {nn−3}=(n4)+10(n5)+15(n6){n \brace n-3} = \binom{n}{4} + 10\binom{n}{5} + 15\binom{n}{6} for n≥3n \ge 3 by a count of the sizes of the blocks.
  7. [M15] Prove that ∑k{nk}(−1)kk!=(−1)n\sum_k {n \brace k}(-1)^k k! = (-1)^n for every n≥0n \ge 0.

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 nn elements into kk 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 xx; the form for a real xx 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 {nk}{n \brace k} 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 ∑n{nk}zn=zk/((1−z)(1−2z)⋯(1−kz))\sum_n {n \brace k} z^n = z^k/((1-z)(1-2z)\cdots(1-kz)), 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 xn‾=x(x+1)⋯(x+n−1)x^{\overline{n}} = x(x+1)\cdots(x+n-1) and the falling power xn‾x^{\underline{n}} as polynomials in xx. The coefficients are again integers that count, and this time they count permutations by their cycles.

Definition P2.8.12 (cycle). Let π\pi be a permutation of a finite set SS. The cycle of an element aa is the list a,π(a),π(π(a)),…a, \pi(a), \pi(\pi(a)), \dots, which returns to aa after a finite number of steps because SS is finite and π\pi is one to one. The cycles of π\pi split SS into disjoint sets. A cycle is written (a π(a) π(π(a)) … )(a\ \pi(a)\ \pi(\pi(a))\ \dots), 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 {1,…,5}\{1, \dots, 5\} with π(1)=3\pi(1) = 3, π(2)=1\pi(2) = 1, π(3)=2\pi(3) = 2, π(4)=5\pi(4) = 5 and π(5)=4\pi(5) = 4 has the cycles (1 3 2)(1\ 3\ 2) and (4 5)(4\ 5). The identity permutation of {1,…,n}\{1, \dots, n\} has nn cycles, all of them fixed points.

Example P2.8.14. A permutation of {1,2,3}\{1, 2, 3\} with one cycle is (1 2 3)(1\ 2\ 3) or (1 3 2)(1\ 3\ 2). The permutations with two cycles are (1 2)(3)(1\ 2)(3), (1 3)(2)(1\ 3)(2) and (2 3)(1)(2\ 3)(1). The identity has three cycles. These are the 3!=63! = 6 permutations of the set.

Definition P2.8.15 (Stirling number of the first kind). For integers n≥0n \ge 0 and kk, the Stirling number of the first kind [nk]{n \brack k} is the number of permutations of {1,…,n}\{1, \dots, n\} with exactly kk cycles. The empty permutation has no cycle, so [00]=1{0 \brack 0} = 1, and [nk]=0{n \brack k} = 0 for k>nk > n and for k<0k < 0, and also for k=0<nk = 0 < n.

Example P2.8.16. The second example above shows [31]=2{3 \brack 1} = 2, [32]=3{3 \brack 2} = 3 and [33]=1{3 \brack 3} = 1. For n=4n = 4 and k=2k = 2 a permutation has either a cycle of three elements and a fixed point, with 4⋅2=84 \cdot 2 = 8 choices, or two cycles of two elements, with 33 choices. So [42]=11{4 \brack 2} = 11.

Example P2.8.17. The first rows, for 0≤k≤n0 \le k \le n, are nk=0123456011012011302314061161502450351016012027422585151\begin{array}{c|ccccccc} n & 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} Each row has the sum n!n!, since every permutation has some number of cycles.

Theorem P2.8.18 (recurrence of the first kind). For every integer n≥0n \ge 0 and every integer kk, [n+1k]=n[nk]+[nk−1].{n+1 \brack k} = n{n \brack k} + {n \brack k-1}.

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 π\pi of {1,…,n+1}\{1, \dots, n+1\} with kk cycles into two classes. In the first class n+1n + 1 is a fixed point. Delete it; the result is a permutation of {1,…,n}\{1, \dots, n\} with k−1k - 1 cycles, and each one arises once. So the first class has [nk−1]{n \brack k-1} members. In the second class π(i)=n+1\pi(i) = n + 1 for some i≤ni \le n. Delete n+1n + 1 from its cycle, that is, define σ(i)=π(n+1)\sigma(i) = \pi(n+1) and σ(j)=π(j)\sigma(j) = \pi(j) for the other j≤nj \le n. Then σ\sigma is a permutation of {1,…,n}\{1, \dots, n\} with kk cycles. Conversely, from σ\sigma and the choice of ii in {1,…,n}\{1, \dots, n\}, put n+1n + 1 in the cycle of ii right after ii. So each σ\sigma arises from exactly nn permutations π\pi, and the second class has n[nk]n{n \brack k} members. □\square

Theorem P2.8.19 (rising and falling powers in powers). For every real xx and every integer n≥0n \ge 0, xn‾=∑k[nk]xk,xn‾=∑k[nk](−1)n−kxk.x^{\overline{n}} = \sum_k {n \brack k} x^k, \qquad x^{\underline{n}} = \sum_k {n \brack k}(-1)^{n-k} x^k.

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 nn. For n=0n = 0 both sides of the first identity are 11. Assume it for nn. Then xn+1‾=(x+n) xn‾=∑k[nk]xk+1+∑kn[nk]xk.x^{\overline{n+1}} = (x + n)\,x^{\overline{n}} = \sum_k {n \brack k} x^{k+1} + \sum_k n{n \brack k} x^k. The coefficient of xkx^k is [nk−1]+n[nk]{n \brack k-1} + n{n \brack k}, which is [n+1k]{n+1 \brack k} by the recurrence. For the second identity, note that xn‾=x(x−1)⋯(x−n+1)=(−1)n(−x)(−x+1)⋯(−x+n−1)=(−1)n(−x)n‾x^{\underline{n}} = x(x-1)\cdots(x-n+1) = (-1)^n(-x)(-x+1)\cdots(-x+n-1) = (-1)^n(-x)^{\overline{n}}. Put −x-x into the first identity and multiply by (−1)n(-1)^n; the term kk gets the sign (−1)n+k=(−1)n−k(-1)^{n+k} = (-1)^{n-k}. □\square

Theorem P2.8.20 (special values of the first kind). For every integer n≥1n \ge 1, [n1]=(n−1)!,[nn−1]=(n2),[nn]=1,[n+12]=n! Hn,{n \brack 1} = (n-1)!, \qquad {n \brack n-1} = \binom{n}{2}, \qquad {n \brack n} = 1, \qquad {n+1 \brack 2} = n!\,H_n, where Hn=1+12+⋯+1nH_n = 1 + \frac12 + \cdots + \frac1n. Also [n0]=0{n \brack 0} = 0 and [00]=1{0 \brack 0} = 1, and ∑k[nk]=n!\sum_k {n \brack k} = n!.

Lean: Mathlib Nat.stirlingFirst_one_right, Nat.stirlingFirst_succ_self_left and Nat.stirlingFirst_self (proved in Mathlib); the value of [n+12]{n+1 \brack 2} with harmonic is not in Mathlib.

Proof. A permutation with one cycle is the cycle (1 a2 a3…an)(1\ a_2\ a_3 \dots a_n) written from 11, where a2,…,ana_2, \dots, a_n is any order of {2,…,n}\{2, \dots, n\}; so there are (n−1)!(n-1)! of them. A permutation with n−1n - 1 cycles exchanges two elements and fixes the others, and there are (n2)\binom{n}{2} choices of the two elements. The identity is the only permutation with nn cycles. The row sum is the number of all permutations. For the value with k=2k = 2, the recurrence gives [n+12]=n[n2]+[n1]=n[n2]+(n−1)!{n+1 \brack 2} = n{n \brack 2} + {n \brack 1} = n{n \brack 2} + (n-1)!. Divide by n!n!: with an=[n+12]/n!a_n = {n+1 \brack 2}/n! this reads an=an−1+1na_n = a_{n-1} + \frac1n for n≥2n \ge 2, and a1=[22]/1!=1=H1a_1 = {2 \brack 2}/1! = 1 = H_1. So an=Hna_n = H_n by induction. □\square

Theorem P2.8.21 (mean number of cycles). For every integer n≥1n \ge 1, ∑kk[nk]=n! Hn\sum_k k{n \brack k} = n!\,H_n. So a permutation of {1,…,n}\{1, \dots, n\}, chosen with all n!n! permutations equally likely, has HnH_n cycles on average.

Lean: not in Mathlib.

Proof. Let p(x)=xn‾=∑k[nk]xkp(x) = x^{\overline{n}} = \sum_k {n \brack k}x^k. Then p′(1)=∑kk[nk]p'(1) = \sum_k k{n \brack k}. On the other hand p(x)=∏j=0n−1(x+j)p(x) = \prod_{j=0}^{n-1}(x + j), and the product rule gives p′(x)=p(x)∑j=0n−11x+jp'(x) = p(x)\sum_{j=0}^{n-1}\frac{1}{x+j} for x>0x > 0. At x=1x = 1 this is n! (1+12+⋯+1n)=n! Hnn!\,(1 + \frac12 + \cdots + \frac1n) = n!\,H_n. □\square

Proof

The recurrence follows the largest element, as in Section 8.1, but now the element can enter an existing cycle in nn ways, one after each element, so the factor is nn and not kk. The expansion of the rising power is the recurrence in the language of polynomials: multiplication by x+nx + n shifts the coefficients and adds nn times them. The falling power differs from the rising power only by the signs. The special values are direct counts, and the value of [n+12]{n+1 \brack 2} comes from the recurrence divided by n!n!. The mean number of cycles is the derivative of xn‾x^{\overline{n}} at x=1x = 1; it equals [n+12]/n!{n+1 \brack 2}/n!, a fact that Section 8.3 explains.

Examples

Example P2.8.22. For n=3n = 3 the theorem on powers says x3‾=x3+3x2+2xx^{\overline{3}} = x^3 + 3x^2 + 2x and x3‾=x3−3x2+2xx^{\underline{3}} = x^3 - 3x^2 + 2x. At x=2x = 2 these read 2⋅3⋅4=24=8+12+42 \cdot 3 \cdot 4 = 24 = 8 + 12 + 4 and 2⋅1⋅0=0=8−12+42 \cdot 1 \cdot 0 = 0 = 8 - 12 + 4.

Example P2.8.23. The value of [n+12]{n+1 \brack 2} for n=3n = 3 is 3! H3=6(1+12+13)=113!\,H_3 = 6\left(1 + \frac12 + \frac13\right) = 11, which is the number [42]{4 \brack 2} of the example after the definition. For n=5n = 5 it is 120⋅13760=274120 \cdot \frac{137}{60} = 274, the entry of the table.

Example P2.8.24. For n=4n = 4 the mean number of cycles is 124(1⋅6+2⋅11+3⋅6+4⋅1)=5024=2512=H4\frac{1}{24}(1 \cdot 6 + 2 \cdot 11 + 3 \cdot 6 + 4 \cdot 1) = \frac{50}{24} = \frac{25}{12} = H_4.

Example P2.8.25. The recurrence computes the row n=5n = 5 from the row n=4n = 4, which is 0,6,11,6,10, 6, 11, 6, 1: [52]=4⋅11+6=50{5 \brack 2} = 4 \cdot 11 + 6 = 50 and [53]=4⋅6+11=35{5 \brack 3} = 4 \cdot 6 + 11 = 35.

Exercises

  1. [10] Compute the row n=7n = 7 of the numbers [nk]{n \brack k} with the recurrence.
  2. [M20] Prove that [nn−3]=6(n4)+20(n5)+15(n6){n \brack n-3} = 6\binom{n}{4} + 20\binom{n}{5} + 15\binom{n}{6} for n≥3n \ge 3 by a count of the lengths of the cycles.
  3. [M15] Prove that ∑k[nk]2k=(n+1)!\sum_k {n \brack k}2^k = (n+1)! for every n≥0n \ge 0.
  4. [M15] Prove that ∑k(−1)k[nk]=0\sum_k (-1)^k{n \brack k} = 0 for every n≥2n \ge 2. What is the sum for n=0n = 0 and n=1n = 1?
  5. [M15] List the cycle types of the permutations of {1,…,5}\{1, \dots, 5\} with three cycles, count each type, and check the total against the table.
  6. [M22] Prove that [n+13]=n!2(Hn2−Hn(2)){n+1 \brack 3} = \frac{n!}{2}\left(H_n^2 - H_n^{(2)}\right) for every n≥0n \ge 0, where Hn(2)=1+14+⋯+1n2H_n^{(2)} = 1 + \frac14 + \cdots + \frac1{n^2}.
  7. [M15] Prove that ∑k[nk](−1)n−knk=n!\sum_k {n \brack k}(-1)^{n-k}n^k = n! for every n≥0n \ge 0.

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 xn‾x^{\overline{n}} and the formula with HnH_n are not yet stated. A formal statement of [n+12]=n! Hn{n+1 \brack 2} = n!\,H_n uses harmonic of Mathlib, which is TAOCP.harmonicPow 1 by TAOCP.harmonicPow_one of TAOCP/Notation, and the sum Hn(2)H_n^{(2)} 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 xn‾x^{\underline{n}}, 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 s(n,k)=(−1)n−k[nk]s(n, k) = (-1)^{n-k}{n \brack k}, 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 [nk]{n \brack k} for the number of changes of the maximum in Algorithm M: the probability of kk changes is [nk+1]/n!{n \brack k+1}/n!, and the mean is Hn−1H_n - 1 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 {nn−m}{n \brace n-m} and [nn−m]{n \brack n-m} as polynomials in nn, 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 n≥0n \ge 0 and m≥0m \ge 0, ∑k[nk]{km}(−1)n−k=[m=n],∑k{nk}[km](−1)n−k=[m=n].\sum_k {n \brack k}{k \brace m}(-1)^{n-k} = [m = n], \qquad \sum_k {n \brace k}{k \brack m}(-1)^{n-k} = [m = n].

Lean: not in Mathlib.

Proof. Put the expansion of Section 8.2 into the expansion of Section 8.1: xn=∑k{nk}xk‾=∑k{nk}∑m[km](−1)k−mxm=∑m(∑k{nk}[km](−1)k−m)xm.x^n = \sum_k {n \brace k}x^{\underline{k}} = \sum_k {n \brace k}\sum_m {k \brack m}(-1)^{k-m}x^m = \sum_m \Bigl(\sum_k {n \brace k}{k \brack m}(-1)^{k-m}\Bigr)x^m. Two polynomials that agree for all real xx have the same coefficients, so the inner sum is [m=n][m = n]. The terms with kk outside m≤k≤nm \le k \le n are zero. If m=nm = n the signs (−1)k−m(-1)^{k-m} and (−1)n−k(-1)^{n-k} agree, and if m≠nm \ne n both sums are zero, so the sign may be written (−1)n−k(-1)^{n-k}. For the first identity, put the expansion of Section 8.1 into that of Section 8.2 in the same way: xn‾=∑k[nk](−1)n−k∑m{km}xm‾.x^{\underline{n}} = \sum_k {n \brack k}(-1)^{n-k}\sum_m {k \brace m}x^{\underline{m}}. The falling powers x0‾,x1‾,…x^{\underline{0}}, x^{\underline{1}}, \dots have the distinct degrees 0,1,…0, 1, \dots, so a polynomial has only one expansion in them, and the coefficient of xm‾x^{\underline{m}} is [m=n][m = n]. □\square

Theorem P2.8.27 (Stirling inversion). Let ff and gg be sequences indexed by the nonnegative integers. Then g(n)=∑k{nk}f(k)g(n) = \sum_k {n \brace k}f(k) for every n≥0n \ge 0 if and only if f(n)=∑k[nk](−1)n−kg(k)f(n) = \sum_k {n \brack k}(-1)^{n-k}g(k) for every n≥0n \ge 0.

Lean: not in Mathlib.

Proof. Assume the first equations. Then ∑k[nk](−1)n−kg(k)=∑jf(j)∑k[nk]{kj}(−1)n−k=∑jf(j)[j=n]=f(n),\sum_k {n \brack k}(-1)^{n-k}g(k) = \sum_j f(j)\sum_k {n \brack k}{k \brace j}(-1)^{n-k} = \sum_j f(j)[j = n] = f(n), by the first orthogonality relation; the sums are finite, so they may change places. The converse is the same computation with the second relation. □\square

Theorem P2.8.28 (Stirling and binomial). For all integers n≥0n \ge 0 and m≥0m \ge 0, {n+1m+1}=∑k(nk){km},[n+1m+1]=∑k[nk](km).{n+1 \brace m+1} = \sum_k \binom{n}{k}{k \brace m}, \qquad {n+1 \brack m+1} = \sum_k {n \brack k}\binom{k}{m}.

Lean: not in Mathlib.

Proof. For the first identity, take a partition of {1,…,n+1}\{1, \dots, n+1\} into m+1m + 1 blocks, and let KK be the set of elements that are not in the block of n+1n + 1. Then KK is a subset of {1,…,n}\{1, \dots, n\}, and the other mm blocks are a partition of KK. Conversely, a subset KK and a partition of KK into mm blocks give one such partition, with the block {1,…,n+1}∖K\{1, \dots, n+1\} \setminus K. There are (nk)\binom{n}{k} subsets with kk elements. For the second identity, use the rising powers: xn+1‾=x (x+1)n‾=x∑k[nk](x+1)k=∑k[nk]∑m(km)xm+1.x^{\overline{n+1}} = x\,(x+1)^{\overline{n}} = x\sum_k {n \brack k}(x+1)^k = \sum_k {n \brack k}\sum_m \binom{k}{m}x^{m+1}. The coefficient of xm+1x^{m+1} on the left is [n+1m+1]{n+1 \brack m+1} by Section 8.2. □\square

Corollary P2.8.29 (the inverse forms). For all integers n≥0n \ge 0 and m≥0m \ge 0, {nm}=∑k(nk){k+1m+1}(−1)n−k,[nm]=∑k[n+1k+1](km)(−1)k−m.{n \brace m} = \sum_k \binom{n}{k}{k+1 \brace m+1}(-1)^{n-k}, \qquad {n \brack m} = \sum_k {n+1 \brack k+1}\binom{k}{m}(-1)^{k-m}.

Lean: not in Mathlib.

Proof. For the first identity, fix mm; the theorem says that g(n)={n+1m+1}g(n) = {n+1 \brace m+1} is the binomial transform of f(k)={km}f(k) = {k \brace m}. Binomial inversion (Section 7.2) gives the claim. For the second, fix nn and let aj=[nj]a_j = {n \brack j} and bk=[n+1k+1]b_k = {n+1 \brack k+1}, so that bk=∑jaj(jk)b_k = \sum_j a_j\binom{j}{k}. Then ∑kbk(km)(−1)k−m=∑jaj∑k(jk)(km)(−1)k−m=∑jaj(−1)j−m[j=m]=am,\sum_k b_k\binom{k}{m}(-1)^{k-m} = \sum_j a_j\sum_k \binom{j}{k}\binom{k}{m}(-1)^{k-m} = \sum_j a_j(-1)^{j-m}[j = m] = a_m, by the orthogonality of binomial coefficients (Section 7.2), since (−1)k−m=(−1)j−m(−1)j−k(-1)^{k-m} = (-1)^{j-m}(-1)^{j-k}. □\square

Theorem P2.8.30 (a mixed sum). For all integers n≥0n \ge 0 and m≥0m \ge 0, ∑k{n+1k+1}[km](−1)k−m=(nm).\sum_k {n+1 \brace k+1}{k \brack m}(-1)^{k-m} = \binom{n}{m}.

Lean: not in Mathlib.

Proof. Expand {n+1k+1}{n+1 \brace k+1} by the theorem on Stirling and binomial, and change the order of the finite sums: ∑k∑j(nj){jk}[km](−1)k−m=∑j(nj)∑k{jk}[km](−1)k−m=∑j(nj)[j=m].\sum_k \sum_j \binom{n}{j}{j \brace k}{k \brack m}(-1)^{k-m} = \sum_j \binom{n}{j}\sum_k {j \brace k}{k \brack m}(-1)^{k-m} = \sum_j \binom{n}{j}[j = m]. The inner sum is the second orthogonality relation, with the sign (−1)k−m(-1)^{k-m} in place of (−1)j−k(-1)^{j-k}; as in its proof, the two signs agree when the sum is not zero. □\square

Theorem P2.8.31 (sums along a column). For all integers n≥0n \ge 0 and m≥0m \ge 0, [n+1m+1]=∑k=0n[km]n!k!,{n+1m+1}=∑k=0n{km}(m+1)n−k.{n+1 \brack m+1} = \sum_{k=0}^{n}{k \brack m}\frac{n!}{k!}, \qquad {n+1 \brace m+1} = \sum_{k=0}^{n}{k \brace m}(m+1)^{n-k}.

Lean: not in Mathlib.

Proof. Use induction on nn. For n=0n = 0 the left sides are [1m+1]={1m+1}=[m=0]{1 \brack m+1} = {1 \brace m+1} = [m = 0], and the right sides are [0m]={0m}=[m=0]{0 \brack m} = {0 \brace m} = [m = 0]. For n≥1n \ge 1 the recurrence of Section 8.2 and the hypothesis for n−1n - 1 give [n+1m+1]=[nm]+n[nm+1]=[nm]+n∑k=0n−1[km](n−1)!k!=∑k=0n[km]n!k!.{n+1 \brack m+1} = {n \brack m} + n{n \brack m+1} = {n \brack m} + n\sum_{k=0}^{n-1}{k \brack m}\frac{(n-1)!}{k!} = \sum_{k=0}^{n}{k \brack m}\frac{n!}{k!}. In the same way the recurrence of Section 8.1 gives {n+1m+1}={nm}+(m+1){nm+1}{n+1 \brace m+1} = {n \brace m} + (m+1){n \brace m+1}, and the factor m+1m + 1 raises each power (m+1)n−1−k(m+1)^{n-1-k} to (m+1)n−k(m+1)^{n-k}. □\square

Theorem P2.8.32 (polynomials of degree 2m). Let m≥0m \ge 0 be an integer. Let cm,jc_{m,j} be the number of partitions of a jj-element set into j−mj - m blocks with no block of one element, and let dm,jd_{m,j} be the number of permutations of a jj-element set with j−mj - m cycles and no fixed point. Then for every integer n≥0n \ge 0, {nn−m}=∑j=02mcm,j(nj),[nn−m]=∑j=02mdm,j(nj).{n \brace n-m} = \sum_{j=0}^{2m} c_{m,j}\binom{n}{j}, \qquad {n \brack n-m} = \sum_{j=0}^{2m} d_{m,j}\binom{n}{j}. So {nn−m}{n \brace n-m} and [nn−m]{n \brack n-m} are polynomials in nn of degree 2m2m, with the leading coefficient 12mm!\frac{1}{2^m m!}. In particular {nn−2}=(n+14)+2(n4),[nn−2]=(n4)+2(n+14).{n \brace n-2} = \binom{n+1}{4} + 2\binom{n}{4}, \qquad {n \brack n-2} = \binom{n}{4} + 2\binom{n+1}{4}.

Lean: not in Mathlib.

Proof. Take a partition of {1,…,n}\{1, \dots, n\} into n−mn - m blocks, and let JJ be the union of its blocks with at least two elements, with ∣J∣=j|J| = j. The blocks inside JJ are a partition of JJ into (n−m)−(n−j)=j−m(n - m) - (n - j) = j - m blocks with no block of one element, and the elements outside JJ are blocks of one element. Conversely, a set JJ and such a partition of JJ give one partition of {1,…,n}\{1, \dots, n\} into n−mn - m blocks. So {nn−m}=∑j(nj)cm,j{n \brace n-m} = \sum_j \binom{n}{j}c_{m,j}. Each of the j−mj - m blocks inside JJ has at least two elements, so j≥2(j−m)j \ge 2(j - m), that is, j≤2mj \le 2m. For j=2mj = 2m all blocks have two elements, and cm,2m=(2m)!2mm!c_{m,2m} = \frac{(2m)!}{2^m m!}: order the 2m2m elements in a row and pair them in order, and each partition into pairs arises from 2mm!2^m m! rows. Since (n2m)\binom{n}{2m} has the leading coefficient 1(2m)!\frac{1}{(2m)!}, the polynomial has the leading coefficient 12mm!\frac{1}{2^m m!}. The same argument with cycles and fixed points gives the second formula; for j=2mj = 2m all cycles have two elements, so dm,2m=cm,2md_{m,2m} = c_{m,2m}.

For m=2m = 2 the set JJ has j=3j = 3 or j=4j = 4 elements. For j=3j = 3 the partition of JJ is one block of three, so c2,3=1c_{2,3} = 1; for j=4j = 4 it is two blocks of two, so c2,4=3c_{2,4} = 3. So {nn−2}=(n3)+3(n4){n \brace n-2} = \binom{n}{3} + 3\binom{n}{4}. For cycles, a cycle of three elements can be written in 22 ways and two cycles of two in 33 ways, so [nn−2]=2(n3)+3(n4){n \brack n-2} = 2\binom{n}{3} + 3\binom{n}{4}. The addition formula (n+14)=(n4)+(n3)\binom{n+1}{4} = \binom{n}{4} + \binom{n}{3} turns these into the forms of the theorem. □\square

Remark P2.8.33 (a sum with both kinds). For integers n≥m≥0n \ge m \ge 0 there is also the identity ∑k(m−nm+k)(m+nn+k){m+kk}=[nn−m],\sum_k \binom{m-n}{m+k}\binom{m+n}{n+k}{m+k \brace k} = {n \brack n-m}, and the same identity with [m+kk]{m+k \brack k} on the left and {nn−m}{n \brace n-m} on the right. It expresses [nn−m]{n \brack n-m} by the numbers {m+kk}{m+k \brace k} 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 m=1m = 1.

Definition P2.8.34 (extended Stirling numbers). For all integers nn and kk, define {nk}{n \brace k} and [nk]{n \brack k} as follows. For n≥0n \ge 0 and k≥0k \ge 0 they are the numbers of Sections 8.1 and 8.2. For n≤0n \le 0 and k≤0k \le 0 let {nk}=[−k−n]{n \brace k} = {-k \brack -n} and [nk]={−k−n}{n \brack k} = {-k \brace -n}. In all other cases both are 00. At n=k=0n = k = 0 the two rules give the same value 11, and on the rest of the axes they give 00.

Example P2.8.35. The definition gives {−1−1}=[11]=1{-1 \brace -1} = {1 \brack 1} = 1, {−1−3}=[31]=2{-1 \brace -3} = {3 \brack 1} = 2 and {−2−4}=[42]=11{-2 \brace -4} = {4 \brack 2} = 11. In the other direction, [−2−4]={42}=7{-2 \brack -4} = {4 \brace 2} = 7.

Example P2.8.36. The values of {nk}{n \brace k} for −4≤n≤−1-4 \le n \le -1 and −5≤k≤−1-5 \le k \le -1 form a table that is the table of [nk]{n \brack k} of Section 8.2, reflected: nk=−1−2−3−4−5−1112624−20131150−3001635−4000110\begin{array}{c|ccccc} n & k=-1 & -2 & -3 & -4 & -5 \\ \hline -1 & 1 & 1 & 2 & 6 & 24 \\ -2 & 0 & 1 & 3 & 11 & 50 \\ -3 & 0 & 0 & 1 & 6 & 35 \\ -4 & 0 & 0 & 0 & 1 & 10 \end{array}

Theorem P2.8.37 (extension and duality). The extended numbers satisfy the recurrences {nk}=k{n−1k}+{n−1k−1},[nk]=(n−1)[n−1k]+[n−1k−1]{n \brace k} = k{n-1 \brace k} + {n-1 \brace k-1}, \qquad {n \brack k} = (n-1){n-1 \brack k} + {n-1 \brack k-1} for all integers nn and kk. They are the only functions on pairs of integers that satisfy these recurrences for all nn and kk together with the conditions {0k}=[0k]=[k=0]{0 \brace k} = {0 \brack k} = [k = 0] and {n0}=[n0]=[n=0]{n \brace 0} = {n \brack 0} = [n = 0]. For all integers nn and mm, {nm}=[−m−n].{n \brace m} = {-m \brack -n}.

Lean: not in Mathlib.

Proof. The duality holds by the definition: for n,m≥0n, m \ge 0 it is the rule for [−m−n]{-m \brack -n} with nonpositive arguments, for n,m≤0n, m \le 0 it is the rule for {nm}{n \brace m}, and in the other cases both sides are 00.

For the recurrence of {nk}{n \brace k}, consider four cases. If n≥1n \ge 1 and k≥1k \ge 1, all three terms have nonnegative arguments, and this is Section 8.1. If n≤0n \le 0 and k≤0k \le 0, put a=−ka = -k and b=−nb = -n; the three terms are [ab]{a \brack b}, [ab+1]{a \brack b+1} and [a+1b+1]{a+1 \brack b+1}, and the recurrence reads [a+1b+1]=a[ab+1]+[ab]{a+1 \brack b+1} = a{a \brack b+1} + {a \brack b}, which is Section 8.2. If n≥1n \ge 1 and k≤0k \le 0, the left side is 00, and each term on the right is 00: a term with first argument n−1≥0n - 1 \ge 0 and second argument kk or k−1k - 1 can be nonzero only at (0,0)(0, 0), and (n−1,k−1)≠(0,0)(n - 1, k - 1) \ne (0, 0), while the term k{n−1k}k{n-1 \brace k} at (0,0)(0, 0) has the factor k=0k = 0. If n≤0n \le 0 and k≥1k \ge 1, the left side is 00; the terms on the right have the first argument n−1<0n - 1 < 0, and they can be nonzero only if the second argument is ≤0\le 0, that is, only the term {n−10}{n-1 \brace 0} for k=1k = 1; it is [01−n]=0{0 \brack 1-n} = 0 since 1−n≥11 - n \ge 1. The recurrence of [nk]{n \brack k} 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 DD be the difference of two solutions of the recurrence of the second kind with the same conditions. Then DD satisfies the recurrence and is 00 on both axes. For n≥1n \ge 1, the recurrence gives row nn of DD from row n−1n - 1, so D=0D = 0 on the rows n≥0n \ge 0. Assume that row n≤0n \le 0 of DD is zero. The recurrence at (n,k+1)(n, k+1) gives (k+1)D(n−1,k+1)+D(n−1,k)=0(k+1)D(n-1, k+1) + D(n-1, k) = 0 for every kk. From D(n−1,0)=0D(n-1, 0) = 0 this gives D(n−1,k)=0D(n-1, k) = 0 for k≥1k \ge 1 step by step upward, and, with k=−1k = -1, D(n−1,−1)=0D(n-1, -1) = 0; then D(n−1,k)=−(k+1)D(n−1,k+1)=0D(n-1, k) = -(k+1)D(n-1, k+1) = 0 for k≤−2k \le -2 step by step downward. So row n−1n - 1 is zero. For the first kind the same argument uses (n−1)D(n−1,k)+D(n−1,k−1)=0(n-1)D(n-1, k) + D(n-1, k-1) = 0 with n−1≠0n - 1 \ne 0. □\square

Remark P2.8.38 (real upper arguments). By the theorem on polynomials of degree 2m2m, the numbers {nn−m}{n \brace n-m} and [nn−m]{n \brack n-m} are values of polynomials in nn, so they have a meaning for every real nn. TAOCP uses this to define {rr−m}{r \brace r-m} and [rr−m]{r \brack r-m} for real rr, and to write them as sums of binomial coefficients with rr 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 2m2m 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 n=3n = 3 and m=1m = 1 has the terms k=1,2,3k = 1, 2, 3: [31]{11}−[32]{21}+[33]{31}=2−3+1=0{3 \brack 1}{1 \brace 1} - {3 \brack 2}{2 \brace 1} + {3 \brack 3}{3 \brace 1} = 2 - 3 + 1 = 0.

Example P2.8.40. The theorem on Stirling and binomial with n=4n = 4 and m=1m = 1 gives {52}=(41){11}+(42){21}+(43){31}+(44){41}=4+6+4+1=15{5 \brace 2} = \binom41{1 \brace 1} + \binom42{2 \brace 1} + \binom43{3 \brace 1} + \binom44{4 \brace 1} = 4 + 6 + 4 + 1 = 15. This is 24−12^4 - 1, as Section 8.1 says.

Example P2.8.41. The mixed sum with n=3n = 3 and m=1m = 1 is {42}[11]−{43}[21]+{44}[31]=7−6+2=3=(31){4 \brace 2}{1 \brack 1} - {4 \brace 3}{2 \brack 1} + {4 \brace 4}{3 \brack 1} = 7 - 6 + 2 = 3 = \binom31.

Example P2.8.42. The theorem on polynomials gives {64}=(74)+2(64)=35+30=65{6 \brace 4} = \binom74 + 2\binom64 = 35 + 30 = 65 and [64]=(64)+2(74)=15+70=85{6 \brack 4} = \binom64 + 2\binom74 = 15 + 70 = 85, the entries of the tables.

Example P2.8.43. The recurrence of the second kind at n=−1n = -1 and k=−2k = -2 reads {−1−2}=−2{−2−2}+{−2−3}{-1 \brace -2} = -2{-2 \brace -2} + {-2 \brace -3}, that is, 1=−2⋅1+31 = -2 \cdot 1 + 3.

Exercises

  1. [M15] Check the second orthogonality relation for n=4n = 4 and m=2m = 2.
  2. [M20] Find all sequences ff with ∑k{nk}f(k)=1\sum_k {n \brace k}f(k) = 1 for every n≥0n \ge 0.
  3. [M15] Compute {63}{6 \brace 3} with the sums along a column.
  4. [M18] Check the remark on a sum with both kinds for m=1m = 1 and every n≥1n \ge 1.
  5. [M15] Compute {−3−5}{-3 \brace -5} and [−2−4]{-2 \brack -4}, and check the second with the recurrence of the first kind at n=−1n = -1, k=−3k = -3.
  6. [M20] Use the sums along a column with m=1m = 1 to prove [n+12]=n! Hn{n+1 \brack 2} = n!\,H_n again.
  7. [M25] The Lah numbers are L(n,k)=∑j[nj]{jk}L(n, k) = \sum_j {n \brack j}{j \brace k}. Prove that xn‾=∑kL(n,k)xk‾x^{\overline{n}} = \sum_k L(n, k)x^{\underline{k}}, and that L(n,k)=(n−1k−1)n!k!L(n, k) = \binom{n-1}{k-1}\frac{n!}{k!} for n≥1n \ge 1.

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 ℤ\mathbb{Z}; 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 ℤ×ℤ\mathbb{Z} \times \mathbb{Z}, 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 {nm}=[−m−n]{n \brace m} = {-m \brack -n}, 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 2m2m 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 m=2m = 2 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 xnx^n, this time with binomial coefficients whose upper index is x+kx + k, 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 a1a2…ana_1 a_2 \dots a_n be a permutation of {1,…,n}\{1, \dots, n\} written as a list. An ascent is an index jj with 1≤j<n1 \le j < n and aj<aj+1a_j < a_{j+1}, and a descent is an index jj with 1≤j<n1 \le j < n and aj>aj+1a_j > a_{j+1}. For integers n≥0n \ge 0 and kk, the Eulerian number ⟨nk⟩\left\langle {n \atop k} \right\rangle is the number of permutations of {1,…,n}\{1, \dots, n\} with exactly kk ascents.

Example P2.8.45. For n=3n = 3 the permutation 123123 has 22 ascents, 321321 has none, and each of 132132, 213213, 231231 and 312312 has exactly one. So ⟨30⟩=1\left\langle {3 \atop 0} \right\rangle = 1, ⟨31⟩=4\left\langle {3 \atop 1} \right\rangle = 4 and ⟨32⟩=1\left\langle {3 \atop 2} \right\rangle = 1. The empty permutation has no ascent, so ⟨00⟩=1\left\langle {0 \atop 0} \right\rangle = 1.

Example P2.8.46. A permutation of n≥1n \ge 1 elements has between 00 and n−1n - 1 ascents, so ⟨nk⟩=0\left\langle {n \atop k} \right\rangle = 0 for k<0k < 0 and for k≥nk \ge n. The first rows, for 0≤k≤n−10 \le k \le n - 1, are nk=01234511211314141111115126662616157302302571\begin{array}{c|cccccc} n & k=0 & 1 & 2 & 3 & 4 & 5 \\ \hline 1 & 1 \\ 2 & 1 & 1 \\ 3 & 1 & 4 & 1 \\ 4 & 1 & 11 & 11 & 1 \\ 5 & 1 & 26 & 66 & 26 & 1 \\ 6 & 1 & 57 & 302 & 302 & 57 & 1 \end{array}

Theorem P2.8.47 (recurrence of the Eulerian numbers). For every integer n≥1n \ge 1 and every integer kk, ⟨nk⟩=(k+1)⟨n−1k⟩+(n−k)⟨n−1k−1⟩.\left\langle {n \atop k} \right\rangle = (k+1)\left\langle {n-1 \atop k} \right\rangle + (n-k)\left\langle {n-1 \atop k-1} \right\rangle.

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 n=1n = 1 the left side is [k=0][k = 0], and the right side is (k+1)[k=0]+(1−k)[k=1]=[k=0](k+1)[k = 0] + (1 - k)[k = 1] = [k = 0]. Let n≥2n \ge 2. Every permutation of {1,…,n}\{1, \dots, n\} comes from exactly one permutation b1…bn−1b_1 \dots b_{n-1} of {1,…,n−1}\{1, \dots, n-1\} by the insertion of nn into one of the nn gaps: before b1b_1, between two neighbors, or after bn−1b_{n-1}. Let bb have jj ascents, and so n−2−jn - 2 - j descents. Insertion before b1b_1 adds a descent and keeps the number of ascents. Insertion into an ascent bi<bi+1b_i < b_{i+1} gives bi<n>bi+1b_i < n > b_{i+1}, so the ascent stays and a descent is added. Insertion into a descent bi>bi+1b_i > b_{i+1} gives bi<n>bi+1b_i < n > b_{i+1}, which adds one ascent. Insertion after bn−1b_{n-1} adds one ascent. So j+1j + 1 gaps keep jj ascents and n−1−jn - 1 - j gaps give j+1j + 1 ascents. A permutation with kk ascents comes from bb with j=kj = k in k+1k + 1 ways and from bb with j=k−1j = k - 1 in n−kn - k ways. □\square

Theorem P2.8.48 (symmetry and row sum). For every integer n≥1n \ge 1 and every integer kk, ⟨nk⟩=⟨nn−1−k⟩\left\langle {n \atop k} \right\rangle = \left\langle {n \atop n-1-k} \right\rangle, and ∑k⟨nk⟩=n!\sum_k \left\langle {n \atop k} \right\rangle = n!.

Lean: not in Mathlib.

Proof. The map a1…an↦(n+1−a1)…(n+1−an)a_1 \dots a_n \mapsto (n+1-a_1) \dots (n+1-a_n) 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 n−1n - 1 indices that are ascents or descents, so kk ascents become n−1−kn - 1 - k ascents. Each permutation has some number of ascents, so the row sum is n!n!. □\square

Lemma P2.8.49 (a step for Worpitzky). For every real xx and all integers n≥0n \ge 0 and kk, x(x+kn)=(n−k)(x+k+1n+1)+(k+1)(x+kn+1).x\binom{x+k}{n} = (n-k)\binom{x+k+1}{n+1} + (k+1)\binom{x+k}{n+1}.

Lean: not in Mathlib.

Proof. Let y=x+ky = x + k. The addition formula gives (y+1n+1)=(yn+1)+(yn)\binom{y+1}{n+1} = \binom{y}{n+1} + \binom{y}{n}, so the right side is (n−k)(yn)+(n+1)(yn+1)(n-k)\binom{y}{n} + (n+1)\binom{y}{n+1}. The factorial form gives (n+1)(yn+1)=(y−n)(yn)(n+1)\binom{y}{n+1} = (y - n)\binom{y}{n}. So the right side is (n−k+y−n)(yn)=(y−k)(yn)=x(x+kn)(n - k + y - n)\binom{y}{n} = (y - k)\binom{y}{n} = x\binom{x+k}{n}. □\square

Theorem P2.8.50 (Worpitzky's identity). For every real xx and every integer n≥0n \ge 0, xn=∑k⟨nk⟩(x+kn).x^n = \sum_k \left\langle {n \atop k} \right\rangle\binom{x+k}{n}.

Lean: not in Mathlib.

Proof. Use induction on nn. For n=0n = 0 the sum is ⟨00⟩(x0)=1\left\langle {0 \atop 0} \right\rangle\binom{x}{0} = 1. Assume the identity for nn, multiply it by xx and use the lemma: xn+1=∑k⟨nk⟩((n−k)(x+k+1n+1)+(k+1)(x+kn+1)).x^{n+1} = \sum_k \left\langle {n \atop k} \right\rangle\left((n-k)\binom{x+k+1}{n+1} + (k+1)\binom{x+k}{n+1}\right). In the first part change kk to k−1k - 1. The coefficient of (x+kn+1)\binom{x+k}{n+1} becomes (n+1−k)⟨nk−1⟩+(k+1)⟨nk⟩(n+1-k)\left\langle {n \atop k-1} \right\rangle + (k+1)\left\langle {n \atop k} \right\rangle, which is ⟨n+1k⟩\left\langle {n+1 \atop k} \right\rangle by the recurrence. □\square

Theorem P2.8.51 (explicit formula for the Eulerian numbers). For all integers n≥0n \ge 0 and k≥0k \ge 0, ⟨nk⟩=∑j=0k(−1)j(n+1j)(k+1−j)n.\left\langle {n \atop k} \right\rangle = \sum_{j=0}^{k}(-1)^j\binom{n+1}{j}(k+1-j)^n.

Lean: not in Mathlib.

Proof. For n=0n = 0 the right side is 11 for k=0k = 0 and 1−1=01 - 1 = 0 for k≥1k \ge 1, as it should be. Let n≥1n \ge 1, and let m≥1m \ge 1 be an integer. Worpitzky's identity at x=mx = m, with the symmetry and the change j=n−1−kj = n - 1 - k, gives mn=∑j⟨nj⟩(m+n−1−jn)=∑j=0m−1⟨nj⟩(m−1−j+nn),m^n = \sum_j \left\langle {n \atop j} \right\rangle\binom{m+n-1-j}{n} = \sum_{j=0}^{m-1}\left\langle {n \atop j} \right\rangle\binom{m-1-j+n}{n}, because for j≥mj \ge m the upper index m+n−1−jm + n - 1 - j lies between 00 and n−1n - 1. Put this with m=k+1−im = k + 1 - i into the right side of the theorem: ∑i=0k(−1)i(n+1i)∑j=0k−i⟨nj⟩(k−i−j+nn)=∑j=0k⟨nj⟩∑i=0k−j(−1)i(n+1i)(k−j−i+nn).\sum_{i=0}^{k}(-1)^i\binom{n+1}{i}\sum_{j=0}^{k-i}\left\langle {n \atop j} \right\rangle\binom{k-i-j+n}{n} = \sum_{j=0}^{k}\left\langle {n \atop j} \right\rangle\sum_{i=0}^{k-j}(-1)^i\binom{n+1}{i}\binom{k-j-i+n}{n}. Let p=k−j≥0p = k - j \ge 0. For 0≤i≤p0 \le i \le p, negation of the upper index gives (p−i+nn)=(p−i+np−i)=(−1)p−i(−n−1p−i)\binom{p-i+n}{n} = \binom{p-i+n}{p-i} = (-1)^{p-i}\binom{-n-1}{p-i}, and the right side is 00 for i>pi > p. So the inner sum is (−1)p∑i(n+1i)(−n−1p−i)=(−1)p(0p)=[p=0](-1)^p\sum_i \binom{n+1}{i}\binom{-n-1}{p-i} = (-1)^p\binom{0}{p} = [p = 0] by Vandermonde's convolution. Only j=kj = k remains, and the result is ⟨nk⟩\left\langle {n \atop k} \right\rangle. □\square

Theorem P2.8.52 (Eulerian and Stirling). For all integers n≥0n \ge 0 and m≥0m \ge 0, m!{nm}=∑k⟨nk⟩(kn−m),⟨nk⟩=∑mm!{nm}(n−mk)(−1)n−m−k.m!{n \brace m} = \sum_k \left\langle {n \atop k} \right\rangle\binom{k}{n-m}, \qquad \left\langle {n \atop k} \right\rangle = \sum_m m!{n \brace m}\binom{n-m}{k}(-1)^{n-m-k}.

Lean: not in Mathlib.

Proof. Vandermonde's convolution gives (x+kn)=∑m(xm)(kn−m)\binom{x+k}{n} = \sum_m \binom{x}{m}\binom{k}{n-m}. Put this into Worpitzky's identity: xn=∑mxm‾m!∑k⟨nk⟩(kn−m).x^n = \sum_m \frac{x^{\underline{m}}}{m!}\sum_k \left\langle {n \atop k} \right\rangle\binom{k}{n-m}. By Section 8.1, also xn=∑m{nm}xm‾x^n = \sum_m {n \brace m}x^{\underline{m}}. A polynomial has only one expansion in falling powers, so the coefficients of xm‾x^{\underline{m}} agree, and this is the first identity. For the second, fix nn and let bj=(n−j)!{nn−j}b_j = (n-j)!{n \brace n-j} for 0≤j≤n0 \le j \le n, bj=0b_j = 0 for j>nj > n, and ak=⟨nk⟩a_k = \left\langle {n \atop k} \right\rangle. The first identity with m=n−jm = n - j says bj=∑kak(kj)b_j = \sum_k a_k\binom{k}{j}. The computation in the proof of the inverse forms in Section 8.3, which uses the orthogonality of binomial coefficients, gives ak=∑jbj(jk)(−1)j−ka_k = \sum_j b_j\binom{j}{k}(-1)^{j-k}. With j=n−mj = n - m this is the second identity. □\square

Corollary P2.8.53 (sums of powers). For all integers n≥0n \ge 0 and N≥0N \ge 0, ∑0≤x<Nxn=∑k⟨nk⟩(N+kn+1).\sum_{0 \le x < N} x^n = \sum_k \left\langle {n \atop k} \right\rangle\binom{N+k}{n+1}.

Lean: not in Mathlib.

Proof. Sum Worpitzky's identity over 0≤x<N0 \le x < N. The sum on the upper index (Section 6.3) gives ∑0≤x<N(x+kn)=(N+kn+1)−(kn+1)\sum_{0 \le x < N}\binom{x+k}{n} = \binom{N+k}{n+1} - \binom{k}{n+1}. For the terms with ⟨nk⟩≠0\left\langle {n \atop k} \right\rangle \ne 0 the index satisfies 0≤k≤max⁡(n−1,0)0 \le k \le \max(n-1, 0), so (kn+1)=0\binom{k}{n+1} = 0. □\square

Proof

The recurrence comes from the insertion of the largest element, as for both kinds of Stirling numbers, and the symmetry from the reflection a↦n+1−aa \mapsto n + 1 - a. 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 n=3n = 3 is x3=(x3)+4(x+13)+(x+23)x^3 = \binom{x}{3} + 4\binom{x+1}{3} + \binom{x+2}{3}. At x=2x = 2 it reads 8=0+4⋅1+48 = 0 + 4 \cdot 1 + 4, and at x=3x = 3 it reads 27=1+4⋅4+1027 = 1 + 4 \cdot 4 + 10.

Example P2.8.55. The explicit formula with n=4n = 4 and k=1k = 1 gives 24−(51)⋅14=16−5=112^4 - \binom51 \cdot 1^4 = 16 - 5 = 11, and with k=2k = 2 it gives 34−5⋅24+10⋅1=81−80+10=113^4 - 5 \cdot 2^4 + 10 \cdot 1 = 81 - 80 + 10 = 11.

Example P2.8.56. The link with Stirling numbers for n=3n = 3 and m=2m = 2 reads 2!{32}=⟨30⟩(01)+⟨31⟩(11)+⟨32⟩(21)=0+4+2=62!{3 \brace 2} = \left\langle {3 \atop 0} \right\rangle\binom01 + \left\langle {3 \atop 1} \right\rangle\binom11 + \left\langle {3 \atop 2} \right\rangle\binom21 = 0 + 4 + 2 = 6, and indeed 2⋅3=62 \cdot 3 = 6.

Example P2.8.57. The corollary on sums of powers for n=3n = 3 gives ∑0≤x<Nx3=(N4)+4(N+14)+(N+24)\sum_{0 \le x < N}x^3 = \binom{N}{4} + 4\binom{N+1}{4} + \binom{N+2}{4}. For N=4N = 4 the right side is 1+20+15=361 + 20 + 15 = 36, as in Section 8.1.

Example P2.8.58. The recurrence computes the row n=5n = 5 from the row n=4n = 4, which is 1,11,11,11, 11, 11, 1: ⟨51⟩=2⋅11+4⋅1=26\left\langle {5 \atop 1} \right\rangle = 2 \cdot 11 + 4 \cdot 1 = 26 and ⟨52⟩=3⋅11+3⋅11=66\left\langle {5 \atop 2} \right\rangle = 3 \cdot 11 + 3 \cdot 11 = 66.

Exercises

  1. [10] Compute the row n=6n = 6 of the Eulerian numbers with the recurrence, and check its sum.
  2. [M15] List the permutations of {1,2,3,4}\{1, 2, 3, 4\} with exactly one ascent.
  3. [M15] Prove that ⟨n1⟩=2n−n−1\left\langle {n \atop 1} \right\rangle = 2^n - n - 1 for every n≥1n \ge 1.
  4. [M20] Use the corollary on sums of powers to find ∑0≤x<Nx2\sum_{0 \le x < N}x^2, and check that it equals (N−1)N(2N−1)6\frac{(N-1)N(2N-1)}{6}.
  5. [M15] A run of a permutation is a maximal block of consecutive entries ai<ai+1<⋯<aja_i < a_{i+1} < \cdots < a_j. Prove that the number of permutations of {1,…,n}\{1, \dots, n\} with exactly rr runs is ⟨nr−1⟩\left\langle {n \atop r-1} \right\rangle for n≥1n \ge 1.
  6. [M20] Prove that ∑kk⟨nk⟩=n! (n−1)2\sum_k k\left\langle {n \atop k} \right\rangle = \frac{n!\,(n-1)}{2} for every n≥1n \ge 1. What is the mean number of ascents of a permutation?
  7. [M20] Use the second identity of the theorem on Eulerian and Stirling numbers to compute ⟨41⟩\left\langle {4 \atop 1} \right\rangle from the numbers {4m}{4 \brace m}.

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 n+1n + 1 and k+1k + 1 in place of nn and kk; the subtraction n−kn - k is truncated on ℕ\mathbb{N}, 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 ∑kknzk\sum_k k^n z^k, which are rational functions with the Eulerian numbers in the numerator: ∑k≥0(k+1)nzk=∑j⟨nj⟩zj/(1−z)n+1\sum_{k \ge 0}(k+1)^n z^k = \sum_j \left\langle {n \atop j} \right\rangle z^j/(1-z)^{n+1}. 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 xnx^n and the falling powers xn‾x^{\underline{n}}, 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 [nk]{n \brack k} and {nk}{n \brace k}, and each kind counts a natural set of objects: permutations with kk cycles and partitions of a set into kk 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 xnx^n 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 [n+12]=n! Hn{n+1 \brack 2} = n!\,H_n. 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 {nn−m}{n \brace n-m} and [nn−m]{n \brack n-m} are polynomials in nn of degree 2m2m, and the duality {nm}=[−m−n]{n \brace m} = {-m \brack -n} 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 [nk]{n \brack k} 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 xk‾x^{\underline{k}} and xk‾x^{\overline{k}}, 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 HnH_n in full; this chapter needs only their definition Hn=1+12+⋯+1nH_n = 1 + \frac12 + \cdots + \frac1n.

The source of this page. Something is wrong? Report it.