taocp

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

Volume C1 · Basic concepts · TAOCP Section 1.2.9

Generating functions

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.

Read it next to Section 1.2.9 of the book. The nodes and the exercises of the section.

Contents
  1. Generating functions, their operations and the table of series

Generating functions, their operations and the table of series

Overview

Section 1.2.9 of TAOCP puts a sequence a0,a1,a2,…a_0, a_1, a_2, \ldots into one power series G(z)=∑anznG(z) = \sum a_n z^n and then works on the series. Parts A to C are the operations on the coefficients: sum, shift and product. Part D changes the variable, and with roots of unity picks out the terms in one residue class. Part E is the derivative and the integral. Part F is the table of the series used most: binomial, exponential, logarithm, and those with the Stirling and Bernoulli numbers. Part G is the notation [zn]G(z)[z^n]G(z) and Cauchy's integral for a coefficient. The end of the section finds the sum hmh_m of all products of mm of nn numbers x1,…,xnx_1, \ldots, x_n, with repeats, as a polynomial in the power sums Sj=∑xkjS_j = \sum x_k^j. The section uses the binomial coefficients of Section 1.2.6, the harmonic numbers of Section 1.2.7 and the Fibonacci numbers of Section 1.2.8.

The ideas

A series is a store for a sequence. Two series are equal exactly when the sequences are equal, so an identity between series is an identity between sequences. This helps most when the sequence has an inductive definition, since the series may satisfy a short equation.

Formal series need no convergence. The section says that convergence is of little use when one looks for a solution, because the answer can be checked in another way. C1 takes this one step further. A formal power series is a sequence of coefficients, with the sum and the product that the section defines. All results of parts A to E and of the end of the section are identities between formal series, and they have no condition of convergence. For the real or complex number zz, the identity is true as an identity between numbers whenever all the series that occur converge, which is so for ∣z∣|z| small. The section recalls two facts about convergence: if the series converges at z0z_0 it converges for ∣z∣<∣z0∣|z| < |z_0|, and it converges at some z≠0z \ne 0 exactly when ∣an∣n\sqrt[n]{|a_n|} is bounded.

Each operation on sequences has a matching operation on series. A sum of sequences is a sum of series, a shift of the index is a product with a power of zz, a convolution is a product of series, a factor cnc^n is the change of zz to czcz, a factor nn is the operator z d/dzz\,d/dz, and a division by nn is an integral. Each proof is a check on one coefficient.

The table is the working set. Each series of part F is proved from the earlier ones, with a differential equation, a recurrence of the Stirling numbers, or Lagrange's theorem.

Definitions, results and proofs

Definition (the generating function of a sequence, TAOCP eq. 1.2.9(1)). For a sequence ⟨an⟩=a0,a1,a2,…\langle a_n \rangle = a_0, a_1, a_2, \ldots of numbers, its generating function is the series

G(z)=a0+a1z+a2z2+⋯=∑n≥0anzn.G(z) = a_0 + a_1 z + a_2 z^2 + \cdots = \sum_{n \ge 0} a_n z^n.

Node: TA07MBSY30 · Lean: TAOCP.ogf, TAOCP.S1_2_9.eq1 · status: proved

Explanation. Two series are equal when all their coefficients are equal, so GG holds the sequence and nothing else. Series are added and multiplied by the rules of polynomials, so they form a ring, and a series with constant term 11 has an inverse.

Example. The Fibonacci numbers F0,F1,F2,…=0,1,1,2,3,5,…F_0, F_1, F_2, \ldots = 0, 1, 1, 2, 3, 5, \ldots have the series z+z2+2z3+3z4+5z5+⋯=z/(1−z−z2)z + z^2 + 2z^3 + 3z^4 + 5z^5 + \cdots = z/(1 - z - z^2) of Section 1.2.8.

Proof. A definition has no proof. The one fact to check is that the map is one to one, and it is, since [zn]G=an[z^n]G = a_n by the definition of equality. □\square

Theorem (addition, TAOCP eq. 1.2.9(2)). Let GG and HH be the generating functions of ⟨an⟩\langle a_n \rangle and ⟨bn⟩\langle b_n \rangle, and let α,β\alpha, \beta be numbers. Then

α∑n≥0anzn+β∑n≥0bnzn=∑n≥0(αan+βbn)zn.\alpha \sum_{n \ge 0} a_n z^n + \beta \sum_{n \ge 0} b_n z^n = \sum_{n \ge 0} (\alpha a_n + \beta b_n) z^n.

Node: TANA9671WF · Lean: TAOCP.S1_2_9.eq2 · status: proved

Explanation. The map from sequences to series is linear. A sequence that is a combination of simpler sequences has a series that is the same combination of their series.

Example. For ⟨2n+3n⟩=2,5,13,35,97,…\langle 2^n + 3^n \rangle = 2, 5, 13, 35, 97, \ldots the series is 11−2z+11−3z=2−5z1−5z+6z2\frac1{1-2z} + \frac1{1-3z} = \frac{2 - 5z}{1 - 5z + 6z^2}, and the first terms are 2+5z+13z2+35z3+97z42 + 5z + 13z^2 + 35z^3 + 97z^4. This is exercise 1.2.9-1.

Proof. The coefficient of znz^n on the left is αan+βbn\alpha a_n + \beta b_n, since the product of a series with a number acts on each coefficient, and the sum of two series is the sum of the coefficients. □\square

Theorem (shift to the right, TAOCP eq. 1.2.9(3)). For each integer m≥0m \ge 0,

zm∑n≥0anzn=∑n≥man−mzn.z^m \sum_{n \ge 0} a_n z^n = \sum_{n \ge m} a_{n-m} z^n.

Node: TAEPGHJ1Y5 · Lean: TAOCP.S1_2_9.eq3 · status: proved

Explanation. A product with zmz^m puts mm zeros in front of the sequence. If ana_n is read as 00 for n<0n < 0, the right side is a sum over all n≥0n \ge 0. In Mathlib this is the rule for the coefficient of a product with XmX^m, PowerSeries.coeff_X_pow_mul'.

Example. For the constant sequence, z2/(1−z)=z2+z3+z4+⋯z^2/(1-z) = z^2 + z^3 + z^4 + \cdots, which is 0,0,1,1,1,…0, 0, 1, 1, 1, \ldots.

Proof. The term akzka_k z^k becomes akzk+ma_k z^{k+m}. Put n=k+mn = k + m: the term is an−mzna_{n-m} z^n with n≥mn \ge m. □\square

Theorem (shift to the left, TAOCP eq. 1.2.9(4)). For each integer m≥0m \ge 0, the series (G(z)−a0−⋯−am−1zm−1)/zm(G(z) - a_0 - \cdots - a_{m-1} z^{m-1})/z^m generates am,am+1,…a_m, a_{m+1}, \ldots, that is,

z−m∑n≥manzn=∑n≥0an+mzn.z^{-m} \sum_{n \ge m} a_n z^n = \sum_{n \ge 0} a_{n+m} z^n.

Node: TA059AA1H6 · Lean: TAOCP.S1_2_9.eq4 (partial) · status: proved

Explanation. The left shift drops the first mm terms. It turns a recurrence into an equation for GG.

Example. For G=1/(1−z)G = 1/(1-z) and m=2m = 2: (1/(1−z)−1−z)/z2=z2/((1−z)z2)=1/(1−z)(1/(1-z) - 1 - z)/z^2 = z^2/((1-z)z^2) = 1/(1-z), which generates 1,1,1,…1, 1, 1, \ldots again.

Proof. The term anzna_n z^n with n≥mn \ge m becomes anzn−ma_n z^{n-m}. With k=n−m≥0k = n - m \ge 0 the term is ak+mzka_{k+m} z^k. □\square

Theorem (the geometric series, TAOCP eq. 1.2.9(5)).

11−z=1+z+z2+⋯ .\frac1{1-z} = 1 + z + z^2 + \cdots.

Node: TAT7S423VY · Lean: TAOCP.S1_2_9.eq5 · status: proved

Explanation. This is the series of the constant sequence 1,1,1,…1, 1, 1, \ldots and the most used series of the table. The proof shows the method of A and B together: shift, subtract and solve. In Mathlib, PowerSeries.invUnitsSub is the series 1/(u−z)1/(u - z), and PowerSeries.invUnitsSub_mul_sub is the equation that it is the inverse of u−zu - z. The change z→czz \to cz gives the series of 1,c,c2,…1, c, c^2, \ldots as 1/(1−cz)1/(1 - cz).

Example. Take z=12z = \frac12: the partial sums of 1+12+14+⋯1 + \frac12 + \frac14 + \cdots approach 2=1/(1−12)2 = 1/(1 - \frac12). The series of the powers of c=3c = 3 is 1/(1−3z)=1+3z+9z2+⋯1/(1 - 3z) = 1 + 3z + 9z^2 + \cdots.

Proof. Let GG be the series of 1,1,1,…1, 1, 1, \ldots. Then zGzG is the series of 0,1,1,…0, 1, 1, \ldots by eq. (3), and (1−z)G(1 - z)G has coefficients 1,0,0,…1, 0, 0, \ldots, so (1−z)G=1(1 - z)G = 1. The series 1−z1 - z has constant term 11, so it has the inverse GG. □\square

Theorem (the product of two series, TAOCP eq. 1.2.9(6)). The product G(z)H(z)G(z)H(z) of the generating functions of ⟨an⟩\langle a_n \rangle and ⟨bn⟩\langle b_n \rangle is the generating function of ⟨cn⟩\langle c_n \rangle with

cn=∑k=0nakbn−k.c_n = \sum_{k=0}^n a_k b_{n-k}.

Node: TAJBVBEXFN · Lean: TAOCP.S1_2_9.eq6 · status: proved

Explanation. The sequence cc is the convolution of aa and bb. The rule is the definition of the product of polynomials. Eq. (3) is the case where bb is 0,…,0,1,0,…0, \ldots, 0, 1, 0, \ldots. Lean: TAOCP.coeff_ogf_mul, PowerSeries.coeff_mul.

Example. With an=bn=Fna_n = b_n = F_n, the coefficient c6=20c_6 = 20 (Section 1.2.8). With an=bn=1a_n = b_n = 1: cn=n+1c_n = n + 1, so 1/(1−z)2=∑(n+1)zn1/(1-z)^2 = \sum (n+1) z^n.

Proof. Each product aizi⋅bjzja_i z^i \cdot b_j z^j has degree i+ji + j. The coefficient of znz^n in the product is the sum of aibja_i b_j over the pairs with i+j=ni + j = n, and the pairs are (k,n−k)(k, n-k) for 0≤k≤n0 \le k \le n. □\square

Theorem (partial sums, TAOCP eq. 1.2.9(7)).

11−zG(z)=a0+(a0+a1)z+(a0+a1+a2)z2+⋯ .\frac1{1-z} G(z) = a_0 + (a_0 + a_1) z + (a_0 + a_1 + a_2) z^2 + \cdots.

Node: TAQ6GWNMKX · Lean: TAOCP.S1_2_9.eq7 · status: proved

Explanation. A division by 1−z1 - z is a running total. This is eq. (6) with bn=1b_n = 1 for all nn.

Example. For an=na_n = n, the series is z/(1−z)2z/(1-z)^2, and the division by 1−z1 - z gives z/(1−z)3z/(1-z)^3, with coefficients 0,1,3,6,10,…0, 1, 3, 6, 10, \ldots, which are the partial sums 0,0+1,0+1+2,0+1+2+3,…0, 0+1, 0+1+2, 0+1+2+3, \ldots.

Proof. By eq. (5), 1/(1−z)1/(1-z) has all coefficients 11. Eq. (6) with bk=1b_k = 1 gives cn=∑k=0nakc_n = \sum_{k=0}^n a_k. □\square

Theorem (a product of three series, TAOCP eq. 1.2.9(8)). The product F(z)G(z)H(z)F(z) G(z) H(z) of the series of ⟨an⟩\langle a_n \rangle, ⟨bn⟩\langle b_n \rangle, ⟨cn⟩\langle c_n \rangle is the series of ⟨dn⟩\langle d_n \rangle with

dn=∑i,j,k≥0i+j+k=naibjck.d_n = \sum_{\substack{i, j, k \ge 0 \\ i + j + k = n}} a_i b_j c_k.

Node: TA8DWZ3VPQ · Lean: TAOCP.S1_2_9.eq8 · status: proved

Explanation. The product of three series is the product of two, and one more use of eq. (6) gives a sum over triples.

Example. With all three sequences equal to 1,1,1,…1, 1, 1, \ldots: dnd_n is the number of triples of nonnegative integers with sum nn. For n=3n = 3 there are 1010, and [z3](1−z)−3=(52)=10[z^3] (1-z)^{-3} = \binom{5}{2} = 10.

Proof. By eq. (6), F⋅(GH)F \cdot (GH) has the coefficient ∑i+m=naiem\sum_{i + m = n} a_i e_m with em=∑j+k=mbjcke_m = \sum_{j + k = m} b_j c_k. Substitute eme_m: the double sum is over all (i,j,k)(i, j, k) with i+j+k=ni + j + k = n, each triple once. □\square

Theorem (a product of many series, TAOCP eq. 1.2.9(9)). Let aj0,aj1,…a_{j0}, a_{j1}, \ldots be sequences for j=0,1,2,…j = 0, 1, 2, \ldots such that the product makes sense, which is so when aj0=1a_{j0} = 1 and ajk=0a_{jk} = 0 for 0<k<j0 < k < j (or for another condition that makes each coefficient a finite sum). Then

∏j≥0∑k≥0ajkzk=∑n≥0zn∑k0,k1,…≥0k0+k1+⋯=na0k0a1k1⋯ .\prod_{j \ge 0} \sum_{k \ge 0} a_{jk} z^k = \sum_{n \ge 0} z^n \sum_{\substack{k_0, k_1, \ldots \ge 0 \\ k_0 + k_1 + \cdots = n}} a_{0 k_0} a_{1 k_1} \cdots.

Node: TA54TKPC2N · Lean: TAOCP.S1_2_9.eq9 (partial) · status: proved

Explanation. The rule is the same as for three factors: pick a term from each factor, with total degree nn. The condition makes each coefficient a finite sum, since the factor jj changes the series only from degree jj on.

Example. The product ∏j≥1(1+zj)\prod_{j \ge 1} (1 + z^j) has aj0=1a_{j0} = 1, ajj=1a_{jj} = 1 and all other ajk=0a_{jk} = 0. The coefficient of znz^n is the number of ways to write nn as a sum of distinct positive integers. For n=6n = 6 they are 66, 5+15+1, 4+24+2, 3+2+13+2+1, which are 44. The expansion of the product starts 1+z+z2+2z3+2z4+3z5+4z6+5z7+⋯1 + z + z^2 + 2z^3 + 2z^4 + 3z^5 + 4z^6 + 5z^7 + \cdots.

Proof. For fixed nn, only the factors with j≤nj \le n can contribute to the coefficient of znz^n by a term other than aj0=1a_{j0} = 1, so the infinite product has the same coefficient of znz^n as the finite product of the first n+1n + 1 factors. For a finite product the formula is the extension of the proof of eq. (8) by induction on the number of factors. □\square

Definition (the binomial convolution, TAOCP eq. 1.2.9(10)). The binomial convolution of ⟨an⟩\langle a_n \rangle and ⟨bn⟩\langle b_n \rangle is the sequence

cn=∑k(nk)akbn−k.c_n = \sum_k \binom nk a_k b_{n-k}.

Node: TA6JYSV9R7 · Lean: TAOCP.S1_2_9.eq11 (partial) · status: not stated yet

Explanation. It arises when a recurrence has binomial coefficients. The next theorem gives the series to use.

Example. With an=bn=1a_n = b_n = 1: cn=∑k(nk)=2nc_n = \sum_k \binom nk = 2^n. With a=b=⟨1,1,2,5⟩a = b = \langle 1, 1, 2, 5 \rangle (the first four terms): c3=1⋅5+3⋅1⋅2+3⋅2⋅1+5⋅1=22c_3 = 1 \cdot 5 + 3 \cdot 1 \cdot 2 + 3 \cdot 2 \cdot 1 + 5 \cdot 1 = 22.

Proof. A definition has no proof. The sum has n+1n + 1 terms for each nn, and the index kk runs over 0≤k≤n0 \le k \le n, since the binomial coefficient is 00 outside. □\square

Theorem (the product of exponential generating functions, TAOCP eq. 1.2.9(11)). If cnc_n is given by eq. (10), then

(∑nann!zn)(∑nbnn!zn)=∑ncnn!zn.\Bigl( \sum_n \frac{a_n}{n!} z^n \Bigr) \Bigl( \sum_n \frac{b_n}{n!} z^n \Bigr) = \sum_n \frac{c_n}{n!} z^n.

Node: TARXNJTW3G · Lean: TAOCP.S1_2_9.eq11 · status: proved

Explanation. The series ∑anzn/n!\sum a_n z^n / n! is the exponential generating function of ⟨an⟩\langle a_n \rangle. The product of two exponential generating functions is the exponential generating function of the binomial convolution. The project defines the exponential generating function as TAOCP.egf, with its coefficients in TAOCP.coeff_egf, and TAOCP.egf_one says that the series of the sequence of ones is PowerSeries.exp. The project has no statement of eq. (11) yet. This is exercise 1.2.9-2.

Example. With an=bn=1a_n = b_n = 1 the series are eze^z each, and ezez=e2z=∑2nzn/n!e^z e^z = e^{2z} = \sum 2^n z^n / n!, so cn=2nc_n = 2^n as in the example above.

Proof. By eq. (6) the coefficient of znz^n in the product is ∑k=0nakk!bn−k(n−k)!\sum_{k=0}^n \frac{a_k}{k!} \frac{b_{n-k}}{(n-k)!}. Write 1k!(n−k)!=1n!(nk)\frac{1}{k!(n-k)!} = \frac1{n!} \binom nk. The sum is 1n!∑k(nk)akbn−k=cn/n!\frac1{n!} \sum_k \binom nk a_k b_{n-k} = c_n / n!. □\square

Theorem (even and odd terms, TAOCP eq. 1.2.9(12)).

12(G(z)+G(−z))=a0+a2z2+a4z4+⋯ ,12(G(z)−G(−z))=a1z+a3z3+a5z5+⋯ .\tfrac12 (G(z) + G(-z)) = a_0 + a_2 z^2 + a_4 z^4 + \cdots, \qquad \tfrac12 (G(z) - G(-z)) = a_1 z + a_3 z^3 + a_5 z^5 + \cdots.

Node: TA5Q2B1361 · Lean: TAOCP.S1_2_9.eq12_even, TAOCP.S1_2_9.eq12_odd · status: not stated yet

Explanation. The change z→−zz \to -z multiplies the term of degree nn by (−1)n(-1)^n, so the odd terms change sign and the even terms do not. The half sum keeps the even terms and the half difference keeps the odd terms. This is part D of the section.

Example. For G=1/(1−z)G = 1/(1-z): 12(11−z+11+z)=11−z2=1+z2+z4+⋯\frac12 (\frac1{1-z} + \frac1{1+z}) = \frac1{1-z^2} = 1 + z^2 + z^4 + \cdots, and 12(11−z−11+z)=z1−z2=z+z3+⋯\frac12 (\frac1{1-z} - \frac1{1+z}) = \frac z{1-z^2} = z + z^3 + \cdots.

Proof. G(−z)=∑(−1)nanznG(-z) = \sum (-1)^n a_n z^n. In the sum G(z)+G(−z)G(z) + G(-z) the coefficient is an(1+(−1)n)a_n (1 + (-1)^n), which is 2an2a_n for even nn and 00 for odd nn. The difference has an(1−(−1)n)a_n (1 - (-1)^n). □\square

Theorem (terms in one residue class, TAOCP eq. 1.2.9(13)). Let m≥1m \ge 1 and ω=e2πi/m\omega = e^{2\pi i / m}. For 0≤r<m0 \le r < m,

∑n≥0nmodm=ranzn=1m∑0≤k<mω−krG(ωkz).\sum_{\substack{n \ge 0 \\ n \bmod m = r}} a_n z^n = \frac1m \sum_{0 \le k < m} \omega^{-kr} G(\omega^k z).

Node: TA8FPN2QPA · Lean: TAOCP.S1_2_9.eq13 · status: proved

Explanation. This extends eq. (12), the case m=2m = 2. The sum over the mm-th roots of unity of a power is mm for a multiple of mm and 00 otherwise, so the sum keeps the terms with n≡rn \equiv r. For m=3m = 3 and r=1r = 1 with ω=−12+32i\omega = -\frac12 + \frac{\sqrt3}2 i, the series a1z+a4z4+a7z7+⋯a_1 z + a_4 z^4 + a_7 z^7 + \cdots equals 13(G(z)+ω−1G(ωz)+ω−2G(ω2z))\frac13 (G(z) + \omega^{-1} G(\omega z) + \omega^{-2} G(\omega^2 z)). This is exercise 1.2.9-14.

Example. Take G=1/(1−z)G = 1/(1-z), m=3m = 3, r=1r = 1, z=12z = \frac12. The left side is z/(1−z3)=0.571429z/(1 - z^3) = 0.571429, and evaluation of the right side with complex numbers gives 0.5714290.571429.

Proof. The right side has the coefficient of znz^n equal to an⋅1m∑k=0m−1ωk(n−r)a_n \cdot \frac1m \sum_{k=0}^{m-1} \omega^{k(n - r)}, since G(ωkz)G(\omega^k z) has the term anωknzna_n \omega^{kn} z^n. If m∣n−rm \mid n - r, then ωn−r=1\omega^{n - r} = 1 and the sum is mm. Otherwise q=ωn−r≠1q = \omega^{n-r} \ne 1 and qm=1q^m = 1, so ∑k=0m−1qk=(qm−1)/(q−1)=0\sum_{k=0}^{m-1} q^k = (q^m - 1)/(q - 1) = 0. Hence the coefficient is ana_n if n≡r(modm)n \equiv r \pmod m and 00 otherwise. □\square

Theorem (the derivative, TAOCP eq. 1.2.9(14)).

G′(z)=a1+2a2z+3a3z2+⋯=∑k≥0(k+1)ak+1zk.G'(z) = a_1 + 2a_2 z + 3a_3 z^2 + \cdots = \sum_{k \ge 0} (k+1) a_{k+1} z^k.

Node: TA2DNG0JNM · Lean: TAOCP.S1_2_9.eq14, TAOCP.S1_2_9.eq14_mul_X · status: proved

Explanation. The derivative is taken term by term, and it obeys (GH)′=G′H+GH′(GH)' = G'H + GH'. The series zG′(z)z G'(z) generates ⟨nan⟩\langle n a_n \rangle, so a multiplication of a term by a polynomial in nn is a differential operator on GG. In Mathlib the derivative is PowerSeries.derivative.

Example. From G=1/(1−z)G = 1/(1-z), G′=1/(1−z)2G' = 1/(1-z)^2 and the series is ∑(k+1)zk\sum (k+1) z^k, as in eq. (16). The series zG′=z/(1−z)2z G' = z/(1-z)^2 generates ⟨n⟩=0,1,2,3,…\langle n \rangle = 0, 1, 2, 3, \ldots.

Proof. The term anzna_n z^n has the derivative nanzn−1n a_n z^{n-1}, and n≥1n \ge 1 since the constant term goes to 00. The renaming k=n−1k = n - 1 gives the form of the theorem. □\square

Theorem (the integral, TAOCP eq. 1.2.9(15)).

∫0zG(t) dt=a0z+12a1z2+13a2z3+⋯=∑k≥11kak−1zk.\int_0^z G(t)\,dt = a_0 z + \tfrac12 a_1 z^2 + \tfrac13 a_2 z^3 + \cdots = \sum_{k \ge 1} \frac1k a_{k-1} z^k.

Node: TATED5YGAF · Lean: TAOCP.S1_2_9.eq15, TAOCP.S1_2_9.integral, TAOCP.S1_2_9.derivative_integral · status: proved

Explanation. The integral is defined term by term and has the constant term 00. It divides the coefficient of zkz^k by kk. The derivative of the integral of GG is GG, and the integral of G′G' is G−a0G - a_0. So the integral undoes the derivative on the series with constant term 00.

Example. The integral of 1/(1−z)1/(1-z) has the terms z+12z2+13z3+⋯z + \frac12 z^2 + \frac13 z^3 + \cdots, which is eq. (17).

Proof. The integral of tnt^{n} from 00 to zz is zn+1/(n+1)z^{n+1}/(n+1). With k=n+1k = n + 1 the term ak−1tk−1a_{k-1} t^{k-1} becomes ak−1zk/ka_{k-1} z^k / k. □\square

Theorem (the series of 1/(1−z)21/(1-z)^2, TAOCP eq. 1.2.9(16)).

1(1−z)2=1+2z+3z2+⋯=∑k≥0(k+1)zk.\frac1{(1-z)^2} = 1 + 2z + 3z^2 + \cdots = \sum_{k \ge 0} (k+1) z^k.

Node: TACR2S4P0N · Lean: TAOCP.S1_2_9.eq16, TAOCP.S1_2_9.eq16_derivative · status: proved

Explanation. It is the derivative of eq. (5). It is also the square of eq. (5): the number of pairs (i,j)(i, j) with i+j=ki + j = k is k+1k + 1.

Example. The coefficients 1,2,3,4,51, 2, 3, 4, 5 for k=0,…,4k = 0, \ldots, 4. At z=12z = \frac12 the series is ∑(k+1)2−k=4=1/(1−12)2\sum (k+1) 2^{-k} = 4 = 1/(1 - \frac12)^2.

Proof. The derivative of ∑zk\sum z^k is ∑(k+1)zk\sum (k+1) z^k by eq. (14). The derivative of (1−z)−1(1-z)^{-1} is (1−z)−2(1-z)^{-2}, by the rule for the derivative of a product applied to (1−z)⋅(1−z)−1=1(1 - z) \cdot (1-z)^{-1} = 1: it gives −(1−z)−1+(1−z)((1−z)−1)′=0-(1-z)^{-1} + (1-z)((1-z)^{-1})' = 0, so ((1−z)−1)′=(1−z)−2((1-z)^{-1})' = (1-z)^{-2}. □\square

Theorem (the logarithm of 1/(1−z)1/(1-z), TAOCP eq. 1.2.9(17)).

ln⁡11−z=z+12z2+13z3+⋯=∑k≥11kzk.\ln \frac1{1-z} = z + \tfrac12 z^2 + \tfrac13 z^3 + \cdots = \sum_{k \ge 1} \frac1k z^k.

Node: TAXVG6PSGJ · Lean: TAOCP.S1_2_9.lnInvOneSub, TAOCP.S1_2_9.eq17, TAOCP.S1_2_9.eq17_real · status: proved

Explanation. The logarithm of a series with constant term 11 is defined as the series with constant term 00 whose derivative is G′/GG'/G. For G=1/(1−z)G = 1/(1-z) this derivative is 1/(1−z)1/(1-z). So the series is the integral of eq. (5).

Example. At z=12z = \frac12: ln⁡2=0.693147\ln 2 = 0.693147. The first four terms give 0.68230.6823.

Proof. The derivative of ln⁡11−z\ln \frac1{1-z} is 11−z\frac{1}{1-z}, since ln⁡11−z=−ln⁡(1−z)\ln \frac1{1-z} = -\ln (1-z) and the derivative of ln⁡(1−z)\ln (1-z) is −1/(1−z)-1/(1-z). By eq. (15) the integral of ∑zn\sum z^n is ∑zk/k\sum z^{k}/k. Both sides have the constant term 00 and the same derivative, so they are equal. □\square

Theorem (the harmonic numbers, TAOCP eq. 1.2.9(18)).

11−zln⁡11−z=z+32z2+116z3+⋯=∑k≥0Hkzk.\frac1{1-z} \ln \frac1{1-z} = z + \tfrac32 z^2 + \tfrac{11}6 z^3 + \cdots = \sum_{k \ge 0} H_k z^k.

Node: TANVNW1BVM · Lean: TAOCP.S1_2_9.eq18 · status: proved

Explanation. The coefficients of the logarithm are 1/k1/k, and a division by 1−z1 - z gives the partial sums, which are the harmonic numbers of Section 1.2.7. Mathlib has the sequence as harmonic.

Example. The coefficients are H1=1H_1 = 1, H2=32H_2 = \frac32, H3=116H_3 = \frac{11}6, H4=2512H_4 = \frac{25}{12}, as in the expansion z+32z2+116z3+2512z4z + \frac32 z^2 + \frac{11}6 z^3 + \frac{25}{12} z^4.

Proof. By eq. (7) the product with 1/(1−z)1/(1-z) has the coefficient ∑j=1k1/j=Hk\sum_{j=1}^k 1/j = H_k by eq. (17), with H0=0H_0 = 0. □\square

Theorem (the binomial series, TAOCP eq. 1.2.9(19)). For each number rr,

(1+z)r=1+rz+r(r−1)2z2+⋯=∑k≥0(rk)zk.(1 + z)^r = 1 + rz + \frac{r(r-1)}2 z^2 + \cdots = \sum_{k \ge 0} \binom rk z^k.

Node: TARVM5FZ9C · Lean: TAOCP.S1_2_9.eq19, TAOCP.S1_2_9.eq19_real (partial) · status: proved

Explanation. For a nonnegative integer rr the series is the polynomial of the binomial theorem. For other rr it is infinite and defines (1+z)r(1+z)^r as a series, with (rk)=r(r−1)⋯(r−k+1)/k!\binom rk = r(r-1) \cdots (r-k+1)/k! (Section 1.2.6). The series converges for ∣z∣<1|z| < 1. The project has the binomial coefficient of a general number as TAOCP.binom.

Example. With r=12r = \frac12: 1+z=1+12z−18z2+116z3−⋯\sqrt{1 + z} = 1 + \frac12 z - \frac18 z^2 + \frac1{16} z^3 - \cdots. At z=0.21z = 0.21 the value is 1.11.1, and the first four terms give 1+0.105−0.0055125+0.000579=1.1000661 + 0.105 - 0.0055125 + 0.000579 = 1.100066, to be compared with 1.21=1.1\sqrt{1.21} = 1.1.

Proof. Let B(z)=∑(rk)zkB(z) = \sum \binom rk z^k. By eq. (14) the series (1+z)B′(z)(1 + z) B'(z) has the coefficient of zkz^k equal to (k+1)(rk+1)+k(rk)(k+1) \binom r{k+1} + k \binom rk. By the identity (k+1)(rk+1)=(r−k)(rk)(k+1) \binom r{k+1} = (r - k) \binom rk, this is r(rk)r \binom rk. So (1+z)B′=rB(1+z) B' = r B. For ∣z∣<1|z| < 1 the function f(z)=(1+z)−rB(z)f(z) = (1 + z)^{-r} B(z) has derivative −r(1+z)−r−1B+(1+z)−rB′=(1+z)−r−1((1+z)B′−rB)=0-r (1+z)^{-r-1} B + (1+z)^{-r} B' = (1+z)^{-r-1} ((1+z) B' - r B) = 0, so f(z)=f(0)=1f(z) = f(0) = 1. □\square

Theorem (a negative power of 1−z1 - z, TAOCP eq. 1.2.9(20)). For each integer n≥0n \ge 0,

1(1−z)n+1=∑k≥0(−n−1k)(−z)k=∑k≥0(n+kn)zk.\frac1{(1-z)^{n+1}} = \sum_{k \ge 0} \binom{-n-1}k (-z)^k = \sum_{k \ge 0} \binom{n+k}n z^k.

Node: TAZ98BYBEG · Lean: TAOCP.S1_2_9.eq20 · status: proved

Explanation. This is eq. (19) with r=−n−1r = -n - 1 and zz replaced by −z-z. The rule of negation of the upper index (Section 1.2.6) turns the coefficient into a binomial coefficient with positive entries. For n=0n = 0 it is eq. (5), and for n=1n = 1 it is eq. (16). The coefficient (n+kn)\binom{n+k}n counts the ways to write kk as an ordered sum of n+1n + 1 nonnegative integers.

Example. For n=2n = 2: (2+k2)=1,3,6,10,15,…\binom{2+k}2 = 1, 3, 6, 10, 15, \ldots, so 1/(1−z)3=1+3z+6z2+10z3+15z4+⋯1/(1-z)^3 = 1 + 3z + 6z^2 + 10z^3 + 15z^4 + \cdots.

Proof. Put r=−n−1r = -n - 1 and z→−zz \to -z in eq. (19). The coefficient is (−n−1k)(−1)k\binom{-n-1}k (-1)^k. The rule of negation says (−n−1k)=(−1)k(n+kk)\binom{-n-1}k = (-1)^k \binom{n+k}k, and (n+kk)=(n+kn)\binom{n+k}k = \binom{n+k}n by symmetry. □\square

Theorem (the generalized binomial series, TAOCP eq. 1.2.9(21)). Let tt be a number and xx the continuous function of zz with xt+1=xt+zx^{t+1} = x^t + z and x=1x = 1 at z=0z = 0. Then for each number rr,

xr=1+rz+r(r−2t−1)2z2+⋯=∑k≥0(r−ktk)rr−ktzk.x^r = 1 + rz + \frac{r(r - 2t - 1)}2 z^2 + \cdots = \sum_{k \ge 0} \binom{r - kt}k \frac r{r - kt} z^k.

Node: TA4DCTDG01 · status: not stated yet

Explanation. For t=0t = 0 it is eq. (19). For k≥1k \ge 1 the coefficient is read as rk(r−kt−1k−1)\frac rk \binom{r - kt - 1}{k - 1}, which is the same number when r≠ktr \ne kt and the right value when r=ktr = kt. The book proves the identity in exercise 1.2.6-25. The proof below is a different one: it uses Lagrange's theorem, which follows from eq. (32).

Example. Take t=1t = 1, so x2=x+zx^2 = x + z, and x=12(1+1+4z)x = \frac12 (1 + \sqrt{1 + 4z}). For r=3r = 3: x3=x⋅x2=x2+zx=x+z+zxx^3 = x \cdot x^2 = x^2 + zx = x + z + zx, and the series is 1+3z+0z2+z3−3z4+9z5−⋯1 + 3z + 0 z^2 + z^3 - 3z^4 + 9z^5 - \cdots. The formula gives the coefficients 3k(2−kk−1)\frac3k \binom{2 - k}{k-1}: k=1k = 1 gives 3(10)=33 \binom 10 = 3; k=2k = 2 gives 32(01)=0\frac32 \binom 01 = 0; k=3k = 3 gives 1⋅(−12)=11 \cdot \binom{-1}2 = 1; k=4k = 4 gives 34(−23)=34⋅(−4)=−3\frac34 \binom{-2}3 = \frac34 \cdot (-4) = -3.

Proof. Put x=1+wx = 1 + w. The equation is (1+w)tw=z(1 + w)^t w = z, that is w=zφ(w)w = z \varphi(w) with φ(w)=(1+w)−t\varphi(w) = (1 + w)^{-t}. By Lagrange's theorem, proved below, for each series H(w)H(w) and each k≥1k \ge 1, [zk]H(w(z))=1k[wk−1]H′(w)φ(w)k[z^k] H(w(z)) = \frac1k [w^{k-1}] H'(w) \varphi(w)^k. Take H(w)=(1+w)rH(w) = (1+w)^r. Then H′φk=r(1+w)r−1−tkH' \varphi^k = r (1+w)^{r - 1 - tk}, and by eq. (19), [wk−1](1+w)r−1−tk=(r−1−tkk−1)[w^{k-1}] (1+w)^{r-1-tk} = \binom{r - 1 - tk}{k-1}. So [zk]xr=rk(r−kt−1k−1)[z^k] x^r = \frac rk \binom{r - kt - 1}{k-1}. For r≠ktr \ne kt the identity (sk)=sk(s−1k−1)\binom{s}{k} = \frac sk \binom{s-1}{k-1} with s=r−kts = r - kt turns this into (r−ktk)rr−kt\binom{r-kt}k \frac r{r-kt}.

Proof of Lagrange's theorem. Let w(z)w(z) be the series with w=zφ(w)w = z \varphi(w), φ(0)≠0\varphi(0) \ne 0, which exists and is unique by solving for the coefficients one at a time. For zz small, the map z↦wz \mapsto w has w(z)=zφ(0)+⋯w(z) = z \varphi(0) + \cdots and is one to one near 00. By eq. (32), [zk]H(w(z))=12πi∮H(w(z))z−k−1dz[z^k] H(w(z)) = \frac1{2\pi i} \oint H(w(z)) z^{-k-1} dz. Change the variable to ww, with z=w/φ(w)z = w/\varphi(w) and dz=(1/φ−wφ′/φ2)dwdz = (1/\varphi - w \varphi'/\varphi^2) dw. The integral becomes 12πi∮Hφkw−k−1dw−12πi∮Hw−kφk−1φ′dw\frac1{2\pi i} \oint H \varphi^k w^{-k-1} dw - \frac1{2\pi i} \oint H w^{-k} \varphi^{k-1} \varphi' dw over a small circle in ww. In the second integral φk−1φ′dw=1kd(φk)\varphi^{k-1} \varphi' dw = \frac1k d(\varphi^k), and an integration by parts on a closed curve gives −1k∮Hw−kd(φk)=1k∮φk(H′w−k−kHw−k−1)dw-\frac1k \oint H w^{-k} d(\varphi^k) = \frac1k \oint \varphi^k (H' w^{-k} - k H w^{-k-1}) dw. The term with Hw−k−1H w^{-k-1} cancels the first integral. What remains is 12πi⋅1k∮H′φkw−kdw=1k[wk−1]H′φk\frac1{2\pi i} \cdot \frac1k \oint H' \varphi^k w^{-k} dw = \frac1k [w^{k-1}] H' \varphi^k. □\square

Theorem (the exponential series, TAOCP eq. 1.2.9(22)).

ez=1+z+12!z2+⋯=∑k≥0zkk!.e^z = 1 + z + \frac1{2!} z^2 + \cdots = \sum_{k \ge 0} \frac{z^k}{k!}.

Node: TARSKE6CZN · Lean: TAOCP.S1_2_9.eq22, TAOCP.S1_2_9.eq22_real · status: proved

Explanation. It is the exponential generating function of 1,1,1,…1, 1, 1, \ldots, equal to its own derivative, and eazebz=e(a+b)ze^{a z} e^{b z} = e^{(a+b)z} is eq. (11) for powers. Mathlib has the series as PowerSeries.exp, with PowerSeries.coeff_exp, PowerSeries.derivative_exp and PowerSeries.exp_mul_exp_eq_exp_add.

Example. At z=1z = 1 the partial sums 1+1+12+16+124+1120=2.716671 + 1 + \frac12 + \frac16 + \frac1{24} + \frac1{120} = 2.71667 approach e=2.71828e = 2.71828.

Proof. The function eze^z is the solution of y′=yy' = y with y(0)=1y(0) = 1. Let y=∑ckzky = \sum c_k z^k. By eq. (14), (k+1)ck+1=ck(k+1) c_{k+1} = c_k and c0=1c_0 = 1, so ck=1/k!c_k = 1/k! by induction on kk. □\square

Theorem (the powers of ez−1e^z - 1, TAOCP eq. 1.2.9(23)). For each integer n≥0n \ge 0,

(ez−1)n=zn+1n+1{n+1n}zn+1+⋯=n!∑k{kn}zkk!.(e^z - 1)^n = z^n + \frac1{n+1} \Bigl\{ {n+1 \atop n} \Bigr\} z^{n+1} + \cdots = n! \sum_k \Bigl\{ {k \atop n} \Bigr\} \frac{z^k}{k!}.

Node: TAZVKN94SN · Lean: TAOCP.S1_2_9.eq23, TAOCP.S1_2_9.coeff_exp_sub_one_pow · status: proved

Explanation. The numbers {k,n}\{k, n\} are the Stirling numbers of the second kind, the number of partitions of a kk-element set into nn nonempty subsets. The theorem says that (ez−1)n/n!(e^z-1)^n / n! is their exponential generating function in kk. The second form of the left side is the first two terms. This is exercise 1.2.9-5. The project has the numbers as TAOCP.stirling2, with the recurrence TAOCP.stirling2_succ_succ.

Example. For n=2n = 2: (ez−1)2=z2+z3+712z4+⋯(e^z - 1)^2 = z^2 + z^3 + \frac7{12} z^4 + \cdots. The values {2,2}=1\{2, 2\} = 1, {3,2}=3\{3, 2\} = 3, {4,2}=7\{4, 2\} = 7 give 2!⋅{k,2}/k!2! \cdot \{k, 2\} / k! equal to 11, 66=1\frac66 = 1 and 1424=712\frac{14}{24} = \frac7{12}. The second form with the first two terms: 13{3,2}=1\frac13 \{3, 2\} = 1.

Proof. Let Mn(z)=∑k{k,n}zk/k!M_n(z) = \sum_k \{k, n\} z^k / k!. The recurrence {k+1,n}=n{k,n}+{k,n−1}\{k+1, n\} = n \{k, n\} + \{k, n-1\} and eq. (14) give Mn′=∑k{k+1,n}zk/k!=nMn+Mn−1M_n' = \sum_k \{k+1, n\} z^k/k! = n M_n + M_{n-1}. Take Nn=(ez−1)n/n!N_n = (e^z - 1)^n / n!. Its derivative is ez(ez−1)n−1/(n−1)!=((ez−1)+1)(ez−1)n−1/(n−1)!=nNn+Nn−1e^z (e^z - 1)^{n-1} / (n-1)! = ((e^z - 1) + 1)(e^z-1)^{n-1}/(n-1)! = n N_n + N_{n-1}. Both sequences have the same equation. For n=0n = 0, M0=1=N0M_0 = 1 = N_0 since {k,0}=0\{k, 0\} = 0 for k>0k > 0. Suppose Mn−1=Nn−1M_{n-1} = N_{n-1} for an n≥1n \ge 1. Then MnM_n and NnN_n solve y′=ny+Nn−1y' = n y + N_{n-1} with y(0)=0y(0) = 0. The difference DD has D′=nDD' = nD and D(0)=0D(0) = 0, so each coefficient of DD is 00 by induction on the degree. So Mn=NnM_n = N_n, which is the claim. □\square

Theorem (the series of ln⁡(1+z)\ln (1 + z), TAOCP eq. 1.2.9(24)).

ln⁡(1+z)=z−12z2+13z3−⋯=∑k≥1(−1)k+1kzk.\ln (1 + z) = z - \tfrac12 z^2 + \tfrac13 z^3 - \cdots = \sum_{k \ge 1} \frac{(-1)^{k+1}}k z^k.

Node: TA93N0K6KQ · Lean: TAOCP.S1_2_9.eq24, TAOCP.S1_2_9.eq24_real · status: proved

Explanation. It is eq. (17) with zz replaced by −z-z and a change of sign: ln⁡(1+z)=−ln⁡11+z\ln (1+z) = -\ln \frac1{1+z}. The series is the integral of 1/(1+z)=1−z+z2−⋯1/(1+z) = 1 - z + z^2 - \cdots.

Example. At z=1z = 1 the series is 1−12+13−⋯=ln⁡2=0.6931471 - \frac12 + \frac13 - \cdots = \ln 2 = 0.693147 (it converges, but slowly). At z=12z = \frac12: ln⁡1.5=0.405465\ln 1.5 = 0.405465, and the terms 0.5−0.125+0.041667−0.015625+0.00625=0.40730.5 - 0.125 + 0.041667 - 0.015625 + 0.00625 = 0.4073.

Proof. By eq. (17) with −z-z in place of zz: ln⁡11+z=∑(−z)k/k\ln \frac1{1+z} = \sum (-z)^k / k. Then ln⁡(1+z)=−∑(−1)kzk/k=∑(−1)k+1zk/k\ln (1 + z) = -\sum (-1)^k z^k/k = \sum (-1)^{k+1} z^k / k. □\square

Theorem (a logarithm times a power, TAOCP eq. 1.2.9(25)). For each integer m≥0m \ge 0,

1(1−z)m+1ln⁡11−z=∑k≥1(Hm+k−Hm)(m+kk)zk.\frac1{(1-z)^{m+1}} \ln \frac1{1-z} = \sum_{k \ge 1} (H_{m+k} - H_m) \binom{m+k}k z^k.

Node: TAXQBKD1NT · Lean: TAOCP.S1_2_9.eq25 · status: proved

Explanation. For m=0m = 0 this is eq. (18). The coefficient is a binomial coefficient times a difference of harmonic numbers.

Example. For m=1m = 1: the series is 1(1−z)2ln⁡11−z=z+52z2+133z3+⋯\frac1{(1-z)^2} \ln \frac1{1-z} = z + \frac52 z^2 + \frac{13}3 z^3 + \cdots. The formula gives for k=2k = 2: (H3−H1)(32)=56⋅3=52(H_3 - H_1) \binom32 = \frac56 \cdot 3 = \frac52, and for k=1k = 1: (H2−H1)(21)=12⋅2=1(H_2 - H_1) \binom21 = \frac12 \cdot 2 = 1. Direct product: (1+2z+3z2)(z+12z2+13z3)(1 + 2z + 3z^2)(z + \frac12 z^2 + \frac13 z^3) has z2z^2 coefficient 12+2=52\frac12 + 2 = \frac52. For k=3k = 3 the value is (H4−H1)(43)=1312⋅4=133(H_4 - H_1) \binom43 = \frac{13}{12} \cdot 4 = \frac{13}3.

Proof. Differentiate eq. (20) with respect to a continuous exponent. Let ss be a variable: by eq. (19), (1−z)−s=∑k(s+k−1k)zk(1 - z)^{-s} = \sum_k \binom{s + k - 1}k z^k, where (s+k−1k)=s(s+1)⋯(s+k−1)/k!\binom{s+k-1}k = s(s+1) \cdots (s+k-1)/k! is a polynomial in ss. The derivative of the left side with respect to ss is −ln⁡(1−z)(1−z)−s=(1−z)−sln⁡11−z-\ln(1-z) (1-z)^{-s} = (1-z)^{-s} \ln \frac1{1-z}. The derivative of the right side is, by the product rule for s(s+1)⋯(s+k−1)s(s+1)\cdots(s+k-1), ∑ks(s+1)⋯(s+k−1)k!∑j=0k−11s+jzk\sum_k \frac{s(s+1)\cdots(s+k-1)}{k!} \sum_{j=0}^{k-1} \frac1{s + j} z^k. Put s=m+1s = m + 1: the product is (m+kk)\binom{m+k}k, and ∑j=0k−11m+1+j=Hm+k−Hm\sum_{j=0}^{k-1} \frac1{m+1+j} = H_{m+k} - H_m. □\square

Theorem (the powers of the logarithm, TAOCP eq. 1.2.9(26)). For each integer n≥0n \ge 0,

(ln⁡11−z)n=zn+1n+1[n+1n]zn+1+⋯=n!∑k[kn]zkk!.\Bigl( \ln \frac1{1-z} \Bigr)^n = z^n + \frac1{n+1} \Bigl[ {n+1 \atop n} \Bigr] z^{n+1} + \cdots = n! \sum_k \Bigl[ {k \atop n} \Bigr] \frac{z^k}{k!}.

Node: TAGPCNSJ3Z · Lean: TAOCP.S1_2_9.eq26, TAOCP.S1_2_9.coeff_lnInvOneSub_pow · status: proved

Explanation. The numbers [k,n][k, n] are the Stirling numbers of the first kind, the number of permutations of kk objects with nn cycles. The theorem is the analogue of eq. (23). The project has them as TAOCP.stirling1, with TAOCP.stirling1_succ_succ.

Example. For n=2n = 2: (ln⁡11−z)2=z2+z3+1112z4+⋯(\ln \frac1{1-z})^2 = z^2 + z^3 + \frac{11}{12} z^4 + \cdots, with [2,2]=1[2, 2] = 1, [3,2]=3[3, 2] = 3, [4,2]=11[4, 2] = 11: 2⋅3/3!=12 \cdot 3/3! = 1 and 2⋅11/4!=11122 \cdot 11/4! = \frac{11}{12}. Check by squaring: (z+12z2+13z3)2(z + \frac12 z^2 + \frac13 z^3)^2 has the z4z^4 coefficient 2⋅13+14=11122 \cdot \frac13 + \frac14 = \frac{11}{12}.

Proof. Let Ln(z)=∑k[k,n]zk/k!L_n(z) = \sum_k [k, n] z^k / k!. The recurrence is [k+1,n]=k[k,n]+[k,n−1][k+1, n] = k [k, n] + [k, n-1]. By eq. (14), Ln′=∑k[k+1,n]zk/k!=∑kk[k,n]zk/k!+Ln−1=zLn′+Ln−1L_n' = \sum_k [k+1, n] z^k / k! = \sum_k k [k, n] z^k / k! + L_{n-1} = z L_n' + L_{n-1}, so (1−z)Ln′=Ln−1(1 - z) L_n' = L_{n-1} and Ln(0)=0L_n(0) = 0 for n≥1n \ge 1. Let ℓ=ln⁡11−z\ell = \ln \frac1{1-z}, so ℓ′=1/(1−z)\ell' = 1/(1-z). Then (ℓn/n!)′=ℓn−1ℓ′/(n−1)!=11−z⋅ℓn−1/(n−1)!(\ell^n / n!)' = \ell^{n-1}\ell'/(n-1)! = \frac{1}{1 - z} \cdot \ell^{n-1}/(n-1)!. So ℓn/n!\ell^n/n! satisfies the same equation, with the same value 00 at z=0z = 0. A series yy with (1−z)y′=g(1-z) y' = g and y(0)y(0) given is unique, since the coefficients are found one by one: (k+1)yk+1−kyk=gk(k+1) y_{k+1} - k y_k = g_k. By induction on nn from L0=1=ℓ0L_0 = 1 = \ell^0, Ln=ℓn/n!L_n = \ell^n / n!. □\square

Theorem (the rising power, TAOCP eq. 1.2.9(27)). For each integer n≥0n \ge 0,

z(z+1)⋯(z+n−1)=∑k[nk]zk.z (z + 1) \cdots (z + n - 1) = \sum_k \Bigl[ {n \atop k} \Bigr] z^k.

Node: TAHV8R3EM0 · Lean: TAOCP.S1_2_9.eq27 · status: proved

Explanation. This is a polynomial identity. It says that the Stirling numbers of the first kind are the coefficients of the rising power zn‾z^{\overline n}. In the project, TAOCP.risingPow is the rising power.

Example. For n=3n = 3: z(z+1)(z+2)=z3+3z2+2zz (z+1)(z+2) = z^3 + 3z^2 + 2z. The coefficients are [3,3]=1[3, 3] = 1, [3,2]=3[3, 2] = 3, [3,1]=2[3, 1] = 2, which are the numbers of permutations of three objects with three, two and one cycle: 1+3+2=6=3!1 + 3 + 2 = 6 = 3!.

Proof. For n=0n = 0 the product is 1=[0,0]1 = [0, 0]. Suppose that it holds for nn. Multiply by (z+n)(z + n): the coefficient of zkz^k in (z+n)∑j[n,j]zj(z + n) \sum_j [n, j] z^j is [n,k−1]+n[n,k][n, k-1] + n [n, k], which is [n+1,k][n+1, k] by the recurrence of the first kind. □\square

Theorem (a column of the Stirling numbers of the second kind, TAOCP eq. 1.2.9(28)). For each integer n≥0n \ge 0,

zn(1−z)(1−2z)⋯(1−nz)=∑k{kn}zk.\frac{z^n}{(1 - z)(1 - 2z) \cdots (1 - nz)} = \sum_k \Bigl\{ {k \atop n} \Bigr\} z^k.

Node: TAYPTWYHRJ · Lean: TAOCP.S1_2_9.eq28 · status: proved

Explanation. Here the ordinary generating function of the numbers {k,n}\{k, n\} in kk, with nn fixed, is a rational function. It is the version of eq. (23) with zkz^k in place of zk/k!z^k/k!.

Example. For n=2n = 2: z2/((1−z)(1−2z))=z2+3z3+7z4+15z5+31z6+⋯z^2 / ((1-z)(1-2z)) = z^2 + 3z^3 + 7z^4 + 15z^5 + 31z^6 + \cdots, and {k,2}=2k−1−1\{k, 2\} = 2^{k-1} - 1 for k=2,…,6k = 2, \ldots, 6 is 1,3,7,15,311, 3, 7, 15, 31.

Proof. Let QnQ_n be the left side, so Q0=1Q_0 = 1 and (1−nz)Qn=zQn−1(1 - nz) Q_n = z Q_{n-1}. In the coefficient of zkz^k this reads qn,k−nqn,k−1=qn−1,k−1q_{n,k} - n q_{n,k-1} = q_{n-1,k-1}, that is qn,k=nqn,k−1+qn−1,k−1q_{n,k} = n q_{n,k-1} + q_{n-1,k-1}. This is the recurrence {k,n}=n{k−1,n}+{k−1,n−1}\{k, n\} = n \{k-1, n\} + \{k-1, n-1\} of the second kind. The initial values agree: q0,k=[k=0]={k,0}q_{0,k} = [k = 0] = \{k, 0\} and qn,0=0={0,n}q_{n,0} = 0 = \{0, n\} for n≥1n \ge 1. By induction on kk and nn, qn,k={k,n}q_{n,k} = \{k, n\}. □\square

Theorem (the Bernoulli numbers, TAOCP eq. 1.2.9(29)). The Bernoulli numbers BkB_k are defined by the series below, and they satisfy B0=1B_0 = 1 and ∑k=0m(m+1k)Bk=0\sum_{k=0}^{m} \binom{m+1}k B_k = 0 for m≥1m \ge 1:

zez−1=1−12z+112z2+⋯=∑k≥0Bkzkk!.\frac z{e^z - 1} = 1 - \tfrac12 z + \tfrac1{12} z^2 + \cdots = \sum_{k \ge 0} \frac{B_k z^k}{k!}.

Node: TA03QCETCT · Lean: TAOCP.S1_2_9.eq29 (partial) · status: proved

Explanation. The series (ez−1)/z=1+z/2+z2/6+⋯(e^z - 1)/z = 1 + z/2 + z^2/6 + \cdots has constant term 11, so it has an inverse, and the coefficients of the inverse define BkB_k. The recurrence gives them one by one. The numbers are studied in Section 1.2.11.2. In Mathlib the series is bernoulliPowerSeries, with bernoulliPowerSeries_mul_exp_sub_one, and the numbers bernoulli, with B1=−12B_1 = -\frac12 as in the book.

Example. From the recurrence, B0=1B_0 = 1, B1=−12⋅1=−12B_1 = -\frac12 \cdot 1 = -\frac12 (since 2B1+B0=02 B_1 + B_0 = 0 for m=1m = 1), B2=16B_2 = \frac16, B3=0B_3 = 0, B4=−130B_4 = -\frac1{30}, B5=0B_5 = 0. In the series the coefficient of z2z^2 is B2/2!=112B_2 / 2! = \frac1{12}, as in the section.

Proof. By definition zez−1⋅ez−1z=1\frac z{e^z-1} \cdot \frac{e^z - 1}z = 1. The series ez−1z=∑j≥0zj/(j+1)!\frac{e^z-1}z = \sum_{j \ge 0} z^j/(j+1)!. The coefficient of zmz^m in the product is ∑k=0mBkk!1(m−k+1)!\sum_{k=0}^m \frac{B_k}{k!} \frac1{(m-k+1)!}, which is 11 for m=0m = 0 and 00 for m≥1m \ge 1. Multiply by (m+1)!(m+1)!: ∑k=0m(m+1k)Bk=0\sum_{k=0}^m \binom{m+1}k B_k = 0 for m≥1m \ge 1, since (m+1)!k!(m+1−k)!=(m+1k)\frac{(m+1)!}{k!(m+1-k)!} = \binom{m+1}k. □\square

Theorem (the series with x=ezxtx = e^{zx^t}, TAOCP eq. 1.2.9(30)). Let tt be a number and xx the continuous function of zz with x=ezxtx = e^{z x^t} and x=1x = 1 at z=0z = 0. Then for each number rr,

xr=1+rz+r(r+2t)2z2+⋯=∑k≥0r(r+kt)k−1k!zk.x^r = 1 + rz + \frac{r(r + 2t)}2 z^2 + \cdots = \sum_{k \ge 0} \frac{r (r + kt)^{k-1}}{k!} z^k.

Node: TAHZ4TRZBF · status: not stated yet

Explanation. This is the analogue of eq. (21) for the exponential function. The proof is Lagrange's theorem again (see exercise 2.3.4.4-29).

Example. With t=1t = 1, r=1r = 1: the coefficients are (1+k)k−1/k!=1,1,32,83,12524,545(1 + k)^{k-1}/k! = 1, 1, \frac32, \frac83, \frac{125}{24}, \frac{54}5 for k=0,…,5k = 0, \ldots, 5. A direct iteration of x=ezxx = e^{zx} from x=1x = 1 gives the series 1+z+32z2+83z3+12524z4+545z51 + z + \frac32 z^2 + \frac83 z^3 + \frac{125}{24} z^4 + \frac{54}5 z^5.

Proof. Let u=ln⁡xu = \ln x. Then u=zxt=zetuu = z x^t = z e^{tu}, so u=zφ(u)u = z \varphi(u) with φ(u)=etu\varphi(u) = e^{tu}. By Lagrange's theorem (in the proof of eq. (21)), with H(u)=eruH(u) = e^{ru}: [zk]xr=1k[uk−1]reruetku=rk⋅(r+tk)k−1(k−1)!=r(r+kt)k−1k![z^k] x^r = \frac1k [u^{k-1}] r e^{ru} e^{tku} = \frac rk \cdot \frac{(r + tk)^{k-1}}{(k-1)!} = \frac{r (r+kt)^{k-1}}{k!}. □\square

Definition (the coefficient of znz^n, TAOCP eq. 1.2.9(31)). For a series GG, [zn]G(z)[z^n] G(z) is the coefficient of znz^n in G(z)G(z).

Node: TAPN7720F9 · status: proved

Explanation. If GG is the series of eq. (1) then [zn]G(z)=an[z^n] G(z) = a_n, and by eq. (7), [zn]G(z)/(1−z)=∑k=0nak[z^n] G(z)/(1-z) = \sum_{k=0}^n a_k. By eq. (6), [zn]GH=∑k[zk]G [zn−k]H[z^n] G H = \sum_k [z^k] G \, [z^{n-k}] H. In Mathlib it is PowerSeries.coeff n, and in the project TAOCP.coeff_ogf.

Example. [z4]11−z−z2=F5=5[z^4] \frac1{1 - z - z^2} = F_5 = 5. [z3](1+z)5=(53)=10[z^3] (1 + z)^5 = \binom53 = 10. [zn]ez=1/n![z^n] e^z = 1/n!.

Proof. A definition has no proof. The notation is well defined since the coefficients of a series are unique. □\square

Theorem (Cauchy's formula for a coefficient, TAOCP eq. 1.2.9(32)). If the series G(z)=∑anznG(z) = \sum a_n z^n converges at z=z0z = z_0 and 0<r<∣z0∣0 < r < |z_0|, then

[zn]G(z)=12πi∮∣z∣=rG(z) dzzn+1.[z^n] G(z) = \frac1{2\pi i} \oint_{|z| = r} \frac{G(z)\,dz}{z^{n+1}}.

Node: TA5HXMXEAY · status: not stated yet

Explanation. The integral over a circle picks one coefficient out of the function, and it is used mostly to estimate a coefficient.

Example. For G=1/(1−z−z2)G = 1/(1 - z - z^2) and n=3n = 3, with r=0.4r = 0.4 (smaller than the radius 1/ϕ=0.6181/\phi = 0.618), a numerical integral with 4000 points on the circle gives 3.00000003.0000000, and [z3]G=F4=3[z^3] G = F_4 = 3.

Proof. For ∣z∣=r<∣z0∣|z| = r < |z_0| the series converges uniformly, so the integral of the sum is the sum of the integrals. The integral of zmz^m over the circle is 00 for each integer m≠−1m \ne -1, since zmz^m has the antiderivative zm+1/(m+1)z^{m+1}/(m+1). For m=−1m = -1 the parametrization z=reiθz = r e^{i\theta} gives ∫−ππ(reiθ)−1d(reiθ)=i∫−ππdθ=2πi\int_{-\pi}^{\pi} (r e^{i\theta})^{-1} d(r e^{i\theta}) = i \int_{-\pi}^{\pi} d\theta = 2\pi i. Hence ∮G(z)z−n−1dz=∑kak∮zk−n−1dz=2πi an\oint G(z) z^{-n-1} dz = \sum_k a_k \oint z^{k - n - 1} dz = 2\pi i \, a_n. □\square

Definition (the complete symmetric functions, TAOCP eq. 1.2.9(33)). For numbers x1,…,xnx_1, \ldots, x_n and an integer m≥0m \ge 0, the sum of all products of mm of them, with repeats allowed, is

hm=∑1≤j1≤⋯≤jm≤nxj1⋯xjm.h_m = \sum_{1 \le j_1 \le \cdots \le j_m \le n} x_{j_1} \cdots x_{j_m}.

Node: TAN3JGMDYC · Lean: TAOCP.S1_2_9.eq33 · status: proved

Explanation. In the sum each monomial of degree mm in the xx's occurs once. For m=0m = 0 the sum has one term, the empty product 11, so h0=1h_0 = 1. For m=1m = 1 it is x1+⋯+xnx_1 + \cdots + x_n. For m=2m = 2 and m=3m = 3 it is the sum ∑i≤jxixj\sum_{i \le j} x_i x_j of eq. 1.2.3(13) and the sum ∑i≤j≤kxixjxk\sum_{i \le j \le k} x_i x_j x_k of exercise 1.2.3-29.

Example. For x=(1,2,3)x = (1, 2, 3): h1=6h_1 = 6, h2=1+4+9+2+3+6=25h_2 = 1 + 4 + 9 + 2 + 3 + 6 = 25, h3=90h_3 = 90, h4=301h_4 = 301.

Proof. A definition has no proof. The number of terms of hmh_m is (n+m−1m)\binom{n + m - 1}m, the number of multisets of size mm chosen from nn objects; for n=3n = 3 and m=2m = 2 it is 66. □\square

Definition (the power sums, TAOCP eq. 1.2.9(34)). For an integer j≥1j \ge 1,

Sj=∑k=1nxkj.S_j = \sum_{k=1}^n x_k^j.

Node: TAT8F54AWF · Lean: TAOCP.S1_2_9.powSum · status: not stated yet

Explanation. The notation makes the formulas short. In terms of it, h2=12S12+12S2h_2 = \frac12 S_1^2 + \frac12 S_2 and h3=16S13+12S1S2+13S3h_3 = \frac16 S_1^3 + \frac12 S_1 S_2 + \frac13 S_3. The aim of the rest of the section is a formula for hmh_m in terms of S1,…,SmS_1, \ldots, S_m which does not depend on nn.

Example. For x=(1,2,3)x = (1, 2, 3): S1=6S_1 = 6, S2=14S_2 = 14, S3=36S_3 = 36, S4=98S_4 = 98. Then h2=12⋅36+12⋅14=25h_2 = \frac12 \cdot 36 + \frac12 \cdot 14 = 25, and h3=16⋅216+12⋅6⋅14+13⋅36=36+42+12=90h_3 = \frac16 \cdot 216 + \frac12 \cdot 6 \cdot 14 + \frac13 \cdot 36 = 36 + 42 + 12 = 90.

Proof. A definition has no proof. The two formulas above are proved as a special case of eq. (38). □\square

Definition (the generating function of the complete symmetric functions, TAOCP eq. 1.2.9(35)).

G(z)=1+h1z+h2z2+⋯=∑k≥0hkzk.G(z) = 1 + h_1 z + h_2 z^2 + \cdots = \sum_{k \ge 0} h_k z^k.

Node: TAZJA16JA6 · Lean: TAOCP.S1_2_9.hSeries, TAOCP.S1_2_9.hh (partial) · status: not stated yet

Explanation. This is the series of the sequence h0,h1,h2,…h_0, h_1, h_2, \ldots, with the numbers x1,…,xnx_1, \ldots, x_n as parameters. It has constant term 11, so its logarithm exists.

Example. For n=1n = 1 and x1=1x_1 = 1: hm=1h_m = 1 and G=1/(1−z)G = 1/(1-z). For x=(1,2,3)x = (1, 2, 3): G=1+6z+25z2+90z3+301z4+966z5+⋯G = 1 + 6z + 25 z^2 + 90 z^3 + 301 z^4 + 966 z^5 + \cdots.

Proof. A definition has no proof. □\square

Theorem (the product form, TAOCP eq. 1.2.9(36)).

G(z)=1(1−x1z)(1−x2z)⋯(1−xnz).G(z) = \frac1{(1 - x_1 z)(1 - x_2 z) \cdots (1 - x_n z)}.

Node: TAZRSZ59NG · Lean: TAOCP.S1_2_9.eq36 · status: proved

Explanation. The product form shows that GG is 11 over a polynomial in zz of degree at most nn. By eq. (5) with the change z→xkzz \to x_k z, each factor 1/(1−xkz)1/(1 - x_k z) generates the powers of xkx_k, and the product of the nn series collects, for each monomial, one term of the sum.

Example. For x=(1,2,3)x = (1, 2, 3): 1/((1−z)(1−2z)(1−3z))=1+6z+25z2+90z3+⋯1/((1-z)(1-2z)(1-3z)) = 1 + 6z + 25z^2 + 90z^3 + \cdots, which agrees with the series of the previous example, and [z2][z^2] is h2=25h_2 = 25.

Proof. By eq. (5) with z→xkzz \to x_k z, 1/(1−xkz)=∑e≥0xkeze1/(1 - x_k z) = \sum_{e \ge 0} x_k^e z^e. By eq. (9) for a finite product, the coefficient of zmz^m in the product of the nn series is the sum of x1e1⋯xnenx_1^{e_1} \cdots x_n^{e_n} over all e1+⋯+en=me_1 + \cdots + e_n = m. These are the monomials of degree mm, one each. A product xj1⋯xjmx_{j_1} \cdots x_{j_m} with j1≤⋯≤jmj_1 \le \cdots \le j_m is a monomial with the exponents ei=e_i = the number of jj's equal to ii. So the sum is hmh_m. □\square

Theorem (the logarithm, TAOCP eq. 1.2.9(37)).

ln⁡G(z)=ln⁡11−x1z+⋯+ln⁡11−xnz=∑k≥1Skzkk.\ln G(z) = \ln \frac1{1 - x_1 z} + \cdots + \ln \frac1{1 - x_n z} = \sum_{k \ge 1} \frac{S_k z^k}k.

Node: TAWHSX3VCR · Lean: TAOCP.S1_2_9.derivative_hSeries (partial) · status: not stated yet

Explanation. The logarithm turns a product into a sum. Each logarithm is a series by eq. (17), with xjzx_j z in place of zz. The sum over jj of the coefficient xjk/kx_j^k/k is Sk/kS_k / k. The logarithm is now written with the power sums alone.

Example. For x=(1,2,3)x = (1, 2, 3), the coefficient of zz in ln⁡G\ln G is S1=6S_1 = 6, and that of z2z^2 is S2/2=7S_2/2 = 7. Check: ln⁡(1+6z+25z2+⋯ )=6z+25z2−12(6z)2+⋯=6z+7z2+⋯\ln (1 + 6z + 25z^2 + \cdots) = 6z + 25z^2 - \frac12 (6z)^2 + \cdots = 6z + 7z^2 + \cdots.

Proof. The logarithm of a product of series with constant term 11 is the sum of the logarithms, since both sides have the constant term 00 and the derivative of the logarithm of GG is G′/GG'/G, which is additive over products by the rule for the derivative of a product. Then eq. (17) gives ln⁡11−xjz=∑kxjkzk/k\ln \frac1{1 - x_j z} = \sum_k x_j^k z^k / k, and the sum over jj is ∑kSkzk/k\sum_k S_k z^k / k. □\square

Theorem (the symmetric functions by power sums, TAOCP eq. 1.2.9(38)). For each integer m≥0m \ge 0,

hm=∑k1,…,km≥0k1+2k2+⋯+mkm=mS1k11k1k1!S2k22k2k2!⋯Smkmmkmkm!.h_m = \sum_{\substack{k_1, \ldots, k_m \ge 0 \\ k_1 + 2k_2 + \cdots + m k_m = m}} \frac{S_1^{k_1}}{1^{k_1} k_1!} \frac{S_2^{k_2}}{2^{k_2} k_2!} \cdots \frac{S_m^{k_m}}{m^{k_m} k_m!}.

Node: TAYSX7K3S7 · status: not stated yet

Explanation. This is the answer to the problem of the section. There is one term for each partition of mm (a way to write mm as a sum of positive integers, without order), with kjk_j the number of parts equal to jj. So the number of terms is p(m)p(m). The formula does not depend on the number nn of variables.

Example. For the partition 10=3+3+2+1+110 = 3 + 3 + 2 + 1 + 1: k1=2k_1 = 2, k2=1k_2 = 1, k3=2k_3 = 2, and the other kjk_j are 00. The term of h10h_{10} is S1212⋅2!⋅S22⋅1!⋅S3232⋅2!=172S12S2S32\frac{S_1^2}{1^2 \cdot 2!} \cdot \frac{S_2}{2 \cdot 1!} \cdot \frac{S_3^2}{3^2 \cdot 2!} = \frac1{72} S_1^2 S_2 S_3^2. The number of partitions of 1010 is 4242, so h10h_{10} has 4242 terms. For m=4m = 4 the five terms give h4=124S14+14S12S2+18S22+13S1S3+14S4h_4 = \frac1{24} S_1^4 + \frac14 S_1^2 S_2 + \frac18 S_2^2 + \frac13 S_1 S_3 + \frac14 S_4, and for x=(1,2,3)x = (1, 2, 3), with S=6,14,36,98S = 6, 14, 36, 98, the five terms are 5454, 126126, 24.524.5, 7272 and 24.524.5, and their sum is 301=h4301 = h_4.

Proof. By eq. (37), G(z)=eln⁡G(z)=exp⁡(∑k≥1Skzk/k)G(z) = e^{\ln G(z)} = \exp \bigl( \sum_{k \ge 1} S_k z^k / k \bigr). The exponential of a sum is the product of the exponentials, so G=∏k≥1eSkzk/kG = \prod_{k \ge 1} e^{S_k z^k/k}. By eq. (22), the factor with index jj is eSjzj/j=∑kj≥0Sjkjzjkjjkjkj!e^{S_j z^j / j} = \sum_{k_j \ge 0} \frac{S_j^{k_j} z^{j k_j}}{j^{k_j} k_j!}. By eq. (9), the coefficient of zmz^m in the product is the sum, over all sequences k1,k2,…k_1, k_2, \ldots with k1+2k2+3k3+⋯=mk_1 + 2k_2 + 3k_3 + \cdots = m, of the product of the coefficients. Such a sequence has kj=0k_j = 0 for j>mj > m. This is the formula. □\square

Theorem (the recursion for the symmetric functions, TAOCP eq. 1.2.9(39)). For each integer n≥1n \ge 1, where nn is now an index and the count of the numbers xkx_k is arbitrary,

hn=1n(S1hn−1+S2hn−2+⋯+Snh0).h_n = \frac1n (S_1 h_{n-1} + S_2 h_{n-2} + \cdots + S_n h_0).

Node: TA27DQ7W0M · Lean: TAOCP.S1_2_9.eq39 · status: proved

Explanation. This is a recurrence that computes hnh_n from the earlier values, and it is cheaper than the sum over the partitions. It also solves the problem in reverse: it gives SnS_n from the hh's, as S1=h1S_1 = h_1, S2=2h2−h12S_2 = 2h_2 - h_1^2, S3=3h3−3h1h2+h13S_3 = 3h_3 - 3h_1 h_2 + h_1^3 (exercise 1.2.9-11). It is one form of Newton's identities between power sums and symmetric functions.

Example. For x=(1,2,3)x = (1, 2, 3) with S=6,14,36,98S = 6, 14, 36, 98: h1=6h_1 = 6, h2=12(6⋅6+14)=25h_2 = \frac12 (6 \cdot 6 + 14) = 25, h3=13(6⋅25+14⋅6+36)=2703=90h_3 = \frac13 (6 \cdot 25 + 14 \cdot 6 + 36) = \frac{270}3 = 90, h4=14(6⋅90+14⋅25+36⋅6+98)=12044=301h_4 = \frac14 (6 \cdot 90 + 14 \cdot 25 + 36 \cdot 6 + 98) = \frac{1204}4 = 301, h5=966h_5 = 966.

Proof. From eq. (37), ln⁡G(z)=∑Skzk/k\ln G(z) = \sum S_k z^k / k. Differentiate: G′(z)/G(z)=∑k≥1Skzk−1G'(z)/G(z) = \sum_{k \ge 1} S_k z^{k-1}. So G′(z)=G(z)∑k≥1Skzk−1G'(z) = G(z) \sum_{k \ge 1} S_k z^{k-1}. The coefficient of zn−1z^{n-1} on the left is nhnn h_n by eq. (14). On the right it is ∑k=1nSkhn−k\sum_{k=1}^n S_k h_{n-k} by eq. (6). Divide by nn. □\square

Algorithms and programs

Section 1.2.9 has no algorithm and no program. The recursion of eq. (39) computes h1,…,hnh_1, \ldots, h_n from the power sums in about n2n^2 operations, but the book gives it as a formula, and C1 adds no algorithm.

The exercises

The table has the 26 exercises of Section 1.2.9. The kind is the class of spec 06.3 that C1 proposes, and the indexer of S0 fixes it in the map.

Exercise Rating Markers Kind Lean Solution
1.2.9-1 12 M K3 not yet stated X1, 1.2.9-1
1.2.9-2 13 M K1 not yet stated X1, 1.2.9-2
1.2.9-3 21 HM K1 not yet stated X1, 1.2.9-3
1.2.9-4 01 M K1 not yet stated X1, 1.2.9-4
1.2.9-5 20 M K1 not yet stated X1, 1.2.9-5
1.2.9-6 15 HM K3 not yet stated X1, 1.2.9-6
1.2.9-7 15 M K1 not yet stated X1, 1.2.9-7
1.2.9-8 23 M K3 not yet stated X1, 1.2.9-8
1.2.9-9 11 M K3 not yet stated X1, 1.2.9-9
1.2.9-10 25 M K3 not yet stated X1, 1.2.9-10
1.2.9-11 25 M K3 not yet stated X1, 1.2.9-11
1.2.9-12 20 M K3 not yet stated X1, 1.2.9-12
1.2.9-13 22 HM K3 not yet stated X1, 1.2.9-13
1.2.9-14 21 HM K1 not yet stated X1, 1.2.9-14
1.2.9-15 28 M K3 not yet stated X1, 1.2.9-15
1.2.9-16 22 M K3 not yet stated X1, 1.2.9-16
1.2.9-17 25 M K3 not yet stated X1, 1.2.9-17
1.2.9-18 25 M K3 not yet stated X1, 1.2.9-18
1.2.9-19 32 HM K1 not yet stated X1, 1.2.9-19
1.2.9-20 21 M K3 not yet stated X1, 1.2.9-20
1.2.9-21 30 HM informal not yet stated X1, 1.2.9-21
1.2.9-22 21 M K3 not yet stated X1, 1.2.9-22
1.2.9-23 33 M K1 not yet stated X1, 1.2.9-23
1.2.9-24 22 M K1 not yet stated X1, 1.2.9-24
1.2.9-25 23 M K3 not yet stated X1, 1.2.9-25
1.2.9-26 40 M informal not yet stated X1, 1.2.9-26

The order to do them: 1.2.9-4, 9, 1 and 2 first, since each is a direct use of an equation. Then 1.2.9-5, 7 and 14, which prove eqs. (23), (38) and (13). Exercises 1.2.9-3 and 6 use the derivative, 1.2.9-12 uses a series in two variables, and 1.2.9-13 uses the Laplace transform. Exercises 1.2.9-8, 10, 11 and 18 are about partitions and symmetric functions, and they follow 1.2.9-9. Exercises 1.2.9-15, 16, 17, 20 and 22 ask for a closed form built with the rules of the section, and 1.2.9-24 and 25 use the coefficient notation. Exercise 1.2.9-19 (Gauss) and 1.2.9-23 are the hardest proofs, and 1.2.9-21 and 26 ask for an exploration with no fixed answer, so they come last.

Lean

The Lean code of tamnd/taocp-lean at main has the file TAOCP/V1/S1_2_9.lean, in the namespace TAOCP.S1_2_9. It states eqs. (1) to (9), (11) to (20), (22) to (29), (33) to (36) and (39), and it has the building blocks in TAOCP/Notation/GenFun.lean: TAOCP.ogf for eq. (1), TAOCP.egf for the exponential generating function, TAOCP.coeff_ogf and TAOCP.coeff_egf for the coefficients and TAOCP.coeff_ogf_mul for the product rule. The Stirling numbers are TAOCP.stirling1 and TAOCP.stirling2. The Node lines name the declarations. Where the Lean statement is weaker, the Node line says "partial".

Not yet stated: the generalized binomial series (eq. (21)), the series with x=ezxtx = e^{zx^t} (eq. (30)), the notation [zn]G(z)[z^n]G(z) (eq. (31)), Cauchy's formula (eq. (32)) and the symmetric functions by power sums (eq. (38)). The declaration TAOCP.S1_2_9.eq31 states a use of the notation, that [zn] G(z)/(1−z)[z^n]\, G(z)/(1-z) is the partial sum a0+⋯+ana_0 + \cdots + a_n, and it is not the definition of the notation, so this chapter does not name it for eq. (31).

The fidelity choice of Lean is formal power series, PowerSeries, over a ring, or over ℚ where the statement needs division, so that the identities need no condition of convergence. The points where Lean differs from the book are these.

  • Eq. (4) is stated without division: G(z)G(z) is its first mm terms plus zmz^m times the series of an+ma_{n+m}. The handbook divides by zmz^m.
  • Eqs. (5), (16), (20) and (28) are stated as a product that equals 11 or znz^n, so they have no division. For example, TAOCP.S1_2_9.eq5 says that the series of ones times 1−z1 - z is 11.
  • Eq. (9) is stated for a finite product, over a Finset. The handbook has the infinite product with the condition on the sequences.
  • Eq. (10) has no declaration of its own. The binomial convolution is written inside TAOCP.S1_2_9.eq11.
  • Eq. (12) is stated over ℚ, and eq. (13) is stated over ℂ with ω=e2πi/m\omega = e^{2\pi i/m}.
  • Eqs. (14) to (16) and (18) to (26) and (28) are formal series over ℚ, and eq. (27) is stated in a commutative ring. Where the analytic form for real xx with ∣x∣<1|x| < 1 is also stated, the name ends in _real.
  • Eq. (19) is stated for a natural exponent as a formal series (TAOCP.S1_2_9.eq19) and for a real exponent as a convergent sum for ∣x∣<1|x| < 1 (TAOCP.S1_2_9.eq19_real). The formal series with a real exponent is not stated.
  • Eq. (29) states that the series of Bk/k!B_k/k! times ez−1e^z - 1 is zz. The recursion ∑k(m+1k)Bk=0\sum_k \binom{m+1}{k} B_k = 0 is not stated here.
  • Eq. (33) is stated with the number lil_i of times that each index occurs. Eq. (35) and eq. (36) are in the other order in Lean: TAOCP.S1_2_9.hSeries is the product of eq. (36), and TAOCP.S1_2_9.hh takes its coefficients. TAOCP.S1_2_9.eq36 says that the product of 1−xiz1 - x_i z times the series is 11. For eq. (37) the declaration TAOCP.S1_2_9.derivative_hSeries states the derivative of the series, which is eq. (37) after the differentiation.
  • The operation of the change z↦czz \mapsto cz is TAOCP.S1_2_9.opD. The values of the first symmetric functions are TAOCP.S1_2_9.hh_zero, TAOCP.S1_2_9.hh_one, TAOCP.S1_2_9.hh_two and TAOCP.S1_2_9.hh_three.

The Mathlib names that the statements use are these.

  • Series: PowerSeries.mk, PowerSeries.coeff, PowerSeries.coeff_mul, PowerSeries.derivative and PowerSeries.exp.
  • Bernoulli and harmonic numbers: bernoulli and harmonic, with the power series bernoulliPowerSeries.
  • Lagrange's theorem and Cauchy's formula have no counterpart in Mathlib in the form of the book.

Notes and history

Abraham de Moivre introduced generating functions to solve linear recurrences, in a paper of 1722. James Stirling (1730) added the derivative and the integral. Leonhard Euler used them for partitions in papers of 1741 and 1750, and the product of eq. (9) for p(n)p(n) is exercise 1.2.9-8. Pierre Simon Laplace gave the method its form in 1812. Augustin Louis Cauchy gave the integral of eq. (32) in 1826, and Joseph Louis Lagrange gave his theorem in 1770. The treatment of series without convergence is by E. T. Bell (1923) and Ivan Niven (1969). For a gentle start, the section points to G. Pólya, "On picture writing" (1956), to Chapter 7 of Concrete Mathematics and to the book generatingfunctionology of H. S. Wilf (second edition, 1994). Its last words are a remark of Wilf (1989), who compares a generating function to a line on which a sequence is put up to be seen. Sums of harmonic numbers that extend eqs. (25) and (26) are in papers of D. A. Zave (1976) and J. Spiess (1990).

The project has no errata of Section 1.2.9 to report.

Section 1.2.9 of TAOCP turns a sequence of numbers into one power series, so that the algebra and the calculus of series act on the whole sequence at once. The section lists the operations (sum, shift, product, change of the variable, derivative, integral), the table of the series that every reader must know, the extraction of a coefficient by a contour integral, and one long application: the formulas for the complete symmetric functions in terms of power sums. This chapter of C1 explains each of the 39 numbered equations of the section, proves each one in full, and checks it on numbers.

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