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

Solutions

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. Solutions to Chapter 1: Sums and their manipulation
  2. Solutions to Chapter 2: The perturbation method and recurrences
  3. Solutions to Chapter 3: Finite calculus
  4. Solutions to Chapter 4: Floors, ceilings, logarithms and mod
  5. Solutions to Chapter 5: Divisibility, primes, gcd and congruences
  6. Solutions to Chapter 6: Binomial coefficients
  7. Solutions to Chapter 7: Binomial identities
  8. Solutions to Chapter 8: Stirling numbers and Eulerian numbers

Solutions to Chapter 1: Sums and their manipulation

Section 1.1: The notation for sums and products

Exercise 1.1-1. The first sum is 4+1+0+1+4+9=194 + 1 + 0 + 1 + 4 + 9 = 19. The second sum has its upper limit 22 below its lower limit 44, so it is the empty sum, 00. The product ∏k=42k\prod_{k=4}^{2} k is the empty product, 11.

Exercise 1.1-2. Rule 3 of the algebra of brackets gives [k odd or 5∣k]=[k odd]+[5∣k]−[k odd][5∣k][k \text{ odd or } 5 \mid k] = [k \text{ odd}] + [5 \mid k] - [k \text{ odd}][5 \mid k], and rule 1 turns the last product into [k odd and 5∣k][k \text{ odd and } 5 \mid k]. So the sum is A+B−CA + B - C with AA the sum of the odd k≤30k \le 30, BB the sum of the multiples of 55 up to 3030, and CC the sum of the odd multiples of 55 up to 3030. The odd numbers 1,3,…,291, 3, \dots, 29 are fifteen numbers with sum 152=22515^2 = 225 (the arithmetic sum of Section 2.2 gives ∑k=1n(2k−1)=n(n+1)−n=n2\sum_{k=1}^{n} (2k - 1) = n(n+1) - n = n^2; a direct addition also gives 225225). Next B=5+10+⋯+30=105B = 5 + 10 + \cdots + 30 = 105 and C=5+15+25=45C = 5 + 15 + 25 = 45. The sum is 225+105−45=285225 + 105 - 45 = 285. A direct sum by computer gives 285285 too.

Exercise 1.1-3. Expand the square and use rule 4: ([P]−[Q])2=[P]2−2[P][Q]+[Q]2=[P]+[Q]−2[P and Q]([P] - [Q])^2 = [P]^2 - 2[P][Q] + [Q]^2 = [P] + [Q] - 2[P \text{ and } Q]. By rule 3, [P]+[Q]−[P and Q]=[P or Q][P] + [Q] - [P \text{ and } Q] = [P \text{ or } Q], so the expression is [P or Q]−[P and Q][P \text{ or } Q] - [P \text{ and } Q]. This is 11 when exactly one of PP, QQ is true and 00 when both or neither are true. A check of the four cases gives the same result: (1−1)2=0(1 - 1)^2 = 0, (1−0)2=1(1 - 0)^2 = 1, (0−1)2=1(0 - 1)^2 = 1 and 02=00^2 = 0.

Exercise 1.1-4. A divisor dd of 3636 lies between 11 and 3636, so ∑d∣36d=∑k=136k [k∣36]\sum_{d \mid 36} d = \sum_{k=1}^{36} k\, [k \mid 36]. The bracket is 11 for k=1,2,3,4,6,9,12,18,36k = 1, 2, 3, 4, 6, 9, 12, 18, 36, and the sum is 1+2+3+4+6+9+12+18+36=911 + 2 + 3 + 4 + 6 + 9 + 12 + 18 + 36 = 91.

Exercise 1.1-5. The bracket [j2≤50][j^2 \le 50] is 11 only for −7≤j≤7-7 \le j \le 7, so aja_j has finite support. The reflection j↦−jj \mapsto -j maps this range onto itself and changes j3j^3 into −j3-j^3, so the sum SS of the aja_j satisfies S=−SS = -S and S=0S = 0. The family bjb_j has bj=2−j≠0b_j = 2^{-j} \ne 0 for all j≥0j \ge 0, so its support is infinite and ∑jbj\sum_j b_j is not a sum with finite support; as an infinite sum it has the value 22, by the example in Section 1.1. The family cjc_j is 00 for ∣j∣>3|j| > 3, so it has finite support. Its values for j=0,±1,±2,±3j = 0, \pm 1, \pm 2, \pm 3 are −1-1, 00, 33 and 88, and ∑jcj=−1+2⋅0+2⋅3+2⋅8=21\sum_j c_j = -1 + 2 \cdot 0 + 2 \cdot 3 + 2 \cdot 8 = 21.

Exercise 1.1-6. Use induction on the size of the finite set FF where RR is true. If FF is empty, the left side is the empty product 11 and the right side is c0=1c^0 = 1. Otherwise take x∈Fx \in F. By the proposition on disjoint relations, ∏Fcaj=∏F∖{x}caj⋅cax\prod_F c^{a_j} = \prod_{F \setminus \{x\}} c^{a_j} \cdot c^{a_x}. The induction hypothesis makes the first factor c∑F∖{x}ajc^{\sum_{F \setminus \{x\}} a_j}, and the rule cucv=cu+vc^u c^v = c^{u+v} gives c∑Fajc^{\sum_F a_j}. For ak=ka_k = k and R(k)R(k): 1≤k≤n1 \le k \le n, the result is ∏k=1n2k=2n(n+1)/2\prod_{k=1}^{n} 2^k = 2^{n(n+1)/2}. For n=3n = 3 this is 2⋅4⋅8=64=262 \cdot 4 \cdot 8 = 64 = 2^6.

Exercise 1.1-7. Fix ii with 1≤i≤n1 \le i \le n. The inner sum ∑j=1nδi,j+1\sum_{j=1}^{n} \delta_{i,j+1} has at most one nonzero term, the term with j=i−1j = i - 1, and this jj is in the range exactly when 2≤i≤n+12 \le i \le n + 1. So the inner sum is [i≥2][i \ge 2] for 1≤i≤n1 \le i \le n, and the outer sum is ∑i=1n[i≥2]=n−1\sum_{i=1}^{n} [i \ge 2] = n - 1. In the second sum, fix ii. The term δijaibj\delta_{ij} a_i b_j is 00 unless j=ij = i, and j=ij = i is in the range, so the inner sum is aibia_i b_i. The outer sum is ∑i=1naibi\sum_{i=1}^{n} a_i b_i. In matrix language, the second sum is a𝖳Iba^{\mathsf T} I b with the identity matrix II.

Exercise 1.1-8. For n=0n = 0 the sum is empty and the right side is 32(1−1)=0\tfrac32 (1 - 1) = 0. The step from nn to n+1n + 1 adds 3−n3^{-n} to the left side, and 32(1−3−n)+3−n=32−12⋅3−n=32(1−3−n−1)\tfrac32 (1 - 3^{-n}) + 3^{-n} = \tfrac32 - \tfrac12 \cdot 3^{-n} = \tfrac32 (1 - 3^{-n-1}), which is the right side for n+1n + 1. As n→∞n \to \infty the sum tends to 32\tfrac32. The negative part is ∑−n≤j<03−∣j∣=∑k=1n3−k=∑0≤k<n+13−k−1=32(1−3−n−1)−1\sum_{-n \le j < 0} 3^{-|j|} = \sum_{k=1}^{n} 3^{-k} = \sum_{0 \le k < n+1} 3^{-k} - 1 = \tfrac32 (1 - 3^{-n-1}) - 1, which tends to 12\tfrac12. So ∑j3−∣j∣=32+12=2\sum_j 3^{-|j|} = \tfrac32 + \tfrac12 = 2.

Exercise 1.1-9. For j≠0j \ne 0 the terms aj=1/ja_j = 1/j and a−j=−1/ja_{-j} = -1/j cancel, and a0=0a_0 = 0. The range −n≤j≤n-n \le j \le n is symmetric, so its sum is 00. The definition of the infinite sum asks for the limit of Pn=∑0≤j<naj=∑k=1n−11/kP_n = \sum_{0 \le j < n} a_j = \sum_{k=1}^{n-1} 1/k. This sequence is not bounded. For each m≥1m \ge 1, ∑k=m+12m1/k≥m⋅12m=12\sum_{k=m+1}^{2m} 1/k \ge m \cdot \tfrac{1}{2m} = \tfrac12, since each of the mm terms is at least 1/(2m)1/(2m). So ∑k=12r1/k≥1+r/2\sum_{k=1}^{2^r} 1/k \ge 1 + r/2, by adding the blocks m=1,2,4,…,2r−1m = 1, 2, 4, \dots, 2^{r-1}. So PnP_n has no finite limit, and ∑jaj\sum_j a_j has no value. The symmetric partial sums hide this; the definition with two separate limits detects it. Mathlib's tsum agrees: the family is not Summable.

Section 1.2: The laws of sums

Exercise 1.2-1. For k≥1k \ge 1, k(k+1)!=(k+1)−1(k+1)!=1k!−1(k+1)!\frac{k}{(k+1)!} = \frac{(k+1) - 1}{(k+1)!} = \frac{1}{k!} - \frac{1}{(k+1)!}. This is f(k+1)−f(k)f(k+1) - f(k) with f(k)=−1/k!f(k) = -1/k!. The theorem on the telescoping sum, with the range 1≤k≤n1 \le k \le n, gives f(n+1)−f(1)=1−1(n+1)!f(n+1) - f(1) = 1 - \frac{1}{(n+1)!}. For n=0n = 0 both sides are 00; for n=2n = 2 the sum is 12+13=56=1−16\tfrac12 + \tfrac13 = \tfrac56 = 1 - \tfrac16.

Exercise 1.2-2. The numerator is k(k+1)−1k(k+1) - 1, so the term is 1−1k(k+1)1 - \frac{1}{k(k+1)}. By the theorem on the sum of two families and the first example of the section, the sum is n−(1−1n+1)=n−nn+1=n2n+1n - \bigl(1 - \frac{1}{n+1}\bigr) = n - \frac{n}{n+1} = \frac{n^2}{n+1}. For n=1n = 1 the sum is 12\tfrac12, and 12\tfrac{1}{2} agrees.

Exercise 1.2-3. Let f(k)=−12k(k+1)f(k) = -\frac{1}{2k(k+1)}. Then f(k+1)−f(k)=12k(k+1)−12(k+1)(k+2)=(k+2)−k2k(k+1)(k+2)=1k(k+1)(k+2).f(k+1) - f(k) = \frac{1}{2k(k+1)} - \frac{1}{2(k+1)(k+2)} = \frac{(k+2) - k}{2k(k+1)(k+2)} = \frac{1}{k(k+1)(k+2)}. The telescoping sum gives f(n+1)−f(1)=14−12(n+1)(n+2)f(n+1) - f(1) = \frac14 - \frac{1}{2(n+1)(n+2)}. For n=1n = 1 both sides are 16\tfrac16.

Exercise 1.2-4. Let S=∑k=0nk akS = \sum_{k=0}^{n} k\, a_k. The reflection k↦n−kk \mapsto n - k gives S=∑k=0n(n−k)an−k=∑k=0n(n−k)akS = \sum_{k=0}^{n} (n - k) a_{n-k} = \sum_{k=0}^{n} (n - k) a_k, by the hypothesis. Add the two forms of SS with the theorem on the sum of two families: 2S=∑k=0nn ak=n∑k=0nak2S = \sum_{k=0}^{n} n\, a_k = n \sum_{k=0}^{n} a_k, by the distributive law. Divide by 22. For ak=1a_k = 1 this gives ∑k=0nk=n(n+1)/2\sum_{k=0}^{n} k = n(n+1)/2, the arithmetic sum of Section 2.2.

Exercise 1.2-5. Factor k3−1=(k−1)(k2+k+1)k^3 - 1 = (k - 1)(k^2 + k + 1) and k3+1=(k+1)(k2−k+1)k^3 + 1 = (k + 1)(k^2 - k + 1). Let g(k)=k2+k+1g(k) = k^2 + k + 1. Then k2−k+1=g(k−1)k^2 - k + 1 = g(k - 1), so the factor is k−1k+1⋅g(k)g(k−1)\frac{k-1}{k+1} \cdot \frac{g(k)}{g(k-1)}. By the laws for products the product splits into two products. The first is ∏k=2nk−1k+1=1⋅2n(n+1)\prod_{k=2}^{n} \frac{k-1}{k+1} = \frac{1 \cdot 2}{n (n+1)}, since the numerators are 1,…,n−11, \dots, n - 1 and the denominators are 3,…,n+13, \dots, n + 1. The second telescopes to g(n)/g(1)=(n2+n+1)/3g(n)/g(1) = (n^2 + n + 1)/3. So the product is 2(n2+n+1)3n(n+1).\frac{2 (n^2 + n + 1)}{3 n (n+1)}. For n=2n = 2 this is 1418=79\tfrac{14}{18} = \tfrac79, and indeed 8−18+1=79\frac{8 - 1}{8 + 1} = \frac79. As n→∞n \to \infty the product tends to 23\tfrac23, since (n2+n+1)/(n2+n)→1(n^2 + n + 1)/(n^2 + n) \to 1.

Exercise 1.2-6. Write ΣR\Sigma_R for ∑R(j)aj\sum_{R(j)} a_j, and so on. Let UU be "RR or SS". The theorem on the change of the domain for UU and TT gives ΣU or T=ΣU+ΣT−ΣU and T\Sigma_{U \text{ or } T} = \Sigma_U + \Sigma_T - \Sigma_{U \text{ and } T}. For RR and SS it gives ΣU=ΣR+ΣS−ΣR and S\Sigma_U = \Sigma_R + \Sigma_S - \Sigma_{R \text{ and } S}. The relation "UU and TT" is "(RR and TT) or (SS and TT)", and the theorem for these two relations, whose conjunction is "RR and SS and TT", gives ΣU and T=ΣR and T+ΣS and T−ΣR and S and T\Sigma_{U \text{ and } T} = \Sigma_{R \text{ and } T} + \Sigma_{S \text{ and } T} - \Sigma_{R \text{ and } S \text{ and } T}. Substitute the last two equations into the first. A second proof uses brackets: [R or S or T]=1−(1−[R])(1−[S])(1−[T])[R \text{ or } S \text{ or } T] = 1 - (1 - [R])(1 - [S])(1 - [T]) by rules 1 and 2, and the expansion of the product, with rule 1, gives the seven terms.

Exercise 1.2-7. For each integer kk, (−1)k+1=1−2[k even](-1)^{k+1} = 1 - 2[k \text{ even}]. By the sum of two families and the distributive law, the left side is ∑k=12n1k−2∑k=12n[k even]k\sum_{k=1}^{2n} \frac1k - 2 \sum_{k=1}^{2n} \frac{[k \text{ even}]}{k}. In the second sum the change of variable k=2jk = 2j maps the range 1≤j≤n1 \le j \le n onto the even kk in 1≤k≤2n1 \le k \le 2n, so that sum is ∑j=1n12j\sum_{j=1}^{n} \frac{1}{2j}, and twice it is ∑j=1n1j\sum_{j=1}^{n} \frac1j. The left side is ∑k=12n1k−∑k=1n1k\sum_{k=1}^{2n} \frac1k - \sum_{k=1}^{n} \frac1k. Since ∑k=12n=∑k=1n+∑k=n+12n\sum_{k=1}^{2n} = \sum_{k=1}^{n} + \sum_{k=n+1}^{2n} by the proposition on disjoint relations, this is ∑k=n+12n1k\sum_{k=n+1}^{2n} \frac1k. For n=2n = 2 both sides are 712\frac{7}{12}.

Exercise 1.2-8. Here p(0)=p(1)=0p(0) = p(1) = 0 and p(2)=p(3)=1p(2) = p(3) = 1, so ∑0≤j≤3ap(j)=2a0+2a1\sum_{0 \le j \le 3} a_{p(j)} = 2a_0 + 2a_1. This differs from a0+a1a_0 + a_1 unless a0+a1=0a_0 + a_1 = 0. For the general rule, write ap(j)=∑R(i)ai[p(j)=i]a_{p(j)} = \sum_{R(i)} a_i [p(j) = i]; the sum has the one term i=p(j)i = p(j), which satisfies RR since pp maps into that set. Then ∑S(j)ap(j)=∑S(j)∑R(i)ai[p(j)=i]=∑R(i)ai∑S(j)[p(j)=i]=∑R(i)ai N(i),\sum_{S(j)} a_{p(j)} = \sum_{S(j)} \sum_{R(i)} a_i [p(j) = i] = \sum_{R(i)} a_i \sum_{S(j)} [p(j) = i] = \sum_{R(i)} a_i\, N(i), by the interchange of the order and the distributive law. When pp is a bijection, N(i)=1N(i) = 1 for all ii and the rule is the theorem on the change of variable. In the example, N(0)=N(1)=2N(0) = N(1) = 2.

Exercise 1.2-9. The corollary on the interchange in a triangle, read from right to left with aji=i/ja_{ji} = i/j, gives ∑i=1n∑j=inij=∑j=1n1j∑i=1ji\sum_{i=1}^{n} \sum_{j=i}^{n} \frac{i}{j} = \sum_{j=1}^{n} \frac1j \sum_{i=1}^{j} i. The inner sum counts the pairs 1≤i′≤i≤j1 \le i' \le i \le j, which the example on pairs below the diagonal in Section 1.3 counts as j(j+1)/2j(j+1)/2. So the sum is ∑j=1nj+12=12(n(n+1)2+n)=n(n+3)4\sum_{j=1}^{n} \frac{j+1}{2} = \frac12 \bigl(\frac{n(n+1)}{2} + n\bigr) = \frac{n(n+3)}{4}. For n=2n = 2 the sum is 1+12+22=521 + \tfrac12 + \tfrac22 = \tfrac52, which agrees.

Exercise 1.2-10. Let f(k)=∑j=mk−1ajf(k) = \sum_{j=m}^{k-1} a_j for k≥mk \ge m. Then f(m)=0f(m) = 0, and the recursive definition of the sum with limits gives f(k+1)=f(k)+akf(k+1) = f(k) + a_k. Let gg be a second function with g(k+1)−g(k)=akg(k+1) - g(k) = a_k for k≥mk \ge m, and let h=f−gh = f - g. Then h(k+1)=h(k)h(k+1) = h(k) for all k≥mk \ge m, and induction on kk gives h(k)=h(m)h(k) = h(m) for all k≥mk \ge m. So ff and gg differ by the constant h(m)h(m). With ff the sum becomes a telescoping sum: ∑k=mn−1ak=f(n)−f(m)\sum_{k=m}^{n-1} a_k = f(n) - f(m). Chapter 3 calls ff an indefinite sum of aa.

Exercise 1.2-11. With f(k)=(k−1)k(k+1)/3f(k) = (k-1)k(k+1)/3, f(k+1)−f(k)=k(k+1)(k+2)−(k−1)k(k+1)3=k(k+1)((k+2)−(k−1))3=k(k+1).f(k+1) - f(k) = \frac{k(k+1)(k+2) - (k-1)k(k+1)}{3} = \frac{k(k+1)\bigl((k+2) - (k-1)\bigr)}{3} = k(k+1). So ∑k=1nk(k+1)=f(n+1)−f(1)=n(n+1)(n+2)3\sum_{k=1}^{n} k(k+1) = f(n+1) - f(1) = \frac{n(n+1)(n+2)}{3}. In the same way g(k)=(k−1)k(k+1)(k+2)/4g(k) = (k-1)k(k+1)(k+2)/4 has g(k+1)−g(k)=k(k+1)(k+2)⋅(k+3)−(k−1)4=k(k+1)(k+2)g(k+1) - g(k) = k(k+1)(k+2) \cdot \frac{(k+3) - (k-1)}{4} = k(k+1)(k+2), and ∑k=1nk(k+1)(k+2)=g(n+1)−g(1)=n(n+1)(n+2)(n+3)4\sum_{k=1}^{n} k(k+1)(k+2) = g(n+1) - g(1) = \frac{n(n+1)(n+2)(n+3)}{4}. For n=2n = 2 the sums are 2+6=82 + 6 = 8 and 6+24=306 + 24 = 30, and the formulas give 88 and 3030. Chapter 3 explains the pattern with rising and falling powers.

Section 1.3: Multiple sums

Exercise 1.3-1. Here ∑k=14k=10\sum_{k=1}^{4} k = 10 and ∑k=14k2=30\sum_{k=1}^{4} k^2 = 30, so the second formula of the theorem on the square of a sum gives 12(100−30)=35\frac12 (100 - 30) = 35. The six terms are 1⋅2+1⋅3+1⋅4+2⋅3+2⋅4+3⋅4=2+3+4+6+8+12=351 \cdot 2 + 1 \cdot 3 + 1 \cdot 4 + 2 \cdot 3 + 2 \cdot 4 + 3 \cdot 4 = 2 + 3 + 4 + 6 + 8 + 12 = 35.

Exercise 1.3-2. Let T=∑j=1n∑k=1naj/akT = \sum_{j=1}^{n} \sum_{k=1}^{n} a_j / a_k. The exchange of the names jj and kk, with the interchange of the order, gives T=∑j,kak/ajT = \sum_{j,k} a_k / a_j. So 2T=∑j,k(ajak+akaj)2T = \sum_{j,k} \bigl(\frac{a_j}{a_k} + \frac{a_k}{a_j}\bigr). For x>0x > 0, x+1/x−2=(x−1)2/x≥0x + 1/x - 2 = (x - 1)^2 / x \ge 0. So each of the n2n^2 terms is at least 22, and 2T≥2n22T \ge 2n^2. Equality holds exactly when all aja_j are equal. The inequality says that the arithmetic mean of the aja_j times the arithmetic mean of the 1/aj1/a_j is at least 11.

Exercise 1.3-3. For 1≤i,j≤n1 \le i, j \le n, min⁡(i,j)=∑m=1n[m≤i][m≤j]\min(i, j) = \sum_{m=1}^{n} [m \le i][m \le j], since the bracket product is 11 exactly for 1≤m≤min⁡(i,j)1 \le m \le \min(i, j). So ∑i=1n∑j=1nmin⁡(i,j)=∑m=1n(∑i=1n[m≤i])(∑j=1n[m≤j])=∑m=1n(n−m+1)2,\sum_{i=1}^{n} \sum_{j=1}^{n} \min(i,j) = \sum_{m=1}^{n} \Bigl(\sum_{i=1}^{n} [m \le i]\Bigr) \Bigl(\sum_{j=1}^{n} [m \le j]\Bigr) = \sum_{m=1}^{n} (n - m + 1)^2, by the interchange of the order and the distributive law. The reflection m↦n+1−mm \mapsto n + 1 - m turns the last sum into ∑m=1nm2\sum_{m=1}^{n} m^2. For n=2n = 2 the four values of min⁡\min are 1,1,1,21, 1, 1, 2, with sum 5=1+45 = 1 + 4.

Exercise 1.3-4. The map (i,j)↦(d,i)(i, j) \mapsto (d, i) with d=j−id = j - i is a bijection from the pairs with 1≤i<j≤n1 \le i < j \le n onto the pairs with 1≤d≤n−11 \le d \le n - 1 and 1≤i≤n−d1 \le i \le n - d; the inverse is (d,i)↦(i,i+d)(d, i) \mapsto (i, i + d). The change of variable gives ∑d=1n−1∑i=1n−dd=∑d=1n−1d(n−d)\sum_{d=1}^{n-1} \sum_{i=1}^{n-d} d = \sum_{d=1}^{n-1} d (n - d). For n=5n = 5 the value is 4+6+6+4=204 + 6 + 6 + 4 = 20. Chapter 6 shows that the value is (n+13)\binom{n+1}{3} in general; for n=5n = 5 this is 2020.

Exercise 1.3-5. The bijection of the proposition on the two forms of a partition maps (4,0,0,0)↦(0,0,0,1)(4,0,0,0) \mapsto (0,0,0,1), (3,1,0,0)↦(1,0,1,0)(3,1,0,0) \mapsto (1,0,1,0), (2,2,0,0)↦(0,2,0,0)(2,2,0,0) \mapsto (0,2,0,0), (2,1,1,0)↦(2,1,0,0)(2,1,1,0) \mapsto (2,1,0,0) and (1,1,1,1)↦(4,0,0,0)(1,1,1,1) \mapsto (4,0,0,0). In each case k1+2k2+3k3+4k4=4k_1 + 2k_2 + 3k_3 + 4k_4 = 4. By the proposition on the number of solutions, the number of all lists (j1,…,j4)(j_1, \dots, j_4) of nonnegative integers with sum 44 is (4+33)=35\binom{4 + 3}{3} = 35. A listing by computer gives 3535 too.

Exercise 1.3-6. The domain is the set of pairs with 0≤i≤n0 \le i \le n and i≤j≤2ii \le j \le 2i. Fix jj and solve for ii. The conditions are i≤ji \le j, i≥j/2i \ge j/2 and 0≤i≤n0 \le i \le n. Since j≥i≥0j \ge i \ge 0, jj is nonnegative. The set of ii is ⌈j/2⌉≤i≤min⁡(j,n)\lceil j/2 \rceil \le i \le \min(j, n), and it is nonempty exactly when ⌈j/2⌉≤n\lceil j/2 \rceil \le n, that is, when 0≤j≤2n0 \le j \le 2n. So S′(j)S'(j) is 0≤j≤2n0 \le j \le 2n, R′(i,j)R'(i, j) is ⌈j/2⌉≤i≤min⁡(j,n)\lceil j/2 \rceil \le i \le \min(j, n), and ∑i=0n∑j=i2iaij=∑j=02n∑⌈j/2⌉≤i≤min⁡(j,n)aij.\sum_{i=0}^{n} \sum_{j=i}^{2i} a_{ij} = \sum_{j=0}^{2n} \sum_{\lceil j/2 \rceil \le i \le \min(j, n)} a_{ij}. The general change of the order applies, since both bracket products are [0≤i≤n][i≤j≤2i][0 \le i \le n][i \le j \le 2i]. A check by computer with random numbers aija_{ij} for n≤5n \le 5 confirms the identity.

Exercise 1.3-7. Fix ii. The row ii has the two nonzero terms aii=1a_{ii} = 1 and ai,i+1=−1a_{i,i+1} = -1, so its sum is 00, and the outer sum over ii is 00. Fix jj. For j=0j = 0 the column has the one nonzero term a00=1a_{00} = 1, since i=−1i = -1 is not allowed. For j≥1j \ge 1 the column has ajj=1a_{jj} = 1 and aj−1,j=−1a_{j-1,j} = -1, with sum 00. So the outer sum over jj is 11. The theorem on the interchange of the order assumes a finite domain; here infinitely many terms are nonzero, and the sum of the absolute values is infinite. P5 proves that the interchange is valid when ∑i,j∣aij∣\sum_{i,j} |a_{ij}| is finite.

Exercise 1.3-8. By the distributive law, (∑ai2)(∑bj2)−(∑aibi)2=∑i,jcij\bigl(\sum a_i^2\bigr)\bigl(\sum b_j^2\bigr) - \bigl(\sum a_i b_i\bigr)^2 = \sum_{i,j} c_{ij} with cij=ai2bj2−aibiajbjc_{ij} = a_i^2 b_j^2 - a_i b_i a_j b_j. The exchange of the names ii and jj shows that this sum equals ∑i,jsij\sum_{i,j} s_{ij} with sij=12(cij+cji)=12(aibj−ajbi)2s_{ij} = \frac12 (c_{ij} + c_{ji}) = \frac12 (a_i b_j - a_j b_i)^2. The family sijs_{ij} is symmetric and sii=0s_{ii} = 0. The proposition on symmetric sums gives ∑i,jsij=2∑i<jsij=∑i<j(aibj−ajbi)2\sum_{i,j} s_{ij} = 2 \sum_{i<j} s_{ij} = \sum_{i<j} (a_i b_j - a_j b_i)^2. This proves the identity. The right side is a sum of squares of real numbers, so it is at least 00, and (∑aibi)2≤(∑ai2)(∑bi2)\bigl(\sum a_i b_i\bigr)^2 \le \bigl(\sum a_i^2\bigr)\bigl(\sum b_i^2\bigr), the inequality of Cauchy. Equality holds exactly when aibj=ajbia_i b_j = a_j b_i for all i<ji < j, that is, when the two lists are proportional.

Exercise 1.3-9. Since σ(n)=∑e∣ne\sigma(n) = \sum_{e \mid n} e, the left side is ∑n=1N∑e∣ne\sum_{n=1}^{N} \sum_{e \mid n} e. The change of the order in the example on divisors, with the term ee in place of 11, gives ∑e=1Ne∑1≤n≤N, e∣n1=∑e=1Ne⌊N/e⌋\sum_{e=1}^{N} e \sum_{1 \le n \le N,\ e \mid n} 1 = \sum_{e=1}^{N} e \lfloor N/e \rfloor. For N=6N = 6 the left side is 1+3+4+7+6+12=331 + 3 + 4 + 7 + 6 + 12 = 33 and the right side is 6+6+6+4+5+6=336 + 6 + 6 + 4 + 5 + 6 = 33.

Exercise 1.3-10. For a partition λ\lambda of nn let k1(λ)k_1(\lambda) be its number of parts equal to 11. Then k1(λ)=∑m=1n[k1(λ)≥m]k_1(\lambda) = \sum_{m=1}^{n} [k_1(\lambda) \ge m], since 0≤k1(λ)≤n0 \le k_1(\lambda) \le n. The total is ∑λk1(λ)=∑λ∑m=1n[k1(λ)≥m]=∑m=1n∑λ[k1(λ)≥m].\sum_{\lambda} k_1(\lambda) = \sum_{\lambda} \sum_{m=1}^{n} [k_1(\lambda) \ge m] = \sum_{m=1}^{n} \sum_{\lambda} [k_1(\lambda) \ge m]. The inner sum counts the partitions of nn with at least mm parts equal to 11. Removing mm parts equal to 11 maps them one to one onto the partitions of n−mn - m; the inverse adds mm parts equal to 11. So the inner sum is p(n−m)p(n - m). For n=4n = 4 the partitions 44, 3+13 + 1, 2+22 + 2, 2+1+12 + 1 + 1 and 1+1+1+11 + 1 + 1 + 1 have 0+1+0+2+4=70 + 1 + 0 + 2 + 4 = 7 parts equal to 11, and p(3)+p(2)+p(1)+p(0)=3+2+1+1=7p(3) + p(2) + p(1) + p(0) = 3 + 2 + 1 + 1 = 7. A check by computer for n≤11n \le 11 agrees.

Exercise 1.3-11. Expand S13=∑i,j,kaiajakS_1^3 = \sum_{i,j,k} a_i a_j a_k, a sum over all n3n^3 ordered triples. Split the triples into three classes. The triples with all three indices equal give S3S_3. The triples with exactly two equal indices fall into three patterns, i=j≠ki = j \ne k, i=k≠ji = k \ne j and j=k≠ij = k \ne i. Each pattern gives ∑i≠kai2ak=S2S1−S3\sum_{i \ne k} a_i^2 a_k = S_2 S_1 - S_3, the sum over all pairs minus the diagonal. The triples with three different indices map onto the sets {i,j,k}\{i, j, k\} with i<j<ki < j < k, and each set comes from 3!=63! = 6 triples, so by Exercise 1.2-8 they give 6e36 e_3, where e3=∑i<j<kaiajake_3 = \sum_{i<j<k} a_i a_j a_k. So S13=S3+3(S1S2−S3)+6e3S_1^3 = S_3 + 3(S_1 S_2 - S_3) + 6 e_3, and e3=16(S13−3S1S2+2S3)e_3 = \frac16 (S_1^3 - 3 S_1 S_2 + 2 S_3). For a=(1,1,1)a = (1, 1, 1) this gives 16(27−27+6)=1\frac16 (27 - 27 + 6) = 1, which is right.

Solutions to Chapter 2: The perturbation method and recurrences

Section 2.1: Sums and recurrences

Exercise 2.1-1. The recurrence is the first example of the repertoire method with α=1\alpha = 1, β=1\beta = 1 and γ=2\gamma = 2. There A(n)=1A(n) = 1, B(n)=nB(n) = n and C(n)=n(n+1)/2C(n) = n(n+1)/2. So Rn=1+n+n(n+1)=n2+2n+1=(n+1)2R_n = 1 + n + n(n+1) = n^2 + 2n + 1 = (n+1)^2. Check: R1=1+3=4R_1 = 1 + 3 = 4 and R2=4+5=9R_2 = 4 + 5 = 9.

Exercise 2.1-2. The solution is Rn=αA(n)+βB(n)+γC(n)R_n = \alpha A(n) + \beta B(n) + \gamma C(n). The sequence 3n3^n solves the recurrence for (1,0,0)(1, 0, 0), so A(n)=3nA(n) = 3^n. The constant sequence 11 needs 1=3+β1 = 3 + \beta, so it solves the recurrence for (1,−2,0)(1, -2, 0), and A(n)−2B(n)=1A(n) - 2B(n) = 1, so B(n)=(3n−1)/2B(n) = (3^n - 1)/2. The sequence nn needs α=0\alpha = 0 and n=3(n−1)+β+γnn = 3(n - 1) + \beta + \gamma n, that is, 0=(2+γ)n+β−30 = (2 + \gamma) n + \beta - 3. So it solves the recurrence for (0,3,−2)(0, 3, -2), and 3B(n)−2C(n)=n3B(n) - 2C(n) = n. So C(n)=3B(n)−n2=3n+1−3−2n4C(n) = \frac{3B(n) - n}{2} = \frac{3^{n+1} - 3 - 2n}{4}. Check: R1=3α+β+γR_1 = 3\alpha + \beta + \gamma, and A(1)=3A(1) = 3, B(1)=1B(1) = 1, C(1)=(9−3−2)/4=1C(1) = (9 - 3 - 2)/4 = 1.

Exercise 2.1-3. Here rn=3r_n = 3, dn=2d_n = 2 and Pn=3nP_n = 3^n. The summation factor gives Tn=3n(5+2∑k=1n3−k)T_n = 3^n \bigl(5 + 2 \sum_{k=1}^{n} 3^{-k}\bigr). The geometric sum gives ∑k=1n3−k=1−3−n2\sum_{k=1}^{n} 3^{-k} = \frac{1 - 3^{-n}}{2}. So Tn=3n(5+1−3−n)=6⋅3n−1T_n = 3^n (5 + 1 - 3^{-n}) = 6 \cdot 3^n - 1. Check: T0=5T_0 = 5 and T1=17=3⋅5+2T_1 = 17 = 3 \cdot 5 + 2.

Exercise 2.1-4. Divide by nn: Tn=n+1nTn−1+1T_n = \frac{n+1}{n} T_{n-1} + 1. So rn=n+1nr_n = \frac{n+1}{n}, dn=1d_n = 1, and Pn=∏k=1nk+1k=n+1P_n = \prod_{k=1}^{n} \frac{k+1}{k} = n + 1, a telescoping product. The summation factor gives Tn=(n+1)∑k=1n1k+1=(n+1)(Hn+1−1).T_n = (n+1) \sum_{k=1}^{n} \frac{1}{k+1} = (n+1) (H_{n+1} - 1). Check: T1=2⋅12=1T_1 = 2 \cdot \frac12 = 1, and the rule gives T1=2⋅0+1=1T_1 = 2 \cdot 0 + 1 = 1; T2=3(12+13)=52T_2 = 3(\frac12 + \frac13) = \frac52, and the rule gives 2T2=3+2=52T_2 = 3 + 2 = 5.

Exercise 2.1-5. The solution of the recurrence is the product Dn=∏k=1n(2k−1)D_n = \prod_{k=1}^{n} (2k - 1), the product of the odd numbers up to 2n−12n - 1; this is the summation factor theorem with dn=0d_n = 0. Split the product (2n)!=∏j=12nj(2n)! = \prod_{j=1}^{2n} j into the even and the odd factors with the change of the domain of Section 1.2: (2n)!=∏k=1n(2k)⋅∏k=1n(2k−1)=2nn!⋅Dn(2n)! = \prod_{k=1}^{n} (2k) \cdot \prod_{k=1}^{n} (2k - 1) = 2^n n! \cdot D_n. Divide by 2nn!2^n n!. Check: D3=1⋅3⋅5=15=720/48D_3 = 1 \cdot 3 \cdot 5 = 15 = 720/48.

Exercise 2.1-6. By the theorem on the termial, 8⋅n?+1=4n(n+1)+1=4n2+4n+1=(2n+1)28 \cdot n? + 1 = 4n(n+1) + 1 = 4n^2 + 4n + 1 = (2n+1)^2, and n?+(n−1)?=n(n+1)+(n−1)n2=2n22=n2n? + (n-1)? = \frac{n(n+1) + (n-1)n}{2} = \frac{2n^2}{2} = n^2. The first identity shows that an integer t≥0t \ge 0 is a triangular number exactly when 8t+18t + 1 is an odd square, since 8t+1=(2n+1)28t + 1 = (2n+1)^2 gives t=n(n+1)/2=n?t = n(n+1)/2 = n?. The second says that two consecutive triangles make a square.

Exercise 2.1-7. Multiply by nn: nTn=n2+∑k=0n−1Tkn T_n = n^2 + \sum_{k=0}^{n-1} T_k. For n≥2n \ge 2 subtract the same equation for n−1n - 1: nTn−(n−1)Tn−1=n2−(n−1)2+Tn−1=2n−1+Tn−1n T_n - (n-1) T_{n-1} = n^2 - (n-1)^2 + T_{n-1} = 2n - 1 + T_{n-1}. So nTn=nTn−1+2n−1n T_n = n T_{n-1} + 2n - 1, and Tn=Tn−1+2−1nT_n = T_{n-1} + 2 - \frac1n. For n=1n = 1 the rule gives T1=1=T0+2−1T_1 = 1 = T_0 + 2 - 1, so the same equation holds. The proposition on sums gives Tn=∑k=1n(2−1k)=2n−HnT_n = \sum_{k=1}^{n} (2 - \frac1k) = 2n - H_n. Check: T2=2+12(0+1)=52=4−32T_2 = 2 + \frac12 (0 + 1) = \frac52 = 4 - \frac32.

Exercise 2.1-8. Here rn=2r_n = 2, dn=nd_n = n and Pn=2nP_n = 2^n. So Tn=2n∑k=1nk2kT_n = 2^n \sum_{k=1}^{n} \frac{k}{2^k}. The example with halves of Section 2.2 gives ∑k=0nk2k=2−n+22n\sum_{k=0}^{n} \frac{k}{2^k} = 2 - \frac{n+2}{2^n}, and the term k=0k = 0 is 00. So Tn=2n+1−n−2T_n = 2^{n+1} - n - 2. This is C(n)C(n) of the second example of the repertoire method, as it must be, since the recurrence is the case α=β=0\alpha = \beta = 0, γ=1\gamma = 1 of that example.

Exercise 2.1-9. By the reflection k↦n+1−kk \mapsto n + 1 - k of Section 1.2, n!=∏k=1n(n+1−k)n! = \prod_{k=1}^{n} (n + 1 - k). Multiply the two forms with the law for products: (n!)2=∏k=1nk(n+1−k)(n!)^2 = \prod_{k=1}^{n} k (n + 1 - k). For each kk, (n+12)2−k(n+1−k)=(n+12−k)2≥0.\Bigl(\frac{n+1}{2}\Bigr)^2 - k(n + 1 - k) = \Bigl(\frac{n+1}{2} - k\Bigr)^2 \ge 0. So each factor is at most (n+12)2\bigl(\frac{n+1}{2}\bigr)^2, all factors are positive, and (n!)2≤(n+12)2n(n!)^2 \le \bigl(\frac{n+1}{2}\bigr)^{2n}. Both sides are positive, so the square root gives the claim. Equality holds only for n=1n = 1: for n≥2n \ge 2 the factor with k=1k = 1 is nn, and (n+12)2−n=(n−12)2>0\bigl(\frac{n+1}{2}\bigr)^2 - n = \bigl(\frac{n-1}{2}\bigr)^2 > 0.

Exercise 2.1-10. The theorem on linearity extends to four parameters with the same proof: Rn=αA(n)+βB(n)+γC(n)+δD(n)R_n = \alpha A(n) + \beta B(n) + \gamma C(n) + \delta D(n). The sequence 11 solves the recurrence for (1,0,0,0)(1, 0, 0, 0), so A(n)=1A(n) = 1. The sequence nn solves it for (0,1,0,0)(0, 1, 0, 0), so B(n)=nB(n) = n. The sequence n2n^2 needs n2−(n−1)2=2n−1n^2 - (n-1)^2 = 2n - 1, so it solves it for (0,−1,2,0)(0, -1, 2, 0), and C(n)=n2+n2C(n) = \frac{n^2 + n}{2}. The sequence n3n^3 needs n3−(n−1)3=3n2−3n+1n^3 - (n-1)^3 = 3n^2 - 3n + 1, so it solves it for (0,1,−3,3)(0, 1, -3, 3), and B(n)−3C(n)+3D(n)=n3B(n) - 3C(n) + 3D(n) = n^3. So D(n)=n3−n+32(n2+n)3=2n3+3n2+n6.D(n) = \frac{n^3 - n + \frac32 (n^2 + n)}{3} = \frac{2n^3 + 3n^2 + n}{6}. The sum ∑k=1nk2\sum_{k=1}^{n} k^2 solves the recurrence for (0,0,0,1)(0, 0, 0, 1), so it equals D(n)=n(n+1)(2n+1)6D(n) = \frac{n(n+1)(2n+1)}{6}.

Section 2.2: The perturbation method

Exercise 2.2-1. The geometric sum with a=1a = 1 and x=3x = 3 gives 1−3n+11−3=3n+1−12\frac{1 - 3^{n+1}}{1 - 3} = \frac{3^{n+1} - 1}{2}. Check: 1+3+9=13=(27−1)/21 + 3 + 9 = 13 = (27 - 1)/2.

Exercise 2.2-2. The theorem on ∑kxk\sum k x^k with x=3x = 3 gives (1−x)2=4(1 - x)^2 = 4 and the numerator 3−(n+1)3n+1+n⋅3n+2=3+3n+1(3n−n−1)=3+(2n−1)3n+13 - (n+1) 3^{n+1} + n \cdot 3^{n+2} = 3 + 3^{n+1} (3n - n - 1) = 3 + (2n - 1) 3^{n+1}. So the sum is (2n−1)3n+1+34\frac{(2n-1) 3^{n+1} + 3}{4}. Check: for n=3n = 3 the sum is 3+18+81=1023 + 18 + 81 = 102, and 5⋅81+34=102\frac{5 \cdot 81 + 3}{4} = 102.

Exercise 2.2-3. The theorem on ∑kxk\sum k x^k with x=−1x = -1 gives (1−x)2=4(1 - x)^2 = 4 and the numerator −1−(n+1)(−1)n+1+n(−1)n+2=−1+(n+1)(−1)n+n(−1)n=(2n+1)(−1)n−1-1 - (n+1)(-1)^{n+1} + n(-1)^{n+2} = -1 + (n+1)(-1)^n + n(-1)^n = (2n+1)(-1)^n - 1. Check: for n=3n = 3 the sum is 0−1+2−3=−20 - 1 + 2 - 3 = -2, and 7⋅(−1)−14=−2\frac{7 \cdot (-1) - 1}{4} = -2.

Exercise 2.2-4. Let S=∑k=0nk2xkS = \sum_{k=0}^{n} k^2 x^k, K=∑k=0nkxkK = \sum_{k=0}^{n} k x^k and G=∑k=0nxkG = \sum_{k=0}^{n} x^k. Since (k+1)2xk+1=x⋅k2xk+2x⋅kxk+x⋅xk(k + 1)^2 x^{k+1} = x \cdot k^2 x^k + 2x \cdot k x^k + x \cdot x^k, the perturbation identity gives S+(n+1)2xn+1=0+xS+2xK+xG.S + (n+1)^2 x^{n+1} = 0 + x S + 2x K + x G. So (1−x)S=2xK+xG−(n+1)2xn+1(1 - x) S = 2xK + xG - (n+1)^2 x^{n+1}. Multiply by (1−x)2(1 - x)^2 and insert the closed forms of KK and GG: (1−x)3S=2x(x−(n+1)xn+1+nxn+2)+x(1−xn+1)(1−x)−(n+1)2xn+1(1−x)2.(1 - x)^3 S = 2x\bigl(x - (n+1) x^{n+1} + n x^{n+2}\bigr) + x (1 - x^{n+1})(1 - x) - (n+1)^2 x^{n+1} (1 - x)^2. Collect powers of xx. The terms xx and x2x^2 have coefficients 11 and 2−1=12 - 1 = 1. The term xn+1x^{n+1} has coefficient −(n+1)2-(n+1)^2. The term xn+2x^{n+2} has −2(n+1)−1+2(n+1)2=2n2+2n−1-2(n+1) - 1 + 2(n+1)^2 = 2n^2 + 2n - 1. The term xn+3x^{n+3} has 2n+1−(n+1)2=−n22n + 1 - (n+1)^2 = -n^2. So the right side is x(1+x−(n+1)2xn+(2n2+2n−1)xn+1−n2xn+2)x\bigl(1 + x - (n+1)^2 x^n + (2n^2 + 2n - 1) x^{n+1} - n^2 x^{n+2}\bigr), as claimed. Check: for x=2x = 2 and n=2n = 2 the sum is 2+16=182 + 16 = 18, and the formula gives 2(1+2−36+88−64)−1=18\frac{2(1 + 2 - 36 + 88 - 64)}{-1} = 18.

Exercise 2.2-5. Expand (2k−1)2=4k2−4k+1(2k - 1)^2 = 4k^2 - 4k + 1 and use the sum of two families with the sums of squares and of kk: ∑k=1n(2k−1)2=2n(n+1)(2n+1)3−2n(n+1)+n=n(2(n+1)(2n+1)−6(n+1)+3)3=n(4n2−1)3.\sum_{k=1}^{n} (2k-1)^2 = \frac{2n(n+1)(2n+1)}{3} - 2n(n+1) + n = \frac{n\bigl(2(n+1)(2n+1) - 6(n+1) + 3\bigr)}{3} = \frac{n(4n^2 - 1)}{3}. And 4n2−1=(2n−1)(2n+1)4n^2 - 1 = (2n - 1)(2n + 1). Check: 1+9+25=35=3⋅5⋅7/31 + 9 + 25 = 35 = 3 \cdot 5 \cdot 7 / 3.

Exercise 2.2-6. With m=4m = 4 the proposition gives (n+1)5=S0+5S1+10S2+10S3+5S4(n+1)^5 = S_0 + 5 S_1 + 10 S_2 + 10 S_3 + 5 S_4, where Sj=Sj(n)S_j = S_j(n). Insert S0=n+1S_0 = n + 1, S1=n(n+1)2S_1 = \frac{n(n+1)}{2}, S2=n(n+1)(2n+1)6S_2 = \frac{n(n+1)(2n+1)}{6} and S3=n2(n+1)24S_3 = \frac{n^2(n+1)^2}{4}. Since (n+1)5−(n+1)=(n+1)n(n+2)(n2+2n+2)(n+1)^5 - (n+1) = (n+1) n (n+2)(n^2 + 2n + 2), every term has the factor n(n+1)n(n+1), and 5S4=n(n+1)(n3+4n2+6n+4−52−5(2n+1)3−5n(n+1)2)=n(n+1)6n3+9n2+n−16.5 S_4 = n(n+1) \Bigl(n^3 + 4n^2 + 6n + 4 - \frac52 - \frac{5(2n+1)}{3} - \frac{5n(n+1)}{2}\Bigr) = n(n+1) \frac{6n^3 + 9n^2 + n - 1}{6}. Finally 6n3+9n2+n−1=(2n+1)(3n2+3n−1)6n^3 + 9n^2 + n - 1 = (2n + 1)(3n^2 + 3n - 1), so S4=n(n+1)(2n+1)(3n2+3n−1)30S_4 = \frac{n(n+1)(2n+1)(3n^2 + 3n - 1)}{30}. Check: 1+16+81=981 + 16 + 81 = 98, and 3⋅4⋅7⋅3530=98\frac{3 \cdot 4 \cdot 7 \cdot 35}{30} = 98.

Exercise 2.2-7. For n=0n = 0 both sides are 00. Assume ∑k=0nk3=(n?)2\sum_{k=0}^{n} k^3 = (n?)^2. Then ∑k=0n+1k3=(n?)2+(n+1)3\sum_{k=0}^{n+1} k^3 = (n?)^2 + (n+1)^3, and the claim for n+1n + 1 is ((n+1)?)2−(n?)2=(n+1)3((n+1)?)^2 - (n?)^2 = (n+1)^3. The left side is ((n+1)?−n?)((n+1)?+n?)=(n+1)⋅(n+1)2\bigl((n+1)? - n?\bigr)\bigl((n+1)? + n?\bigr) = (n + 1) \cdot (n+1)^2, by the recurrence of the termial and by exercise 2.1-6.

Exercise 2.2-8. For ∣x∣<1|x| < 1, x≠1x \ne 1, so the theorem on ∑kxk\sum k x^k gives the partial sums ∑k=0nkxk=x(1−x)2−(n+1)xn+1−nxn+2(1−x)2.\sum_{k=0}^{n} k x^k = \frac{x}{(1-x)^2} - \frac{(n+1) x^{n+1} - n x^{n+2}}{(1-x)^2}. It is enough to prove n∣x∣n→0n |x|^n \to 0, since then both (n+1)xn+1(n+1) x^{n+1} and nxn+2n x^{n+2} tend to 00. For x=0x = 0 this is clear. Otherwise write ∣x∣=11+h|x| = \frac{1}{1 + h} with h>0h > 0. For n≥2n \ge 2 the binomial theorem gives (1+h)n≥(n2)h2=n(n−1)2h2(1 + h)^n \ge \binom{n}{2} h^2 = \frac{n(n-1)}{2} h^2, so n∣x∣n≤2(n−1)h2→0n |x|^n \le \frac{2}{(n - 1) h^2} \to 0. So the partial sums tend to x(1−x)2\frac{x}{(1-x)^2}. Since the terms with negative index are 00, this limit is the infinite sum of Section 1.1.

Exercise 2.2-9. Let S=∑k=0nHkS = \sum_{k=0}^{n} H_k. Since Hk+1=Hk+1k+1H_{k+1} = H_k + \frac{1}{k+1}, the perturbation identity gives S+Hn+1=H0+∑k=0nHk+∑k=0n1k+1=S+Hn+1S + H_{n+1} = H_0 + \sum_{k=0}^{n} H_k + \sum_{k=0}^{n} \frac{1}{k+1} = S + H_{n+1}, which holds for every SS. Now let T=∑k=0nkHkT = \sum_{k=0}^{n} k H_k. Since (k+1)Hk+1=(k+1)Hk+1=kHk+Hk+1(k+1) H_{k+1} = (k+1) H_k + 1 = k H_k + H_k + 1, the perturbation identity gives T+(n+1)Hn+1=0+T+S+(n+1).T + (n+1) H_{n+1} = 0 + T + S + (n + 1). So S=(n+1)Hn+1−(n+1)=(n+1)Hn+1−(n+1)=(n+1)Hn−nS = (n+1) H_{n+1} - (n+1) = (n+1) H_n + 1 - (n+1) = (n+1) H_n - n. Check: H1+H2=1+32=52H_1 + H_2 = 1 + \frac32 = \frac52, and 3⋅32−2=523 \cdot \frac32 - 2 = \frac52.

Exercise 2.2-10. By the distributive law, Mn=(∑i=1ni)(∑j=1nj)=(n?)2M_n = \bigl(\sum_{i=1}^{n} i\bigr)\bigl(\sum_{j=1}^{n} j\bigr) = (n?)^2. Split the square 1≤i,j≤n1 \le i, j \le n by the value k=max⁡(i,j)k = \max(i, j), with the change of the domain of Section 1.2. The pairs with max⁡(i,j)=k\max(i, j) = k are (k,k)(k, k), the pairs (i,k)(i, k) with i<ki < k and the pairs (k,j)(k, j) with j<kj < k. Their products add up to k2+2k∑i=1k−1i=k2+2k⋅(k−1)k2=k2+k3−k2=k3.k^2 + 2k \sum_{i=1}^{k-1} i = k^2 + 2k \cdot \frac{(k-1)k}{2} = k^2 + k^3 - k^2 = k^3. So (n?)2=Mn=∑k=1nk3(n?)^2 = M_n = \sum_{k=1}^{n} k^3.

Section 2.3: Linear recurrences with constant coefficients

Exercise 2.3-1. Here χ(z)=z2−5z+6=(z−3)(z−2)\chi(z) = z^2 - 5z + 6 = (z - 3)(z - 2), with r=3r = 3 and s=2s = 2. The theorem gives A=1−01=1A = \frac{1 - 0}{1} = 1 and B=0−11=−1B = \frac{0 - 1}{1} = -1. So xn=3n−2nx_n = 3^n - 2^n. Check: x2=5=9−4x_2 = 5 = 9 - 4.

Exercise 2.3-2. Here χ(z)=(z−2)2\chi(z) = (z - 2)^2, with the double root r=2r = 2. The theorem gives A=1A = 1 and B=4/2−1=1B = 4/2 - 1 = 1, so xn=(n+1)2nx_n = (n + 1) 2^n. Check: x2=16−4=12=3⋅4x_2 = 16 - 4 = 12 = 3 \cdot 4.

Exercise 2.3-3. The roots are r=ϕr = \phi and s=ϕ^s = \hat\phi, with r−s=5r - s = \sqrt5. The theorem gives A=1−2ϕ^5A = \frac{1 - 2\hat\phi}{\sqrt5} and B=2ϕ−15B = \frac{2\phi - 1}{\sqrt5}. Since 2ϕ−1=52\phi - 1 = \sqrt5 and 1−2ϕ^=51 - 2\hat\phi = \sqrt5, both are 11, and Ln=ϕn+ϕ^nL_n = \phi^n + \hat\phi^n. For the second claim, the sequence yn=Fn−1+Fn+1y_n = F_{n-1} + F_{n+1} for n≥1n \ge 1 satisfies the Fibonacci rule for n≥3n \ge 3, as a sum of two shifted solutions. Its first values are y1=F0+F2=1=L1y_1 = F_0 + F_2 = 1 = L_1 and y2=F1+F3=3=L2y_2 = F_1 + F_3 = 3 = L_2. By uniqueness, applied to the sequences that start at index 11, yn=Lny_n = L_n for all n≥1n \ge 1.

Exercise 2.3-4. The sequence Bn=An+1B_n = A_n + 1 satisfies Bn=Bn−1+Bn−2B_n = B_{n-1} + B_{n-2}, since An+1=(An−1+1)+(An−2+1)A_n + 1 = (A_{n-1} + 1) + (A_{n-2} + 1). Its initial values are B0=B1=1=F1=F2B_0 = B_1 = 1 = F_1 = F_2. So Bn=Fn+1B_n = F_{n+1} by uniqueness, and An=Fn+1−1A_n = F_{n+1} - 1. The number AnA_n counts the additions that the program does: a call with n≤1n \le 1 does no addition, and a call with n≥2n \ge 2 does one addition plus those of its two calls. This agrees with the proposition on calls: the calls with n≥2n \ge 2 are the internal nodes of a binary tree with CnC_n nodes, so their number is (Cn−1)/2=Fn+1−1(C_n - 1)/2 = F_{n+1} - 1.

Exercise 2.3-5. The Fibonacci rule gives Fk=Fk+2−Fk+1F_k = F_{k+2} - F_{k+1} for k≥0k \ge 0. The telescoping sum of Section 1.2 gives ∑k=0nFk=∑k=0n(Fk+2−Fk+1)=Fn+2−F1=Fn+2−1\sum_{k=0}^{n} F_k = \sum_{k=0}^{n} (F_{k+2} - F_{k+1}) = F_{n+2} - F_1 = F_{n+2} - 1.

Exercise 2.3-6. Here χ(z)=z2−z−2=(z−2)(z+1)\chi(z) = z^2 - z - 2 = (z - 2)(z + 1). Since χ(1)=−2≠0\chi(1) = -2 \ne 0, try a constant pp: p=p+2p+3p = p + 2p + 3 gives p=−32p = -\frac32. By the proposition on particular and homogeneous parts, yn=xn+32y_n = x_n + \frac32 satisfies the homogeneous rule, with y0=y1=32y_0 = y_1 = \frac32. The theorem on two distinct roots with r=2r = 2, s=−1s = -1 gives A=3/2+3/23=1A = \frac{3/2 + 3/2}{3} = 1 and B=3−3/23=12B = \frac{3 - 3/2}{3} = \frac12. So xn=2n+(−1)n2−32x_n = 2^n + \frac{(-1)^n}{2} - \frac32. Check: x2=3x_2 = 3 and 4+12−32=34 + \frac12 - \frac32 = 3; x3=3+0+3=6x_3 = 3 + 0 + 3 = 6 and 8−12−32=68 - \frac12 - \frac32 = 6.

Exercise 2.3-7. For n=1n = 1, ϕ=F1ϕ+F0\phi = F_1 \phi + F_0. If ϕn=Fnϕ+Fn−1\phi^n = F_n \phi + F_{n-1}, then with ϕ2=ϕ+1\phi^2 = \phi + 1, ϕn+1=Fnϕ2+Fn−1ϕ=Fn(ϕ+1)+Fn−1ϕ=(Fn+Fn−1)ϕ+Fn=Fn+1ϕ+Fn.\phi^{n+1} = F_n \phi^2 + F_{n-1} \phi = F_n (\phi + 1) + F_{n-1} \phi = (F_n + F_{n-1}) \phi + F_n = F_{n+1} \phi + F_n. The proof uses only ϕ2=ϕ+1\phi^2 = \phi + 1, which also holds for ϕ^\hat\phi. Subtract the two identities: ϕn−ϕ^n=Fn(ϕ−ϕ^)=Fn5\phi^n - \hat\phi^n = F_n (\phi - \hat\phi) = F_n \sqrt5, which is Binet's formula for n≥1n \ge 1; for n=0n = 0 both sides are 00. Finally ϕ10=55ϕ+34=55⋅1.6180340+34=122.992\phi^{10} = 55\phi + 34 = 55 \cdot 1.6180340 + 34 = 122.992, to three decimals.

Exercise 2.3-8. Here χ(z)=z2−2z+2\chi(z) = z^2 - 2z + 2, with the roots r=1+ir = 1 + i and s=1−is = 1 - i, and r−s=2ir - s = 2i. The theorem on two distinct roots holds for complex roots with the same proof, and gives A=12iA = \frac{1}{2i}, B=−12iB = -\frac{1}{2i}. So xn=(1+i)n−(1−i)n2ix_n = \frac{(1+i)^n - (1-i)^n}{2i}. Write 1±i=2 e±iπ/41 \pm i = \sqrt2\, e^{\pm i\pi/4}. Then (1+i)n−(1−i)n=2n/2(einπ/4−e−inπ/4)=2n/2⋅2isin⁡(nπ/4)(1 + i)^n - (1 - i)^n = 2^{n/2} (e^{in\pi/4} - e^{-in\pi/4}) = 2^{n/2} \cdot 2i \sin(n\pi/4), and xn=2n/2sin⁡(nπ/4)x_n = 2^{n/2} \sin(n\pi/4). Check: x2=2x_2 = 2 and 2sin⁡(π/2)=22 \sin(\pi/2) = 2; x4=2x3−2x2=4−4=0x_4 = 2x_3 - 2x_2 = 4 - 4 = 0 and sin⁡π=0\sin \pi = 0.

Exercise 2.3-9. By exercise 2.3-3 and ϕϕ^=−1\phi \hat\phi = -1, Lm2=(ϕm+ϕ^m)2=ϕ2m+ϕ^2m+2(ϕϕ^)m=L2m+2(−1)m.L_m^2 = (\phi^m + \hat\phi^m)^2 = \phi^{2m} + \hat\phi^{2m} + 2(\phi\hat\phi)^m = L_{2m} + 2(-1)^m. So L2m=Lm2−2L_{2m} = L_m^2 - 2 for even mm. Prove yk=L2k+1y_k = L_{2^{k+1}} by induction on kk. For k=0k = 0, y0=3=L2y_0 = 3 = L_2. If yk=L2k+1y_k = L_{2^{k+1}}, then yk+1=L2k+12−2=L2k+2y_{k+1} = L_{2^{k+1}}^2 - 2 = L_{2^{k+2}}, since m=2k+1m = 2^{k+1} is even. Check: y1=7=L4y_1 = 7 = L_4 and y2=47=L8y_2 = 47 = L_8.

Exercise 2.3-10. Let Dn=xn+1xn−1−xn2D_n = x_{n+1} x_{n-1} - x_n^2 for n≥1n \ge 1. Use the rule for xn+2x_{n+2} and for xn+1x_{n+1}: Dn+1=xn+2xn−xn+12=(pxn+1+qxn)xn−xn+1(pxn+qxn−1)=qxn2−qxn+1xn−1=−qDn.D_{n+1} = x_{n+2} x_n - x_{n+1}^2 = (p x_{n+1} + q x_n) x_n - x_{n+1} (p x_n + q x_{n-1}) = q x_n^2 - q x_{n+1} x_{n-1} = -q D_n. So Dn=(−q)n−1D1D_n = (-q)^{n-1} D_1 by induction, and D1=x2x0−x12D_1 = x_2 x_0 - x_1^2. For the Fibonacci numbers q=1q = 1 and D1=F2F0−F12=−1D_1 = F_2 F_0 - F_1^2 = -1, so Fn+1Fn−1−Fn2=(−1)n−1(−1)=(−1)nF_{n+1} F_{n-1} - F_n^2 = (-1)^{n-1} (-1) = (-1)^n.

Solutions to Chapter 3: Finite calculus

Section 3.1: Differences, falling powers and definite sums

Exercise 3.1-1. By the definitions, 64‾=6⋅5⋅4⋅3=3606^{\underline{4}} = 6 \cdot 5 \cdot 4 \cdot 3 = 360 and 64‾=6⋅7⋅8⋅9=30246^{\overline{4}} = 6 \cdot 7 \cdot 8 \cdot 9 = 3024. Next, (−2)3‾=(−2)(−3)(−4)=−24(-2)^{\underline{3}} = (-2)(-3)(-4) = -24. Last, 4−2‾=1(4+1)(4+2)=1304^{\underline{-2}} = \frac{1}{(4+1)(4+2)} = \frac{1}{30}. As a check of the proposition on falling and rising powers, 64‾=94‾=9⋅8⋅7⋅66^{\overline{4}} = 9^{\underline{4}} = 9 \cdot 8 \cdot 7 \cdot 6.

Exercise 3.1-2. Since 1/x=1/((x−1)+1)1/x = 1/((x-1) + 1), the definition gives 1/x=(x−1)−1‾1/x = (x-1)^{\underline{-1}}. The difference operator commutes with a shift of the variable: if g(x)=h(x−1)g(x) = h(x - 1), then Δg(x)=h(x)−h(x−1)=(Δh)(x−1)\Delta g(x) = h(x) - h(x-1) = (\Delta h)(x-1). With h(y)=y−1‾h(y) = y^{\underline{-1}} and Δh(y)=−y−2‾\Delta h(y) = -y^{\underline{-2}}, this gives Δ(1/x)=−(x−1)−2‾=−1x(x+1)\Delta(1/x) = -(x-1)^{\underline{-2}} = -\frac{1}{x(x+1)}. Directly, 1x+1−1x=x−(x+1)x(x+1)=−1x(x+1)\frac{1}{x+1} - \frac{1}{x} = \frac{x - (x+1)}{x(x+1)} = -\frac{1}{x(x+1)}, which agrees. The formula holds for x≠0,−1x \ne 0, -1.

Exercise 3.1-3. Here k0‾=1k^{\underline{0}} = 1, so the sum is ∑0≤k<nck\sum_{0 \le k < n} c^k. Since Δcx=(c−1)cx\Delta c^x = (c-1) c^x, the function cx/(c−1)c^x/(c-1) is an indefinite sum of cxc^x, and the fundamental theorem gives ∑0≤k<nck=cn−1c−1\sum_{0 \le k < n} c^k = \frac{c^n - 1}{c - 1}. For c=3c = 3 and n=4n = 4: 1+3+9+27=401 + 3 + 9 + 27 = 40, and (81−1)/2=40(81 - 1)/2 = 40.

Exercise 3.1-4. The condition Δf=f\Delta f = f says f(x+1)−f(x)=f(x)f(x+1) - f(x) = f(x), that is f(x+1)=2f(x)f(x+1) = 2 f(x), for every integer xx. Induction upward gives f(n)=2nf(0)f(n) = 2^n f(0) for n≥0n \ge 0, and the relation f(x)=f(x+1)/2f(x) = f(x+1)/2 with induction downward gives f(−n)=2−nf(0)f(-n) = 2^{-n} f(0). So f(x)=C⋅2xf(x) = C \cdot 2^x with C=f(0)C = f(0). Conversely, Δ(C2x)=C2x\Delta(C 2^x) = C 2^x for every constant CC. In the same way, Δf=2f\Delta f = 2f says f(x+1)=3f(x)f(x+1) = 3 f(x), and the solutions are exactly the functions C⋅3xC \cdot 3^x.

Exercise 3.1-5. By the definition, (1/2)m‾=∏0≤j<m(12−j)=2−m∏0≤j<m(1−2j)(1/2)^{\underline{m}} = \prod_{0 \le j < m} \bigl(\frac{1}{2} - j\bigr) = 2^{-m} \prod_{0 \le j < m} (1 - 2j). The factor for j=0j = 0 is 11, and for 1≤j<m1 \le j < m the factor is −(2j−1)-(2j - 1). So the product is (−1)m−1⋅1⋅3⋅5⋯(2m−3)(-1)^{m-1} \cdot 1 \cdot 3 \cdot 5 \cdots (2m - 3). The product of the odd numbers below 2m−22m - 2 is (2m−2)!(2m-2)! divided by the product of the even numbers 2⋅4⋯(2m−2)=2m−1(m−1)!2 \cdot 4 \cdots (2m-2) = 2^{m-1} (m-1)!. So

(12)m‾=(−1)m−1(2m−2)!2m⋅2m−1(m−1)!=(−1)m−1(2m−2)!22m−1(m−1)!.\Bigl(\frac{1}{2}\Bigr)^{\underline{m}} = (-1)^{m-1} \frac{(2m-2)!}{2^m \cdot 2^{m-1} (m-1)!} = (-1)^{m-1} \frac{(2m-2)!}{2^{2m-1} (m-1)!}.

Check: m=1m = 1 gives 0!2⋅0!=12\frac{0!}{2 \cdot 0!} = \frac{1}{2}, and m=2m = 2 gives −2!8⋅1!=−14=12⋅(−12)-\frac{2!}{8 \cdot 1!} = -\frac{1}{4} = \frac{1}{2} \cdot \bigl(-\frac{1}{2}\bigr).

Exercise 3.1-6. Apply the law with the exponents −m-m and mm: p0(x)=p−m(x) pm(x+m)p_0(x) = p_{-m}(x) \, p_m(x + m). By the assumption, p0(x)=x0‾=1p_0(x) = x^{\underline{0}} = 1 and pm(x+m)=(x+m)m‾=(x+m)(x+m−1)⋯(x+1)p_m(x + m) = (x+m)^{\underline{m}} = (x+m)(x+m-1) \cdots (x+1). So p−m(x)=1(x+1)(x+2)⋯(x+m)=x−m‾p_{-m}(x) = \frac{1}{(x+1)(x+2)\cdots(x+m)} = x^{\underline{-m}}. The law of exponents leaves no other choice for the negative falling powers.

Exercise 3.1-7. By the proposition on falling and rising powers, k(k+1)(k+2)=k3‾=(k+2)3‾k(k+1)(k+2) = k^{\overline{3}} = (k+2)^{\underline{3}}. Put j=k+2j = k + 2:

∑0≤k<nk(k+1)(k+2)=∑2≤j<n+2j3‾=(n+2)4‾−24‾4=(n+2)(n+1)n(n−1)4,\sum_{0 \le k < n} k(k+1)(k+2) = \sum_{2 \le j < n+2} j^{\underline{3}} = \frac{(n+2)^{\underline{4}} - 2^{\underline{4}}}{4} = \frac{(n+2)(n+1)n(n-1)}{4},

since 24‾=02^{\underline{4}} = 0. Check n=3n = 3: 0+6+24=300 + 6 + 24 = 30 and 5⋅4⋅3⋅2/4=305 \cdot 4 \cdot 3 \cdot 2/4 = 30.

Exercise 3.1-8. For k≥1k \ge 1, 1k(k+1)(k+2)=(k−1)−3‾\frac{1}{k(k+1)(k+2)} = (k-1)^{\underline{-3}}. Put j=k−1j = k - 1, so 0≤j<n0 \le j < n. The corollary on sums of falling powers with m=−3m = -3 and a=0a = 0 gives

∑0≤j<nj−3‾=n−2‾−0−2‾−2=12(12−1(n+1)(n+2))=14−12(n+1)(n+2).\sum_{0 \le j < n} j^{\underline{-3}} = \frac{n^{\underline{-2}} - 0^{\underline{-2}}}{-2} = \frac{1}{2}\Bigl(\frac{1}{2} - \frac{1}{(n+1)(n+2)}\Bigr) = \frac{1}{4} - \frac{1}{2(n+1)(n+2)}.

Check n=2n = 2: 16+124=524\frac{1}{6} + \frac{1}{24} = \frac{5}{24}, and 14−124=524\frac{1}{4} - \frac{1}{24} = \frac{5}{24}.

Exercise 3.1-9. For m≥2m \ge 2 the exponent 1−m1 - m is not 00, and the corollary on sums of falling powers gives

∑0≤k<nk−m‾=n1−m‾−01−m‾1−m=1m−1(1(m−1)!−1(n+1)(n+2)⋯(n+m−1)).\sum_{0 \le k < n} k^{\underline{-m}} = \frac{n^{\underline{1-m}} - 0^{\underline{1-m}}}{1 - m} = \frac{1}{m-1}\Bigl(\frac{1}{(m-1)!} - \frac{1}{(n+1)(n+2)\cdots(n+m-1)}\Bigr).

As n→∞n \to \infty the last fraction tends to 00, because its denominator is at least n+1n + 1. The terms of the series are positive, so the series converges, and its sum is 1(m−1)(m−1)!\frac{1}{(m-1)(m-1)!}. For m=2m = 2 this is ∑k≥01(k+1)(k+2)=1\sum_{k \ge 0} \frac{1}{(k+1)(k+2)} = 1, as in the second example of the Examples part.

Exercise 3.1-10. The two products xm‾=x(x+1)⋯(x+m−1)x^{\overline{m}} = x(x+1)\cdots(x+m-1) and (x−1)m‾=(x−1)x⋯(x+m−2)(x-1)^{\overline{m}} = (x-1)x\cdots(x+m-2) share the m−1m - 1 factors x,…,x+m−2x, \dots, x + m - 2, whose product is xm−1‾x^{\overline{m-1}}. So ∇xm‾=xm−1‾((x+m−1)−(x−1))=m xm−1‾\nabla x^{\overline{m}} = x^{\overline{m-1}} \bigl((x + m - 1) - (x - 1)\bigr) = m \, x^{\overline{m-1}}. For the sum, let g(x)=xm+1‾/(m+1)g(x) = x^{\overline{m+1}}/(m+1), so ∇g(x)=xm‾\nabla g(x) = x^{\overline{m}}. A sum of backward differences telescopes: ∑1≤k≤n∇g(k)=∑1≤k≤n(g(k)−g(k−1))=g(n)−g(0)\sum_{1 \le k \le n} \nabla g(k) = \sum_{1 \le k \le n} (g(k) - g(k-1)) = g(n) - g(0). Since m+1≥1m + 1 \ge 1, the product 0m+1‾0^{\overline{m+1}} has the factor 00, so g(0)=0g(0) = 0 and ∑1≤k≤nkm‾=nm+1‾m+1\sum_{1 \le k \le n} k^{\overline{m}} = \frac{n^{\overline{m+1}}}{m+1}. For m=1m = 1 this is 1+2+⋯+n=n(n+1)21 + 2 + \cdots + n = \frac{n(n+1)}{2}.

Exercise 3.1-11. Let p=g−hp = g - h. Then Δp=Δg−Δh=0\Delta p = \Delta g - \Delta h = 0, so p(x+1)=p(x)p(x+1) = p(x) for every real xx: pp has period 11. For the example take g(x)=x2g(x) = x^2, which has Δg=2x+1\Delta g = 2x + 1, and h(x)=x2+sin⁡2πxh(x) = x^2 + \sin 2\pi x. Then Δh(x)=2x+1+sin⁡(2πx+2π)−sin⁡2πx=2x+1\Delta h(x) = 2x + 1 + \sin(2\pi x + 2\pi) - \sin 2\pi x = 2x + 1, and g−h=−sin⁡2πxg - h = -\sin 2\pi x is not constant. On the integers the two functions agree, as part 4 of the rules of the difference operator requires.

Exercise 3.1-12. Pascal's rule (the corollary on the difference of a binomial coefficient, at x=r−1x = r - 1) gives (rk)=(r−1k)+(r−1k−1)\binom{r}{k} = \binom{r-1}{k} + \binom{r-1}{k-1}. Let ak=(−1)k(r−1k)a_k = (-1)^k \binom{r-1}{k}, so a−1=0a_{-1} = 0. Then

(−1)k(rk)=(−1)k(r−1k)+(−1)k(r−1k−1)=ak−ak−1.(-1)^k \binom{r}{k} = (-1)^k \binom{r-1}{k} + (-1)^k \binom{r-1}{k-1} = a_k - a_{k-1}.

The sum over 0≤k≤n0 \le k \le n telescopes to an−a−1=(−1)n(r−1n)a_n - a_{-1} = (-1)^n \binom{r-1}{n}. Check r=5r = 5, n=2n = 2: 1−5+10=6=(42)1 - 5 + 10 = 6 = \binom{4}{2}.

Section 3.2: Summation by parts and the harmonic numbers

Exercise 3.2-1. Take u=x2u = x^2 and v=2xv = 2^x, so Δu=2x+1\Delta u = 2x + 1 and Δv=2x\Delta v = 2^x. The first form of the product rule gives Δ(x22x)=x22x+2x+1(2x+1)=2x(x2+4x+2)\Delta(x^2 2^x) = x^2 2^x + 2^{x+1}(2x+1) = 2^x (x^2 + 4x + 2). Check at x=1x = 1: 4⋅4−1⋅2=144 \cdot 4 - 1 \cdot 2 = 14 and 2⋅7=142 \cdot 7 = 14.

Exercise 3.2-2. Write u,vu, v for the values at xx and u′,v′u', v' for the values at x+1x + 1. Then u′v′−uv=u′v−uv′vv′\frac{u'}{v'} - \frac{u}{v} = \frac{u' v - u v'}{v v'}. Add and subtract uvuv in the numerator: u′v−uv′=(u′−u)v−u(v′−v)=vΔu−uΔvu'v - uv' = (u' - u) v - u (v' - v) = v \Delta u - u \Delta v. The denominator is v⋅Evv \cdot E v.

Exercise 3.2-3. The theorem on the sum of kxkk x^k with x=3x = 3 gives 3−n3n+(n−1)3n+14=3+3n(3n−3−n)4=(2n−3)3n+34\frac{3 - n 3^n + (n-1) 3^{n+1}}{4} = \frac{3 + 3^n (3n - 3 - n)}{4} = \frac{(2n - 3) 3^n + 3}{4}. Check n=3n = 3: 0+3+18=210 + 3 + 18 = 21 and (3⋅27+3)/4=21(3 \cdot 27 + 3)/4 = 21.

Exercise 3.2-4. With x=12x = \frac{1}{2} the theorem gives

∑0≤k<nk2k=4(12−n2n+n−12n+1)=2−4n−2n+22n=2−n+12n−1.\sum_{0 \le k < n} \frac{k}{2^k} = 4\Bigl(\frac{1}{2} - \frac{n}{2^n} + \frac{n-1}{2^{n+1}}\Bigr) = 2 - \frac{4n - 2n + 2}{2^n} = 2 - \frac{n+1}{2^{n-1}}.

Since (n+1)/2n−1→0(n+1)/2^{n-1} \to 0, the limit is 22, which is also x(1−x)2\frac{x}{(1-x)^2} at x=12x = \frac{1}{2}. Check n=3n = 3: 0+12+24=10 + \frac{1}{2} + \frac{2}{4} = 1 and 2−44=12 - \frac{4}{4} = 1.

Exercise 3.2-5. Take u(k)=k2u(k) = k^2 and Δv(k)=(−1)k\Delta v(k) = (-1)^k, with v(k)=−12(−1)kv(k) = -\frac{1}{2}(-1)^k, so v(k+1)=12(−1)kv(k+1) = \frac{1}{2}(-1)^k and Δu(k)=2k+1\Delta u(k) = 2k + 1. Summation by parts gives

∑0≤k<n(−1)kk2=−n2(−1)n2−∑0≤k<n(−1)kk−12∑0≤k<n(−1)k.\sum_{0 \le k < n} (-1)^k k^2 = -\frac{n^2 (-1)^n}{2} - \sum_{0 \le k < n} (-1)^k k - \frac{1}{2}\sum_{0 \le k < n} (-1)^k.

The second example of the Examples part gives ∑(−1)kk=(−1)n+1n2−1−(−1)n4\sum (-1)^k k = \frac{(-1)^{n+1} n}{2} - \frac{1 - (-1)^n}{4}, and ∑(−1)k=1−(−1)n2\sum (-1)^k = \frac{1 - (-1)^n}{2}. The terms with 1−(−1)n1 - (-1)^n cancel, and the sum is (−1)n+1n22+(−1)nn2=(−1)n−1n(n−1)2\frac{(-1)^{n+1} n^2}{2} + \frac{(-1)^n n}{2} = (-1)^{n-1} \frac{n(n-1)}{2}. Check n=4n = 4: 0−1+4−9=−60 - 1 + 4 - 9 = -6 and −4⋅32=−6-\frac{4 \cdot 3}{2} = -6.

Exercise 3.2-6. Let SS be the sum. Take u(k)=Hku(k) = H_k and Δv(k)=1k+1\Delta v(k) = \frac{1}{k+1}, so v(k)=Hkv(k) = H_k by the theorem on the discrete logarithm, and Δu(k)=1k+1\Delta u(k) = \frac{1}{k+1}. Summation by parts gives

S=Hn2−∑0≤k<nHk+1k+1=Hn2−∑0≤k<nHk+1k+1k+1=Hn2−S−Hn(2).S = H_n^2 - \sum_{0 \le k < n} \frac{H_{k+1}}{k+1} = H_n^2 - \sum_{0 \le k < n} \frac{H_k + \frac{1}{k+1}}{k+1} = H_n^2 - S - H_n^{(2)}.

So 2S=Hn2−Hn(2)2S = H_n^2 - H_n^{(2)}. Check n=3n = 3: S=0+12+3/23=1S = 0 + \frac{1}{2} + \frac{3/2}{3} = 1, and 12(12136−4936)=1\frac{1}{2}\bigl(\frac{121}{36} - \frac{49}{36}\bigr) = 1.

Exercise 3.2-7. First find ∑0≤k<nHk2\sum_{0 \le k < n} H_k^2. Take u(k)=Hk2u(k) = H_k^2 and Δv(k)=1\Delta v(k) = 1, so v(k)=kv(k) = k. Here Δu(k)=(Hk+1−Hk)(Hk+1+Hk)=1k+1(2Hk+1k+1)\Delta u(k) = (H_{k+1} - H_k)(H_{k+1} + H_k) = \frac{1}{k+1}\bigl(2 H_k + \frac{1}{k+1}\bigr), and v(k+1)Δu(k)=2Hk+1k+1v(k+1) \Delta u(k) = 2H_k + \frac{1}{k+1}. So

∑0≤k<nHk2=nHn2−2∑0≤k<nHk−Hn=nHn2−2(nHn−n)−Hn,\sum_{0 \le k < n} H_k^2 = n H_n^2 - 2 \sum_{0 \le k < n} H_k - H_n = n H_n^2 - 2(n H_n - n) - H_n,

by the theorem on the sum of harmonic numbers. Add Hn2H_n^2 and drop the term H02=0H_0^2 = 0: ∑1≤k≤nHk2=(n+1)Hn2−(2n+1)Hn+2n\sum_{1 \le k \le n} H_k^2 = (n+1) H_n^2 - (2n+1) H_n + 2n. Check n=2n = 2: 1+94=1341 + \frac{9}{4} = \frac{13}{4}, and 3⋅94−5⋅32+4=27−30+164=1343 \cdot \frac{9}{4} - 5 \cdot \frac{3}{2} + 4 = \frac{27 - 30 + 16}{4} = \frac{13}{4}.

Exercise 3.2-8. Since k(k−1)=2(k2)k(k-1) = 2\binom{k}{2}, the theorem on the sum of (km)Hk\binom{k}{m} H_k with m=2m = 2 gives

∑0≤k<nk(k−1)Hk=2(n3)(Hn−13)=n(n−1)(n−2)3(Hn−13).\sum_{0 \le k < n} k(k-1) H_k = 2 \binom{n}{3}\Bigl(H_n - \frac{1}{3}\Bigr) = \frac{n(n-1)(n-2)}{3}\Bigl(H_n - \frac{1}{3}\Bigr).

Check n=4n = 4: 2H2+6H3=3+11=142 H_2 + 6 H_3 = 3 + 11 = 14, and 8(2512−412)=8⋅74=148\bigl(\frac{25}{12} - \frac{4}{12}\bigr) = 8 \cdot \frac{7}{4} = 14.

Exercise 3.2-9. For k≥1k \ge 1, 1k(k+1)=1k−1k+1=Δv(k)\frac{1}{k(k+1)} = \frac{1}{k} - \frac{1}{k+1} = \Delta v(k) with v(k)=−1kv(k) = -\frac{1}{k}. Use summation by parts on 1≤k<n+11 \le k < n+1 with u(k)=Hku(k) = H_k:

∑1≤k≤nHkk(k+1)=−Hn+1n+1+H11+∑1≤k≤n1k+1⋅1k+1=1−Hn+1n+1+Hn+1(2)−1.\sum_{1 \le k \le n} \frac{H_k}{k(k+1)} = -\frac{H_{n+1}}{n+1} + \frac{H_1}{1} + \sum_{1 \le k \le n} \frac{1}{k+1} \cdot \frac{1}{k+1} = 1 - \frac{H_{n+1}}{n+1} + H_{n+1}^{(2)} - 1.

Now Hn+1(2)=Hn(2)+1(n+1)2H_{n+1}^{(2)} = H_n^{(2)} + \frac{1}{(n+1)^2} and Hn+1n+1=Hnn+1+1(n+1)2\frac{H_{n+1}}{n+1} = \frac{H_n}{n+1} + \frac{1}{(n+1)^2}, so the sum is Hn(2)−Hnn+1H_n^{(2)} - \frac{H_n}{n+1}. Check n=2n = 2: 12+3/26=34\frac{1}{2} + \frac{3/2}{6} = \frac{3}{4}, and 54−12=34\frac{5}{4} - \frac{1}{2} = \frac{3}{4}. As n→∞n \to \infty the sum tends to π26\frac{\pi^2}{6}, by the two given limits.

Exercise 3.2-10. Take u(k)=ku(k) = k and Δv(k)=(km)\Delta v(k) = \binom{k}{m}, so v(k)=(km+1)v(k) = \binom{k}{m+1} and Δu=1\Delta u = 1. Summation by parts gives

∑0≤k<nk(km)=n(nm+1)−∑0≤k<n(k+1m+1)=n(nm+1)−(n+1m+2),\sum_{0 \le k < n} k \binom{k}{m} = n \binom{n}{m+1} - \sum_{0 \le k < n} \binom{k+1}{m+1} = n \binom{n}{m+1} - \binom{n+1}{m+2},

since ∑0≤k<n(k+1m+1)=∑0≤j≤n(jm+1)\sum_{0 \le k < n} \binom{k+1}{m+1} = \sum_{0 \le j \le n} \binom{j}{m+1} (the term j=0j = 0 is 00), which is (n+1m+2)\binom{n+1}{m+2} by the corollary on sums over the upper index. Check m=1m = 1, n=4n = 4: 0+1+4+9=140 + 1 + 4 + 9 = 14, and 4⋅6−10=144 \cdot 6 - 10 = 14.

Exercise 3.2-11. Put B0=0B_0 = 0, so bk=Bk+1−Bk=ΔB(k)b_k = B_{k+1} - B_k = \Delta B(k). Summation by parts with u(k)=aku(k) = a_k on 0≤k<n−10 \le k < n - 1, plus the last term, gives

∑0≤k<nakbk=an−1Bn−∑0≤k<n−1Bk+1(ak+1−ak).\sum_{0 \le k < n} a_k b_k = a_{n-1} B_n - \sum_{0 \le k < n-1} B_{k+1} (a_{k+1} - a_k).

(Check by expanding: the coefficient of each BjB_j on the right is aj−1−aja_{j-1} - a_j for 1≤j<n1 \le j < n and an−1a_{n-1} for j=nj = n, as on the left.) Each ak−ak+1≥0a_k - a_{k+1} \ge 0, and ∣Bj∣≤M|B_j| \le M. So the absolute value is at most Man−1+M∑0≤k<n−1(ak−ak+1)=Man−1+M(a0−an−1)=Ma0M a_{n-1} + M \sum_{0 \le k < n-1} (a_k - a_{k+1}) = M a_{n-1} + M (a_0 - a_{n-1}) = M a_0.

Section 3.3: Difference tables and Newton's formula

Exercise 3.3-1. The table of x4x^4 for 0≤x≤50 \le x \le 5 has the rows 0,1,16,81,256,6250, 1, 16, 81, 256, 625; then 1,15,65,175,3691, 15, 65, 175, 369; then 14,50,110,19414, 50, 110, 194; then 36,60,8436, 60, 84; then 24,2424, 24; then 00. The left edge is 0,1,14,36,240, 1, 14, 36, 24, and Newton's formula gives x4=(x1)+14(x2)+36(x3)+24(x4)x^4 = \binom{x}{1} + 14\binom{x}{2} + 36\binom{x}{3} + 24\binom{x}{4}. Divide by the factorials: x4=x1‾+7x2‾+6x3‾+x4‾x^4 = x^{\underline{1}} + 7 x^{\underline{2}} + 6 x^{\underline{3}} + x^{\underline{4}}. The fourth row is 4!=244! = 24, as the theorem on the nnth difference says.

Exercise 3.3-2. By Exercise 1 and the corollary on sums of falling powers,

∑0≤k<nk4=n2‾2+7n3‾3+6n4‾4+n5‾5.\sum_{0 \le k < n} k^4 = \frac{n^{\underline{2}}}{2} + \frac{7 n^{\underline{3}}}{3} + \frac{6 n^{\underline{4}}}{4} + \frac{n^{\underline{5}}}{5}.

Take out n(n−1)30\frac{n(n-1)}{30}. What is left is 15+70(n−2)+45(n−2)(n−3)+6(n−2)(n−3)(n−4)15 + 70(n-2) + 45(n-2)(n-3) + 6(n-2)(n-3)(n-4). Expand: the constant term is 15−140+270−144=115 - 140 + 270 - 144 = 1, the coefficient of nn is 70−225+156=170 - 225 + 156 = 1, the coefficient of n2n^2 is 45−54=−945 - 54 = -9, and that of n3n^3 is 66. So the sum is n(n−1)(6n3−9n2+n+1)30=n(n−1)(2n−1)(3n2−3n−1)30\frac{n(n-1)(6n^3 - 9n^2 + n + 1)}{30} = \frac{n(n-1)(2n-1)(3n^2 - 3n - 1)}{30}. Check n=3n = 3: 0+1+16=170 + 1 + 16 = 17, and 3⋅2⋅5⋅1730=17\frac{3 \cdot 2 \cdot 5 \cdot 17}{30} = 17.

Exercise 3.3-3. The table is 1,0,3,161, 0, 3, 16; then −1,3,13-1, 3, 13; then 4,104, 10; then 66. Since pp has degree at most 33, the row Δ3p\Delta^3 p is constant, so its next entry is 66. Then the next entries of the rows above are 10+6=1610 + 6 = 16, then 13+16=2913 + 16 = 29, then 16+29=4516 + 29 = 45. So p(4)=45p(4) = 45. Newton's formula with the left edge 1,−1,4,61, -1, 4, 6 gives

p(x)=1−x+4(x2)+6(x3)=1−x+2x(x−1)+x(x−1)(x−2)=x3−x2−x+1=(x−1)2(x+1).p(x) = 1 - x + 4\binom{x}{2} + 6\binom{x}{3} = 1 - x + 2x(x-1) + x(x-1)(x-2) = x^3 - x^2 - x + 1 = (x-1)^2 (x+1).

Check: p(4)=9⋅5=45p(4) = 9 \cdot 5 = 45.

Exercise 3.3-4. Let f(x)=1x=(x−1)−1‾f(x) = \frac{1}{x} = (x-1)^{\underline{-1}}. The theorem on the difference of a falling power, applied nn times, gives Δn(x−1)−1‾=(−1)(−2)⋯(−n)(x−1)−1−n‾=(−1)nn!x(x+1)⋯(x+n)\Delta^n (x-1)^{\underline{-1}} = (-1)(-2)\cdots(-n) (x-1)^{\underline{-1-n}} = \frac{(-1)^n n!}{x (x+1) \cdots (x+n)}, valid for x∉{0,−1,…,−n}x \notin \{0, -1, \dots, -n\}. The theorem on powers of the difference operator gives Δnf(x)=∑k(nk)(−1)n−k1x+k\Delta^n f(x) = \sum_k \binom{n}{k} (-1)^{n-k} \frac{1}{x+k}. Compare and multiply by (−1)n(-1)^n:

∑0≤k≤n(nk)(−1)kx+k=n!x(x+1)⋯(x+n).\sum_{0 \le k \le n} \binom{n}{k} \frac{(-1)^k}{x+k} = \frac{n!}{x(x+1)\cdots(x+n)}.

Check n=2n = 2, x=1x = 1: 1−1+13=131 - 1 + \frac{1}{3} = \frac{1}{3} and 26=13\frac{2}{6} = \frac{1}{3}.

Exercise 3.3-5. Since Δcx=(c−1)cx\Delta c^x = (c-1) c^x and Δ\Delta is linear, induction gives Δncx=(c−1)ncx\Delta^n c^x = (c-1)^n c^x. The theorem on powers of the difference operator at x=0x = 0 gives ∑k(nk)(−1)n−kck=Δncx∣x=0=(c−1)n\sum_k \binom{n}{k} (-1)^{n-k} c^k = \Delta^n c^x \big|_{x=0} = (c-1)^n. This is the binomial theorem for (c+(−1))n(c + (-1))^n.

Exercise 3.3-6. By Newton's formula, p(x)=∑0≤k≤dΔkp(0)(xk)p(x) = \sum_{0 \le k \le d} \Delta^k p(0) \binom{x}{k}. Each Δkp(0)=∑j(kj)(−1)k−jp(j)\Delta^k p(0) = \sum_j \binom{k}{j} (-1)^{k-j} p(j) is an integer, since it uses only p(0),…,p(k)p(0), \dots, p(k) with k≤dk \le d. It remains to show that (nk)\binom{n}{k} is an integer for each integer nn and k≥0k \ge 0. For n≥0n \ge 0 it counts the subsets of size kk of a set of nn elements (Chapter 6 proves this; it also follows from Pascal's rule by induction on nn). For n<0n < 0, the proposition on falling and rising powers gives nk‾=(−1)k(−n)k‾=(−1)k(k−n−1)k‾n^{\underline{k}} = (-1)^k (-n)^{\overline{k}} = (-1)^k (k - n - 1)^{\underline{k}}, so (nk)=(−1)k(k−n−1k)\binom{n}{k} = (-1)^k \binom{k - n - 1}{k} with k−n−1≥0k - n - 1 \ge 0. So p(n)p(n) is an integer. The polynomial (x2)=x2−x2\binom{x}{2} = \frac{x^2 - x}{2} has degree 22, takes the integer values 0,0,10, 0, 1 at 0,1,20, 1, 2, and its coefficients are not integers.

Exercise 3.3-7. The number Δkq(0)\Delta^k q(0) depends only on q(0),…,q(k)q(0), \dots, q(k), by the theorem on powers of the difference operator. For k≤nk \le n these are the values 20,…,2k2^0, \dots, 2^k, so Δkq(0)=Δk2x∣x=0=1\Delta^k q(0) = \Delta^k 2^x \big|_{x=0} = 1. Newton's formula gives q(x)=∑0≤k≤n(xk)q(x) = \sum_{0 \le k \le n} \binom{x}{k}. So q(n+1)=∑0≤k≤n(n+1k)=2n+1−(n+1n+1)=2n+1−1q(n+1) = \sum_{0 \le k \le n} \binom{n+1}{k} = 2^{n+1} - \binom{n+1}{n+1} = 2^{n+1} - 1, by the binomial theorem (the fourth example of the Examples part with c=2c = 2). The example 1,2,4,8,16,311, 2, 4, 8, 16, 31 in the text is the case n=4n = 4.

Exercise 3.3-8. The left side is Δnf(0)\Delta^n f(0) for f(x)=xn+1f(x) = x^{n+1}. Expand xn+1‾=∏0≤j≤n(x−j)=xn+1−(0+1+⋯+n)xn+⋯=xn+1−(n+12)xn+(lower terms)x^{\underline{n+1}} = \prod_{0 \le j \le n} (x - j) = x^{n+1} - (0 + 1 + \cdots + n) x^n + \cdots = x^{n+1} - \binom{n+1}{2} x^n + (\text{lower terms}). So xn+1−xn+1‾−(n+12)xn‾x^{n+1} - x^{\underline{n+1}} - \binom{n+1}{2} x^{\underline{n}} has degree less than nn, because xn‾=xn+(lower terms)x^{\underline{n}} = x^n + (\text{lower terms}). Apply Δn\Delta^n and the theorem on the nnth difference of a polynomial: the part of degree less than nn goes to 00, Δnxn‾=n!\Delta^n x^{\underline{n}} = n! and Δnxn+1‾=(n+1)! x\Delta^n x^{\underline{n+1}} = (n+1)! \, x, which is 00 at x=0x = 0. So Δnf(0)=(n+12)n!\Delta^n f(0) = \binom{n+1}{2} n!. Check n=2n = 2: 1⋅0−2⋅1+1⋅8=61 \cdot 0 - 2 \cdot 1 + 1 \cdot 8 = 6, and 2!⋅3=62! \cdot 3 = 6.

Exercise 3.3-9. Let p(x)=∑0≤k≤dΔkf(0)(xk)p(x) = \sum_{0 \le k \le d} \Delta^k f(0) \binom{x}{k} and g=f−pg = f - p on ℤ\mathbb{Z}. By the corollary on the difference of a binomial coefficient, Δk(xj)=(xj−k)\Delta^k \binom{x}{j} = \binom{x}{j-k}, which is [j=k][j = k] at x=0x = 0 for 0≤j,k≤d0 \le j, k \le d. So Δkp(0)=Δkf(0)\Delta^k p(0) = \Delta^k f(0), and Δkg(0)=0\Delta^k g(0) = 0 for 0≤k≤d0 \le k \le d. Also Δd+1p=0\Delta^{d+1} p = 0 because pp has degree at most dd, so Δd+1g=0\Delta^{d+1} g = 0 on ℤ\mathbb{Z}. Now show by downward induction on kk that Δkg=0\Delta^k g = 0 on ℤ\mathbb{Z} for k=d,d−1,…,0k = d, d-1, \dots, 0. The function Δkg\Delta^k g has difference Δk+1g=0\Delta^{k+1} g = 0, so it is constant on ℤ\mathbb{Z} by part 4 of the rules of the difference operator, and the constant is Δkg(0)=0\Delta^k g(0) = 0. For k=0k = 0 this says f=pf = p on all of ℤ\mathbb{Z}.

Exercise 3.3-10. By the lemma on the basis of falling powers, km=∑0≤j≤mcjkj‾k^m = \sum_{0 \le j \le m} c_j k^{\underline{j}} with cm=1c_m = 1. By the corollary on sums of falling powers, Sm(n)=∑0≤j≤mcjnj+1‾j+1S_m(n) = \sum_{0 \le j \le m} c_j \frac{n^{\underline{j+1}}}{j+1}. Each nj+1‾n^{\underline{j+1}} is a polynomial of degree j+1j + 1 with the factor nn, so SmS_m is a polynomial with constant term 00. Its degree is m+1m + 1, and only the term j=mj = m has degree m+1m + 1, with leading coefficient cmm+1=1m+1\frac{c_m}{m+1} = \frac{1}{m+1}. For m=0m = 0 the sum is nn, with the convention 00=10^0 = 1.

Exercise 3.3-11. By the theorem on the discrete logarithm, ΔHx=x−1‾\Delta H_x = x^{\underline{-1}} for integers x≥0x \ge 0. Then k−1k - 1 more differences give ΔkHx=(−1)(−2)⋯(−(k−1)) x−k‾=(−1)k−1(k−1)! x−k‾\Delta^k H_x = (-1)(-2)\cdots(-(k-1)) \, x^{\underline{-k}} = (-1)^{k-1} (k-1)! \, x^{\underline{-k}}. At x=0x = 0, with 0−k‾=1k!0^{\underline{-k}} = \frac{1}{k!}, this is (−1)k−1k\frac{(-1)^{k-1}}{k}. Newton's formula holds for every function on the nonnegative integers, so

Hn=H0+∑1≤k≤n(nk)(−1)k−1k=∑1≤k≤n(nk)(−1)k−1k.H_n = H_0 + \sum_{1 \le k \le n} \binom{n}{k} \frac{(-1)^{k-1}}{k} = \sum_{1 \le k \le n} \binom{n}{k} \frac{(-1)^{k-1}}{k}.

Check n=3n = 3: 3−32+13=116=H33 - \frac{3}{2} + \frac{1}{3} = \frac{11}{6} = H_3.

Solutions to Chapter 4: Floors, ceilings, logarithms and mod

Section 4.1: Powers and logarithms

Exercise 4.1-1. 163/4=(161/4)3=23=816^{3/4} = (16^{1/4})^3 = 2^3 = 8. 27−2/3=1/(271/3)2=1/927^{-2/3} = 1/(27^{1/3})^2 = 1/9. log⁡3181=−4\log_3 \frac{1}{81} = -4, because 3−4=1813^{-4} = \frac{1}{81}. log⁡432=52\log_4 32 = \frac{5}{2}, because 45/2=(41/2)5=25=324^{5/2} = (4^{1/2})^5 = 2^5 = 32.

Exercise 4.1-2. Since k≠0k \ne 0 and b≠1b \ne 1, the base bkb^k is positive and not 11. Let u=log⁡bxu = \log_b x. Then x=bu=(bk)u/kx = b^u = (b^k)^{u/k} by the law (br)s=brs(b^r)^s = b^{rs}, so log⁡bkx=u/k\log_{b^k} x = u/k. For example log⁡8x=13lg⁡x\log_8 x = \frac{1}{3} \lg x.

Exercise 4.1-3. Since 2<3<42 < 3 < 4, 1<lg⁡3<21 < \lg 3 < 2. Suppose lg⁡3=p/q\lg 3 = p/q with integers p,q≥1p, q \ge 1. Then 2p/q=32^{p/q} = 3, and the qqth power gives 2p=3q2^p = 3^q. The left side is even and the right side is odd, which is impossible. So lg⁡3\lg 3 is irrational.

Exercise 4.1-4. 363=263lg⁡33^{63} = 2^{63 \lg 3}. With 1.58496≤lg⁡3<1.584971.58496 \le \lg 3 < 1.58497, the exponent lies between 63⋅1.58496=99.8524863 \cdot 1.58496 = 99.85248 and 63⋅1.58497=99.8531163 \cdot 1.58497 = 99.85311. Both bounds are below 100100, and x↦2xx \mapsto 2^x is increasing, so 21002^{100} is larger. The quotient 2100/3632^{100}/3^{63} is about 20.1475=1.1082^{0.1475} = 1.108.

Exercise 4.1-5. log⁡1021000=1000log⁡102=301.0299957\log_{10} 2^{1000} = 1000 \log_{10} 2 = 301.0299957, with an error below 10−710^{-7}. By Theorem P2.4.21, 210002^{1000} has ⌊301.03⌋+1=302\lfloor 301.03 \rfloor + 1 = 302 digits. Also 21000=10301⋅100.02999572^{1000} = 10^{301} \cdot 10^{0.0299957} and 100.0299957=1.071510^{0.0299957} = 1.0715, so the leading digit is 11 and the number starts with 107107.

Exercise 4.1-6. By Theorem P2.4.21, 2d−1≤n<2d2^{d-1} \le n < 2^d. Square: 22d−2≤n2<22d2^{2d-2} \le n^2 < 2^{2d}. So n2n^2 has 2d−12d - 1 binary digits if n2<22d−1n^2 < 2^{2d-1}, and 2d2d digits otherwise. Examples: n=2=102n = 2 = 10_2 has d=2d = 2, and n2=1002n^2 = 100_2 has 3=2d−13 = 2d - 1 digits; n=3=112n = 3 = 11_2 has d=2d = 2, and n2=10012n^2 = 1001_2 has 4=2d4 = 2d digits. The first case happens exactly when n<2d−1/2n < 2^{d - 1/2}, that is when n/2d−1<2n/2^{d-1} < \sqrt{2}.

Exercise 4.1-7. Since 5=4⋅1.255 = 4 \cdot 1.25, lg⁡5=2+lg⁡1.25\lg 5 = 2 + \lg 1.25. Square y=1.25y = 1.25: y2=1.5625<2y^2 = 1.5625 < 2, bit 00, y=1.5625y = 1.5625. Then y2=2.4414≥2y^2 = 2.4414 \ge 2, bit 11, y=1.2207y = 1.2207. Then y2=1.4901y^2 = 1.4901, bit 00. Then y2=2.2204y^2 = 2.2204, bit 11, y=1.1102y = 1.1102. So lg⁡5=10.0101…2\lg 5 = 10.0101\ldots_2, and the four bits give 2.31252.3125. The true value is 2.321932.32193, which is 10.01010010…210.01010010\ldots_2.

Exercise 4.1-8. For n≥1n \ge 1, n1/n≥1n^{1/n} \ge 1, so n1/n=1+tnn^{1/n} = 1 + t_n with tn≥0t_n \ge 0. For n≥2n \ge 2 the binomial theorem gives n=(1+tn)n≥(n2)tn2=n(n−1)2tn2n = (1 + t_n)^n \ge \binom{n}{2} t_n^2 = \frac{n(n-1)}{2} t_n^2, since all terms are nonnegative. So tn2≤2n−1t_n^2 \le \frac{2}{n-1} and 0≤tn≤2/(n−1)0 \le t_n \le \sqrt{2/(n-1)}, which tends to 00. So n1/n→1n^{1/n} \to 1.

Exercise 4.1-9. log⁡105=log⁡1010−log⁡102=1−0.30103=0.69897\log_{10} 5 = \log_{10} 10 - \log_{10} 2 = 1 - 0.30103 = 0.69897. Since 72=23⋅3272 = 2^3 \cdot 3^2, log⁡1072=3⋅0.30103+2⋅0.47712=0.90309+0.95424=1.85733\log_{10} 72 = 3 \cdot 0.30103 + 2 \cdot 0.47712 = 0.90309 + 0.95424 = 1.85733. The true values are 0.6989700.698970 and 1.8573321.857332.

Section 4.2: Floors and ceilings

Exercise 4.2-1. ⌊−0.5⌋=−1\lfloor -0.5 \rfloor = -1 and ⌈−0.5⌉=0\lceil -0.5 \rceil = 0. Since ⌈2.3⌉=3\lceil 2.3 \rceil = 3, ⌊⌈2.3⌉−0.5⌋=⌊2.5⌋=2\lfloor \lceil 2.3 \rceil - 0.5 \rfloor = \lfloor 2.5 \rfloor = 2.

Exercise 4.2-2. By part 5 of Theorem P2.4.30, ⌊−x⌋=−⌈x⌉\lfloor -x \rfloor = -\lceil x \rceil. So the sum is ⌊x⌋−⌈x⌉=−[x∉ℤ]\lfloor x \rfloor - \lceil x \rceil = -[x \notin \mathbb{Z}], by part 6.

Exercise 4.2-3. Write x=⌊x⌋+ax = \lfloor x \rfloor + a and y=⌊y⌋+by = \lfloor y \rfloor + b with a,b∈[0,1)a, b \in [0, 1). By part 4 of Theorem P2.4.30, ⌊x+y⌋=⌊x⌋+⌊y⌋+⌊a+b⌋\lfloor x + y \rfloor = \lfloor x \rfloor + \lfloor y \rfloor + \lfloor a + b \rfloor, and 0≤a+b<20 \le a + b < 2 gives ⌊a+b⌋∈{0,1}\lfloor a + b \rfloor \in \{0, 1\}. For the ceiling apply this to −x-x and −y-y: ⌈x+y⌉=−⌊−x−y⌋\lceil x + y \rceil = -\lfloor -x - y \rfloor, which is −⌊−x⌋−⌊−y⌋=⌈x⌉+⌈y⌉-\lfloor -x \rfloor - \lfloor -y \rfloor = \lceil x \rceil + \lceil y \rceil or this number minus 11. Examples: x=y=0.2x = y = 0.2 gives ⌊0.4⌋=0=0+0\lfloor 0.4 \rfloor = 0 = 0 + 0 and ⌈0.4⌉=1=1+1−1\lceil 0.4 \rceil = 1 = 1 + 1 - 1; x=y=0.6x = y = 0.6 gives ⌊1.2⌋=1=0+0+1\lfloor 1.2 \rfloor = 1 = 0 + 0 + 1 and ⌈1.2⌉=2=1+1\lceil 1.2 \rceil = 2 = 1 + 1.

Exercise 4.2-4. Write x=n+ax = n + a with n=⌊x⌋n = \lfloor x \rfloor and a=x−⌊x⌋∈[0,1)a = x - \lfloor x \rfloor \in [0, 1). Then 2x=2n+2a2x = 2n + 2a and ⌊2x⌋=2n+⌊2a⌋\lfloor 2x \rfloor = 2n + \lfloor 2a \rfloor. Here ⌊2a⌋=0\lfloor 2a \rfloor = 0 when a<12a < \frac{1}{2} and ⌊2a⌋=1\lfloor 2a \rfloor = 1 when 12≤a<1\frac{1}{2} \le a < 1.

Exercise 4.2-5. Block bb holds the bytes jj with bm≤j<(b+1)mbm \le j < (b+1)m, that is with b≤j/m<b+1b \le j/m < b + 1. By part 1 of Theorem P2.4.30 this says b=⌊j/m⌋b = \lfloor j/m \rfloor. The bytes 0,…,n−10, \ldots, n-1 of the file lie in the blocks ⌊0/m⌋=0\lfloor 0/m \rfloor = 0 to ⌊(n−1)/m⌋\lfloor (n-1)/m \rfloor, and each block in between holds at least one byte, since the map j↦⌊j/m⌋j \mapsto \lfloor j/m \rfloor increases by at most 11 at each step. So the file needs ⌊(n−1)/m⌋+1\lfloor (n-1)/m \rfloor + 1 blocks, which is ⌈n/m⌉\lceil n/m \rceil by Theorem P2.4.34.

Exercise 4.2-6. Both claims are false. (a) For x=3.5x = 3.5: ⌊4⌋=2\lfloor \sqrt{4} \rfloor = 2, but ⌊3.5⌋=1\lfloor \sqrt{3.5} \rfloor = 1. (b) For x=4.5x = 4.5: ⌈4⌉=2\lceil \sqrt{4} \rceil = 2, but ⌈4.5⌉=3\lceil \sqrt{4.5} \rceil = 3. Theorem P2.4.31 pairs the floor outside with the floor inside, and the ceiling with the ceiling. A mixed pair can cross an integer value of ff: in (a) the inner ceiling moves 3.53.5 up to the square 44.

Exercise 4.2-7. The squares in [1,1000][1, 1000] are j2j^2 with 1≤j≤⌊1000⌋=311 \le j \le \lfloor \sqrt{1000} \rfloor = 31. The cubes are j3j^3 with 1≤j≤101 \le j \le 10. A number is both a square and a cube exactly when it is a sixth power, and the sixth powers in range are 11, 6464 and 729729. By inclusion and exclusion the answer is 31+10−3=3831 + 10 - 3 = 38.

Exercise 4.2-8. Let k≥1k \ge 1 be an integer. By part 3 of Theorem P2.4.30, ⌊kα⌋≤N\lfloor k\alpha \rfloor \le N holds if and only if ⌊kα⌋<N+1\lfloor k\alpha \rfloor < N + 1, if and only if kα<N+1k\alpha < N + 1, that is k<(N+1)/αk < (N+1)/\alpha. Again by part 3, k<(N+1)/αk < (N+1)/\alpha holds if and only if k<⌈(N+1)/α⌉k < \lceil (N+1)/\alpha \rceil, that is k≤⌈(N+1)/α⌉−1k \le \lceil (N+1)/\alpha \rceil - 1. So the integers in question are 1,…,⌈(N+1)/α⌉−11, \ldots, \lceil (N+1)/\alpha \rceil - 1. Their number is ⌈(N+1)/α⌉−1\lceil (N+1)/\alpha \rceil - 1, which is at least 00 because (N+1)/α>0(N+1)/\alpha > 0. Check: α=2.5\alpha = 2.5, N=5N = 5: ⌊2.5⌋=2\lfloor 2.5 \rfloor = 2, ⌊5⌋=5\lfloor 5 \rfloor = 5, ⌊7.5⌋=7\lfloor 7.5 \rfloor = 7, so two values of kk; and ⌈6/2.5⌉−1=3−1=2\lceil 6/2.5 \rceil - 1 = 3 - 1 = 2.

Exercise 4.2-9. Apply part 2 of Theorem P2.4.35 with k=2k = 2 to the real number y=x≥0y = \sqrt{x} \ge 0: ⌊⌊y⌋⌋=⌊y⌋=⌊x1/4⌋\lfloor \sqrt{\lfloor y \rfloor} \rfloor = \lfloor \sqrt{y} \rfloor = \lfloor x^{1/4} \rfloor.

Exercise 4.2-10. First let x≥0x \ge 0 and n=⌊x⌋n = \lfloor x \rfloor. Then n2≤x2<(n+1)2n^2 \le x^2 < (n+1)^2, so ⌊x2⌋≥n2\lfloor x^2 \rfloor \ge n^2, with equality if and only if x2<n2+1x^2 < n^2 + 1, that is x<n2+1x < \sqrt{n^2 + 1}. Now let x<0x < 0, and let m≥1m \ge 1 with −m≤x<−m+1-m \le x < -m + 1, so ⌊x⌋2=m2\lfloor x \rfloor^2 = m^2. Then (m−1)2<x2≤m2(m-1)^2 < x^2 \le m^2, so ⌊x2⌋≤m2\lfloor x^2 \rfloor \le m^2, with equality if and only if x2=m2x^2 = m^2, that is x=−mx = -m. The solutions are the xx in ⋃n≥0[n,n2+1)\bigcup_{n \ge 0} [n, \sqrt{n^2 + 1}) and the negative integers.

Section 4.3: The mod operation

Exercise 4.3-1. 13 mod 5=13−5⋅2=313 \bmod 5 = 13 - 5 \cdot 2 = 3. (−13) mod 5=−13−5⋅(−3)=2(-13) \bmod 5 = -13 - 5 \cdot (-3) = 2. 13 mod (−5)=13−(−5)(−3)=−213 \bmod (-5) = 13 - (-5)(-3) = -2. (−13) mod (−5)=−13−(−5)⋅2=−3(-13) \bmod (-5) = -13 - (-5) \cdot 2 = -3. 13 mod 0=1313 \bmod 0 = 13.

Exercise 4.3-2. 7.5 mod 2=7.5−2⋅3=1.57.5 \bmod 2 = 7.5 - 2 \cdot 3 = 1.5. (−7.5) mod 2=−7.5−2⋅(−4)=0.5(-7.5) \bmod 2 = -7.5 - 2 \cdot (-4) = 0.5. 7.5 mod (−2)=7.5−(−2)(−4)=−0.57.5 \bmod (-2) = 7.5 - (-2)(-4) = -0.5. The last value also follows from Exercise 10: −((−7.5) mod 2)=−0.5-\bigl((-7.5) \bmod 2\bigr) = -0.5.

Exercise 4.3-3. Let t=x/yt = x/y. By the definition, x mod y+(−x) mod y=x−y⌊t⌋−x−y⌊−t⌋=−y(⌊t⌋+⌊−t⌋)x \bmod y + (-x) \bmod y = x - y\lfloor t \rfloor - x - y \lfloor -t \rfloor = -y\bigl(\lfloor t \rfloor + \lfloor -t \rfloor\bigr). By Exercise 4.2-2 the bracket is −[t∉ℤ]-[t \notin \mathbb{Z}], so the sum is y [x/y∉ℤ]y\,[x/y \notin \mathbb{Z}].

Exercise 4.3-4. By the definition with the divisor 11, x/y mod 1=x/y−⌊x/y⌋x/y \bmod 1 = x/y - \lfloor x/y \rfloor. Multiply by yy: y(x/y mod 1)=x−y⌊x/y⌋=x mod yy(x/y \bmod 1) = x - y\lfloor x/y \rfloor = x \bmod y.

Exercise 4.3-5. For n=0n = 0 both sides are abab. Let n≠0n \ne 0. Then a=a mod n+kna = a \bmod n + kn and b=b mod n+lnb = b \bmod n + ln with integers kk and ll, and a mod na \bmod n and b mod nb \bmod n are integers by Theorem P2.4.52. So ab=(a mod n)(b mod n)+n(k(b mod n)+l(a mod n)+kln)ab = (a \bmod n)(b \bmod n) + n\bigl(k (b \bmod n) + l (a \bmod n) + kln\bigr), and the bracket is an integer. Part 3 of Theorem P2.4.46 gives equal remainders. For real numbers the bracket need not be an integer: with a=1.5a = 1.5, b=0.5b = 0.5 and n=1n = 1, (ab) mod 1=0.75 mod 1=0.75(ab) \bmod 1 = 0.75 \bmod 1 = 0.75, but ((a mod 1)(b mod 1)) mod 1=0.25\bigl((a \bmod 1)(b \bmod 1)\bigr) \bmod 1 = 0.25.

Exercise 4.3-6. By Theorem P2.4.50 with c=10c = 10, 10 (3.7 mod 0.4)=37 mod 4=110\,(3.7 \bmod 0.4) = 37 \bmod 4 = 1. So 3.7 mod 0.4=0.13.7 \bmod 0.4 = 0.1. Check: 3.7=9⋅0.4+0.13.7 = 9 \cdot 0.4 + 0.1.

Exercise 4.3-7. If y≤x/2y \le x/2, then x mod y<y≤x/2x \bmod y < y \le x/2 by Theorem P2.4.45. If y>x/2y > x/2, then 1≤x/y<21 \le x/y < 2, so ⌊x/y⌋=1\lfloor x/y \rfloor = 1 and x mod y=x−y<x−x/2=x/2x \bmod y = x - y < x - x/2 = x/2. In the algorithm of Euclid this means that each number at least halves after two steps.

Exercise 4.3-8. If xx is an integer, then −x-x and x+1x + 1 are integers, and all three values of the sawtooth function are 00. Let xx not be an integer. Then −x-x is not an integer, and Exercise 3 with y=1y = 1 gives (−x) mod 1=1−x mod 1(-x) \bmod 1 = 1 - x \bmod 1. So ((−x))=1−x mod 1−12=−(x mod 1−12)=−((x))((-x)) = 1 - x \bmod 1 - \frac{1}{2} = -\bigl(x \bmod 1 - \frac{1}{2}\bigr) = -((x)). Also x+1x + 1 is not an integer and (x+1) mod 1=x mod 1(x + 1) \bmod 1 = x \bmod 1 by part 1 of Theorem P2.4.46, so ((x+1))=((x))((x + 1)) = ((x)).

Exercise 4.3-9. By the definition and part 5 of Theorem P2.4.30, (−x) mod y=−x−y⌊−x/y⌋=−x+y⌈x/y⌉(-x) \bmod y = -x - y\lfloor -x/y \rfloor = -x + y \lceil x/y \rceil.

Exercise 4.3-10. Theorem P2.4.50 with c=−1c = -1, applied to the numbers −x-x and yy, gives −((−x) mod y)=((−1)(−x)) mod ((−1)y)=x mod (−y)-\bigl((-x) \bmod y\bigr) = \bigl((-1)(-x)\bigr) \bmod \bigl((-1) y\bigr) = x \bmod (-y). The law holds for all yy, also y=0y = 0, where both sides are xx.

Section 4.4: Sums of floors

Exercise 4.4-1. The parts are ⌊(100+k)/7⌋\lfloor (100 + k)/7 \rfloor for 0≤k<70 \le k < 7: 14,14,14,14,14,15,1514, 14, 14, 14, 14, 15, 15. Since 100 mod 7=2100 \bmod 7 = 2, two parts are 1515, and 5⋅14+2⋅15=1005 \cdot 14 + 2 \cdot 15 = 100.

Exercise 4.4-2. Hermite's identity with n=2n = 2 and x=n/2k+1x = n/2^{k+1} (here nn on the left is the given integer) gives ⌊n/2k+1+12⌋=⌊n/2k⌋−⌊n/2k+1⌋\lfloor n/2^{k+1} + \frac{1}{2} \rfloor = \lfloor n/2^k \rfloor - \lfloor n/2^{k+1} \rfloor. The left side is the term ⌊(n+2k)/2k+1⌋\lfloor (n + 2^k)/2^{k+1} \rfloor. Choose KK with 2K>n2^K > n. For k≥Kk \ge K the term is 00, since 0≤n+2k<2k+10 \le n + 2^k < 2^{k+1}. The sum for 0≤k<K0 \le k < K telescopes to ⌊n⌋−⌊n/2K⌋=n−0=n\lfloor n \rfloor - \lfloor n/2^K \rfloor = n - 0 = n. Check n=6n = 6: ⌊7/2⌋+⌊8/4⌋+⌊10/8⌋+⌊14/16⌋=3+2+1+0=6\lfloor 7/2 \rfloor + \lfloor 8/4 \rfloor + \lfloor 10/8 \rfloor + \lfloor 14/16 \rfloor = 3 + 2 + 1 + 0 = 6.

Exercise 4.4-3. By part 6 of Theorem P2.4.30, ⌈k⌉=⌊k⌋+[k∉ℤ]\lceil \sqrt{k} \rceil = \lfloor \sqrt{k} \rfloor + [\sqrt{k} \notin \mathbb{Z}], and k\sqrt{k} is an integer exactly when kk is a perfect square. So the difference of the two sums is the number of kk in [0,n)[0, n) that are not squares. The squares in [0,n)[0, n) are j2j^2 with 0≤j<n0 \le j < \sqrt{n}, that is 0≤j≤⌈n⌉−10 \le j \le \lceil \sqrt{n} \rceil - 1 by part 3; there are ⌈n⌉\lceil \sqrt{n} \rceil of them. So the difference is n−⌈n⌉n - \lceil \sqrt{n} \rceil. Check n=10n = 10: the sum of the ceilings is 0+1+2+2+2+3+3+3+3+3=220 + 1 + 2 + 2 + 2 + 3 + 3 + 3 + 3 + 3 = 22, and 16+10−4=2216 + 10 - 4 = 22.

Exercise 4.4-4. Follow the proof of Theorem P2.4.63. For k≥0k \ge 0, ⌊k1/3⌋\lfloor k^{1/3} \rfloor is the number of integers j≥1j \ge 1 with j3≤kj^3 \le k. Change the order of summation: the sum is ∑j≥1#{k:j3≤k<n}\sum_{j \ge 1} \#\{k : j^3 \le k < n\}. The count is n−j3n - j^3 for j3≤nj^3 \le n, that is for j≤aj \le a by Theorem P2.4.35, and 00 otherwise. So the sum is ∑1≤j≤a(n−j3)=na−(a(a+1)2)2\sum_{1 \le j \le a} (n - j^3) = na - \bigl(\frac{a(a+1)}{2}\bigr)^2, by the sum of cubes in Theorem P2.3.54. Check n=10n = 10, a=2a = 2: the terms are 0,1,1,1,1,1,1,1,2,20, 1, 1, 1, 1, 1, 1, 1, 2, 2, with the sum 1111, and 20−9=1120 - 9 = 11.

Exercise 4.4-5. Here m=12m = 12, n=8n = 8, x=5x = 5 and d=4d = 4. Theorem P2.4.65 gives 4⌊5/4⌋+11⋅72+32=4+38.5+1.5=444 \lfloor 5/4 \rfloor + \frac{11 \cdot 7}{2} + \frac{3}{2} = 4 + 38.5 + 1.5 = 44. Term by term, ⌊(8k+5)/12⌋\lfloor (8k + 5)/12 \rfloor for k=0,…,11k = 0, \ldots, 11 is 0,1,1,2,3,3,4,5,5,6,7,70, 1, 1, 2, 3, 3, 4, 5, 5, 6, 7, 7, with the sum 4444.

Exercise 4.4-6. Write m=dm′m = dm' and n=dn′n = dn' with gcd⁡(m′,n′)=1\gcd(m', n') = 1, as in the proof of Theorem P2.4.65. Then m∣nkm \mid nk if and only if m′∣n′km' \mid n'k, if and only if m′∣km' \mid k, by the fact from Chapter 5 used in that proof. The multiples of m′m' in [0,m)[0, m) are 0,m′,…,(d−1)m′0, m', \ldots, (d-1)m', and there are dd of them. For n=0n = 0 the claim says that all mm numbers are multiples of mm, which agrees with gcd⁡(m,0)=m\gcd(m, 0) = m.

Exercise 4.4-7. By Theorem P2.4.36, ⌊n/k⌋\lfloor n/k \rfloor is the number of multiples of kk among 1,…,n1, \ldots, n. So ∑1≤k≤n⌊n/k⌋=∑1≤k≤n∑1≤j≤n[k∣j]=∑1≤j≤n∑1≤k≤n[k∣j]=∑1≤j≤nτ(j)\sum_{1 \le k \le n} \lfloor n/k \rfloor = \sum_{1 \le k \le n} \sum_{1 \le j \le n} [k \mid j] = \sum_{1 \le j \le n} \sum_{1 \le k \le n} [k \mid j] = \sum_{1 \le j \le n} \tau(j), since each divisor of j≤nj \le n is at most nn. For n=10n = 10: 10+5+3+2+2+1+1+1+1+1=2710 + 5 + 3 + 2 + 2 + 1 + 1 + 1 + 1 + 1 = 27, and τ(1),…,τ(10)\tau(1), \ldots, \tau(10) are 1,2,2,3,2,4,2,4,3,41, 2, 2, 3, 2, 4, 2, 4, 3, 4, with the sum 2727.

Exercise 4.4-8. By part 5 of Theorem P2.4.30, ⌈(nk+x)/m⌉=−⌊((−n)k+(−x))/m⌋\lceil (nk + x)/m \rceil = -\lfloor ((-n)k + (-x))/m \rfloor. Apply Theorem P2.4.65 to −n-n and −x-x; the greatest common divisor of mm and −n-n is dd. The sum is

−(d⌊−xd⌋+(m−1)(−n−1)2+d−12)=d⌈xd⌉+(m−1)(n+1)2−d−12.-\Bigl(d \Bigl\lfloor \frac{-x}{d} \Bigr\rfloor + \frac{(m-1)(-n-1)}{2} + \frac{d-1}{2}\Bigr) = d \Bigl\lceil \frac{x}{d} \Bigr\rceil + \frac{(m-1)(n+1)}{2} - \frac{d-1}{2}.

Check m=4m = 4, n=6n = 6, x=1x = 1: the terms ⌈1/4⌉,⌈7/4⌉,⌈13/4⌉,⌈19/4⌉\lceil 1/4 \rceil, \lceil 7/4 \rceil, \lceil 13/4 \rceil, \lceil 19/4 \rceil are 1,2,4,51, 2, 4, 5, with the sum 1212, and the formula gives 2+212−12=122 + \frac{21}{2} - \frac{1}{2} = 12.

Exercise 4.4-9. Write ⌊x+2k/n⌋=⌊(2k+nx)/n⌋\lfloor x + 2k/n \rfloor = \lfloor (2k + nx)/n \rfloor. This is Theorem P2.4.65 with the modulus nn, the multiplier 22 and the real number nxnx. Since nn is odd, gcd⁡(n,2)=1\gcd(n, 2) = 1, and the sum is ⌊nx⌋+(n−1)(2−1)2+0=⌊nx⌋+n−12\lfloor nx \rfloor + \frac{(n-1)(2-1)}{2} + 0 = \lfloor nx \rfloor + \frac{n-1}{2}. Check n=3n = 3, x=0x = 0: 0+0+1=10 + 0 + 1 = 1.

Exercise 4.4-10. Let a=⌊n⌋a = \lfloor \sqrt{n} \rfloor and θ=n−a\theta = \sqrt{n} - a, so 0≤θ<10 \le \theta < 1 and n=(a+θ)2n = (a + \theta)^2. Theorem P2.4.63 gives S(n)=na−a33−a22−a6S(n) = na - \frac{a^3}{3} - \frac{a^2}{2} - \frac{a}{6}. Expand na=a3+2a2θ+aθ2na = a^3 + 2a^2\theta + a\theta^2, 23n3/2=23(a3+3a2θ+3aθ2+θ3)\frac{2}{3} n^{3/2} = \frac{2}{3}(a^3 + 3a^2\theta + 3a\theta^2 + \theta^3) and n2=12(a2+2aθ+θ2)\frac{n}{2} = \frac{1}{2}(a^2 + 2a\theta + \theta^2). Then

R(n)=S(n)−23n3/2+n2=a(θ−θ2−16)+θ22−2θ33.R(n) = S(n) - \frac{2}{3} n^{3/2} + \frac{n}{2} = a\Bigl(\theta - \theta^2 - \frac{1}{6}\Bigr) + \frac{\theta^2}{2} - \frac{2\theta^3}{3}.

The terms in a3a^3, a2θa^2\theta and a2a^2 cancel. For 0≤θ<10 \le \theta < 1, 0≤θ−θ2≤140 \le \theta - \theta^2 \le \frac{1}{4}, so the first bracket lies in [−16,112][-\frac{1}{6}, \frac{1}{12}] and the first term has absolute value at most a6\frac{a}{6}. The function g(θ)=θ22−2θ33g(\theta) = \frac{\theta^2}{2} - \frac{2\theta^3}{3} has g′(θ)=θ(1−2θ)g'(\theta) = \theta(1 - 2\theta), so on [0,1][0, 1] it rises from 00 to g(12)=124g(\frac{1}{2}) = \frac{1}{24} and falls to g(1)=−16g(1) = -\frac{1}{6}; so ∣g(θ)∣≤16|g(\theta)| \le \frac{1}{6}. Together, ∣R(n)∣≤a+16≤n+16|R(n)| \le \frac{a + 1}{6} \le \frac{\sqrt{n} + 1}{6}. Check n=100n = 100: S=615S = 615 and 23⋅1000−50=616.67\frac{2}{3} \cdot 1000 - 50 = 616.67, so R=−1.67R = -1.67, within the bound 116=1.83\frac{11}{6} = 1.83.

Solutions to Chapter 5: Divisibility, primes, gcd and congruences

Section 5.1: Divisibility and the greatest common divisor

Exercise 5.1-1. The pairs are (2310,1001)(2310, 1001), then (1001,308)(1001, 308) since 2310=2⋅1001+3082310 = 2 \cdot 1001 + 308, then (308,77)(308, 77) since 1001=3⋅308+771001 = 3 \cdot 308 + 77, then (77,0)(77, 0) since 308=4⋅77308 = 4 \cdot 77. The algorithm stops after three passes with gcd⁡(2310,1001)=77\gcd(2310, 1001) = 77. Check: 2310=2⋅3⋅5⋅7⋅112310 = 2 \cdot 3 \cdot 5 \cdot 7 \cdot 11 and 1001=7⋅11⋅131001 = 7 \cdot 11 \cdot 13, and the common part is 7⋅11=777 \cdot 11 = 77.

Exercise 5.1-2. Divide n2+1n^2 + 1 by n+1n + 1: n2+1=(n+1)(n−1)+2n^2 + 1 = (n + 1)(n - 1) + 2. By the step of Euclid, gcd⁡(n2+1,n+1)=gcd⁡(n+1,2)\gcd(n^2 + 1, n + 1) = \gcd(n + 1, 2). (The step uses the remainder, and 22 is the remainder when n+1>2n + 1 > 2; for n≤1n \le 1 the same identity holds by rule (iii) of the rules of divisibility.) So the gcd is 22 when nn is odd and 11 when nn is even. Check: n=3n = 3 gives gcd⁡(10,4)=2\gcd(10, 4) = 2, and n=4n = 4 gives gcd⁡(17,5)=1\gcd(17, 5) = 1.

Exercise 5.1-3. The rows (r,a,b)(r, a, b) are (391,1,0)(391, 1, 0) and (299,0,1)(299, 0, 1) at the start. Then q=1q = 1 gives (92,1,−1)(92, 1, -1); q=3q = 3 gives (23,−3,4)(23, -3, 4); q=4q = 4 gives (0,13,−17)(0, 13, -17). So gcd⁡(391,299)=23\gcd(391, 299) = 23 with a=−3a = -3 and b=4b = 4. Check: −3⋅391+4⋅299=−1173+1196=23-3 \cdot 391 + 4 \cdot 299 = -1173 + 1196 = 23. The last row gives 391=17⋅23391 = 17 \cdot 23 and 299=13⋅23299 = 13 \cdot 23.

Exercise 5.1-4. For k=0k = 0 both sides are 00. Let k>0k > 0 and g=gcd⁡(m,n)g = \gcd(m, n). The number kgkg divides kmkm and knkn. By Bézout, g=am+bng = am + bn, so kg=a(km)+b(kn)kg = a(km) + b(kn). Each common divisor of kmkm and knkn divides this combination, that is kgkg. So kgkg is a common divisor that each common divisor divides. When mm and nn are not both 00, it is positive, and by rule (iv) it is the largest common divisor. When m=n=0m = n = 0 both sides are 00.

A second proof uses Euclid's algorithm: the run on (km,kn)(km, kn) is the run on (m,n)(m, n) with every number multiplied by kk, since (km) mod (kn)=k(m mod n)(km) \bmod (kn) = k (m \bmod n) for k>0k > 0 (the distributive law of Section 4.3).

Exercise 5.1-5. Use the exponents of Section 5.2. Fix a prime pp and let xx, yy, zz be the exponents of pp in aa, bb, cc. The exponent of pp in gcd⁡(ab,bc,ca)\gcd(ab, bc, ca) is min⁡(x+y,y+z,z+x)\min(x + y, y + z, z + x). The least of the three pairwise sums leaves out the largest of xx, yy, zz, so it equals x+y+z−max⁡(x,y,z)x + y + z - \max(x, y, z). Hence the exponent of pp in abc/gcd⁡(ab,bc,ca)abc / \gcd(ab, bc, ca) is max⁡(x,y,z)\max(x, y, z), the exponent of pp in lcm⁡(a,b,c)\operatorname{lcm}(a, b, c). Since this holds for each pp, the two numbers are equal.

For the example take a=4a = 4, b=6b = 6, c=10c = 10. Then gcd⁡(a,b,c)=2\gcd(a, b, c) = 2 and lcm⁡(a,b,c)=60\operatorname{lcm}(a, b, c) = 60, with product 120120, but abc=240abc = 240. The formula gives 240/gcd⁡(24,60,40)=240/4=60240 / \gcd(24, 60, 40) = 240 / 4 = 60.

Exercise 5.1-6. An amount is 6i+15j=3(2i+5j)6i + 15j = 3(2i + 5j) with i,j≥0i, j \ge 0. So it is a multiple of 33, and the question is which kk have the form 2i+5j2i + 5j. The values k=0k = 0 and k=2k = 2 do. The values k=1k = 1 and k=3k = 3 do not: j=0j = 0 leaves an odd kk that is not 2i2i, and j≥1j \ge 1 gives k≥5k \ge 5. Each even kk is 2i2i. Each odd k≥5k \ge 5 is 5+2i5 + 2i. So kk can be each nonnegative integer except 11 and 33, and the machine takes exactly the multiples of 33 except 33 and 99. From 00 to 6060 these are 0,6,12,15,18,21,…,57,600, 6, 12, 15, 18, 21, \dots, 57, 60: all multiples of 33 in the range except 33 and 99.

Exercise 5.1-7. Number the rows of the run 0,1,…,t+10, 1, \dots, t + 1, with r0=mr_0 = m, r1=nr_1 = n, rt=gr_t = g and rt+1=0r_{t+1} = 0. Row j+1j + 1 is row j−1j - 1 minus qjq_j times row jj, where qj=⌊rj−1/rj⌋≥1q_j = \lfloor r_{j-1} / r_j \rfloor \ge 1. The output is (at,bt)(a_t, b_t).

First, the signs alternate and the sizes grow. The column aa starts a0=1a_0 = 1, a1=0a_1 = 0, a2=1a_2 = 1. By induction on jj, aja_j has the sign (−1)j(-1)^j for j≥2j \ge 2, and ∣aj+1∣=∣aj−1∣+qj∣aj∣|a_{j+1}| = |a_{j-1}| + q_j |a_j| for j≥1j \ge 1, since aj−1a_{j-1} and −qjaj-q_j a_j have the same sign (or one of them is 00). So ∣a1∣≤∣a2∣≤⋯≤∣at+1∣|a_1| \le |a_2| \le \cdots \le |a_{t+1}|. The column bb starts b0=0b_0 = 0, b1=1b_1 = 1, b2=−q1b_2 = -q_1, and in the same way ∣b1∣≤∣b2∣≤⋯≤∣bt+1∣|b_1| \le |b_2| \le \cdots \le |b_{t+1}|.

Second, the last row. The number Dj=ajbj+1−aj+1bjD_j = a_j b_{j+1} - a_{j+1} b_j is 11 for j=0j = 0, and each pass changes its sign, since aj+2=aj−qaj+1a_{j+2} = a_j - q a_{j+1} and bj+2=bj−qbj+1b_{j+2} = b_j - q b_{j+1}. So Dt=±1D_t = \pm 1, and gcd⁡(at+1,bt+1)=1\gcd(a_{t+1}, b_{t+1}) = 1. Now at+1m+bt+1n=rt+1=0a_{t+1} m + b_{t+1} n = r_{t+1} = 0. Divide by gg: at+1(m/g)=−bt+1(n/g)a_{t+1} (m/g) = -b_{t+1} (n/g), with m/g⊥n/gm/g \perp n/g. So n/g∣at+1n/g \mid a_{t+1} by the corollary on cancelling a coprime factor. Write at+1=c n/ga_{t+1} = c \, n/g. Then bt+1=−c m/gb_{t+1} = -c \, m/g. The integer cc divides both at+1a_{t+1} and bt+1b_{t+1}, which are coprime, so c=±1c = \pm 1. Hence ∣at+1∣=n/g|a_{t+1}| = n/g and ∣bt+1∣=m/g|b_{t+1}| = m/g.

Together, ∣at∣≤∣at+1∣=n/g|a_t| \le |a_{t+1}| = n/g and ∣bt∣≤∣bt+1∣=m/g|b_t| \le |b_{t+1}| = m/g. The run on (1517,943)(1517, 943) in Section 5.1 shows the last row (−23,37)(-23, 37) and the output (5,−8)(5, -8). A check by machine of all pairs m>n>0m > n > 0 with m<700m < 700 found no exception.

Section 5.2: Primes and factorization

Exercise 5.2-1. 9991=10000−9=1002−32=97⋅1039991 = 10000 - 9 = 100^2 - 3^2 = 97 \cdot 103, and both factors are prime (no prime up to 103<11\sqrt{103} < 11 divides either). For 1000110001, trial division by the primes 2,3,5,7,11,…2, 3, 5, 7, 11, \dots finds the first divisor at 7373: 10001=73⋅13710001 = 73 \cdot 137. Both factors are prime, since no prime up to 1111 divides 137137.

Exercise 5.2-2. N=30030+1=30031N = 30030 + 1 = 30031. For each prime p≤13p \le 13, pp divides 3003030030, so N≡1(modp)N \equiv 1 \pmod{p} and p∤Np \nmid N. Trial division gives 30031=59⋅50930031 = 59 \cdot 509, and 509509 is prime (it has no prime divisor up to 2222). Both factors exceed 1313, as they must. So NN is not prime, and the proof of the infinity of primes does not claim that it is.

Exercise 5.2-3. Complete the square: n4+64=(n2+8)2−16n2=(n2−4n+8)(n2+4n+8).n^4 + 64 = (n^2 + 8)^2 - 16n^2 = (n^2 - 4n + 8)(n^2 + 4n + 8). The first factor is (n−2)2+4≥4(n - 2)^2 + 4 \ge 4, and the second is larger than the first for n≥1n \ge 1. So both factors exceed 11, and n4+64n^4 + 64 is composite. For example n=1n = 1 gives 65=5⋅1365 = 5 \cdot 13, and n=3n = 3 gives 145=5⋅29145 = 5 \cdot 29.

Exercise 5.2-4. By Legendre's formula: ν2(50!)=25+12+6+3+1=47,ν3(50!)=16+5+1=22,\nu_2(50!) = 25 + 12 + 6 + 3 + 1 = 47, \qquad \nu_3(50!) = 16 + 5 + 1 = 22, ν5(50!)=10+2=12,ν7(50!)=7+1=8.\nu_5(50!) = 10 + 2 = 12, \qquad \nu_7(50!) = 7 + 1 = 8. The number of zeros at the end is min⁡(47,12)=12\min(47, 12) = 12. Check of ν2\nu_2 by digits: 50=110010250 = 110010_2 has three 11 digits, and 50−3=4750 - 3 = 47.

Exercise 5.2-5. Since 12=22⋅312 = 2^2 \cdot 3, the power 12z12^z divides 2024!2024! exactly when 2z≤ν2(2024!)2z \le \nu_2(2024!) and z≤ν3(2024!)z \le \nu_3(2024!). Here 2024=1111110100022024 = 11111101000_2 has seven 11 digits, so ν2=2024−7=2017\nu_2 = 2024 - 7 = 2017. And ν3=674+224+74+24+8+2=1006.\nu_3 = 674 + 224 + 74 + 24 + 8 + 2 = 1006. So the number of zeros is min⁡(⌊2017/2⌋,1006)=min⁡(1008,1006)=1006\min(\lfloor 2017/2 \rfloor, 1006) = \min(1008, 1006) = 1006. A direct computation of 2024!2024! confirms it.

Exercise 5.2-6. The digit form of Legendre's formula with p=2p = 2 gives ν2(n!)=(n−s2(n))/1\nu_2(n!) = (n - s_2(n))/1. The value is n−1n - 1 exactly when s2(n)=1s_2(n) = 1, that is when nn has a single 11 digit in binary. So the answer is the powers of 22: n=1,2,4,8,…n = 1, 2, 4, 8, \dots.

Exercise 5.2-7. By Legendre's formula, νp(2nn)=νp((2n)!)−2νp(n!)=∑k≥1(⌊2npk⌋−2⌊npk⌋).\nu_p\binom{2n}{n} = \nu_p((2n)!) - 2\nu_p(n!) = \sum_{k \ge 1} \left( \left\lfloor \frac{2n}{p^k} \right\rfloor - 2 \left\lfloor \frac{n}{p^k} \right\rfloor \right). For each real xx, ⌊2x⌋−2⌊x⌋\lfloor 2x \rfloor - 2\lfloor x \rfloor is 00 or 11: write x=⌊x⌋+fx = \lfloor x \rfloor + f with 0≤f<10 \le f < 1, and the value is ⌊2f⌋\lfloor 2f \rfloor. So each term of the sum is 00 or 11. A term with pk>2np^k > 2n is 0−0=00 - 0 = 0. So ee is at most the number of k≥1k \ge 1 with pk≤2np^k \le 2n, and then pe≤2np^e \le 2n. Check: (2010)=184756=22⋅11⋅13⋅17⋅19\binom{20}{10} = 184756 = 2^2 \cdot 11 \cdot 13 \cdot 17 \cdot 19, and each prime power is at most 2020.

Exercise 5.2-8. Pair each positive divisor dd of nn with n/dn/d. The pairing is a map of the set of divisors to itself, and applying it twice gives dd back. A divisor is paired with itself exactly when d=n/dd = n/d, that is d2=nd^2 = n. So the divisors that are not paired with themselves come in pairs of two, and the number of divisors is odd if and only if there is a dd with d2=nd^2 = n. A second proof: the number of divisors is ∏p(ep+1)\prod_p (e_p + 1), which is odd exactly when each epe_p is even.

Section 5.3: Congruences

Exercise 5.3-1. 1000+1=1001=7⋅1431000 + 1 = 1001 = 7 \cdot 143, so 1000≡−1(mod7)1000 \equiv -1 \pmod{7} holds. 210−1=1023=11⋅932^{10} - 1 = 1023 = 11 \cdot 93, so 210≡1(mod11)2^{10} \equiv 1 \pmod{11} holds as well. (The second one is also Fermat's theorem of Section 5.4 with p=11p = 11.)

Exercise 5.3-2. Since p>3p > 3 is prime, pp is odd and 3∤p3 \nmid p. Write p2−1=(p−1)(p+1)p^2 - 1 = (p - 1)(p + 1). The factors are consecutive even numbers, so one of them is a multiple of 44 and the other a multiple of 22; hence 8∣p2−18 \mid p^2 - 1. Of the three consecutive numbers p−1p - 1, pp, p+1p + 1, one is a multiple of 33, and it is not pp; hence 3∣p2−13 \mid p^2 - 1. Since 8⊥38 \perp 3, Law D gives 24∣p2−124 \mid p^2 - 1.

Exercise 5.3-3. The rows (r,a,b)(r, a, b) for m=60m = 60, n=17n = 17 are (60,1,0)(60, 1, 0), (17,0,1)(17, 0, 1), then (9,1,−3)(9, 1, -3) with q=3q = 3, (8,−1,4)(8, -1, 4) with q=1q = 1, (1,2,−7)(1, 2, -7) with q=1q = 1. So 2⋅60−7⋅17=12 \cdot 60 - 7 \cdot 17 = 1, and 17⋅(−7)≡1(mod60)17 \cdot (-7) \equiv 1 \pmod{60}. The inverse is −7≡53-7 \equiv 53. Check: 17⋅53=901=15⋅60+117 \cdot 53 = 901 = 15 \cdot 60 + 1.

Exercise 5.3-4. Here gcd⁡(91,154)=7\gcd(91, 154) = 7, and 7∣357 \mid 35, so there are 77 solutions modulo 154154. Divide by 77 (Law C): 13x≡5(mod22)13x \equiv 5 \pmod{22}. The inverse of 1313 modulo 2222 is 1717, since 13⋅17=221=10⋅22+113 \cdot 17 = 221 = 10 \cdot 22 + 1. So x≡85≡19(mod22)x \equiv 85 \equiv 19 \pmod{22}. The solutions modulo 154154 are x≡19,41,63,85,107,129,151(mod154).x \equiv 19, 41, 63, 85, 107, 129, 151 \pmod{154}. Check one: 91⋅19=1729=11⋅154+3591 \cdot 19 = 1729 = 11 \cdot 154 + 35.

Exercise 5.3-5. Solve one congruence at a time. From x≡3(mod25)x \equiv 3 \pmod{25}, x=3+25tx = 3 + 25t. Modulo 99: 3+25t≡3+7t≡23 + 25t \equiv 3 + 7t \equiv 2, so 7t≡8(mod9)7t \equiv 8 \pmod 9. The inverse of 77 modulo 99 is 44, since 28≡128 \equiv 1. So t≡32≡5t \equiv 32 \equiv 5, and x≡3+125=128(mod225)x \equiv 3 + 125 = 128 \pmod{225}. Write x=128+225ux = 128 + 225u. Modulo 44: 128+225u≡u≡1128 + 225u \equiv u \equiv 1. So u=1u = 1 gives the least positive solution x=353x = 353. Check: 353=88⋅4+1=39⋅9+2=14⋅25+3353 = 88 \cdot 4 + 1 = 39 \cdot 9 + 2 = 14 \cdot 25 + 3.

Exercise 5.3-6. Write n=b0+b1⋅1000+b2⋅10002+⋯n = b_0 + b_1 \cdot 1000 + b_2 \cdot 1000^2 + \cdots with blocks 0≤bi<10000 \le b_i < 1000. Since 1000≡−1(mod1001)1000 \equiv -1 \pmod{1001}, Law A gives 1000i≡(−1)i1000^i \equiv (-1)^i, and so n≡b0−b1+b2−⋯(mod1001)n \equiv b_0 - b_1 + b_2 - \cdots \pmod{1001}. The same congruence holds modulo each divisor 77, 1111, 1313 of 10011001. For n=123456789n = 123456789 the blocks are 789789, 456456, 123123, and 789−456+123=456789 - 456 + 123 = 456. Then 456=65⋅7+1=41⋅11+5=35⋅13+1456 = 65 \cdot 7 + 1 = 41 \cdot 11 + 5 = 35 \cdot 13 + 1. So 123456789123456789 is 11 modulo 77, 55 modulo 1111 and 11 modulo 1313. A direct division confirms all three.

Exercise 5.3-7. If x2≡1(modp)x^2 \equiv 1 \pmod p, then p∣(x−1)(x+1)p \mid (x - 1)(x + 1), and Euclid's lemma gives p∣x−1p \mid x - 1 or p∣x+1p \mid x + 1. So x≡±1x \equiv \pm 1. (For p=2p = 2 the two values coincide.)

For 105=3⋅5⋅7105 = 3 \cdot 5 \cdot 7, Law D says that x2≡1(mod105)x^2 \equiv 1 \pmod{105} holds exactly when it holds modulo 33, 55 and 77, that is when x≡±1x \equiv \pm 1 modulo each of them. That gives 23=82^3 = 8 choices of signs, and by the Chinese remainder theorem each choice gives one class modulo 105105. The eight solutions are x≡1,29,34,41,64,71,76,104(mod105).x \equiv 1, 29, 34, 41, 64, 71, 76, 104 \pmod{105}. For example 29≡−1(mod3)29 \equiv -1 \pmod 3, 29≡−1(mod5)29 \equiv -1 \pmod 5 and 29≡1(mod7)29 \equiv 1 \pmod 7, and 292=841=8⋅105+129^2 = 841 = 8 \cdot 105 + 1. The solutions come in pairs xx and 105−x105 - x.

Exercise 5.3-8. The two congruences say r∣a−br \mid a - b and s∣a−bs \mid a - b, that is a−ba - b is a common multiple of rr and ss. By the theorem of Section 5.1 on the gcd times the lcm, the common multiples of rr and ss are exactly the multiples of lcm⁡(r,s)\operatorname{lcm}(r, s). So the two congruences hold together if and only if lcm⁡(r,s)∣a−b\operatorname{lcm}(r, s) \mid a - b. When r⊥sr \perp s, lcm⁡(r,s)=rs/gcd⁡(r,s)=rs\operatorname{lcm}(r, s) = rs/\gcd(r, s) = rs, which is Law D.

Section 5.4: The theorems of Fermat, Euler and Wilson

Exercise 5.4-1. 1000=23⋅531000 = 2^3 \cdot 5^3, so φ(1000)=22⋅1⋅52⋅4=400\varphi(1000) = 2^2 \cdot 1 \cdot 5^2 \cdot 4 = 400. 1001=7⋅11⋅131001 = 7 \cdot 11 \cdot 13, so φ(1001)=6⋅10⋅12=720\varphi(1001) = 6 \cdot 10 \cdot 12 = 720. 1024=2101024 = 2^{10}, so φ(1024)=29=512\varphi(1024) = 2^9 = 512.

Exercise 5.4-2. By Fermat, 36≡1(mod7)3^6 \equiv 1 \pmod{7}. Since 1000=166⋅6+41000 = 166 \cdot 6 + 4, 31000≡34=81≡4(mod7)3^{1000} \equiv 3^4 = 81 \equiv 4 \pmod{7}. Modulo 1313, a shorter cycle exists: 33=27≡13^3 = 27 \equiv 1. Since 1000=333⋅3+11000 = 333 \cdot 3 + 1, 31000≡3(mod13)3^{1000} \equiv 3 \pmod{13}.

Exercise 5.4-3. Euler's theorem with φ(100)=40\varphi(100) = 40 would do. A shorter cycle exists: 72=497^2 = 49 and 74=2401≡1(mod100)7^4 = 2401 \equiv 1 \pmod{100}. Since 2026=506⋅4+22026 = 506 \cdot 4 + 2, 72026≡72=49(mod100)7^{2026} \equiv 7^2 = 49 \pmod{100}. The last two digits are 4949.

Exercise 5.4-4. Let a⊥1105a \perp 1105. Then aa is coprime to each of 55, 1313 and 1717. Fermat gives a4≡1(mod5)a^4 \equiv 1 \pmod 5, a12≡1(mod13)a^{12} \equiv 1 \pmod{13} and a16≡1(mod17)a^{16} \equiv 1 \pmod{17}. The exponent 11041104 is a multiple of 44, 1212 and 1616: 1104=4⋅276=12⋅92=16⋅691104 = 4 \cdot 276 = 12 \cdot 92 = 16 \cdot 69. So a1104≡1a^{1104} \equiv 1 modulo each of the three primes. The primes are pairwise coprime, so Law D, applied twice, gives a1104≡1(mod1105)a^{1104} \equiv 1 \pmod{1105}. A composite number with this property is called a Carmichael number. A machine check of all a<1105a < 1105 with a⊥1105a \perp 1105 confirms the result.

Exercise 5.4-5. Let φ(n)=12\varphi(n) = 12 and p∣np \mid n. Then p−1p - 1 divides φ(n)\varphi(n) by the product formula, so p−1∈{1,2,3,4,6,12}p - 1 \in \{1, 2, 3, 4, 6, 12\} and p∈{2,3,5,7,13}p \in \{2, 3, 5, 7, 13\}. Also p2∣np^2 \mid n forces p∣12p \mid 12, so only 22 and 33 can appear squared.

If 5∣n5 \mid n, write n=5mn = 5m with 5⊥m5 \perp m (since 52∤n5^2 \nmid n); then φ(m)=3\varphi(m) = 3. No mm has φ(m)=3\varphi(m) = 3: the value is 11 for m≤2m \le 2 and even for m≥3m \ge 3. So 5∤n5 \nmid n.

If 13∣n13 \mid n, then n=13mn = 13m with φ(m)=1\varphi(m) = 1, so m∈{1,2}m \in \{1, 2\} and n∈{13,26}n \in \{13, 26\}. If 7∣n7 \mid n and 13∤n13 \nmid n, then n=7mn = 7m with φ(m)=2\varphi(m) = 2 and mm built from 22 and 33: m∈{3,4,6}m \in \{3, 4, 6\}, and n∈{21,28,42}n \in \{21, 28, 42\}. Otherwise n=2a3bn = 2^a 3^b. With a,b≥1a, b \ge 1, φ(n)=2a−1⋅2⋅3b−1=2a3b−1=12\varphi(n) = 2^{a-1} \cdot 2 \cdot 3^{b-1} = 2^a 3^{b-1} = 12 gives a=2a = 2, b=2b = 2, n=36n = 36. With b=0b = 0, φ(n)=2a−1\varphi(n) = 2^{a-1} is a power of 22; with a=0a = 0, φ(n)=2⋅3b−1\varphi(n) = 2 \cdot 3^{b-1} is not 1212. So the answer is n∈{13,21,26,28,36,42}n \in \{13, 21, 26, 28, 36, 42\}. The cases cover each nn, since the primes and their exponents are limited as above. A search by machine up to n=200n = 200 finds the same six values.

Exercise 5.4-6. Wilson gives (p−1)!≡−1(p - 1)! \equiv -1. Also (p−1)!=(p−1)(p−2)!≡−(p−2)!(p - 1)! = (p - 1)(p - 2)! \equiv -(p - 2)!. So (p−2)!≡1(modp)(p - 2)! \equiv 1 \pmod p. For p=53p = 53: 51!≡151! \equiv 1, and 51!=51⋅50!≡−2⋅50!51! = 51 \cdot 50! \equiv -2 \cdot 50!. So −2⋅50!≡1-2 \cdot 50! \equiv 1. The inverse of 22 modulo 5353 is 2727, so 50!≡−27≡26(mod53)50! \equiv -27 \equiv 26 \pmod{53}. A direct computation of 50! mod 5350! \bmod 53 gives 2626.

Exercise 5.4-7. 2730=2⋅3⋅5⋅7⋅132730 = 2 \cdot 3 \cdot 5 \cdot 7 \cdot 13, a product of distinct primes. For each of these primes pp, p−1∈{1,2,4,6,12}p - 1 \in \{1, 2, 4, 6, 12\} divides 1212. If p∤ap \nmid a, Fermat gives ap−1≡1a^{p-1} \equiv 1, so a12=(ap−1)12/(p−1)≡1a^{12} = (a^{p-1})^{12/(p-1)} \equiv 1 and a13≡a(modp)a^{13} \equiv a \pmod p. If p∣ap \mid a, both sides are ≡0\equiv 0. So p∣a13−ap \mid a^{13} - a for each of the five primes. They are pairwise coprime, and Law D gives 2730∣a13−a2730 \mid a^{13} - a. A check of all aa from 00 to 27292729 confirms it.

Exercise 5.4-8. For n=2n = 2 the sum is 1=2⋅1/21 = 2 \cdot 1/2. Let n≥3n \ge 3. The map k↦n−kk \mapsto n - k sends the numbers k∈{1,…,n−1}k \in \{1, \dots, n - 1\} with k⊥nk \perp n to themselves, since gcd⁡(n−k,n)=gcd⁡(k,n)\gcd(n - k, n) = \gcd(k, n). No such kk is fixed: k=n−kk = n - k would mean n=2kn = 2k and gcd⁡(k,n)=k>1\gcd(k, n) = k > 1. So the φ(n)\varphi(n) numbers fall into φ(n)/2\varphi(n)/2 pairs {k,n−k}\{k, n - k\}, each with sum nn. The total is nφ(n)/2n\varphi(n)/2. Check: for n=12n = 12 the numbers are 1,5,7,111, 5, 7, 11 with sum 24=12⋅4/224 = 12 \cdot 4/2.

Solutions to Chapter 6: Binomial coefficients

Section 6.1: Permutations and factorials

Exercise 6.1-1. An award without repeats is a 33-arrangement of the 1010 people, so there are 103‾=10⋅9⋅8=72010^{\underline{3}} = 10 \cdot 9 \cdot 8 = 720 awards. If one person may get several prizes, each prize goes to any of the 1010 people independently, and there are 103=100010^3 = 1000 awards. The difference, 280280, counts the awards in which some person gets at least two prizes.

Exercise 6.1-2. A word of four different letters is a 44-arrangement of the 2626 letters. There are 264‾=26⋅25⋅24⋅23=35880026^{\underline{4}} = 26 \cdot 25 \cdot 24 \cdot 23 = 358800 such words.

Exercise 6.1-3. By the recurrence, (n+1)!−n!=(n+1) n!−n!=n⋅n!(n + 1)! - n! = (n + 1)\,n! - n! = n \cdot n!. So k⋅k!=(k+1)!−k!k \cdot k! = (k + 1)! - k! for each k≥0k \ge 0, and the sum telescopes: ∑k=0n−1k⋅k!=∑k=0n−1((k+1)!−k!)=n!−0!=n!−1.\sum_{k=0}^{n-1} k \cdot k! = \sum_{k=0}^{n-1} \big( (k + 1)! - k! \big) = n! - 0! = n! - 1. Check for n=4n = 4: 0+1+4+18=23=24−10 + 1 + 4 + 18 = 23 = 24 - 1. For n=10n = 10 the sum is 36287993628799.

Exercise 6.1-4. The values n!=1,2,6,24n! = 1, 2, 6, 24 and 2n=2,4,8,162^n = 2, 4, 8, 16 for n=1,2,3,4n = 1, 2, 3, 4 show that n!>2nn! > 2^n first holds at n=4n = 4. If n!>2nn! > 2^n for some n≥4n \ge 4, then (n+1)!=(n+1) n!>2⋅2n=2n+1(n + 1)! = (n + 1)\,n! > 2 \cdot 2^n = 2^{n+1}, since n+1>2n + 1 > 2. So the inequality holds for all n≥4n \ge 4. For base 33: 6!=720<729=366! = 720 < 729 = 3^6, but 7!=5040>2187=377! = 5040 > 2187 = 3^7, and the smaller cases fail too (n!≤3nn! \le 3^n for 1≤n≤61 \le n \le 6). The same step works with the factor n+1≥8>3n + 1 \ge 8 > 3. So n!>3nn! > 3^n holds exactly for n≥7n \ge 7.

Exercise 6.1-5. Split the factors of (2n)!(2n)! into even and odd ones: (2n)!=(2⋅4⋯2n)⋅(1⋅3⋯(2n−1))=2n n!⋅(1⋅3⋯(2n−1)).(2n)! = (2 \cdot 4 \cdots 2n) \cdot (1 \cdot 3 \cdots (2n - 1)) = 2^n\,n! \cdot (1 \cdot 3 \cdots (2n - 1)). The even factors are 2⋅1,2⋅2,…,2⋅n2 \cdot 1, 2 \cdot 2, \dots, 2 \cdot n, with product 2nn!2^n n!. Divide by n!n!: (2n)!/n!=2n⋅1⋅3⋯(2n−1)(2n)!/n! = 2^n \cdot 1 \cdot 3 \cdots (2n - 1), a multiple of 2n2^n, and the quotient by 2n2^n is the product of the first nn odd numbers. For n=3n = 3: 720/6=120=8⋅15720/6 = 120 = 8 \cdot 15.

Exercise 6.1-6. Let AA be the set of permutations in which 11 comes before 22, and BB the set in which 22 comes before 11. Each permutation is in exactly one of AA and BB. The map that swaps the entries 11 and 22 sends AA to BB and BB to AA, and it is its own inverse. So ∣A∣=∣B∣|A| = |B|, and ∣A∣=n!/2|A| = n!/2. For n=5n = 5 this gives 6060, which a direct enumeration confirms.

Exercise 6.1-7. The theorem gives nn/2≤n!n^{n/2} \le n!. Take lg⁡\lg of both sides; the logarithm is increasing, so n2lg⁡n≤lg⁡n!\tfrac{n}{2}\lg n \le \lg n!. For the second part, the upper bound n!≤((n+1)/2)nn! \le ((n + 1)/2)^n shows that n!≤10100n! \le 10^{100} while nlog⁡10((n+1)/2)≤100n \log_{10}((n + 1)/2) \le 100, which holds for all n≤65n \le 65. The lower bound n!≥nn/2n! \ge n^{n/2} shows that n!>10100n! > 10^{100} when n2log⁡10n>100\tfrac{n}{2}\log_{10} n > 100, which holds for n≥101n \ge 101. So the answer lies between 6666 and 101101. A direct computation in that range gives 69!≈1.71⋅109869! \approx 1.71 \cdot 10^{98} and 70!≈1.20⋅1010070! \approx 1.20 \cdot 10^{100}. The least nn is 7070.

Section 6.2: Combinations and the definition of the binomial coefficient

Exercise 6.2-1. (103)=10⋅9⋅8/6=120\binom{10}{3} = 10 \cdot 9 \cdot 8/6 = 120 and (107)=10⋅9⋯4/5040=604800/5040=120\binom{10}{7} = 10 \cdot 9 \cdots 4/5040 = 604800/5040 = 120, as symmetry predicts. (−32)=(−3)(−4)/2=6\binom{-3}{2} = (-3)(-4)/2 = 6. (5/23)=52⋅32⋅12/6=158/6=516\binom{5/2}{3} = \tfrac52 \cdot \tfrac32 \cdot \tfrac12/6 = \tfrac{15}{8}/6 = \tfrac{5}{16}.

Exercise 6.2-2. Choose the suit in 44 ways, then 55 of its 1313 cards in (135)=1287\binom{13}{5} = 1287 ways. That gives 4⋅1287=51484 \cdot 1287 = 5148 hands. (This count includes the hands whose five cards are also consecutive in rank.)

Exercise 6.2-3. By the factorial form, (nk+1)(nk)=n!(k+1)! (n−k−1)!⋅k! (n−k)!n!=n−kk+1.\frac{\binom{n}{k+1}}{\binom{n}{k}} = \frac{n!}{(k + 1)!\,(n - k - 1)!} \cdot \frac{k!\,(n - k)!}{n!} = \frac{n - k}{k + 1}. The ratio is greater than 11 when n−k>k+1n - k > k + 1, that is k<(n−1)/2k < (n - 1)/2; it equals 11 when k=(n−1)/2k = (n - 1)/2; and it is less than 11 when k>(n−1)/2k > (n - 1)/2. So the row increases strictly up to k=⌊n/2⌋k = \lfloor n/2 \rfloor and then decreases strictly, with one tie between k=(n−1)/2k = (n - 1)/2 and k+1=(n+1)/2k + 1 = (n + 1)/2 when nn is odd. The largest entry is (n⌊n/2⌋)\binom{n}{\lfloor n/2 \rfloor}, which equals (n⌈n/2⌉)\binom{n}{\lceil n/2 \rceil}. Row 1010 has its largest entry (105)=252\binom{10}{5} = 252; row 99 has the two largest entries (94)=(95)=126\binom{9}{4} = \binom{9}{5} = 126.

Exercise 6.2-4. A path through (3,2)(3, 2) is a path from (0,0)(0, 0) to (3,2)(3, 2) followed by a path from (3,2)(3, 2) to (6,4)(6, 4). The first part has 55 steps, 22 of them up, so there are (52)=10\binom{5}{2} = 10 choices. The second part goes 33 right and 22 up, again (52)=10\binom{5}{2} = 10 choices. The product is 100100, which is less than half of all 210210 paths.

Exercise 6.2-5. (r4)=r(r−1)(r−2)(r−3)/24\binom{r}{4} = r(r - 1)(r - 2)(r - 3)/24. Multiply out: r(r−1)=r2−rr(r - 1) = r^2 - r and (r−2)(r−3)=r2−5r+6(r - 2)(r - 3) = r^2 - 5r + 6, so the product is r4−6r3+11r2−6rr^4 - 6r^3 + 11r^2 - 6r, and (r4)=r4−6r3+11r2−6r24.\binom{r}{4} = \frac{r^4 - 6r^3 + 11r^2 - 6r}{24}. At r=4r = 4: (256−384+176−24)/24=1(256 - 384 + 176 - 24)/24 = 1. At r=5r = 5: (625−750+275−30)/24=5(625 - 750 + 275 - 30)/24 = 5. At r=−1r = -1: (1+6+11+6)/24=1(1 + 6 + 11 + 6)/24 = 1, which agrees with (−14)=(−1)4=1\binom{-1}{4} = (-1)^4 = 1.

Exercise 6.2-6. For k≥0k \ge 0, (rk)=r(r−1)⋯(r−k+1)/k!\binom{r}{k} = r(r - 1) \cdots (r - k + 1)/k!, and k!≠0k! \ne 0. A product of real numbers is 00 if and only if one factor is 00. The factor r−jr - j is 00 if and only if r=jr = j, for 0≤j≤k−10 \le j \le k - 1. So (rk)=0\binom{r}{k} = 0 if and only if r∈{0,1,…,k−1}r \in \{0, 1, \dots, k - 1\}. For k=0k = 0 the set is empty, and indeed (r0)=1\binom{r}{0} = 1 for all rr.

Exercise 6.2-7. Write a kk-subset as a1<a2<⋯<aka_1 < a_2 < \dots < a_k. It has no two consecutive numbers if and only if ai+1≥ai+2a_{i+1} \ge a_i + 2 for each ii. Put bi=ai−(i−1)b_i = a_i - (i - 1). Then bi+1−bi=ai+1−ai−1b_{i+1} - b_i = a_{i+1} - a_i - 1, so the condition becomes b1<b2<⋯<bkb_1 < b_2 < \dots < b_k. Also b1=a1≥1b_1 = a_1 \ge 1 and bk=ak−k+1≤n−k+1b_k = a_k - k + 1 \le n - k + 1. So the map sends the subsets with no consecutive numbers to the kk-subsets of {1,…,n−k+1}\{1, \dots, n - k + 1\}. The inverse is ai=bi+(i−1)a_i = b_i + (i - 1), and it maps each kk-subset of {1,…,n−k+1}\{1, \dots, n - k + 1\} to a subset of {1,…,n}\{1, \dots, n\} with gaps at least 22. So the map is a bijection, and the count is (n−k+1k)\binom{n - k + 1}{k}. For n=12n = 12 and k=4k = 4 it is (94)=126\binom{9}{4} = 126; a direct enumeration of the 495495 subsets of size 44 confirms this.

Section 6.3: The basic identities

Exercise 6.3-1. By absorption, k(8k)=8(7k−1)k\binom{8}{k} = 8\binom{7}{k-1} for all kk. So ∑kk(8k)=8∑k(7k−1)=8⋅27=1024\sum_k k\binom{8}{k} = 8\sum_k \binom{7}{k - 1} = 8 \cdot 2^7 = 1024. The direct sum is 0+8+56+168+280+280+168+56+8=10240 + 8 + 56 + 168 + 280 + 280 + 168 + 56 + 8 = 1024. In general ∑kk(nk)=n 2n−1\sum_k k\binom{n}{k} = n\,2^{n-1} for n≥1n \ge 1; this is Nat.sum_range_mul_choose in Mathlib.

Exercise 6.3-2. Upper summation with m=3m = 3 and n=10n = 10 gives (114)=330\binom{11}{4} = 330. Check: 1+4+10+20+35+56+84+120=3301 + 4 + 10 + 20 + 35 + 56 + 84 + 120 = 330.

Exercise 6.3-3. Put x→2xx \to 2x and y=−3y = -3 in the binomial theorem with n=4n = 4: (2x−3)4=∑k=04(4k)(2x)k(−3)4−k=16x4−96x3+216x2−216x+81.(2x - 3)^4 = \sum_{k=0}^{4} \binom{4}{k}(2x)^k(-3)^{4-k} = 16x^4 - 96x^3 + 216x^2 - 216x + 81. The coefficients are 1⋅161 \cdot 16, 4⋅8⋅(−3)4 \cdot 8 \cdot (-3), 6⋅4⋅96 \cdot 4 \cdot 9, 4⋅2⋅(−27)4 \cdot 2 \cdot (-27) and 1⋅811 \cdot 81. Check at x=1x = 1: (−1)4=1=16−96+216−216+81(-1)^4 = 1 = 16 - 96 + 216 - 216 + 81.

Exercise 6.3-4. The values at k=1,2,3k = 1, 2, 3 give c=1c = 1, then 8=b+2c8 = b + 2c, so b=6b = 6, then 27=a+3b+3c27 = a + 3b + 3c, so a=6a = 6. Both sides are polynomials of degree 33 in kk that agree at k=0,1,2,3k = 0, 1, 2, 3, so they are equal: k3=6(k3)+6(k2)+(k1).k^3 = 6\binom{k}{3} + 6\binom{k}{2} + \binom{k}{1}. Sum over 0≤k≤n0 \le k \le n with upper summation: ∑k=0nk3=6(n+14)+6(n+13)+(n+12).\sum_{k=0}^{n} k^3 = 6\binom{n + 1}{4} + 6\binom{n + 1}{3} + \binom{n + 1}{2}. For n=3n = 3 this is 6+24+6=36=1+8+276 + 24 + 6 = 36 = 1 + 8 + 27. The right side simplifies to (n(n+1)/2)2(n(n + 1)/2)^2.

Exercise 6.3-5. By absorption, k(nk)=n(n−1k−1)k\binom{n}{k} = n\binom{n-1}{k-1}. So ∑k(−1)kk(nk)=n∑k(−1)k(n−1k−1)=−n∑j(−1)j(n−1j)=−n [n−1=0],\sum_k (-1)^k k\binom{n}{k} = n\sum_k (-1)^k\binom{n - 1}{k - 1} = -n\sum_j (-1)^j\binom{n - 1}{j} = -n\,[n - 1 = 0], by the row sums with j=k−1j = k - 1. For n≥2n \ge 2 the value is 00. For n=1n = 1 it is −1-1: the sum is 0⋅1−1⋅1=−10 \cdot 1 - 1 \cdot 1 = -1.

Exercise 6.3-6. By eq. 1.2.6(18) with r=7r = 7 and n=5n = 5, the sum is (−1)5(65)=−6(-1)^5\binom{6}{5} = -6. Directly: 1−7+21−35+35−21=−61 - 7 + 21 - 35 + 35 - 21 = -6.

Exercise 6.3-7. By trinomial revision, (nm)(mk)=(nk)(n−km−k)\binom{n}{m}\binom{m}{k} = \binom{n}{k}\binom{n - k}{m - k}. Sum over mm; the factor (nk)\binom{n}{k} does not depend on mm, and ∑m(n−km−k)=2n−k\sum_m \binom{n-k}{m-k} = 2^{n-k} by the row sums. So the sum is (nk)2n−k\binom{n}{k}2^{n-k}. By counting: the left side counts pairs (committee, subcommittee of size kk). Choose the subcommittee first, in (nk)\binom{n}{k} ways. Each of the other n−kn - k people is either in the committee or not, independently: 2n−k2^{n-k} ways. For n=4n = 4 and k=2k = 2: (42)⋅1+(43)⋅3+(44)⋅6=6+12+6=24=6⋅4\binom{4}{2} \cdot 1 + \binom{4}{3} \cdot 3 + \binom{4}{4} \cdot 6 = 6 + 12 + 6 = 24 = 6 \cdot 4.

Exercise 6.3-8. From the definition, (−34)=(−3)(−4)(−5)(−6)/24=360/24=15\binom{-3}{4} = (-3)(-4)(-5)(-6)/24 = 360/24 = 15. With the negation theorem, (−34)=(−1)4(4+3−14)=(64)=15\binom{-3}{4} = (-1)^4\binom{4 + 3 - 1}{4} = \binom{6}{4} = 15.

Section 6.4: Binomial coefficients with real arguments

Exercise 6.4-1. From the definition, (1/23)=12⋅(−12)⋅(−32)/6=38/6=116\binom{1/2}{3} = \tfrac12 \cdot (-\tfrac12) \cdot (-\tfrac32)/6 = \tfrac38/6 = \tfrac{1}{16} and (−1/23)=(−12)(−32)(−52)/6=−158/6=−516\binom{-1/2}{3} = (-\tfrac12)(-\tfrac32)(-\tfrac52)/6 = -\tfrac{15}{8}/6 = -\tfrac{5}{16}. The theorem gives (1/23)=(−1)2(63)/(43⋅5)=20/320=1/16\binom{1/2}{3} = (-1)^2\binom{6}{3}/(4^3 \cdot 5) = 20/320 = 1/16 and (−1/23)=(−1/4)3(63)=−20/64=−5/16\binom{-1/2}{3} = (-1/4)^3\binom{6}{3} = -20/64 = -5/16.

Exercise 6.4-2. By the theorem on a negative integer upper index, (−2k)=(−1)k(k+1k)=(−1)k(k+1)\binom{-2}{k} = (-1)^k\binom{k + 1}{k} = (-1)^k(k + 1) and (−3k)=(−1)k(k+2k)=(−1)k(k+1)(k+2)/2\binom{-3}{k} = (-1)^k\binom{k + 2}{k} = (-1)^k(k + 1)(k + 2)/2. So, for ∣x∣<1|x| < 1, (1+x)−3=1−3x+6x2−10x3+15x4−⋯ ,(1 + x)^{-3} = 1 - 3x + 6x^2 - 10x^3 + 15x^4 - \cdots, with the triangular numbers as sizes of the coefficients.

Exercise 6.4-3. With r=1/3r = 1/3: (1/30)=1\binom{1/3}{0} = 1, (1/31)=1/3\binom{1/3}{1} = 1/3, (1/32)=13⋅(−23)/2=−19\binom{1/3}{2} = \tfrac13 \cdot (-\tfrac23)/2 = -\tfrac19, (1/33)=13⋅(−23)(−53)/6=1027/6=581\binom{1/3}{3} = \tfrac13 \cdot (-\tfrac23)(-\tfrac53)/6 = \tfrac{10}{27}/6 = \tfrac{5}{81}, and (1/34)=(1/33)⋅(13−3)/4=581⋅(−83)/4=−10243\binom{1/3}{4} = \binom{1/3}{3} \cdot (\tfrac13 - 3)/4 = \tfrac{5}{81} \cdot (-\tfrac{8}{3})/4 = -\tfrac{10}{243}. So (1+x)1/3=1+x3−x29+5x381−10x4243+⋯ .(1 + x)^{1/3} = 1 + \frac{x}{3} - \frac{x^2}{9} + \frac{5x^3}{81} - \frac{10x^4}{243} + \cdots.

Exercise 6.4-4. With x=0.1x = 0.1 the terms tk=(1/2k)(0.1)kt_k = \binom{1/2}{k}(0.1)^k are t0=1t_0 = 1, t1=0.05t_1 = 0.05, t2=−0.00125t_2 = -0.00125, t3=0.0000625t_3 = 0.0000625 and t4=−0.00000390625t_4 = -0.00000390625. The first four terms give 1.04881251.0488125; the true value is 1.1=1.04880885…\sqrt{1.1} = 1.04880885\ldots, so the error is about 3.65⋅10−63.65 \cdot 10^{-6}. To prove that the error is less than ∣t4∣|t_4|: for k≥1k \ge 1 the sign of tkt_k is (−1)k−1(-1)^{k-1}, so the terms alternate. Also ∣tk+1/tk∣=(k−1/2)k+1⋅0.1<1|t_{k+1}/t_k| = \tfrac{(k - 1/2)}{k + 1} \cdot 0.1 < 1, so the sizes decrease to 00. For an alternating series with decreasing terms, the remainder after a term has the sign of the next term and is smaller in size than that next term. Since the binomial series converges to 1.1\sqrt{1.1}, the error of the four term sum is less than ∣t4∣≈3.9⋅10−6|t_4| \approx 3.9 \cdot 10^{-6}, and the estimate is too large.

Exercise 6.4-5. For ∣x∣<1|x| < 1 the binomial series ∑k(1/2k)xk\sum_k \binom{1/2}{k}x^k converges absolutely to 1+x\sqrt{1 + x} (P5). The product of two absolutely convergent series is the series of the Cauchy products of their coefficients (P5). So 1+x=1+x⋅1+x=∑n≥0(∑k=0n(1/2k)(1/2n−k))xn.1 + x = \sqrt{1 + x}\cdot\sqrt{1 + x} = \sum_{n \ge 0}\left(\sum_{k=0}^{n}\binom{1/2}{k}\binom{1/2}{n - k}\right)x^n. A power series that converges on an interval about 00 determines its coefficients, and the coefficients of 1+x1 + x are 1,1,0,0,…1, 1, 0, 0, \dots, which are (1n)\binom{1}{n}. So the inner sum is (1n)\binom{1}{n}. Check for n=2n = 2: (1/20)(1/22)+(1/21)2+(1/22)(1/20)=−18+14−18=0\binom{1/2}{0}\binom{1/2}{2} + \binom{1/2}{1}^2 + \binom{1/2}{2}\binom{1/2}{0} = -\tfrac18 + \tfrac14 - \tfrac18 = 0. The identity is a special case of the Vandermonde convolution of Chapter 7. In Mathlib the formal version is PowerSeries.binomialSeries_add.

Exercise 6.4-6. By the theorem on a half-integer upper index, (−1)k−122k−1(1/2k)=22k−1(2kk)/(4k(2k−1))=(2kk)/(2(2k−1))(-1)^{k-1}2^{2k-1}\binom{1/2}{k} = 2^{2k-1}\binom{2k}{k}/(4^k(2k - 1)) = \binom{2k}{k}/(2(2k - 1)). Absorption twice gives (2kk)=2kk(2k−1k−1)=2(2k−1k−1)\binom{2k}{k} = \tfrac{2k}{k}\binom{2k-1}{k-1} = 2\binom{2k-1}{k-1} and (2k−1k−1)=2k−1k(2k−2k−1)\binom{2k-1}{k-1} = \tfrac{2k - 1}{k}\binom{2k-2}{k-1} (eq. 1.2.6(8) with r=2k−1r = 2k - 1). So (2kk)=2(2k−1)k(2k−2k−1)\binom{2k}{k} = \tfrac{2(2k - 1)}{k}\binom{2k-2}{k-1}, and the quotient is 1k(2k−2k−1)\tfrac1k\binom{2k-2}{k-1}. For k=1,…,5k = 1, \dots, 5 the values are 1,1,2,5,141, 1, 2, 5, 14. They are the Catalan numbers, which TAOCP meets in Section 2.3.4.4 as the numbers of binary trees.

Exercise 6.4-7. If k<0k < 0, the value is 00. Let k≥0k \ge 0. If r≥0r \ge 0, the value is the number of kk-subsets of an rr-set by Section 6.2 (it is 00 for k>rk > r), so it is an integer. If r<0r < 0, the negation theorem gives (rk)=(−1)k(k−r−1k)\binom{r}{k} = (-1)^k\binom{k - r - 1}{k}. Here k−r−1≥k≥0k - r - 1 \ge k \ge 0 is a natural number, so (k−r−1k)\binom{k - r - 1}{k} is again a count of subsets, and (rk)\binom{r}{k} is an integer. A consequence: for integers rr and k≥0k \ge 0, the product of kk consecutive integers r(r−1)⋯(r−k+1)r(r - 1) \cdots (r - k + 1) is divisible by k!k!.

Solutions to Chapter 7: Binomial identities

Section 7.1: Vandermonde's convolution

Exercise 7.1-1. The terms with k=0,1,2k = 0, 1, 2 are (40)(32)=3\binom40\binom32 = 3, (41)(31)=12\binom41\binom31 = 12 and (42)(30)=6\binom42\binom30 = 6. All other terms are zero. The sum is 2121, and Vandermonde's convolution with r=4r = 4, s=3s = 3 and n=2n = 2 gives (72)=21\binom72 = 21.

Exercise 7.1-2. Symmetry gives (nk)=(nn−k)\binom{n}{k} = \binom{n}{n-k} for the integer n≥0n \ge 0 and every integer kk. So ∑k(mk)(nk)=∑k(mk)(nn−k)=(m+nn),\sum_k \binom{m}{k}\binom{n}{k} = \sum_k \binom{m}{k}\binom{n}{n-k} = \binom{m+n}{n}, by Vandermonde's convolution with r=mr = m and s=ns = n, and (m+nn)=(m+nm)\binom{m+n}{n} = \binom{m+n}{m}. For a real ss, use the symmetry on the factor with the integer upper index nn: ∑k(nn−k)(sk)=(n+sn)\sum_k \binom{n}{n-k}\binom{s}{k} = \binom{n+s}{n}, again by the convolution. The symmetry may not be used on (sk)\binom{s}{k}, because ss need not be a nonnegative integer.

Exercise 7.1-3. Absorption gives k(nk)=n(n−1k−1)k\binom{n}{k} = n\binom{n-1}{k-1} for every integer kk. So k2(nk)2=n2(n−1k−1)2k^2\binom{n}{k}^2 = n^2\binom{n-1}{k-1}^2, and Exercise 2 with m=n=n−1m = n = n - 1, after the shift j=k−1j = k - 1, gives ∑kk2(nk)2=n2∑j(n−1j)2=n2(2n−2n−1).\sum_k k^2\binom{n}{k}^2 = n^2\sum_j \binom{n-1}{j}^2 = n^2\binom{2n-2}{n-1}. For n=2n = 2 the terms are 1⋅4+4⋅1=81 \cdot 4 + 4 \cdot 1 = 8 and the formula gives 4(21)=84\binom21 = 8. For n=3n = 3 the terms are 1⋅9+4⋅9+9⋅1=541 \cdot 9 + 4 \cdot 9 + 9 \cdot 1 = 54 and the formula gives 9(42)=549\binom42 = 54.

Exercise 7.1-4. Section 6.4 gives (1/2k)=(−1)k−14k(2k−1)(2kk)\binom{1/2}{k} = \frac{(-1)^{k-1}}{4^k(2k-1)}\binom{2k}{k} for every integer k≥0k \ge 0; for k=0k = 0 the right side is −1−1=1\frac{-1}{-1} = 1. So (1/2k)(1/2n−k)=(−1)n4n (2kk)(2n−2kn−k)(2k−1)(2n−2k−1),\binom{1/2}{k}\binom{1/2}{n-k} = \frac{(-1)^n}{4^n}\,\frac{\binom{2k}{k}\binom{2n-2k}{n-k}}{(2k-1)(2n-2k-1)}, since (−1)k−1(−1)n−k−1=(−1)n(-1)^{k-1}(-1)^{n-k-1} = (-1)^n. Sum over 0≤k≤n0 \le k \le n and use the convolution with r=s=12r = s = \frac12: the left side becomes (1n)\binom1n. So the sum in the exercise is (−1)n4n(1n)(-1)^n4^n\binom1n. It is 11 for n=0n = 0, −4-4 for n=1n = 1 and 00 for every n≥2n \ge 2. For n=1n = 1 the two terms are 1⋅2(−1)(1)+2⋅1(1)(−1)=−4\frac{1 \cdot 2}{(-1)(1)} + \frac{2 \cdot 1}{(1)(-1)} = -4.

Exercise 7.1-5. With r=m=n=0r = m = n = 0 and s=1s = 1 the left side has the one term (00)(10)=1\binom00\binom10 = 1, and the right side is (21)=2\binom{2}{1} = 2. In the proof, N=2N = 2 and the right side counts the sets {1}\{1\} and {2}\{2\}. For X={1}X = \{1\} the element of rank 11 is x=1x = 1, and k=x−s−1=−1k = x - s - 1 = -1. This value lies outside the range 0≤k≤r0 \le k \le r of the sum. So the step that fails is the claim k≥n−s≥0k \ge n - s \ge 0, which needs n≥sn \ge s: the set {1}\{1\} is not counted on the left.

Exercise 7.1-6. Put j=n−kj = n - k. Then (−1)k=(−1)n−j(-1)^k = (-1)^{n-j}, (nk)=(nj)\binom{n}{k} = \binom{n}{j} and (2n−kn)=(n+jn)\binom{2n-k}{n} = \binom{n+j}{n}, so the sum is ∑j(nj)(n+jn)(−1)n−j.\sum_j \binom{n}{j}\binom{n+j}{n}(-1)^{n-j}. The negated form of Vandermonde's convolution with r=nr = n, s=ns = n and the lower index nn gives (nn−n)=(n0)=1\binom{n}{n-n} = \binom{n}{0} = 1.

Exercise 7.1-7. Group the terms by m=i+jm = i + j. For a fixed mm the inner sum is ∑i(ri)(sm−i)=(r+sm)\sum_i \binom{r}{i}\binom{s}{m-i} = \binom{r+s}{m} by Vandermonde's convolution. Then the outer sum is ∑m(r+sm)(tn−m)=(r+s+tn)\sum_m \binom{r+s}{m}\binom{t}{n-m} = \binom{r+s+t}{n} by the convolution again. Each triple with i+j+k=ni + j + k = n appears once, as the term with m=i+jm = i + j and the given ii. All sums are finite, because a term is zero unless ii, jj and kk are nonnegative.

Exercise 7.1-8. Take P(x,y)=y(y−1)=y2−yP(x, y) = y(y - 1) = y^2 - y. It is not the zero polynomial, and P(a,0)=P(a,1)=0P(a, 0) = P(a, 1) = 0 for every aa. The polynomial argument needs infinite sets T1T_1 and T2T_2; here T2={0,1}T_2 = \{0, 1\} is finite, so the lemma does not apply. In its proof, the step in one variable fails: a nonzero polynomial in yy can have the two roots 00 and 11. For Vandermonde's convolution, the counting proof gives the identity at all pairs of nonnegative integers, and the difference of the two sides is a polynomial in rr and ss. If only one variable ran over an infinite set and the other over a finite set, then a factor such as s(s−1)s(s-1) could hide in the difference, as in PP, and the identity would not follow for all real ss.

Section 7.2: Orthogonality and binomial inversion

Exercise 7.2-1. The theorem on derangements gives D6=720(1−1+12−16+124−1120+1720)=360−120+30−6+1=265.D_6 = 720\left(1 - 1 + \frac12 - \frac16 + \frac1{24} - \frac1{120} + \frac1{720}\right) = 360 - 120 + 30 - 6 + 1 = 265. The recurrence of Exercise 2 gives D1=0D_1 = 0, D2=1D_2 = 1, D3=2D_3 = 2, D4=9D_4 = 9, D5=44D_5 = 44 and D6=6⋅44+1=265D_6 = 6 \cdot 44 + 1 = 265.

Exercise 7.2-2. Split off the last term of the sum in the theorem on derangements: Dn=n⋅(n−1)!∑j=0n−1(−1)jj!+n! (−1)nn!=nDn−1+(−1)n.D_n = n \cdot (n-1)!\sum_{j=0}^{n-1}\frac{(-1)^j}{j!} + n!\,\frac{(-1)^n}{n!} = nD_{n-1} + (-1)^n.

Exercise 7.2-3. Let π\pi be a derangement of {1,…,n+1}\{1, \dots, n+1\}, and let ii be the element with π(i)=n+1\pi(i) = n + 1. Then i≤ni \le n, so there are nn choices for ii. Fix ii. If π(n+1)=i\pi(n+1) = i, then π\pi swaps ii and n+1n + 1 and is a derangement of the other n−1n - 1 elements; there are Dn−1D_{n-1} such π\pi. If π(n+1)=j≠i\pi(n+1) = j \ne i, define σ\sigma on {1,…,n}\{1, \dots, n\} by σ(i)=j\sigma(i) = j and σ(a)=π(a)\sigma(a) = \pi(a) for a≠ia \ne i. Then σ\sigma is a permutation of {1,…,n}\{1, \dots, n\} without fixed points, since σ(i)=j≠i\sigma(i) = j \ne i. Conversely, every derangement σ\sigma of {1,…,n}\{1, \dots, n\} comes from exactly one such π\pi: put π(i)=n+1\pi(i) = n + 1 and π(n+1)=σ(i)\pi(n+1) = \sigma(i), and π(a)=σ(a)\pi(a) = \sigma(a) for the other aa. So there are DnD_n such π\pi. In total Dn+1=n(Dn+Dn−1)D_{n+1} = n(D_n + D_{n-1}). Check: D4=3(2+1)=9D_4 = 3(2 + 1) = 9.

Exercise 7.2-4. Binomial inversion gives f(k)=∑j(kj)(−1)k−jj3f(k) = \sum_j \binom{k}{j}(-1)^{k-j}j^3, which is Δkx3\Delta^k x^3 at x=0x = 0 by the difference formula. So f(0)=0f(0) = 0, f(1)=1f(1) = 1, f(2)=8−2=6f(2) = 8 - 2 = 6, f(3)=27−24+3=6f(3) = 27 - 24 + 3 = 6, and f(k)=0f(k) = 0 for k≥4k \ge 4 by the theorem on the difference of a polynomial. So n3=(n1)+6(n2)+6(n3)n^3 = \binom{n}{1} + 6\binom{n}{2} + 6\binom{n}{3}. For n=2n = 2: 2+6=82 + 6 = 8. For n=3n = 3: 3+18+6=273 + 18 + 6 = 27.

Exercise 7.2-5. The theorem on the difference of a polynomial with r=5r = 5 and p(k)=k5p(k) = k^5 gives ∑k(5k)(−1)5−kk5=5!=120\sum_k \binom5k(-1)^{5-k}k^5 = 5! = 120. Since (−1)k=−(−1)5−k(-1)^k = -(-1)^{5-k}, the first sum is −120-120. The polynomial (k2+1)2(k^2 + 1)^2 has degree 4<54 < 5, so Δ5\Delta^5 of it is zero, and the second sum is 00.

Exercise 7.2-6. The function p(k)=(a+bk)rp(k) = (a + bk)^r is a polynomial in kk of degree at most rr, and the coefficient of krk^r is brb^r. The theorem on the difference of a polynomial gives ∑k(rk)(−1)r−kp(k)=r! br\sum_k \binom{r}{k}(-1)^{r-k}p(k) = r!\,b^r. Multiply by (−1)r(-1)^r, and use (−1)r−k(−1)r=(−1)k(-1)^{r-k}(-1)^r = (-1)^k: the sum in the exercise is (−1)rr! br=(−b)rr!(-1)^r r!\,b^r = (-b)^r r!. The value does not depend on aa.

Exercise 7.2-7. A permutation with exactly jj fixed points is fixed by its set JJ of fixed points, with (nj)\binom{n}{j} choices, and by its action on the other n−jn - j elements, which must be a derangement of them, with Dn−jD_{n-j} choices. So there are (nj)Dn−j\binom{n}{j}D_{n-j} of them. Absorption gives j(nj)=n(n−1j−1)j\binom{n}{j} = n\binom{n-1}{j-1}, so with i=j−1i = j - 1 ∑jj(nj)Dn−j=n∑i(n−1i)Dn−1−i=n⋅(n−1)!=n!,\sum_j j\binom{n}{j}D_{n-j} = n\sum_i \binom{n-1}{i}D_{n-1-i} = n \cdot (n-1)! = n!, where the second sum is (n−1)!(n-1)! by the theorem on derangements and the symmetry (n−1i)=(n−1n−1−i)\binom{n-1}{i} = \binom{n-1}{n-1-i}. The left side is the total number of fixed points over all n!n! permutations. So the average number of fixed points of a permutation is 11 for every n≥1n \ge 1.

Exercise 7.2-8. The series gives n!/e=n!∑j≥0(−1)j/j!n!/e = n!\sum_{j \ge 0}(-1)^j/j!, so by the theorem on derangements Dn−n!e=−n!∑j>n(−1)jj!=(−1)n(1n+1−1(n+1)(n+2)+1(n+1)(n+2)(n+3)−⋯ ).D_n - \frac{n!}{e} = -n!\sum_{j > n}\frac{(-1)^j}{j!} = (-1)^n\left(\frac{1}{n+1} - \frac{1}{(n+1)(n+2)} + \frac{1}{(n+1)(n+2)(n+3)} - \cdots\right). The terms in the parentheses have alternating signs and strictly decrease in absolute value to 00. So the value in the parentheses lies strictly between 00 and its first term 1n+1\frac{1}{n+1}, because the pairs of consecutive terms after the first one have negative sums. So ∣Dn−n!/e∣<1n+1|D_n - n!/e| < \frac{1}{n+1}. For n≥1n \ge 1 the bound is at most 12\frac12, so the integer DnD_n is the integer nearest to n!/en!/e. For n=0n = 0 the bound is 11, and indeed D0=1D_0 = 1 while 1/e≈0.371/e \approx 0.37 is nearer to 00.

Section 7.3: Abel's identity and convolutions

Exercise 7.3-1. The definition with n=3n = 3 gives A3(x,t)=x(x−3t−1)(x−3t−2)/6A_3(x, t) = x(x - 3t - 1)(x - 3t - 2)/6. So A3(x,1)=x(x−4)(x−5)/6A_3(x, 1) = x(x - 4)(x - 5)/6 and A3(x,−1)=x(x+2)(x+1)/6=(x+23)A_3(x, -1) = x(x + 2)(x + 1)/6 = \binom{x+2}{3}. Then A3(5,1)=0A_3(5, 1) = 0, because of the factor x−5x - 5.

Exercise 7.3-2. For n=2n = 2 the three terms of the left side are y2y^2 for k=0k = 0, 2x(y+z)2x(y + z) for k=1k = 1, and x(x−2z)x(x - 2z) for k=2k = 2. Their sum is y2+2xy+2xz+x2−2xz=(x+y)2y^2 + 2xy + 2xz + x^2 - 2xz = (x + y)^2.

Exercise 7.3-3. The sequences have length r+un=7r + un = 7, with n=2n = 2 terms equal to 1−u=−21 - u = -2 and 55 terms equal to 11. The partial sums rise at each term 11, so only the partial sums at the terms −2-2 can fail. If the jjth term −2-2 is at position pp, then the partial sum there is (p−j)−2j=p−3j(p - j) - 2j = p - 3j, and it is positive exactly when p>3jp > 3j. So the first −2-2 is at a position 44, 55 or 66, and the second −2-2 is at position 77. The good sequences are 1,1,1,−2,1,1,−2,1,1,1,1,−2,1,−2,1,1,1,1,1,−2,−2.1, 1, 1, -2, 1, 1, -2, \qquad 1, 1, 1, 1, -2, 1, -2, \qquad 1, 1, 1, 1, 1, -2, -2. There are exactly 33 of them, and A2(1,−3)=17(72)=3A_2(1, -3) = \frac{1}{7}\binom72 = 3.

Exercise 7.3-4. The shift 3,−13, -1 has the partial sums 3,23, 2, so it is good. The shift −1,3-1, 3 starts with −1-1, so it is not good. So exactly 11 shift is good, but the sum is 22. The cycle lemma needs ai≤1a_i \le 1 for each ii, and here a1=3a_1 = 3. In the proof, the step sp(v)=vs_{p(v)} = v uses steps of size at most 11; with a step 33 the partial sums skip the values 11 and 22 on the way up.

Exercise 7.3-5. With y=0y = 0 and z=1z = 1 Abel's identity becomes ∑k(nk) x(x−k)k−1kn−k=xn,\sum_k \binom{n}{k}\,x(x - k)^{k-1}k^{n-k} = x^n, where the term with k=0k = 0 is 0n0^n, which is 00 for n≥1n \ge 1. For n=3n = 3 the terms with k=1,2,3k = 1, 2, 3 are 3x3x, 6x(x−2)=6x2−12x6x(x - 2) = 6x^2 - 12x and x(x−3)2=x3−6x2+9xx(x - 3)^2 = x^3 - 6x^2 + 9x. The sum is x3x^3.

Exercise 7.3-6. Take r=s=1r = s = 1 and t=−2t = -2 in the convolution of AA and BB. Then Ak(1,−2)=CkA_k(1, -2) = C_k by the second example after the definition, Bn−k(1,−2)=(1+2(n−k)n−k)B_{n-k}(1, -2) = \binom{1 + 2(n-k)}{n-k}, and Bn(2,−2)=(2+2nn)B_n(2, -2) = \binom{2 + 2n}{n}. So ∑kCk(2n−2k+1n−k)=(2n+2n).\sum_k C_k\binom{2n-2k+1}{n-k} = \binom{2n+2}{n}. For n=2n = 2 the left side is 1⋅10+1⋅3+2⋅1=151 \cdot 10 + 1 \cdot 3 + 2 \cdot 1 = 15, and (62)=15\binom62 = 15.

Exercise 7.3-7. For n=0n = 0, A0(0,t)=1A_0(0, t) = 1. For n≥1n \ge 1 the definition of An(x,t)A_n(x, t) has the factor xx, so An(0,t)=0A_n(0, t) = 0. So An(0,t)=[n=0]A_n(0, t) = [n = 0]. The convolution of AA with s=−rs = -r gives ∑kAk(r,t)An−k(−r,t)=An(0,t)=[n=0]\sum_k A_k(r, t)A_{n-k}(-r, t) = A_n(0, t) = [n = 0]. So the sequences An(r,t)A_n(r, t) and An(−r,t)A_n(-r, t) are inverse under convolution.

Exercise 7.3-8. Let bb be a balanced sequence, and let cc be the sequence 11 followed by bb. The partial sums of cc are 11 plus the partial sums of bb, together with the first partial sum 11. So cc has positive partial sums exactly when bb has nonnegative partial sums. Conversely, a good sequence cc starts with 11, since its first partial sum is positive, and the rest of cc is balanced. So the balanced sequences of length 2n2n correspond one to one with the good sequences of length 2n+12n + 1 with n+1n + 1 terms 11 and nn terms −1-1. These are the good sequences with r=1r = 1, u=2u = 2 and 1−u=−11 - u = -1, and their number is An(1,−2)=12n+1(2n+1n)=CnA_n(1, -2) = \frac{1}{2n+1}\binom{2n+1}{n} = C_n.

Exercise 7.3-9. The convolution of AA with r=s=1r = s = 1 and t=−3t = -3 gives ∑kTkTn−k=An(2,−3)=23n+2(3n+2n),\sum_k T_kT_{n-k} = A_n(2, -3) = \frac{2}{3n+2}\binom{3n+2}{n}, where the closed form is the factorial form of AnA_n for x−nt=3n+2≠0x - nt = 3n + 2 \ne 0. The first values are T0=1T_0 = 1, T1=1T_1 = 1, T2=3T_2 = 3 and T3=12T_3 = 12. For n=3n = 3 the left side is 12+3+3+12=3012 + 3 + 3 + 12 = 30, and 211(113)=2⋅16511=30\frac{2}{11}\binom{11}{3} = \frac{2 \cdot 165}{11} = 30.

Section 7.4: Multinomials, partial sums and q-binomials

Exercise 7.4-1. COMMITTEE has 99 letters: C, O, I once each, and M, T, E twice each. By the theorem on words with given letters the number of words is (91,1,1,2,2,2)=9!2! 2! 2!=3628808=45360.\binom{9}{1, 1, 1, 2, 2, 2} = \frac{9!}{2!\,2!\,2!} = \frac{362880}{8} = 45360.

Exercise 7.4-2. The multinomial theorem with x1=2xx_1 = 2x, x2=−yx_2 = -y and x3=zx_3 = z gives the term (92,3,4)(2x)2(−y)3z4\binom{9}{2, 3, 4}(2x)^2(-y)^3z^4. Here (92,3,4)=3628802⋅6⋅24=1260\binom{9}{2, 3, 4} = \frac{362880}{2 \cdot 6 \cdot 24} = 1260, so the coefficient is 1260⋅4⋅(−1)=−50401260 \cdot 4 \cdot (-1) = -5040.

Exercise 7.4-3. Put x1=⋯=xm=1x_1 = \cdots = x_m = 1 in the multinomial theorem. The left side is mnm^n, and the right side is the sum of all (nk1,…,km)\binom{n}{k_1, \dots, k_m} with k1+⋯+km=nk_1 + \cdots + k_m = n. A count gives the same result: both sides count the words of length nn over an alphabet of mm letters, the right side sorted by the number of times each letter occurs.

Exercise 7.4-4. Count the words of length nn with kik_i letters ii by their last letter. If the last letter is ii, then ki≥1k_i \ge 1, and the first n−1n - 1 letters form a word with ki−1k_i - 1 letters ii and kjk_j letters jj for j≠ij \ne i. There are (n−1k1,…,ki−1,…,km)\binom{n-1}{k_1, \dots, k_i - 1, \dots, k_m} such words. Sum over the ii with ki≥1k_i \ge 1. The algebra gives the same: (n−1)!k1!⋯(ki−1)!⋯km!=kin(nk1,…,km)\frac{(n-1)!}{k_1! \cdots (k_i - 1)! \cdots k_m!} = \frac{k_i}{n}\binom{n}{k_1, \dots, k_m}, and the kik_i add up to nn.

Exercise 7.4-5. Negation of the upper index gives (−3k)=(−1)k(k+22)\binom{-3}{k} = (-1)^k\binom{k+2}{2}. Use induction on nn. For n=0n = 0 both sides are 11. For the step it is enough to show that the difference of the right sides for nn and n−1n - 1 is the term (−1)n(n+22)(-1)^n\binom{n+2}{2}, that is, ⌊(n+2)24⌋+⌊(n+1)24⌋=(n+2)(n+1)2.\left\lfloor\frac{(n+2)^2}{4}\right\rfloor + \left\lfloor\frac{(n+1)^2}{4}\right\rfloor = \frac{(n+2)(n+1)}{2}. Let m=n+2m = n + 2. If m=2am = 2a, the left side is a2+(a2−a)=a(2a−1)=m(m−1)/2a^2 + (a^2 - a) = a(2a - 1) = m(m-1)/2. If m=2a+1m = 2a + 1, the left side is (a2+a)+a2=a(2a+1)=m(m−1)/2(a^2 + a) + a^2 = a(2a + 1) = m(m-1)/2. In both cases the identity holds. The values for n=0,…,4n = 0, \dots, 4 are 1,−2,4,−6,91, -2, 4, -6, 9.

Exercise 7.4-6. The theorem with a linear factor with m=2n+1m = 2n + 1 gives ∑k≤n(2n+1k)(k−2n+12)=−2n+12(2nn).\sum_{k \le n}\binom{2n+1}{k}\Bigl(k - \frac{2n+1}{2}\Bigr) = -\frac{2n+1}{2}\binom{2n}{n}. The corollary on half of an odd row gives ∑k≤n(2n+1k)=4n\sum_{k \le n}\binom{2n+1}{k} = 4^n. Add 2n+124n\frac{2n+1}{2}4^n to both sides: ∑k=0nk(2n+1k)=2n+12(4n−(2nn)).\sum_{k=0}^{n}k\binom{2n+1}{k} = \frac{2n+1}{2}\left(4^n - \binom{2n}{n}\right). For n=1n = 1 the sum is 33, and the formula gives 32(4−2)=3\frac32(4 - 2) = 3. For n=2n = 2 the sum is 5+20=255 + 20 = 25, and the formula gives 52(16−6)=25\frac52(16 - 6) = 25.

Exercise 7.4-7. The first qq-Pascal rule gives (52)q=(41)q+q2(42)q\binom52_q = \binom41_q + q^2\binom42_q. Here (41)q=1+q+q2+q3\binom41_q = 1 + q + q^2 + q^3 and (42)q=1+q+2q2+q3+q4\binom42_q = 1 + q + 2q^2 + q^3 + q^4, so (52)q=1+q+2q2+2q3+2q4+q5+q6.\binom52_q = 1 + q + 2q^2 + 2q^3 + 2q^4 + q^5 + q^6. At q=1q = 1 the coefficients add up to 10=(52)10 = \binom52.

Exercise 7.4-8. By the theorem on subset sums, the coefficient of qjq^j in (nk)q\binom{n}{k}_q is the number of kk-element subsets SS of {1,…,n}\{1, \dots, n\} with the sum j+(k+12)j + \binom{k+1}{2}. The map s↦n+1−ss \mapsto n + 1 - s is a one to one map of the kk-element subsets onto themselves, and it sends a sum σ\sigma to k(n+1)−σk(n+1) - \sigma. With σ=j+(k+12)\sigma = j + \binom{k+1}{2} the new sum is k(n+1)−j−k(k+1)2=(k(n−k)−j)+(k+12)k(n+1) - j - \frac{k(k+1)}{2} = (k(n-k) - j) + \binom{k+1}{2}. So the coefficients of qjq^j and of qk(n−k)−jq^{k(n-k)-j} are equal. The largest sum is k(n+1)−(k+12)k(n+1) - \binom{k+1}{2}, so the degree of (nk)q\binom{n}{k}_q is k(n−k)k(n-k), and the equality of these coefficients is the identity qk(n−k)(nk)1/q=(nk)qq^{k(n-k)}\binom{n}{k}_{1/q} = \binom{n}{k}_q. The definition gives a direct check: 1−q−a=−q−a(1−qa)1 - q^{-a} = -q^{-a}(1 - q^a), and the exponents in the numerator minus those in the denominator add up to (kn−(k2))−(k+12)=k(n−k)(kn - \binom{k}{2}) - \binom{k+1}{2} = k(n-k), while the kk signs above and below cancel.

Exercise 7.4-9. First way: the theorem of Section 7.4 with b=−nb = -n and c=1c = 1 gives F(−n,−n;1;1)=(n+1)n‾1n‾=(n+1)(n+2)⋯(2n)n!=(2nn).F(-n, -n; 1; 1) = \frac{(n+1)^{\overline{n}}}{1^{\overline{n}}} = \frac{(n+1)(n+2)\cdots(2n)}{n!} = \binom{2n}{n}. Second way: (−n)k‾=(−n)(−n+1)⋯(−n+k−1)=(−1)knk‾(-n)^{\overline{k}} = (-n)(-n+1)\cdots(-n+k-1) = (-1)^kn^{\underline{k}} and 1k‾=k!1^{\overline{k}} = k!. So the term with index kk is (nk‾)2k! k!=(nk)2\frac{(n^{\underline{k}})^2}{k!\,k!} = \binom{n}{k}^2, and the corollary on the sum of squares of a row in Section 7.1 gives ∑k(nk)2=(2nn)\sum_k \binom{n}{k}^2 = \binom{2n}{n}.

Solutions to Chapter 8: Stirling numbers and Eulerian numbers

Section 8.1: Stirling numbers of the second kind

Exercise 8.1-1. The row n=6n = 6 is 0,1,31,90,65,15,10, 1, 31, 90, 65, 15, 1. The recurrence {7k}=k{6k}+{6k−1}{7 \brace k} = k{6 \brace k} + {6 \brace k-1} gives {71}=1{7 \brace 1} = 1, {72}=2⋅31+1=63{7 \brace 2} = 2 \cdot 31 + 1 = 63, {73}=3⋅90+31=301{7 \brace 3} = 3 \cdot 90 + 31 = 301, {74}=4⋅65+90=350{7 \brace 4} = 4 \cdot 65 + 90 = 350, {75}=5⋅15+65=140{7 \brace 5} = 5 \cdot 15 + 65 = 140, {76}=6⋅1+15=21{7 \brace 6} = 6 \cdot 1 + 15 = 21 and {77}=1{7 \brace 7} = 1. So the row n=7n = 7 is 0,1,63,301,350,140,21,10, 1, 63, 301, 350, 140, 21, 1, with the sum 877877.

Exercise 8.1-2. The explicit formula with m=3m = 3 gives 6{n3}=3n−3⋅2n+3⋅1n−0n6{n \brace 3} = 3^n - 3 \cdot 2^n + 3 \cdot 1^n - 0^n. For n≥1n \ge 1 the last term is 00, so {n3}=16(3n−3⋅2n+3){n \brace 3} = \frac16(3^n - 3 \cdot 2^n + 3). For n=4n = 4 this is 16(81−48+3)=6\frac16(81 - 48 + 3) = 6, as in the table.

Exercise 8.1-3. An assignment of the people to the rooms is a function from the set of 55 people to the set of 33 rooms, and no room stays empty exactly when the function is onto. By the explicit formula there are 3!{53}=6⋅25=1503!{5 \brace 3} = 6 \cdot 25 = 150 such functions. The formula 35−3⋅25+3=1503^5 - 3 \cdot 2^5 + 3 = 150 gives the same number directly.

Exercise 8.1-4. Sort the partitions of {1,…,n+1}\{1, \dots, n+1\} by the block BB that contains n+1n + 1. The set B∖{n+1}B \setminus \{n+1\} is a subset of {1,…,n}\{1, \dots, n\}; let kk be the number of elements outside it, so it has n−kn - k elements, with (nn−k)=(nk)\binom{n}{n-k} = \binom{n}{k} choices. The other blocks form an arbitrary partition of the kk remaining elements, with ϖk\varpi_k choices. So ϖn+1=∑k(nk)ϖk\varpi_{n+1} = \sum_k \binom{n}{k}\varpi_k. Starting from ϖ0=1\varpi_0 = 1 the recurrence gives ϖ1=1\varpi_1 = 1, ϖ2=2\varpi_2 = 2, ϖ3=1+2+2=5\varpi_3 = 1 + 2 + 2 = 5, ϖ4=1+3+6+5=15\varpi_4 = 1 + 3 + 6 + 5 = 15, ϖ5=1+4+12+20+15=52\varpi_5 = 1 + 4 + 12 + 20 + 15 = 52 and ϖ6=1+5+20+50+75+52=203\varpi_6 = 1 + 5 + 20 + 50 + 75 + 52 = 203. These are also the row sums of the table.

Exercise 8.1-5. The row n=4n = 4 gives x4=x1‾+7x2‾+6x3‾+x4‾x^4 = x^{\underline{1}} + 7x^{\underline{2}} + 6x^{\underline{3}} + x^{\underline{4}}. Sum over 0≤x<N0 \le x < N and use ∑0≤x<Nxk‾=Nk+1‾/(k+1)\sum_{0 \le x < N}x^{\underline{k}} = N^{\underline{k+1}}/(k+1): ∑0≤x<Nx4=N2‾2+7N3‾3+6N4‾4+N5‾5.\sum_{0 \le x < N}x^4 = \frac{N^{\underline{2}}}{2} + \frac{7N^{\underline{3}}}{3} + \frac{6N^{\underline{4}}}{4} + \frac{N^{\underline{5}}}{5}. For N=3N = 3 the right side is 3+14+0+0=173 + 14 + 0 + 0 = 17, and the left side is 0+1+16=170 + 1 + 16 = 17.

Exercise 8.1-6. A partition of {1,…,n}\{1, \dots, n\} into n−3n - 3 blocks has the sum of ∣B∣−1|B| - 1 over its blocks equal to n−(n−3)=3n - (n - 3) = 3. So its blocks with more than one element have one of the following size patterns: one block of 44; one block of 33 and one of 22; three blocks of 22. All other blocks have one element. Let jj be the number of elements in the large blocks, so j=4j = 4, 55 or 66. Choose these jj elements in (nj)\binom{n}{j} ways. There is 11 way to make one block of 44 from 44 elements, (53)=10\binom53 = 10 ways to split 55 elements into blocks of 33 and 22, and 5⋅3⋅1=155 \cdot 3 \cdot 1 = 15 ways to split 66 elements into three pairs. So {nn−3}=(n4)+10(n5)+15(n6){n \brace n-3} = \binom{n}{4} + 10\binom{n}{5} + 15\binom{n}{6}. For n=6n = 6 this is 15+60+15=9015 + 60 + 15 = 90.

Exercise 8.1-7. Put x=−1x = -1 in the theorem on powers in falling powers. The falling power is (−1)k‾=(−1)(−2)⋯(−k)=(−1)kk!(-1)^{\underline{k}} = (-1)(-2)\cdots(-k) = (-1)^kk!, so (−1)n=∑k{nk}(−1)kk!(-1)^n = \sum_k {n \brace k}(-1)^kk!.

Section 8.2: Stirling numbers of the first kind

Exercise 8.2-1. The row n=6n = 6 is 0,120,274,225,85,15,10, 120, 274, 225, 85, 15, 1. The recurrence [7k]=6[6k]+[6k−1]{7 \brack k} = 6{6 \brack k} + {6 \brack k-1} gives [71]=720{7 \brack 1} = 720, [72]=6⋅274+120=1764{7 \brack 2} = 6 \cdot 274 + 120 = 1764, [73]=6⋅225+274=1624{7 \brack 3} = 6 \cdot 225 + 274 = 1624, [74]=6⋅85+225=735{7 \brack 4} = 6 \cdot 85 + 225 = 735, [75]=6⋅15+85=175{7 \brack 5} = 6 \cdot 15 + 85 = 175, [76]=6+15=21{7 \brack 6} = 6 + 15 = 21 and [77]=1{7 \brack 7} = 1. The sum is 5040=7!5040 = 7!, as it must be.

Exercise 8.2-2. A permutation of {1,…,n}\{1, \dots, n\} with n−3n - 3 cycles has the sum of (length −1- 1) over its cycles equal to 33. So its cycles of length at least 22 are one cycle of length 44, or a cycle of length 33 and one of length 22, or three cycles of length 22. Let jj be the number of elements that they move, so j=4j = 4, 55 or 66, with (nj)\binom{n}{j} choices of these elements. On 44 given elements there are 3!=63! = 6 cycles of length 44. On 55 given elements there are (53)⋅2=20\binom53 \cdot 2 = 20 ways to make a 33-cycle and a 22-cycle, since a set of 33 elements carries 22 cycles. On 66 given elements there are 1515 ways to make three 22-cycles. All other elements are fixed points. So [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=5n = 5 this is 30+20=5030 + 20 = 50, and the table gives [52]=50{5 \brack 2} = 50.

Exercise 8.2-3. Put x=2x = 2 in xn‾=∑k[nk]xkx^{\overline{n}} = \sum_k {n \brack k}x^k. The left side is 2⋅3⋯(n+1)=(n+1)!2 \cdot 3 \cdots (n+1) = (n+1)!.

Exercise 8.2-4. Put x=−1x = -1 in the same identity. The left side is (−1)(−1+1)⋯(−1+n−1)(-1)(-1+1)\cdots(-1+n-1), which has the factor 00 when n≥2n \ge 2. So ∑k(−1)k[nk]=0\sum_k (-1)^k{n \brack k} = 0 for n≥2n \ge 2. For n=0n = 0 the sum is [00]=1{0 \brack 0} = 1, and for n=1n = 1 it is −[11]=−1-{1 \brack 1} = -1. So for n≥2n \ge 2 the permutations with an even number of cycles and those with an odd number are equally many.

Exercise 8.2-5. The cycle lengths add up to 55, and there are 33 cycles. So the type is (3,1,1)(3, 1, 1) or (2,2,1)(2, 2, 1). For (3,1,1)(3, 1, 1) choose the 33 elements of the long cycle in (53)=10\binom53 = 10 ways, and make a cycle on them in 22 ways: 2020 permutations. For (2,2,1)(2, 2, 1) choose the fixed point in 55 ways and split the other 44 elements into two pairs in 33 ways: 1515 permutations. The total is 35=[53]35 = {5 \brack 3}.

Exercise 8.2-6. The coefficient of x3x^3 in xn+1‾=x(x+1)⋯(x+n)x^{\overline{n+1}} = x(x+1)\cdots(x+n) is [n+13]{n+1 \brack 3}. This is the coefficient of x2x^2 in (x+1)(x+2)⋯(x+n)(x+1)(x+2)\cdots(x+n), that is, the sum of the products ∏k∉{i,j}k\prod_{k \notin \{i, j\}}k over the pairs i<ji < j in {1,…,n}\{1, \dots, n\}. Each such product is n!ij\frac{n!}{ij}. So [n+13]=n!∑1≤i<j≤n1ij=n!2((∑i1i)2−∑i1i2)=n!2(Hn2−Hn(2)).{n+1 \brack 3} = n!\sum_{1 \le i < j \le n}\frac{1}{ij} = \frac{n!}{2}\left(\Bigl(\sum_i \frac1i\Bigr)^2 - \sum_i \frac{1}{i^2}\right) = \frac{n!}{2}\left(H_n^2 - H_n^{(2)}\right). For n=3n = 3: H3=116H_3 = \frac{11}{6} and H3(2)=4936H_3^{(2)} = \frac{49}{36}, so the right side is 3(12136−4936)=63\left(\frac{121}{36} - \frac{49}{36}\right) = 6, and [43]=6{4 \brack 3} = 6. For n=0n = 0 and n=1n = 1 both sides are 00.

Exercise 8.2-7. Put x=nx = n in xn‾=∑k[nk](−1)n−kxkx^{\underline{n}} = \sum_k {n \brack k}(-1)^{n-k}x^k. The left side is n(n−1)⋯1=n!n(n-1)\cdots1 = n!.

Section 8.3: Inversion and identities

Exercise 8.3-1. The second relation with n=4n = 4 and m=2m = 2 is ∑k{4k}[k2](−1)4−k\sum_k {4 \brace k}{k \brack 2}(-1)^{4-k}. The terms with k=2,3,4k = 2, 3, 4 are 7⋅17 \cdot 1, −6⋅3-6 \cdot 3 and 1⋅111 \cdot 11; the others are zero. The sum is 7−18+11=0=[2=4]7 - 18 + 11 = 0 = [2 = 4].

Exercise 8.3-2. By Stirling inversion with g(n)=1g(n) = 1, the condition holds exactly for the one sequence f(n)=∑k[nk](−1)n−kf(n) = \sum_k {n \brack k}(-1)^{n-k}. This sum is xn‾x^{\underline{n}} at x=1x = 1, which is 11 for n=0n = 0 and n=1n = 1 and 00 for n≥2n \ge 2, because of the factor 1−11 - 1. So f(k)=[k≤1]f(k) = [k \le 1] is the only solution. Check: ∑k{nk}[k≤1]={n0}+{n1}=1\sum_k {n \brace k}[k \le 1] = {n \brace 0} + {n \brace 1} = 1 for every n≥0n \ge 0.

Exercise 8.3-3. The second sum along a column with n=5n = 5 and m=2m = 2 is {63}=∑k=05{k2}35−k=1⋅27+3⋅9+7⋅3+15⋅1=27+27+21+15=90.{6 \brace 3} = \sum_{k=0}^{5}{k \brace 2}3^{5-k} = 1 \cdot 27 + 3 \cdot 9 + 7 \cdot 3 + 15 \cdot 1 = 27 + 27 + 21 + 15 = 90.

Exercise 8.3-4. For m=1m = 1 the left side is ∑k(1−n1+k)(1+nn+k){1+kk}\sum_k \binom{1-n}{1+k}\binom{1+n}{n+k}{1+k \brace k}. A term with k≤−2k \le -2 has the lower index 1+k<01 + k < 0 in the first factor, so it is 00. For k=−1k = -1 and k=0k = 0 the factor {1+kk}{1+k \brace k} is {0−1}=0{0 \brace -1} = 0 or {10}=0{1 \brace 0} = 0. For k≥2k \ge 2 the second factor is (n+1n+k)=0\binom{n+1}{n+k} = 0, since n+k>n+1≥0n + k > n + 1 \ge 0. Only k=1k = 1 remains, with the value (1−n2)(n+1n+1){21}=(1−n)(−n)2=(n2)\binom{1-n}{2}\binom{n+1}{n+1}{2 \brace 1} = \frac{(1-n)(-n)}{2} = \binom{n}{2}. The right side is [nn−1]=(n2){n \brack n-1} = \binom{n}{2}. The dual form with [1+kk]{1+k \brack k} and {nn−1}{n \brace n-1} works the same way, since [21]=1{2 \brack 1} = 1 and {nn−1}=(n2){n \brace n-1} = \binom{n}{2}.

Exercise 8.3-5. By the definition of the extended numbers, {−3−5}=[53]=35{-3 \brace -5} = {5 \brack 3} = 35 and [−2−4]={42}=7{-2 \brack -4} = {4 \brace 2} = 7. The recurrence of the first kind at n=−1n = -1 and k=−3k = -3 says [−1−3]=−2[−2−3]+[−2−4]{-1 \brack -3} = -2{-2 \brack -3} + {-2 \brack -4}. Here [−1−3]={31}=1{-1 \brack -3} = {3 \brace 1} = 1 and [−2−3]={32}=3{-2 \brack -3} = {3 \brace 2} = 3, so the right side is −6+7=1-6 + 7 = 1, which agrees.

Exercise 8.3-6. The first sum along a column with m=1m = 1 gives [n+12]=∑k=0n[k1]n!k!{n+1 \brack 2} = \sum_{k=0}^{n}{k \brack 1}\frac{n!}{k!}. The term with k=0k = 0 is 00, and [k1]=(k−1)!{k \brack 1} = (k-1)! for k≥1k \ge 1. So [n+12]=∑k=1n(k−1)! n!k!=n!∑k=1n1k=n! Hn.{n+1 \brack 2} = \sum_{k=1}^{n}(k-1)!\,\frac{n!}{k!} = n!\sum_{k=1}^{n}\frac1k = n!\,H_n.

Exercise 8.3-7. Expand xn‾x^{\overline{n}} in powers by Section 8.2, and each power in falling powers by Section 8.1: xn‾=∑j[nj]xj=∑j[nj]∑k{jk}xk‾=∑kL(n,k)xk‾.x^{\overline{n}} = \sum_j {n \brack j}x^j = \sum_j {n \brack j}\sum_k {j \brace k}x^{\underline{k}} = \sum_k L(n, k)x^{\underline{k}}. For the closed form, let n≥1n \ge 1. Then xn‾/n!=(x+n−1n)x^{\overline{n}}/n! = \binom{x+n-1}{n}, and Vandermonde's convolution with r=n−1r = n - 1 and s=xs = x gives (x+n−1n)=∑k(n−1n−k)(xk)=∑k(n−1k−1)xk‾k!,\binom{x+n-1}{n} = \sum_k \binom{n-1}{n-k}\binom{x}{k} = \sum_k \binom{n-1}{k-1}\frac{x^{\underline{k}}}{k!}, where the last step uses the symmetry of (n−1n−k)\binom{n-1}{n-k}, which is valid because n−1≥0n - 1 \ge 0. So xn‾=∑k(n−1k−1)n!k!xk‾x^{\overline{n}} = \sum_k \binom{n-1}{k-1}\frac{n!}{k!}x^{\underline{k}}. A polynomial has only one expansion in falling powers, so L(n,k)=(n−1k−1)n!k!L(n, k) = \binom{n-1}{k-1}\frac{n!}{k!}. For n=4n = 4 the values for k=1,…,4k = 1, \dots, 4 are 2424, 3636, 1212 and 11.

Section 8.4: Eulerian numbers

Exercise 8.4-1. The row n=5n = 5 is 1,26,66,26,11, 26, 66, 26, 1. The recurrence ⟨6k⟩=(k+1)⟨5k⟩+(6−k)⟨5k−1⟩\left\langle {6 \atop k} \right\rangle = (k+1)\left\langle {5 \atop k} \right\rangle + (6-k)\left\langle {5 \atop k-1} \right\rangle gives 11 for k=0k = 0, 2⋅26+5⋅1=572 \cdot 26 + 5 \cdot 1 = 57 for k=1k = 1, 3⋅66+4⋅26=3023 \cdot 66 + 4 \cdot 26 = 302 for k=2k = 2, 4⋅26+3⋅66=3024 \cdot 26 + 3 \cdot 66 = 302 for k=3k = 3, 5⋅1+2⋅26=575 \cdot 1 + 2 \cdot 26 = 57 for k=4k = 4 and 0+1⋅1=10 + 1 \cdot 1 = 1 for k=5k = 5. The sum is 1+57+302+302+57+1=720=6!1 + 57 + 302 + 302 + 57 + 1 = 720 = 6!.

Exercise 8.4-2. A permutation with exactly one ascent is a decreasing list followed by another decreasing list, with an ascent between them. The 1111 permutations are 1432, 2143, 2431, 3142, 3214, 3241, 3421, 4132, 4213, 4231, 4312.1432,\ 2143,\ 2431,\ 3142,\ 3214,\ 3241,\ 3421,\ 4132,\ 4213,\ 4231,\ 4312. In each of them the ascent is at one place: for example 31423142 has the ascent 1<41 < 4 and the descents 3>13 > 1 and 4>24 > 2.

Exercise 8.4-3. The explicit formula with k=1k = 1 gives ⟨n1⟩=2n−(n+11)1n=2n−n−1\left\langle {n \atop 1} \right\rangle = 2^n - \binom{n+1}{1}1^n = 2^n - n - 1. A count gives the same result. For each subset AA of {1,…,n}\{1, \dots, n\}, write the elements of AA in decreasing order and then the other elements in decreasing order. This gives 2n2^n lists, and each list has at most one ascent, at the join. A permutation with exactly one ascent comes from exactly one AA, the set of entries before the ascent. The decreasing permutation n…21n \dots 21 comes from the n+1n + 1 sets A={n,n−1,…,n−j+1}A = \{n, n-1, \dots, n-j+1\} with 0≤j≤n0 \le j \le n. So ⟨n1⟩=2n−(n+1)\left\langle {n \atop 1} \right\rangle = 2^n - (n + 1).

Exercise 8.4-4. The row n=2n = 2 is ⟨20⟩=⟨21⟩=1\left\langle {2 \atop 0} \right\rangle = \left\langle {2 \atop 1} \right\rangle = 1, so the corollary gives ∑0≤x<Nx2=(N3)+(N+13)=N(N−1)((N−2)+(N+1))6=(N−1)N(2N−1)6.\sum_{0 \le x < N}x^2 = \binom{N}{3} + \binom{N+1}{3} = \frac{N(N-1)\bigl((N-2) + (N+1)\bigr)}{6} = \frac{(N-1)N(2N-1)}{6}. For N=4N = 4 this is 4+10=14=0+1+4+94 + 10 = 14 = 0 + 1 + 4 + 9.

Exercise 8.4-5. The runs end exactly at the descents and at the last entry, so a permutation with rr runs has r−1r - 1 descents. The map a↦n+1−aa \mapsto n + 1 - a of the proof of symmetry turns descents into ascents, so the number of permutations with r−1r - 1 descents equals the number with r−1r - 1 ascents, which is ⟨nr−1⟩\left\langle {n \atop r-1} \right\rangle.

Exercise 8.4-6. By the symmetry, ∑kk⟨nk⟩=∑k(n−1−k)⟨nk⟩\sum_k k\left\langle {n \atop k} \right\rangle = \sum_k (n-1-k)\left\langle {n \atop k} \right\rangle. Add the two forms: 2∑kk⟨nk⟩=(n−1)∑k⟨nk⟩=(n−1) n!2\sum_k k\left\langle {n \atop k} \right\rangle = (n-1)\sum_k \left\langle {n \atop k} \right\rangle = (n-1)\,n!. So the sum is n! (n−1)2\frac{n!\,(n-1)}{2}, and the mean number of ascents is n−12\frac{n-1}{2}. Another way: each of the n−1n - 1 places is an ascent in exactly half of the permutations, since the swap of the two entries at that place changes an ascent there into a descent.

Exercise 8.4-7. The values m!{4m}m!{4 \brace m} for m=0,…,4m = 0, \dots, 4 are 00, 11, 1414, 3636 and 2424. The second identity with n=4n = 4 and k=1k = 1 is ⟨41⟩=∑mm!{4m}(4−m1)(−1)3−m=1⋅3−14⋅2+36⋅1−24⋅0=3−28+36=11.\left\langle {4 \atop 1} \right\rangle = \sum_m m!{4 \brace m}\binom{4-m}{1}(-1)^{3-m} = 1 \cdot 3 - 14 \cdot 2 + 36 \cdot 1 - 24 \cdot 0 = 3 - 28 + 36 = 11.

This chapter has a full solution of each exercise of the volume, one file per chapter. Exercise kk of Section c.sc.s is called Exercise c.sc.s-kk. Try an exercise for some time before you read its solution. Each solution gives the steps that a reader at the level of the rating needs, and many of them end with a check by small cases.

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