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

Finite calculus

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. Differences, falling powers and definite sums
  2. Summation by parts and the harmonic numbers
  3. Difference tables and Newton's formula

Differences, falling powers and definite sums

Statement

In this section a function is a map ff from a set DD of real or complex numbers to the complex numbers, where DD contains x+1x + 1 for each x∈Dx \in D. The main cases are D=ℤD = \mathbb{Z}, D=ℝD = \mathbb{R}, and DD equal to a coset x0+ℤx_0 + \mathbb{Z}. The section defines the difference operator, finds the functions that it treats as simply as the derivative treats xmx^m, and proves the fundamental theorem that turns a sum into a difference of two values.

Definition P2.3.1 (difference and shift operators). Let ff be a function. The difference of ff is the function Δf\Delta f with Δf(x)=f(x+1)−f(x)\Delta f(x) = f(x+1) - f(x). The shift of ff is the function EfE f with Ef(x)=f(x+1)E f(x) = f(x+1). Write II for the identity operator, If=fI f = f. Then Δ=E−I\Delta = E - I. The powers of the operators are their iterates: Δ0f=f\Delta^0 f = f, Δn+1f=Δ(Δnf)\Delta^{n+1} f = \Delta(\Delta^n f), and Enf(x)=f(x+n)E^n f(x) = f(x+n) for n≥0n \ge 0.

Lean: Mathlib fwdDiff h f, with the notation Δ_[h] f and the value f (n + h) - f n; the operator of this section is Δ_[1], and its iterate is Δ_[1]^[n].

Example P2.3.2. Let f(x)=x2f(x) = x^2. Then Δf(x)=(x+1)2−x2=2x+1\Delta f(x) = (x+1)^2 - x^2 = 2x + 1, Δ2f(x)=2(x+1)+1−(2x+1)=2\Delta^2 f(x) = 2(x+1) + 1 - (2x+1) = 2 and Δ3f=0\Delta^3 f = 0. The derivative of x2x^2 is 2x2x, not 2x+12x + 1. So the ordinary powers do not behave well under Δ\Delta. The falling powers below repair this.

Example P2.3.3. Let cc be a number and f(x)=cxf(x) = c^x on the integers. Then Δf(x)=cx+1−cx=(c−1)cx\Delta f(x) = c^{x+1} - c^x = (c - 1) c^x. For c=2c = 2 this gives Δ2x=2x\Delta 2^x = 2^x. So 2x2^x plays the part that exe^x plays in calculus: it is equal to its own difference. For c=1c = 1 the function is constant and its difference is 00.

Proposition P2.3.4 (rules of the difference operator). Let ff and gg be functions on DD and let aa, bb be constants. Then:

  1. Δ(af+bg)=aΔf+bΔg\Delta(af + bg) = a \Delta f + b \Delta g, and the same holds for EE.
  2. Δc=0\Delta c = 0 for a constant function cc.
  3. ΔE=EΔ\Delta E = E \Delta, so ΔmEn=EnΔm\Delta^m E^n = E^n \Delta^m for all m,n≥0m, n \ge 0.
  4. If D=ℤD = \mathbb{Z} and Δf=0\Delta f = 0, then ff is constant.

Lean: Mathlib fwdDiff_add, fwdDiff_const_smul and fwdDiff_const (proved in Mathlib).

Proof. For part 1, Δ(af+bg)(x)=af(x+1)+bg(x+1)−af(x)−bg(x)=aΔf(x)+bΔg(x)\Delta(af + bg)(x) = af(x+1) + bg(x+1) - af(x) - bg(x) = a \Delta f(x) + b \Delta g(x). Part 2 is c−c=0c - c = 0. For part 3, both ΔEf(x)\Delta E f(x) and EΔf(x)E \Delta f(x) are equal to f(x+2)−f(x+1)f(x+2) - f(x+1). The general form follows by induction on m+nm + n. For part 4, Δf=0\Delta f = 0 says f(x+1)=f(x)f(x+1) = f(x) for every integer xx. Induction upward from 00 gives f(n)=f(0)f(n) = f(0) for n≥0n \ge 0, and induction downward gives f(−n)=f(0)f(-n) = f(0) for n≥0n \ge 0. □\square

Part 4 needs D=ℤD = \mathbb{Z}. On D=ℝD = \mathbb{R} the function sin⁡2πx\sin 2\pi x has difference 00 and is not constant. A function with Δf=0\Delta f = 0 on ℝ\mathbb{R} is exactly a function of period 11.

Definition P2.3.5 (falling and rising powers). Let xx be a number and m≥0m \ge 0 an integer. The falling power xm‾x^{\underline{m}} ("xx to the mm falling") and the rising power xm‾x^{\overline{m}} ("xx to the mm rising") are the products

xm‾=∏0≤j<m(x−j)=x(x−1)⋯(x−m+1),xm‾=∏0≤j<m(x+j)=x(x+1)⋯(x+m−1).x^{\underline{m}} = \prod_{0 \le j < m} (x - j) = x(x-1)\cdots(x-m+1), \qquad x^{\overline{m}} = \prod_{0 \le j < m} (x + j) = x(x+1)\cdots(x+m-1).

For m=0m = 0 each product is empty, so x0‾=x0‾=1x^{\underline{0}} = x^{\overline{0}} = 1. These are equations 1.2.5(18) and 1.2.5(19) of TAOCP. Both are polynomials in xx of degree mm with leading coefficient 11.

Lean: Mathlib descPochhammer R m and ascPochhammer R m (the polynomials), with Nat.descFactorial n m and Nat.ascFactorial on the natural numbers; descPochhammer_eval_eq_descFactorial links the two (proved in Mathlib).

Example P2.3.6. Let x=7x = 7 and m=3m = 3. Then 73‾=7⋅6⋅5=2107^{\underline{3}} = 7 \cdot 6 \cdot 5 = 210 and 73‾=7⋅8⋅9=5047^{\overline{3}} = 7 \cdot 8 \cdot 9 = 504. The number 73‾7^{\underline{3}} counts the ordered lists of 33 different objects chosen from 77: there are 77 choices for the first, 66 for the second and 55 for the third. For each n≥0n \ge 0 the definitions give nn‾=n!n^{\underline{n}} = n! and 1n‾=n!1^{\overline{n}} = n!.

Example P2.3.7. Expand the products: x2‾=x2−xx^{\underline{2}} = x^2 - x, x3‾=x3−3x2+2xx^{\underline{3}} = x^3 - 3x^2 + 2x and x3‾=x3+3x2+2xx^{\overline{3}} = x^3 + 3x^2 + 2x. Let nn and mm be integers with 0≤n<m0 \le n < m. Then the product nm‾n^{\underline{m}} contains the factor n−n=0n - n = 0, so nm‾=0n^{\underline{m}} = 0. For example 35‾=3⋅2⋅1⋅0⋅(−1)=03^{\underline{5}} = 3 \cdot 2 \cdot 1 \cdot 0 \cdot (-1) = 0. In contrast, (−3)2‾=(−3)(−4)=12(-3)^{\underline{2}} = (-3)(-4) = 12, since a negative xx never meets a zero factor.

Proposition P2.3.8 (falling and rising powers). Let xx be a number and m≥0m \ge 0 an integer. Then

xm‾=(x+m−1)m‾=(−1)m(−x)m‾,xm‾=(x−m+1)m‾=(−1)m(−x)m‾.x^{\overline{m}} = (x + m - 1)^{\underline{m}} = (-1)^m (-x)^{\underline{m}}, \qquad x^{\underline{m}} = (x - m + 1)^{\overline{m}} = (-1)^m (-x)^{\overline{m}}.

If x=nx = n is an integer with n≥mn \ge m, then nm‾=n!/(n−m)!n^{\underline{m}} = n!/(n-m)!. If x=n≥1x = n \ge 1, then nm‾=(n+m−1)!/(n−1)!n^{\overline{m}} = (n + m - 1)!/(n-1)!.

Lean: Mathlib descPochhammer_eval_eq_ascPochhammer (the shift form), ascPochhammer_eval_neg_eq_descPochhammer (the sign form) and Nat.descFactorial_eq_div (the quotient of factorials); all proved in Mathlib.

Proof. The factors of xm‾x^{\overline{m}} are x,x+1,…,x+m−1x, x+1, \dots, x+m-1. Read from the top they are (x+m−1),(x+m−1)−1,…,(x+m−1)−(m−1)(x+m-1), (x+m-1) - 1, \dots, (x+m-1) - (m-1), which are the factors of (x+m−1)m‾(x+m-1)^{\underline{m}}. Also x+j=(−1)(−x−j)x + j = (-1)(-x - j) for each jj, so the product of the mm factors x+jx + j is (−1)m(-1)^m times the product of the factors −x−j-x - j, which is (−x)m‾(-x)^{\underline{m}}. The second chain follows from the first: put x−m+1x - m + 1 for xx in the first equation, and put −x-x for xx in the second. For the factorials, n!=nm‾⋅(n−m)!n! = n^{\underline{m}} \cdot (n-m)!, since the first mm factors of n(n−1)⋯1n(n-1)\cdots 1 form nm‾n^{\underline{m}} and the rest form (n−m)!(n-m)!. The formula for nm‾n^{\overline{m}} follows from nm‾=(n+m−1)m‾n^{\overline{m}} = (n+m-1)^{\underline{m}}. □\square

The proposition is equation 1.2.5(20). The quotient x!/(x−m)!x!/(x-m)! in equation 1.2.5(21) uses the factorial of a noninteger, which is the gamma function: x!=Γ(x+1)x! = \Gamma(x+1). P5 treats the gamma function. This chapter needs only integer exponents, and for those the products above are enough.

Definition P2.3.9 (falling powers with negative exponents). Let m≥1m \ge 1 be an integer and let xx be a number that is not one of −1,−2,…,−m-1, -2, \dots, -m. Then

x−m‾=1(x+1)(x+2)⋯(x+m),x−m‾=1(x−1)(x−2)⋯(x−m),x^{\underline{-m}} = \frac{1}{(x+1)(x+2)\cdots(x+m)}, \qquad x^{\overline{-m}} = \frac{1}{(x-1)(x-2)\cdots(x-m)},

where the second needs x∉{1,…,m}x \notin \{1, \dots, m\}.

Lean: not yet stated; Mathlib has descPochhammer only for exponents in ℕ\mathbb{N}.

Example P2.3.10. The first cases are x−1‾=1/(x+1)x^{\underline{-1}} = 1/(x+1) and x−2‾=1/((x+1)(x+2))x^{\underline{-2}} = 1/((x+1)(x+2)). For x=3x = 3 these are 1/41/4 and 1/201/20. For x=0x = 0 the definition gives 0−m‾=1/m!0^{\underline{-m}} = 1/m!. So 0m‾0^{\underline{m}} is 11 for m=0m = 0 and 00 for m>0m > 0, but it is 1/m!1/m! for m<0m < 0.

Example P2.3.11. The definition is the one that keeps a law of exponents. Multiply x3‾=x(x−1)(x−2)x^{\underline{3}} = x(x-1)(x-2) by (x−3)−2‾=1/((x−2)(x−1))(x-3)^{\underline{-2}} = 1/((x-2)(x-1)). The product is x=x1‾x = x^{\underline{1}}, and 1=3+(−2)1 = 3 + (-2). The next theorem proves this law in general. The plain rule xm‾xn‾=xm+n‾x^{\underline{m}} x^{\underline{n}} = x^{\underline{m+n}} is false: x1‾x1‾=x2x^{\underline{1}} x^{\underline{1}} = x^2, but x2‾=x2−xx^{\underline{2}} = x^2 - x.

Theorem P2.3.12 (law of exponents for falling powers). For all integers mm and nn,

xm+n‾=xm‾ (x−m)n‾,x^{\underline{m+n}} = x^{\underline{m}} \, (x - m)^{\underline{n}},

for each number xx at which the three falling powers are defined.

Lean: Mathlib descPochhammer_mul gives the case m,n≥0m, n \ge 0 as an identity of polynomials (proved in Mathlib); the case of negative exponents is not yet stated.

Proof. First, the step rule xk‾=(x−k+1) xk−1‾x^{\underline{k}} = (x - k + 1) \, x^{\underline{k-1}} holds for every integer kk, as an identity of rational functions of xx. For k≥1k \ge 1 it is the definition: the last factor of xk‾x^{\underline{k}} is x−k+1x - k + 1. For k=0k = 0 it says 1=(x+1)⋅1x+11 = (x+1) \cdot \frac{1}{x+1}. For k=−jk = -j with j≥1j \ge 1 it says 1(x+1)⋯(x+j)=(x+j+1)⋅1(x+1)⋯(x+j+1)\frac{1}{(x+1)\cdots(x+j)} = (x + j + 1) \cdot \frac{1}{(x+1)\cdots(x+j+1)}, which is true.

Now fix mm and use induction on nn, upward and downward from 00. For n=0n = 0 the claim is xm‾=xm‾x^{\underline{m}} = x^{\underline{m}}. Suppose the claim holds for nn. The step rule for xx and k=m+n+1k = m + n + 1, then the claim for nn, then the step rule for x−mx - m and k=n+1k = n + 1 give

xm+n+1‾=(x−m−n) xm+n‾=xm‾⋅(x−m−n)(x−m)n‾=xm‾(x−m)n+1‾.x^{\underline{m+n+1}} = (x - m - n) \, x^{\underline{m+n}} = x^{\underline{m}} \cdot (x - m - n)(x - m)^{\underline{n}} = x^{\underline{m}} (x - m)^{\underline{n+1}}.

For the downward step, the same two step rules, read from right to left, give xm+n−1‾=xm+n‾/(x−m−n+1)x^{\underline{m+n-1}} = x^{\underline{m+n}}/(x - m - n + 1) and (x−m)n−1‾=(x−m)n‾/(x−m−n+1)(x-m)^{\underline{n-1}} = (x-m)^{\underline{n}}/(x - m - n + 1) as rational functions. Divide the claim for nn by x−m−n+1x - m - n + 1 to get the claim for n−1n - 1. So the law holds as an identity of rational functions. Two rational functions that are equal take equal values at each xx where both are defined, which proves the law for numbers. □\square

Theorem P2.3.13 (difference of a falling power). For every integer mm,

Δxm‾=m xm−1‾,\Delta x^{\underline{m}} = m \, x^{\underline{m-1}},

at each xx where xm‾x^{\underline{m}} and (x+1)m‾(x+1)^{\underline{m}} are defined. In the same way Δxm‾=m(x+1)m−1‾\Delta x^{\overline{m}} = m (x+1)^{\overline{m-1}} for m≥1m \ge 1.

Lean: for m≥1m \ge 1 the identity of polynomials follows from descPochhammer_succ_eval and descPochhammer_mul; the form for binomial coefficients is fwdDiff_choose (proved in Mathlib). The statement for all integers mm is not yet stated.

Proof. Apply the law of exponents twice, once with the split m=1+(m−1)m = 1 + (m-1) at the point x+1x + 1 and once with the split m=(m−1)+1m = (m-1) + 1 at the point xx:

(x+1)m‾=(x+1) xm−1‾,xm‾=xm−1‾ (x−m+1).(x+1)^{\underline{m}} = (x+1) \, x^{\underline{m-1}}, \qquad x^{\underline{m}} = x^{\underline{m-1}} \, (x - m + 1).

Subtract: Δxm‾=xm−1‾((x+1)−(x−m+1))=m xm−1‾\Delta x^{\underline{m}} = x^{\underline{m-1}} \bigl((x+1) - (x - m + 1)\bigr) = m \, x^{\underline{m-1}}. For the rising power, (x+1)m‾(x+1)^{\overline{m}} and xm‾x^{\overline{m}} share the m−1m - 1 factors (x+1)⋯(x+m−1)(x+1)\cdots(x+m-1), and the remaining factors are x+mx + m and xx. So Δxm‾=(x+1)m−1‾((x+m)−x)=m(x+1)m−1‾\Delta x^{\overline{m}} = (x+1)^{\overline{m-1}} \bigl((x+m) - x\bigr) = m (x+1)^{\overline{m-1}}. □\square

The theorem is the discrete form of ddxxm=mxm−1\frac{d}{dx} x^m = m x^{m-1}. It holds for negative mm too. For m=−1m = -1 it reads Δ1x+1=1x+2−1x+1=−1(x+1)(x+2)=−x−2‾\Delta \frac{1}{x+1} = \frac{1}{x+2} - \frac{1}{x+1} = \frac{-1}{(x+1)(x+2)} = -x^{\underline{-2}}, which agrees.

Definition P2.3.14 (binomial coefficient). For a number xx and an integer mm, the binomial coefficient is (xm)=xm‾/m!\binom{x}{m} = x^{\underline{m}}/m! when m≥0m \ge 0 and (xm)=0\binom{x}{m} = 0 when m<0m < 0. This is the definition of TAOCP 1.2.6(3). Chapter 6 develops it.

Lean: TAOCP.binom r k in TAOCP/Notation (tamnd/taocp-lean main), for rr in a field and k∈ℤk \in \mathbb{Z}, with the bridge TAOCP.binom_natCast to Mathlib Nat.choose; Mathlib also has Ring.choose for a binomial ring.

Example P2.3.15. The coefficient (73)=210/6=35\binom{7}{3} = 210/6 = 35 counts the subsets of size 33 of a set of 77 elements: each subset gives 3!=63! = 6 ordered lists. For x=1/2x = 1/2, (1/22)=(1/2)(−1/2)2=−18\binom{1/2}{2} = \frac{(1/2)(-1/2)}{2} = -\frac{1}{8}, so the upper index need not be an integer.

Example P2.3.16. For 0≤n<m0 \le n < m the coefficient (nm)\binom{n}{m} is 00, since nm‾=0n^{\underline{m}} = 0. Also (x0)=1\binom{x}{0} = 1 and (x1)=x\binom{x}{1} = x for every xx, and (−1m)=(−1)(−2)⋯(−m)/m!=(−1)m\binom{-1}{m} = (-1)(-2)\cdots(-m)/m! = (-1)^m for m≥0m \ge 0.

Corollary P2.3.17 (difference of a binomial coefficient). For every number xx and every integer mm, Δ(xm)=(xm−1)\Delta \binom{x}{m} = \binom{x}{m-1}; that is, (x+1m)=(xm)+(xm−1)\binom{x+1}{m} = \binom{x}{m} + \binom{x}{m-1}.

Lean: Mathlib fwdDiff_choose and Nat.choose_succ_succ' for natural numbers, Ring.choose_succ_succ in a binomial ring (proved in Mathlib).

Proof. For m≥1m \ge 1 divide the theorem by m!m!: Δ(xm)=m xm−1‾/m!=xm−1‾/(m−1)!=(xm−1)\Delta \binom{x}{m} = m \, x^{\underline{m-1}}/m! = x^{\underline{m-1}}/(m-1)! = \binom{x}{m-1}. For m=0m = 0 both sides are 00, since (x0)=1\binom{x}{0} = 1 is constant and (x−1)=0\binom{x}{-1} = 0. For m<0m < 0 both sides are 00. □\square

The corollary is the addition formula for binomial coefficients, Pascal's rule, here proved for every upper index xx.

Definition P2.3.18 (indefinite and definite sums). Let ff be a function. A function gg is an indefinite sum of ff if Δg=f\Delta g = f. For integers aa and bb and a function ff on ℤ\mathbb{Z}, the definite sum of ff from aa to bb is

∑abf(x) δx={∑a≤k<bf(k),a≤b,−∑b≤k<af(k),a>b.\sum\nolimits_a^b f(x) \, \delta x = \begin{cases} \sum_{a \le k < b} f(k), & a \le b, \\ -\sum_{b \le k < a} f(k), & a > b. \end{cases}

The upper limit bb is not in the range of the sum when a≤ba \le b. The form ∑a≤k<b\sum_{a \le k < b} is the natural one for finite calculus, as the next theorem shows.

Lean: Mathlib Finset.sum over Finset.Ico a b; Mathlib has no definite sum with the sign rule for a>ba > b, and the handbook does not state one yet.

Example P2.3.19. The function g(x)=x2‾/2=x(x−1)/2g(x) = x^{\underline{2}}/2 = x(x-1)/2 satisfies Δg(x)=x\Delta g(x) = x, by the theorem with m=2m = 2. So gg is an indefinite sum of xx. The definite sum ∑0nx δx=0+1+⋯+(n−1)\sum_0^n x \, \delta x = 0 + 1 + \cdots + (n-1) is n(n−1)/2n(n-1)/2, which the next theorem gives as g(n)−g(0)g(n) - g(0). For n=5n = 5 this is 10=0+1+2+3+410 = 0 + 1 + 2 + 3 + 4.

Example P2.3.20. The function 2x2^x is an indefinite sum of itself. So ∑0n2x δx=2n−20=2n−1\sum_0^n 2^x \, \delta x = 2^n - 2^0 = 2^n - 1, the geometric sum of Chapter 2. The sign rule gives ∑31f(x) δx=−(f(1)+f(2))\sum_3^1 f(x) \, \delta x = -(f(1) + f(2)), so that ∑13+∑31=0\sum_1^3 + \sum_3^1 = 0, as for integrals.

Theorem P2.3.21 (fundamental theorem of finite calculus). Let ff and gg be functions on ℤ\mathbb{Z}.

  1. If Δg=f\Delta g = f, then ∑abf(x) δx=g(b)−g(a)\sum_a^b f(x) \, \delta x = g(b) - g(a) for all integers aa and bb.
  2. The function G(x)=∑0xf(t) δtG(x) = \sum_0^x f(t) \, \delta t satisfies ΔG=f\Delta G = f, and each indefinite sum of ff is G+CG + C for a constant CC.
  3. For all integers aa, bb and cc, ∑abf(x) δx+∑bcf(x) δx=∑acf(x) δx\sum_a^b f(x) \, \delta x + \sum_b^c f(x) \, \delta x = \sum_a^c f(x) \, \delta x.

Lean: Mathlib Finset.sum_range_sub gives part 1 for a=0≤ba = 0 \le b (proved in Mathlib); Finset.sum_Ico_sub gives the form on Finset.Ico a b for 0≤a≤b0 \le a \le b.

Proof. For part 1 with a≤ba \le b, the sum ∑a≤k<b(g(k+1)−g(k))\sum_{a \le k < b} (g(k+1) - g(k)) telescopes (Chapter 1): each g(k)g(k) with a<k<ba < k < b appears once with each sign, and g(b)−g(a)g(b) - g(a) is left. For a>ba > b, the definition and the case just proved give −∑b≤k<af(k)=−(g(a)−g(b))=g(b)−g(a)-\sum_{b \le k < a} f(k) = -(g(a) - g(b)) = g(b) - g(a). Part 3 follows from part 1 for any indefinite sum gg, if one exists; so prove part 2 first, directly. Let x≥0x \ge 0. Then G(x+1)−G(x)=∑0≤k<x+1f(k)−∑0≤k<xf(k)=f(x)G(x+1) - G(x) = \sum_{0 \le k < x+1} f(k) - \sum_{0 \le k < x} f(k) = f(x). Let x<0x < 0. Then G(x)=−∑x≤k<0f(k)G(x) = -\sum_{x \le k < 0} f(k) and G(x+1)=−∑x+1≤k<0f(k)G(x+1) = -\sum_{x+1 \le k < 0} f(k), so again G(x+1)−G(x)=f(x)G(x+1) - G(x) = f(x). If Δg=f\Delta g = f too, then Δ(g−G)=0\Delta(g - G) = 0, and g−Gg - G is constant by the rules of the difference operator. Now part 3 is (g(b)−g(a))+(g(c)−g(b))=g(c)−g(a)(g(b) - g(a)) + (g(c) - g(b)) = g(c) - g(a) with g=Gg = G. □\square

Corollary P2.3.22 (sums of falling powers). Let a≤ba \le b be integers and let m≠−1m \ne -1 be an integer. If m<−1m < -1, assume that a≥0a \ge 0. Then

∑a≤k<bkm‾=bm+1‾−am+1‾m+1.\sum_{a \le k < b} k^{\underline{m}} = \frac{b^{\underline{m+1}} - a^{\underline{m+1}}}{m+1}.

In particular ∑0≤k<nkm‾=nm+1‾/(m+1)\sum_{0 \le k < n} k^{\underline{m}} = n^{\underline{m+1}}/(m+1) for m≥0m \ge 0 and n≥0n \ge 0.

Lean: for m≥0m \ge 0 and natural numbers, the form with binomial coefficients is Mathlib Nat.sum_Icc_choose, and the case m=1m = 1 is Finset.sum_range_id_mul_two (both proved in Mathlib). The case m<0m < 0 is not yet stated.

Proof. By the theorem on the difference of a falling power, g(x)=xm+1‾/(m+1)g(x) = x^{\underline{m+1}}/(m+1) satisfies Δg(x)=xm‾\Delta g(x) = x^{\underline{m}}. For m≥0m \ge 0 this holds at every integer. For m<−1m < -1 the falling powers xm‾x^{\underline{m}} and xm+1‾x^{\underline{m+1}} are defined at every integer x≥0x \ge 0, and that is the range used when a≥0a \ge 0. The fundamental theorem gives the claim. □\square

The case m=−1m = -1 is the exception, just as ∫x−1 dx\int x^{-1} \, dx is the exception for integrals. Section 3.2 shows that the harmonic numbers fill this gap.

Corollary P2.3.23 (sums over the upper index). Let rr be a number and let m,n≥0m, n \ge 0 be integers. Then

∑0≤k≤n(km)=(n+1m+1),∑0≤k≤n(r+kk)=(r+n+1n).\sum_{0 \le k \le n} \binom{k}{m} = \binom{n+1}{m+1}, \qquad \sum_{0 \le k \le n} \binom{r + k}{k} = \binom{r + n + 1}{n}.

These are equations 1.2.6(11) and 1.2.6(10).

Lean: Mathlib Nat.sum_Icc_choose (the first identity) and Nat.sum_range_add_choose (the second for a natural number rr); both proved in Mathlib. The second for a real rr is not yet stated.

Proof. The corollary on the difference of a binomial coefficient, with m+1m + 1 in place of mm, says that (xm+1)\binom{x}{m+1} is an indefinite sum of (xm)\binom{x}{m}. The fundamental theorem gives ∑0≤k<n+1(km)=(n+1m+1)−(0m+1)=(n+1m+1)\sum_{0 \le k < n+1} \binom{k}{m} = \binom{n+1}{m+1} - \binom{0}{m+1} = \binom{n+1}{m+1}. For the second identity let g(k)=(r+kk−1)g(k) = \binom{r + k}{k - 1}. Then

Δg(k)=(r+k+1k)−(r+kk−1)=(r+kk),\Delta g(k) = \binom{r + k + 1}{k} - \binom{r + k}{k - 1} = \binom{r + k}{k},

by Pascal's rule (y+1k)=(yk)+(yk−1)\binom{y+1}{k} = \binom{y}{k} + \binom{y}{k-1} at y=r+ky = r + k. The fundamental theorem gives ∑0≤k<n+1(r+kk)=g(n+1)−g(0)=(r+n+1n)−(r−1)=(r+n+1n)\sum_{0 \le k < n+1} \binom{r+k}{k} = g(n+1) - g(0) = \binom{r+n+1}{n} - \binom{r}{-1} = \binom{r+n+1}{n}. □\square

Proof

All the proofs of the section rest on two facts. The first is the telescoping sum of Chapter 1, which is the fundamental theorem in disguise: a sum of differences is a difference. The second is the law of exponents for falling powers. Once that law holds for all integer exponents, the difference of xm‾x^{\underline{m}} is one line, because xm‾x^{\underline{m}} and (x+1)m‾(x+1)^{\underline{m}} share the factor xm−1‾x^{\underline{m-1}} and differ only in one end factor. In calculus the derivative of xmx^m needs the binomial theorem or a limit; here no limit appears and the computation is exact.

The negative falling powers are not a free choice. If the law of exponents is to hold for all integers, then x0‾=x−m‾(x+m)m‾x^{\underline{0}} = x^{\underline{-m}} (x + m)^{\underline{m}} forces x−m‾=1/(x+m)m‾x^{\underline{-m}} = 1/(x+m)^{\underline{m}}, which is the definition. Exercise 6 asks for this argument. The same remark explains why the law has the shift x−mx - m in its second factor: the falling power "uses up" the values x,x−1,…,x−m+1x, x-1, \dots, x-m+1, and the next factor must start at x−mx - m.

The method of the section for a sum ∑a≤k<bf(k)\sum_{a \le k < b} f(k) is: write ff as a combination of functions whose indefinite sums are known, then apply the fundamental theorem. The functions with known indefinite sums are so far xm‾x^{\underline{m}} for m≠−1m \ne -1, (xm)\binom{x}{m} and cxc^x for c≠1c \ne 1. Section 3.2 adds the products, and Section 3.3 shows how to write any polynomial in falling powers.

Examples

Example P2.3.24. Find ∑0≤k<nk(k−1)(k−2)\sum_{0 \le k < n} k(k-1)(k-2). The term is k3‾k^{\underline{3}}, so the corollary on sums of falling powers gives n4‾/4=n(n−1)(n−2)(n−3)/4n^{\underline{4}}/4 = n(n-1)(n-2)(n-3)/4. For n=5n = 5 the terms are 0,0,0,6,240, 0, 0, 6, 24, with sum 3030, and 5⋅4⋅3⋅2/4=305 \cdot 4 \cdot 3 \cdot 2/4 = 30.

Example P2.3.25. Find ∑0≤k<n1(k+1)(k+2)\sum_{0 \le k < n} \frac{1}{(k+1)(k+2)}. The term is k−2‾k^{\underline{-2}}, and m=−2m = -2, a=0a = 0. The corollary gives

∑0≤k<nk−2‾=n−1‾−0−1‾−1=1−1n+1=nn+1.\sum_{0 \le k < n} k^{\underline{-2}} = \frac{n^{\underline{-1}} - 0^{\underline{-1}}}{-1} = 1 - \frac{1}{n+1} = \frac{n}{n+1}.

For n=3n = 3 the sum is 12+16+112=34\frac{1}{2} + \frac{1}{6} + \frac{1}{12} = \frac{3}{4}, which agrees. As n→∞n \to \infty the sum tends to 11. In the same way ∑k≥0k−m‾=1(m−1)⋅(m−1)!\sum_{k \ge 0} k^{\underline{-m}} = \frac{1}{(m-1) \cdot (m-1)!} for each m≥2m \ge 2 (Exercise 9).

Example P2.3.26. Find ∑1≤k≤nk(k+1)\sum_{1 \le k \le n} k(k+1). The term is the rising power k2‾k^{\overline{2}}. By the proposition on falling and rising powers, k2‾=(k+1)2‾k^{\overline{2}} = (k+1)^{\underline{2}}, so the sum is ∑2≤j≤n+1j2‾\sum_{2 \le j \le n+1} j^{\underline{2}} with j=k+1j = k + 1. The corollary gives (n+2)3‾−23‾3=(n+2)(n+1)n3\frac{(n+2)^{\underline{3}} - 2^{\underline{3}}}{3} = \frac{(n+2)(n+1)n}{3}, since 23‾=02^{\underline{3}} = 0. For n=3n = 3: 2+6+12=20=5⋅4⋅3/32 + 6 + 12 = 20 = 5 \cdot 4 \cdot 3/3.

Example P2.3.27. Find ∑0≤k≤n(k+33)\sum_{0 \le k \le n} \binom{k+3}{3}. Here (k+33)=(k+3k)\binom{k+3}{3} = \binom{k+3}{k} for integers k≥0k \ge 0, so the second identity of the corollary on sums over the upper index with r=3r = 3 gives (n+4n)=(n+44)\binom{n+4}{n} = \binom{n+4}{4}. For n=2n = 2: 1+4+10=15=(64)1 + 4 + 10 = 15 = \binom{6}{4}. With r=1/2r = 1/2 the same identity gives (1/20)+(3/21)+(5/22)=(7/22)\binom{1/2}{0} + \binom{3/2}{1} + \binom{5/2}{2} = \binom{7/2}{2}, that is 1+32+158=3581 + \frac{3}{2} + \frac{15}{8} = \frac{35}{8}, which is true.

Example P2.3.28. The method also gives a sum that is not a polynomial. Let c≠1c \ne 1. 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 ∑a≤k<bck=cb−cac−1\sum_{a \le k < b} c^k = \frac{c^b - c^a}{c - 1}. For c=3c = 3, a=2a = 2, b=5b = 5: 9+27+81=117=(243−9)/29 + 27 + 81 = 117 = (243 - 9)/2.

Exercises

  1. [10] Compute 64‾6^{\underline{4}}, 64‾6^{\overline{4}}, (−2)3‾(-2)^{\underline{3}} and 4−2‾4^{\underline{-2}}.
  2. [12] Write 1/x1/x as a falling power of x−1x - 1, and use the theorem on the difference of a falling power to find Δ(1/x)\Delta(1/x). Check the result directly.
  3. [M15] Let c≠1c \ne 1. Use finite calculus to find ∑0≤k<nk0‾ck\sum_{0 \le k < n} k^{\underline{0}} c^k, and check the case c=3c = 3, n=4n = 4.
  4. [M18] Find all functions f:ℤ→ℂf: \mathbb{Z} \to \mathbb{C} with Δf=f\Delta f = f, and all functions with Δf=2f\Delta f = 2f.
  5. [M20] Show that (1/2)m‾=(−1)m−1(2m−2)!22m−1(m−1)!(1/2)^{\underline{m}} = (-1)^{m-1} \frac{(2m-2)!}{2^{2m-1} (m-1)!} for every integer m≥1m \ge 1.
  6. [M15] Assume that a family of rational functions pm(x)p_m(x), one for each integer mm, satisfies pm(x)=xm‾p_m(x) = x^{\underline{m}} for m≥0m \ge 0 and the law pm+n(x)=pm(x)pn(x−m)p_{m+n}(x) = p_m(x) p_n(x - m) for all integers mm and nn. Show that p−m(x)=x−m‾p_{-m}(x) = x^{\underline{-m}} for m≥1m \ge 1.
  7. [M20] Find a closed form for ∑0≤k<nk(k+1)(k+2)\sum_{0 \le k < n} k(k+1)(k+2) by writing the term as a falling power.
  8. [M20] Find a closed form for ∑1≤k≤n1k(k+1)(k+2)\sum_{1 \le k \le n} \frac{1}{k(k+1)(k+2)}.
  9. [HM20] Let m≥2m \ge 2. Show that ∑k≥0k−m‾=1(m−1) (m−1)!\sum_{k \ge 0} k^{\underline{-m}} = \frac{1}{(m-1)\,(m-1)!}.
  10. [M22] Let ∇f(x)=f(x)−f(x−1)\nabla f(x) = f(x) - f(x-1) be the backward difference. Show that ∇xm‾=mxm−1‾\nabla x^{\overline{m}} = m x^{\overline{m-1}} for m≥1m \ge 1, and deduce that ∑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≥0m \ge 0 and n≥0n \ge 0.
  11. [M15] Let gg and hh be two functions on ℝ\mathbb{R} with Δg=Δh\Delta g = \Delta h. Show that g−hg - h has period 11. Give gg and hh with Δg=Δh=2x+1\Delta g = \Delta h = 2x + 1 such that g−hg - h is not constant.
  12. [M20] Let rr be a number and n≥0n \ge 0 an integer. Show that ∑0≤k≤n(−1)k(rk)=(−1)n(r−1n)\sum_{0 \le k \le n} (-1)^k \binom{r}{k} = (-1)^n \binom{r - 1}{n}.

Lean

Mathlib has the difference operator as fwdDiff h f in the file Mathlib.Algebra.Group.ForwardDiff, with the notation Δ_[h] in the scope fwdDiff. The operator of this chapter is Δ_[1]. The file proves linearity (fwdDiff_add, fwdDiff_const_smul), the difference of a constant (fwdDiff_const) and the difference of a binomial coefficient on the natural numbers (fwdDiff_choose). The falling and rising powers are the polynomials descPochhammer R m and ascPochhammer R m in Mathlib.RingTheory.Polynomial.Pochhammer, with descPochhammer_mul as the law of exponents for m,n≥0m, n \ge 0 and descPochhammer_eval_eq_ascPochhammer as the link to rising powers. On the natural numbers the values are Nat.descFactorial and Nat.ascFactorial. The telescoping sum is Finset.sum_range_sub, and the sums over the upper index are Nat.sum_Icc_choose and Nat.sum_range_add_choose. All of these are proved in Mathlib.

Mathlib has no falling power with a negative exponent and no definite sum with the sign rule of this section. The project library tamnd/taocp-lean defines the binomial coefficient of TAOCP 1.2.6(3) as TAOCP.binom in TAOCP/Notation, with TAOCP.binom_of_neg for a negative lower index and TAOCP.binom_natCast as the bridge to Nat.choose. It does not yet state the theorems of this section.

Notes and history

The calculus of finite differences is as old as the calculus itself. Newton used differences for interpolation in the 1670s, and Brook Taylor wrote the first book on the subject, Methodus Incrementorum, in 1715. The systematic theory of the operators Δ\Delta and EE, with the identity E=I+ΔE = I + \Delta, is due to the nineteenth century British school of the calculus of operations; the book of George Boole, A Treatise on the Calculus of Finite Differences (1860), is the classic account.

The notations xm‾x^{\underline{m}} and xm‾x^{\overline{m}} are fairly recent. TAOCP 1.2.5 traces them to Capelli and Toscano, and Concrete Mathematics made them standard in computer science. The extension to negative exponents and the notation ∑abf(x) δx\sum_a^b f(x) \, \delta x follow GKP94, Section 2.6. The name "Pochhammer symbol" in Mathlib comes from the use of (x)m(x)_m for one of these products in the theory of hypergeometric functions, where unfortunately it often means the rising power.

Summation by parts and the harmonic numbers

Statement

Section 3.1 sums a function when an indefinite sum of it is known. This section extends the method to products. The tool is the discrete form of integration by parts. It needs the rule for the difference of a product, which has one more term than the rule for the derivative of a product, or rather one term with a shift. The section also defines the harmonic numbers, which fill the gap m=−1m = -1 in the sums of falling powers, and uses them to sum kxkk x^k, HkH_k, kHkk H_k and (km)Hk\binom{k}{m} H_k.

As in Section 3.1, EE is the shift: Ev(x)=v(x+1)E v(x) = v(x+1).

Theorem P2.3.29 (difference of a product). Let uu and vv be functions. Then

Δ(uv)=u Δv+Ev Δu=v Δu+Eu Δv=u Δv+v Δu+Δu Δv.\Delta(uv) = u \, \Delta v + E v \, \Delta u = v \, \Delta u + E u \, \Delta v = u \, \Delta v + v \, \Delta u + \Delta u \, \Delta v.

Lean: Mathlib fwdDiff_smul (the third form, proved in Mathlib).

Proof. Write u=u(x)u = u(x), v=v(x)v = v(x), u′=u(x+1)u' = u(x+1) and v′=v(x+1)v' = v(x+1). Then Δ(uv)(x)=u′v′−uv\Delta(uv)(x) = u'v' - uv. Add and subtract uv′uv': u′v′−uv=u(v′−v)+v′(u′−u)=uΔv+EvΔuu'v' - uv = u(v' - v) + v'(u' - u) = u \Delta v + E v \Delta u. The second form is the first with uu and vv exchanged. For the third form, write Ev=v+ΔvE v = v + \Delta v in the first. □\square

Example P2.3.30. Let u(x)=xu(x) = x and v(x)=2xv(x) = 2^x. Then Δu=1\Delta u = 1 and Δv=2x\Delta v = 2^x, so the theorem gives Δ(x2x)=x2x+2x+1=(x+2)2x\Delta(x 2^x) = x 2^x + 2^{x+1} = (x+2) 2^x. Directly: (x+1)2x+1−x2x=2x(2x+2−x)=(x+2)2x(x+1)2^{x+1} - x 2^x = 2^x (2x + 2 - x) = (x+2) 2^x.

The derivative of a product is uv′+vu′u v' + v u' with no shift. The shift in EvE v is the price of a finite step: the term ΔuΔv\Delta u \Delta v of the third form is the discrete version of du dvdu \, dv, which calculus neglects.

Theorem P2.3.31 (summation by parts). Let uu and vv be functions on ℤ\mathbb{Z} and let a≤ba \le b be integers. Then

∑a≤k<bu(k) Δv(k)=u(b)v(b)−u(a)v(a)−∑a≤k<bv(k+1) Δu(k).\sum_{a \le k < b} u(k) \, \Delta v(k) = u(b) v(b) - u(a) v(a) - \sum_{a \le k < b} v(k+1) \, \Delta u(k).

In the notation of definite sums, ∑abu Δv δx=uv∣ab−∑abEv Δu δx\sum_a^b u \, \Delta v \, \delta x = uv \big|_a^b - \sum_a^b E v \, \Delta u \, \delta x.

Lean: Mathlib Finset.sum_range_by_parts and Finset.sum_Ico_by_parts (proved in Mathlib), in the form with partial sums of the second factor.

Proof. Sum the first form of the product rule, uΔv=Δ(uv)−EvΔuu \Delta v = \Delta(uv) - E v \Delta u, over a≤k<ba \le k < b. The fundamental theorem of finite calculus (Section 3.1) gives ∑a≤k<bΔ(uv)(k)=u(b)v(b)−u(a)v(a)\sum_{a \le k < b} \Delta(uv)(k) = u(b)v(b) - u(a)v(a). □\square

The rule is useful when Δv\Delta v is a factor of the term whose indefinite sum vv is known, and when Ev ΔuE v \, \Delta u is simpler than u Δvu \, \Delta v. The usual choice makes uu a polynomial or a harmonic number, whose difference is simpler, and Δv\Delta v a power ckc^k or a falling power, whose indefinite sum is known.

Definition P2.3.32 (harmonic numbers). For an integer n≥0n \ge 0 the nnth harmonic number is

Hn=∑1≤k≤n1k=1+12+⋯+1n.H_n = \sum_{1 \le k \le n} \frac{1}{k} = 1 + \frac{1}{2} + \cdots + \frac{1}{n}.

So H0=0H_0 = 0 (the empty sum) and Hn+1=Hn+1n+1H_{n+1} = H_n + \frac{1}{n+1}. Chapter 9 studies these numbers in depth; this section uses only the definition.

Lean: Mathlib harmonic n, a rational number, with harmonic_zero and harmonic_succ (proved in Mathlib); TAOCP/Notation (tamnd/taocp-lean main) has TAOCP.harmonicPow r n for Hn(r)H_n^{(r)} and the bridge TAOCP.harmonicPow_one to harmonic.

Example P2.3.33. The first values are H1=1H_1 = 1, H2=32H_2 = \frac{3}{2}, H3=116H_3 = \frac{11}{6}, H4=2512H_4 = \frac{25}{12}, H5=13760H_5 = \frac{137}{60} and H6=4920H_6 = \frac{49}{20}. For n≥2n \ge 2 the number HnH_n is never an integer: the largest power of 22 up to nn divides the denominator of exactly one term. The denominators grow fast.

Example P2.3.34. The harmonic numbers grow without bound, but slowly. Group the terms in blocks 12j+1+⋯+12j+1\frac{1}{2^j + 1} + \cdots + \frac{1}{2^{j+1}}. A block has 2j2^j terms, each at least 2−j−12^{-j-1}, so its sum is at least 12\frac{1}{2}. So H2n≥1+n2H_{2^n} \ge 1 + \frac{n}{2}. In the same way, the block 12j+⋯+12j+1−1\frac{1}{2^j} + \cdots + \frac{1}{2^{j+1} - 1} has sum at most 11, so H2n−1≤nH_{2^n - 1} \le n. So HnH_n grows like a logarithm. Chapter 9 proves that Hn−ln⁡nH_n - \ln n tends to a constant.

Theorem P2.3.35 (harmonic numbers as the discrete logarithm). For each integer x≥0x \ge 0, ΔHx=1x+1=x−1‾\Delta H_x = \frac{1}{x+1} = x^{\underline{-1}}. So for integers 0≤a≤b0 \le a \le b,

∑a≤k<bk−1‾=∑a≤k<b1k+1=Hb−Ha.\sum_{a \le k < b} k^{\underline{-1}} = \sum_{a \le k < b} \frac{1}{k+1} = H_b - H_a.

With the corollary on sums of falling powers of Section 3.1, this gives, for every integer mm and every n≥0n \ge 0,

∑0≤k<nkm‾={nm+1‾m+1,m≠−1,Hn,m=−1.\sum_{0 \le k < n} k^{\underline{m}} = \begin{cases} \dfrac{n^{\underline{m+1}}}{m+1}, & m \ne -1, \\ H_n, & m = -1. \end{cases}

Lean: Mathlib harmonic_succ gives the difference (proved in Mathlib); the case m=−1m = -1 of the sum is harmonic itself, by harmonic_eq_sum_Icc.

Proof. ΔHx=Hx+1−Hx=1x+1\Delta H_x = H_{x+1} - H_x = \frac{1}{x+1} by the definition, and 1x+1=x−1‾\frac{1}{x+1} = x^{\underline{-1}} by the definition of negative falling powers. The fundamental theorem gives the sum from aa to bb. For m=−1m = -1 and a=0a = 0 it gives Hn−H0=HnH_n - H_0 = H_n. □\square

In calculus, ∫1xtm dt\int_1^x t^{m} \, dt is xm+1−1m+1\frac{x^{m+1} - 1}{m+1} for m≠−1m \ne -1 and ln⁡x\ln x for m=−1m = -1. The theorem is the discrete twin, and this is the sense in which HxH_x is the discrete logarithm. Note that x−1‾x^{\underline{-1}} is 1x+1\frac{1}{x+1} and not 1x\frac{1}{x}; the shift is why the sum of 1k\frac{1}{k} for 1≤k≤n1 \le k \le n appears as a sum over 0≤k<n0 \le k < n.

Theorem P2.3.36 (the sum of kxkk x^k). Let x≠1x \ne 1 be a number and n≥0n \ge 0 an integer. Then

∑0≤k<nkxk=x−nxn+(n−1)xn+1(1−x)2.\sum_{0 \le k < n} k x^k = \frac{x - n x^n + (n-1) x^{n+1}}{(1-x)^2}.

If ∣x∣<1|x| < 1, then ∑k≥0kxk=x(1−x)2\sum_{k \ge 0} k x^k = \frac{x}{(1-x)^2}.

Lean: not yet stated; the geometric sum is Mathlib geom_sum_eq (proved in Mathlib).

Proof. Use summation by parts with u(k)=ku(k) = k and Δv(k)=xk\Delta v(k) = x^k. Section 3.1 gives v(k)=xkx−1v(k) = \frac{x^k}{x - 1}, and Δu=1\Delta u = 1. So

∑0≤k<nkxk=nxnx−1−0−∑0≤k<nxk+1x−1=nxnx−1−x(xn−1)(x−1)2.\sum_{0 \le k < n} k x^k = \frac{n x^n}{x-1} - 0 - \sum_{0 \le k < n} \frac{x^{k+1}}{x-1} = \frac{n x^n}{x-1} - \frac{x(x^n - 1)}{(x-1)^2}.

Bring the two terms to the denominator (x−1)2=(1−x)2(x-1)^2 = (1-x)^2. The numerator is nxn+1−nxn−xn+1+x=x−nxn+(n−1)xn+1n x^{n+1} - n x^n - x^{n+1} + x = x - n x^n + (n-1) x^{n+1}. For ∣x∣<1|x| < 1 the terms nxnn x^n and (n−1)xn+1(n-1)x^{n+1} tend to 00 as n→∞n \to \infty (P5 proves that nxn→0n x^n \to 0; it also follows from the ratio (n+1)∣x∣n+1n∣x∣n→∣x∣<1\frac{(n+1)|x|^{n+1}}{n |x|^n} \to |x| < 1), so the sum tends to x(1−x)2\frac{x}{(1-x)^2}. □\square

Theorem P2.3.37 (the sum of harmonic numbers). For each integer n≥0n \ge 0,

∑0≤k<nHk=nHn−n,∑1≤k≤nHk=(n+1)Hn−n.\sum_{0 \le k < n} H_k = n H_n - n, \qquad \sum_{1 \le k \le n} H_k = (n+1) H_n - n.

The second form is equation 1.2.7(8).

Lean: not yet stated.

Proof. Use summation by parts with u(k)=Hku(k) = H_k and Δv(k)=1\Delta v(k) = 1, so v(k)=kv(k) = k and Δu(k)=1k+1\Delta u(k) = \frac{1}{k+1}. Then ∑0≤k<nHk=nHn−0−∑0≤k<n(k+1)⋅1k+1=nHn−n\sum_{0 \le k < n} H_k = n H_n - 0 - \sum_{0 \le k < n} (k+1) \cdot \frac{1}{k+1} = n H_n - n. For the second form, H0=0H_0 = 0, so ∑1≤k≤nHk=∑0≤k<n+1Hk=(n+1)Hn+1−(n+1)\sum_{1 \le k \le n} H_k = \sum_{0 \le k < n+1} H_k = (n+1) H_{n+1} - (n+1). Now (n+1)Hn+1=(n+1)Hn+1(n+1) H_{n+1} = (n+1) H_n + 1, which gives (n+1)Hn−n(n+1) H_n - n. □\square

Theorem P2.3.38 (the sum of (km)Hk\binom{k}{m} H_k). For integers m≥0m \ge 0 and n≥0n \ge 0,

∑0≤k<n(km)Hk=(nm+1)(Hn−1m+1).\sum_{0 \le k < n} \binom{k}{m} H_k = \binom{n}{m+1} \Bigl(H_n - \frac{1}{m+1}\Bigr).

Equivalently, ∑0≤k≤n(km)Hk=(n+1m+1)(Hn+1−1m+1)\sum_{0 \le k \le n} \binom{k}{m} H_k = \binom{n+1}{m+1} \bigl(H_{n+1} - \frac{1}{m+1}\bigr), which is equation 1.2.7(9).

Lean: not yet stated.

Proof. Use summation by parts with u(k)=Hku(k) = H_k and Δv(k)=(km)\Delta v(k) = \binom{k}{m}. By the corollary on the difference of a binomial coefficient (Section 3.1), v(k)=(km+1)v(k) = \binom{k}{m+1}. Then v(0)=0v(0) = 0 and

∑0≤k<n(km)Hk=(nm+1)Hn−∑0≤k<n(k+1m+1)1k+1.\sum_{0 \le k < n} \binom{k}{m} H_k = \binom{n}{m+1} H_n - \sum_{0 \le k < n} \binom{k+1}{m+1} \frac{1}{k+1}.

For each integer k≥0k \ge 0, (k+1m+1)1k+1=(k+1)km‾(m+1)! (k+1)=1m+1(km)\binom{k+1}{m+1} \frac{1}{k+1} = \frac{(k+1) k^{\underline{m}}}{(m+1)! \, (k+1)} = \frac{1}{m+1} \binom{k}{m}. So the last sum is 1m+1∑0≤k<n(km)=1m+1(nm+1)\frac{1}{m+1} \sum_{0 \le k < n} \binom{k}{m} = \frac{1}{m+1} \binom{n}{m+1}, by the corollary on sums over the upper index. This proves the first form. The second form is the first with n+1n + 1 in place of nn. □\square

For m=0m = 0 the theorem gives back ∑0≤k<nHk=n(Hn−1)\sum_{0 \le k < n} H_k = n (H_n - 1).

Corollary P2.3.39 (the sum of kHkk H_k). For each integer n≥0n \ge 0,

∑0≤k<nkHk=n(n−1)2(Hn−12).\sum_{0 \le k < n} k H_k = \frac{n(n-1)}{2} \Bigl(H_n - \frac{1}{2}\Bigr).

Lean: not yet stated.

Proof. Put m=1m = 1 in the theorem: (k1)=k\binom{k}{1} = k and (n2)=n(n−1)2\binom{n}{2} = \frac{n(n-1)}{2}. □\square

Proof

Summation by parts is the product rule summed with the fundamental theorem, and every result of the section is one application of it with a good choice of uu and Δv\Delta v. The rule moves a difference from one factor to the other, at the cost of a shift. The choice is right when the new sum ∑Ev Δu\sum E v \, \Delta u is one that Section 3.1 can do directly.

For kxkk x^k the factor kk is differenced to 11, and the new sum is geometric. For HkH_k times a polynomial, the harmonic number is differenced to 1k+1\frac{1}{k+1}, and this cancels one factor of the indefinite sum of the polynomial. The cancellation (k+1m+1)1k+1=1m+1(km)\binom{k+1}{m+1} \frac{1}{k+1} = \frac{1}{m+1}\binom{k}{m} is the heart of the proof of equation 1.2.7(9). It works because the indefinite sum of (km)\binom{k}{m} is (km+1)\binom{k}{m+1} and the shift EE turns it into (k+1m+1)\binom{k+1}{m+1}, which contains the factor k+1k + 1. This is the reason to sum (km)Hk\binom{k}{m} H_k and not kmHkk^m H_k: the binomial coefficients are the functions for which the method closes.

Examples

Example P2.3.40. Find ∑0≤k<nk22k\sum_{0 \le k < n} k^2 2^k. Take u(k)=k2u(k) = k^2 and Δv(k)=2k\Delta v(k) = 2^k, so v(k)=2kv(k) = 2^k and Δu(k)=2k+1\Delta u(k) = 2k + 1. Then

∑0≤k<nk22k=n22n−∑0≤k<n(2k+1)2k+1=n22n−4∑0≤k<nk2k−2(2n−1).\sum_{0 \le k < n} k^2 2^k = n^2 2^n - \sum_{0 \le k < n} (2k + 1) 2^{k+1} = n^2 2^n - 4 \sum_{0 \le k < n} k 2^k - 2(2^n - 1).

The theorem on kxkk x^k with x=2x = 2 gives ∑0≤k<nk2k=2−n2n+(n−1)2n+1=(n−2)2n+2\sum_{0 \le k < n} k 2^k = 2 - n 2^n + (n-1)2^{n+1} = (n - 2) 2^n + 2. So the sum is n22n−4(n−2)2n−8−2n+1+2=(n2−4n+6)2n−6n^2 2^n - 4(n-2) 2^n - 8 - 2^{n+1} + 2 = (n^2 - 4n + 6) 2^n - 6. Check n=4n = 4: 0+2+16+72=900 + 2 + 16 + 72 = 90, and (16−16+6)⋅16−6=90(16 - 16 + 6) \cdot 16 - 6 = 90.

Example P2.3.41. Find ∑0≤k<n(−1)kk\sum_{0 \le k < n} (-1)^k k. Take u(k)=ku(k) = k and Δv(k)=(−1)k\Delta v(k) = (-1)^k. Since Δ(−1)k=−2(−1)k\Delta (-1)^k = -2 (-1)^k, the function v(k)=−12(−1)kv(k) = -\frac{1}{2}(-1)^k works. Then

∑0≤k<n(−1)kk=−n(−1)n2+12∑0≤k<n(−1)k+1=(−1)n+1n2−1−(−1)n4,\sum_{0 \le k < n} (-1)^k k = -\frac{n (-1)^n}{2} + \frac{1}{2} \sum_{0 \le k < n} (-1)^{k+1} = \frac{(-1)^{n+1} n}{2} - \frac{1 - (-1)^n}{4},

since ∑0≤k<n(−1)k=1−(−1)n2\sum_{0 \le k < n} (-1)^k = \frac{1 - (-1)^n}{2}. For n=5n = 5: 0−1+2−3+4=20 - 1 + 2 - 3 + 4 = 2, and 52−24=2\frac{5}{2} - \frac{2}{4} = 2. For even nn the value is −n2-\frac{n}{2}.

Example P2.3.42. Find ∑0≤k<nkHk\sum_{0 \le k < n} k H_k without the general theorem. Take u(k)=Hku(k) = H_k and Δv(k)=k=k1‾\Delta v(k) = k = k^{\underline{1}}, so v(k)=k2‾2v(k) = \frac{k^{\underline{2}}}{2}. Then

∑0≤k<nkHk=n2‾2Hn−∑0≤k<n(k+1)2‾2⋅1k+1=n2‾2Hn−12∑0≤k<nk=n2‾2(Hn−12),\sum_{0 \le k < n} k H_k = \frac{n^{\underline{2}}}{2} H_n - \sum_{0 \le k < n} \frac{(k+1)^{\underline{2}}}{2} \cdot \frac{1}{k+1} = \frac{n^{\underline{2}}}{2} H_n - \frac{1}{2} \sum_{0 \le k < n} k = \frac{n^{\underline{2}}}{2} \Bigl(H_n - \frac{1}{2}\Bigr),

because (k+1)2‾=(k+1)k(k+1)^{\underline{2}} = (k+1) k. For n=3n = 3: 0+1⋅1+2⋅32=40 + 1 \cdot 1 + 2 \cdot \frac{3}{2} = 4, and 3⋅(116−12)=3⋅43=43 \cdot (\frac{11}{6} - \frac{1}{2}) = 3 \cdot \frac{4}{3} = 4.

Example P2.3.43. A bad choice of the parts makes the sum worse. In ∑k2k\sum k 2^k, take u(k)=2ku(k) = 2^k and Δv(k)=k\Delta v(k) = k. Then v(k)=k2‾2v(k) = \frac{k^{\underline{2}}}{2}, Δu(k)=2k\Delta u(k) = 2^k, and the new sum is ∑(k+1)k22k\sum \frac{(k+1)k}{2} 2^k, which has a polynomial of higher degree. The rule of thumb is to difference the factor that becomes simpler.

Example P2.3.44. The sum of (km)Hk\binom{k}{m} H_k for m=2m = 2 and n=4n = 4, in the form of equation 1.2.7(9): ∑0≤k≤4(k2)Hk=H2+3H3+6H4=32+112+252=392\sum_{0 \le k \le 4} \binom{k}{2} H_k = H_2 + 3 H_3 + 6 H_4 = \frac{3}{2} + \frac{11}{2} + \frac{25}{2} = \frac{39}{2}. The formula gives (53)(H5−13)=10(13760−2060)=10⋅11760=392\binom{5}{3} (H_5 - \frac{1}{3}) = 10 \bigl(\frac{137}{60} - \frac{20}{60}\bigr) = 10 \cdot \frac{117}{60} = \frac{39}{2}.

Exercises

  1. [10] Use the rule for the difference of a product to find Δ(x22x)\Delta(x^2 2^x).
  2. [M15] Prove the rule for the difference of a quotient: Δuv=v Δu−u Δvv Ev\Delta \frac{u}{v} = \frac{v \, \Delta u - u \, \Delta v}{v \, E v}, where v(x)v(x+1)≠0v(x) v(x+1) \ne 0.
  3. [M18] Find a closed form for ∑0≤k<nk 3k\sum_{0 \le k < n} k \, 3^k.
  4. [M20] Find a closed form for ∑0≤k<nk/2k\sum_{0 \le k < n} k / 2^k and its limit as n→∞n \to \infty.
  5. [M20] Find a closed form for ∑0≤k<n(−1)kk2\sum_{0 \le k < n} (-1)^k k^2.
  6. [M22] Let Hn(2)=∑1≤k≤n1/k2H_n^{(2)} = \sum_{1 \le k \le n} 1/k^2. Show that ∑0≤k<nHkk+1=12(Hn2−Hn(2))\sum_{0 \le k < n} \frac{H_k}{k+1} = \frac{1}{2}\bigl(H_n^2 - H_n^{(2)}\bigr).
  7. [M25] Show that ∑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.
  8. [M20] Find a closed form for ∑0≤k<nk(k−1)Hk\sum_{0 \le k < n} k(k-1) H_k.
  9. [M22] With Hn(2)H_n^{(2)} as in Exercise 6, show that ∑1≤k≤nHkk(k+1)=Hn(2)−Hnn+1\sum_{1 \le k \le n} \frac{H_k}{k(k+1)} = H_n^{(2)} - \frac{H_n}{n+1}. Given that Hn(2)→π2/6H_n^{(2)} \to \pi^2/6 and Hn/(n+1)→0H_n/(n+1) \to 0, find ∑k≥1Hkk(k+1)\sum_{k \ge 1} \frac{H_k}{k(k+1)}.
  10. [M20] Let m≥0m \ge 0. Use summation by parts to show that ∑0≤k<nk(km)=n(nm+1)−(n+1m+2)\sum_{0 \le k < n} k \binom{k}{m} = n \binom{n}{m+1} - \binom{n+1}{m+2}.
  11. [M22] (Abel's inequality.) Let a0≥a1≥⋯≥an−1≥0a_0 \ge a_1 \ge \cdots \ge a_{n-1} \ge 0 and let b0,…,bn−1b_0, \dots, b_{n-1} be real numbers whose partial sums Bk=∑0≤j<kbjB_k = \sum_{0 \le j < k} b_j satisfy ∣Bk∣≤M|B_k| \le M for 1≤k≤n1 \le k \le n. Show that ∣∑0≤k<nakbk∣≤Ma0\bigl|\sum_{0 \le k < n} a_k b_k\bigr| \le M a_0.

Lean

Mathlib states the product rule in the form Δ(fg)=Δf⋅g+f⋅Δg+Δf⋅Δg\Delta(f g) = \Delta f \cdot g + f \cdot \Delta g + \Delta f \cdot \Delta g as fwdDiff_smul, and summation by parts as Finset.sum_range_by_parts and Finset.sum_Ico_by_parts in Mathlib.Algebra.BigOperators.Module. The Mathlib form differences the first factor and uses the partial sums of the second factor; it is the theorem of this section with v(k)=∑0≤j<kg(j)v(k) = \sum_{0 \le j < k} g(j). The harmonic numbers are harmonic n : ℚ, with harmonic_succ for the step, harmonic_eq_sum_Icc for the sum and the bounds log_add_one_le_harmonic and harmonic_le_one_add_log in Mathlib.NumberTheory.Harmonic.Bounds. All of these are proved in Mathlib. TAOCP/Notation in tamnd/taocp-lean main defines TAOCP.harmonicPow r n, the harmonic number of order rr, with TAOCP.harmonicPow_one as the bridge to harmonic.

The sums of kxkk x^k, HkH_k and (km)Hk\binom{k}{m} H_k, equations 1.2.7(8) and 1.2.7(9), are not yet stated in Lean.

Notes and history

Summation by parts is due to Abel, who used it in 1826 to prove the continuity of a power series on the boundary of its disk of convergence; Exercise 11 is his inequality. The harmonic numbers have their name from the harmonic series of music, where strings of lengths 1,12,13,…1, \frac{1}{2}, \frac{1}{3}, \dots give the overtones. The divergence of the harmonic series was proved by Oresme in the fourteenth century with the grouping argument of the second example after the definition.

The analogy between HxH_x and ln⁡x\ln x is the theme of GKP94, Section 2.6. TAOCP 1.2.7 derives equation (9), and an exercise there gives the general rule of summation by parts. Chapter 9 of this volume returns to harmonic numbers: their growth, their sums with binomial weights and the numbers Hn(r)H_n^{(r)} of higher order.

Difference tables and Newton's formula

Statement

The difference operator can be applied again and again. The values f(0),f(1),f(2),…f(0), f(1), f(2), \dots and their repeated differences form a triangle of numbers, the difference table. This section shows that the left edge of the table, the numbers Δkf(0)\Delta^k f(0), determines ff at every nonnegative integer, and that for a polynomial it determines ff everywhere. The result is Newton's forward formula, the discrete form of Taylor's formula. It turns the sum of any polynomial into a sum of binomial coefficients, which Section 3.1 can do.

Definition P2.3.45 (difference table). Let ff be a function on the integers x≥0x \ge 0. The difference table of ff is the array whose row jj, for j=0,1,2,…j = 0, 1, 2, \dots, is the sequence Δjf(0),Δjf(1),Δjf(2),…\Delta^j f(0), \Delta^j f(1), \Delta^j f(2), \dots. Row 00 is the sequence of values of ff. Each entry of row j+1j + 1 is the entry above it on the right minus the entry above it on the left. The left edge of the table is the sequence Δ0f(0),Δ1f(0),Δ2f(0),…\Delta^0 f(0), \Delta^1 f(0), \Delta^2 f(0), \dots.

Lean: Mathlib Δ_[1]^[j] f x, the iterate of fwdDiff 1.

Example P2.3.46. The table of f(x)=x3f(x) = x^3 for 0≤x≤50 \le x \le 5:

row
ff 00 11 88 2727 6464 125125
Δf\Delta f 11 77 1919 3737 6161
Δ2f\Delta^2 f 66 1212 1818 2424
Δ3f\Delta^3 f 66 66 66
Δ4f\Delta^4 f 00 00

The third row is constant and equal to 3!=63! = 6, and the fourth row is 00. The left edge is 0,1,6,6,0,…0, 1, 6, 6, 0, \dots.

Example P2.3.47. The table of f(x)=2xf(x) = 2^x has every row equal to 1,2,4,8,…1, 2, 4, 8, \dots, since Δ2x=2x\Delta 2^x = 2^x. Its left edge is 1,1,1,…1, 1, 1, \dots. The table of f(x)=(−1)xf(x) = (-1)^x has row jj equal to (−2)j(−1)x(-2)^j (-1)^x, since Δ(−1)x=−2(−1)x\Delta (-1)^x = -2 (-1)^x, so the rows grow and never become 00.

Theorem P2.3.48 (powers of the difference and shift operators). Let ff be a function, xx a point of its domain and n≥0n \ge 0 an integer. Then

Δnf(x)=∑0≤k≤n(nk)(−1)n−kf(x+k),f(x+n)=∑0≤k≤n(nk)Δkf(x).\Delta^n f(x) = \sum_{0 \le k \le n} \binom{n}{k} (-1)^{n-k} f(x+k), \qquad f(x+n) = \sum_{0 \le k \le n} \binom{n}{k} \Delta^k f(x).

Lean: Mathlib fwdDiff_iter_eq_sum_shift and shift_eq_sum_fwdDiff_iter (proved in Mathlib).

Proof. Both formulas hold for n=0n = 0. Suppose the second holds for nn, at every point. Then f(x+n+1)f(x + n + 1) is the formula for nn at the point x+1x + 1:

f(x+1+n)=∑k(nk)Δkf(x+1)=∑k(nk)(Δkf(x)+Δk+1f(x)),f(x+1+n) = \sum_{k} \binom{n}{k} \Delta^k f(x+1) = \sum_k \binom{n}{k} \bigl(\Delta^k f(x) + \Delta^{k+1} f(x)\bigr),

since Δkf(x+1)=Δkf(x)+ΔΔkf(x)\Delta^k f(x+1) = \Delta^k f(x) + \Delta \Delta^k f(x). Collect the terms with Δkf(x)\Delta^k f(x): the coefficient is (nk)+(nk−1)=(n+1k)\binom{n}{k} + \binom{n}{k-1} = \binom{n+1}{k}, by Pascal's rule (Section 3.1). This is the formula for n+1n + 1. The first formula has the same proof: suppose it holds for nn, and write Δn+1f(x)=Δnf(x+1)−Δnf(x)\Delta^{n+1} f(x) = \Delta^n f(x+1) - \Delta^n f(x). The formula for nn at the two points gives ∑k(nk)(−1)n−kf(x+1+k)−∑k(nk)(−1)n−kf(x+k)\sum_k \binom{n}{k} (-1)^{n-k} f(x+1+k) - \sum_k \binom{n}{k} (-1)^{n-k} f(x+k). The coefficient of f(x+k)f(x+k) is (nk−1)(−1)n−k+1+(nk)(−1)n+1−k=(n+1k)(−1)n+1−k\binom{n}{k-1} (-1)^{n-k+1} + \binom{n}{k} (-1)^{n+1-k} = \binom{n+1}{k} (-1)^{n+1-k}. □\square

In operator form the theorem says Δn=(E−I)n\Delta^n = (E - I)^n and En=(I+Δ)nE^n = (I + \Delta)^n, expanded by the binomial theorem. That is legal because EE and II commute; the proof above checks it without the language of operators.

Lemma P2.3.49 (falling powers form a basis). Let ff be a polynomial of degree d≥0d \ge 0 with leading coefficient aa. There are unique numbers c0,…,cdc_0, \dots, c_d with

f(x)=∑0≤j≤dcj xj‾,f(x) = \sum_{0 \le j \le d} c_j \, x^{\underline{j}},

and cd=ac_d = a.

Lean: not yet stated in this form; Mathlib proves that descPochhammer R j is monic of degree jj (monic_descPochhammer, descPochhammer_natDegree).

Proof. Use induction on dd. For d=0d = 0, f=a=a x0‾f = a = a \, x^{\underline{0}}. For d≥1d \ge 1, the polynomial xd‾x^{\underline{d}} has degree dd and leading coefficient 11. So f−a xd‾f - a \, x^{\underline{d}} has degree less than dd (or is 00), and the induction hypothesis writes it in falling powers of degree less than dd. For uniqueness, suppose ∑j≤dcjxj‾=0\sum_{j \le d} c_j x^{\underline{j}} = 0 with some cj≠0c_j \ne 0, and let j0j_0 be the largest such jj. The left side has degree j0j_0 and leading coefficient cj0≠0c_{j_0} \ne 0, which is impossible. □\square

Theorem P2.3.50 (nnth difference of a polynomial). Let ff be a polynomial of degree d≥1d \ge 1 with leading coefficient aa. Then Δf\Delta f is a polynomial of degree d−1d - 1 with leading coefficient dad a. So Δdf\Delta^d f is the constant d! ad! \, a, and Δnf=0\Delta^n f = 0 for n>dn > d.

Lean: Mathlib Polynomial.fwdDiff_iter_degree_eq_factorial, Polynomial.fwdDiff_iter_eq_zero_of_degree_lt, fwdDiff_iter_eq_factorial and fwdDiff_iter_pow_eq_zero_of_lt (proved in Mathlib).

Proof. Write f=∑j≤dcjxj‾f = \sum_{j \le d} c_j x^{\underline{j}} with cd=ac_d = a, by the lemma. By the theorem on the difference of a falling power, Δf=∑1≤j≤djcjxj−1‾\Delta f = \sum_{1 \le j \le d} j c_j x^{\underline{j-1}}. Its term of highest degree is da xd−1‾d a \, x^{\underline{d-1}}, so Δf\Delta f has degree d−1d - 1 and leading coefficient dad a. Apply this dd times: Δdf\Delta^d f has degree 00 and leading coefficient d! ad! \, a, so it is that constant. One more difference gives 00. □\square

Corollary P2.3.51 (alternating sums of a polynomial). Let n≥0n \ge 0 and let f(x)=b0+b1x+⋯+bnxnf(x) = b_0 + b_1 x + \cdots + b_n x^n be a polynomial of degree at most nn. Then

∑0≤k≤n(nk)(−1)n−kf(k)=n! bn.\sum_{0 \le k \le n} \binom{n}{k} (-1)^{n-k} f(k) = n! \, b_n.

In particular, ∑k(nk)(−1)kkj=0\sum_{k} \binom{n}{k} (-1)^k k^j = 0 for 0≤j<n0 \le j < n. This is equation 1.2.6(34).

Lean: Mathlib fwdDiff_iter_sum_mul_pow_eq_zero (the case bn=0b_n = 0) and Polynomial.fwdDiff_iter_degree_eq_factorial, with fwdDiff_iter_eq_sum_shift (proved in Mathlib).

Proof. By the theorem on powers of the difference operator, the left side is Δnf(0)\Delta^n f(0). If bn≠0b_n \ne 0, then ff has degree nn and the last theorem gives Δnf=n! bn\Delta^n f = n! \, b_n (for n=0n = 0 both sides are b0b_0). If bn=0b_n = 0, then ff has degree less than nn and Δnf=0=n! bn\Delta^n f = 0 = n! \, b_n. □\square

Theorem P2.3.52 (Newton's forward formula). Let ff be a function on the integers x≥0x \ge 0. Then for each integer n≥0n \ge 0,

f(n)=∑0≤k≤nΔkf(0)(nk).f(n) = \sum_{0 \le k \le n} \Delta^k f(0) \binom{n}{k}.

If ff is a polynomial of degree at most dd, then f(x)=∑0≤k≤dΔkf(0)(xk)f(x) = \sum_{0 \le k \le d} \Delta^k f(0) \binom{x}{k} for every number xx.

Lean: Mathlib shift_eq_sum_fwdDiff_iter (the first statement, proved in Mathlib); the identity of polynomials is not yet stated.

Proof. The first statement is the theorem on powers of the shift operator at x=0x = 0. For the second, let g(x)=∑k≤dΔkf(0)(xk)g(x) = \sum_{k \le d} \Delta^k f(0) \binom{x}{k}. This is a polynomial of degree at most dd. For n≥0n \ge 0, the first statement gives f(n)=∑k≤nΔkf(0)(nk)f(n) = \sum_{k \le n} \Delta^k f(0) \binom{n}{k}. The terms with k>dk > d vanish because Δkf=0\Delta^k f = 0 for k>dk > d, and the terms with n<k≤dn < k \le d vanish because (nk)=0\binom{n}{k} = 0. So f(n)=g(n)f(n) = g(n) for every integer n≥0n \ge 0. The polynomial f−gf - g has degree at most dd and infinitely many roots, so it is 00. □\square

The formula is the discrete form of Taylor's formula f(x)=∑kf(k)(0)xkk!f(x) = \sum_k f^{(k)}(0) \frac{x^k}{k!}. In finite calculus the role of xkk!\frac{x^k}{k!} is played by xk‾k!=(xk)\frac{x^{\underline{k}}}{k!} = \binom{x}{k}, and the role of the derivatives is played by the differences.

Corollary P2.3.53 (Newton's formula for sums). Let ff be a function on the integers x≥0x \ge 0. Then for each integer n≥0n \ge 0,

∑0≤k<nf(k)=∑0≤j<n(nj+1)Δjf(0).\sum_{0 \le k < n} f(k) = \sum_{0 \le j < n} \binom{n}{j+1} \Delta^j f(0).

Lean: Mathlib sum_range_shift_eq_sum_fwdDiff_iter (proved in Mathlib).

Proof. Put Newton's formula into the sum and change the order of summation:

∑0≤k<nf(k)=∑0≤k<n∑0≤j≤kΔjf(0)(kj)=∑0≤j<nΔjf(0)∑j≤k<n(kj).\sum_{0 \le k < n} f(k) = \sum_{0 \le k < n} \sum_{0 \le j \le k} \Delta^j f(0) \binom{k}{j} = \sum_{0 \le j < n} \Delta^j f(0) \sum_{j \le k < n} \binom{k}{j}.

The inner sum is ∑0≤k<n(kj)=(nj+1)\sum_{0 \le k < n} \binom{k}{j} = \binom{n}{j+1}, by the corollary on sums over the upper index (Section 3.1), since the terms with k<jk < j are 00. □\square

Theorem P2.3.54 (sums of squares and cubes). For each integer n≥0n \ge 0,

∑0≤k<nk2=n(n−1)(2n−1)6,∑0≤k<nk3=(n(n−1)2)2.\sum_{0 \le k < n} k^2 = \frac{n(n-1)(2n-1)}{6}, \qquad \sum_{0 \le k < n} k^3 = \Bigl(\frac{n(n-1)}{2}\Bigr)^2.

Equivalently, ∑1≤k≤nk2=13n(n+12)(n+1)\sum_{1 \le k \le n} k^2 = \frac{1}{3} n \bigl(n + \frac{1}{2}\bigr)(n+1), which is equation 1.2.6(12).

Lean: Mathlib Finset.sum_range_id_mul_two for the first powers; the sums of squares and cubes are not yet stated in this form.

Proof. The difference table of x2x^2 at 0,1,20, 1, 2 is 0,1,40, 1, 4; 1,31, 3; 22, with left edge 0,1,20, 1, 2. Newton's formula gives x2=(x1)+2(x2)=x1‾+x2‾x^2 = \binom{x}{1} + 2\binom{x}{2} = x^{\underline{1}} + x^{\underline{2}}. The first example of the section has left edge 0,1,6,60, 1, 6, 6 for x3x^3, so x3=(x1)+6(x2)+6(x3)=x1‾+3x2‾+x3‾x^3 = \binom{x}{1} + 6\binom{x}{2} + 6\binom{x}{3} = x^{\underline{1}} + 3 x^{\underline{2}} + x^{\underline{3}}. Sum with the corollary on sums of falling powers:

∑0≤k<nk2=n2‾2+n3‾3=n(n−1)6(3+2(n−2))=n(n−1)(2n−1)6,\sum_{0 \le k < n} k^2 = \frac{n^{\underline{2}}}{2} + \frac{n^{\underline{3}}}{3} = \frac{n(n-1)}{6}\bigl(3 + 2(n-2)\bigr) = \frac{n(n-1)(2n-1)}{6},

∑0≤k<nk3=n2‾2+n3‾+n4‾4=n(n−1)4(2+4(n−2)+(n−2)(n−3))=n2(n−1)24.\sum_{0 \le k < n} k^3 = \frac{n^{\underline{2}}}{2} + n^{\underline{3}} + \frac{n^{\underline{4}}}{4} = \frac{n(n-1)}{4}\bigl(2 + 4(n-2) + (n-2)(n-3)\bigr) = \frac{n^2 (n-1)^2}{4}.

For the second form of the squares, replace nn by n+1n + 1: (n+1)n(2n+1)6=13n(n+12)(n+1)\frac{(n+1) n (2n+1)}{6} = \frac{1}{3} n (n + \frac{1}{2})(n+1). □\square

The same method sums kmk^m for any mm: find the left edge of the table of xmx^m, write xmx^m in falling powers and sum. The coefficients that appear are the Stirling numbers of the second kind, xm=∑k{mk}xk‾x^m = \sum_k {m \brace k} x^{\underline{k}}, and Chapter 8 develops them with the general change between ordinary and falling powers. Chapter 11 gives the closed forms of ∑km\sum k^m with the Bernoulli numbers.

Proof

The section has one idea: the left edge of the difference table is a complete description of a function on the nonnegative integers. The theorem on powers of the shift operator says how to rebuild each value from the edge, and the theorem on powers of the difference operator says how to compute the edge from the values. The two formulas are inverse to each other, and both are the binomial theorem for E=I+ΔE = I + \Delta.

For polynomials the edge is finite: the theorem on the nnth difference shows that a polynomial of degree dd has Δkf=0\Delta^k f = 0 for k>dk > d. The proof uses the basis of falling powers, on which Δ\Delta acts as the derivative acts on ordinary powers. Then Newton's formula holds at every integer, and the rule that a nonzero polynomial has only finitely many roots extends it to every number. That last step is the reason that the conclusion for all xx needs ff to be a polynomial: the function f(x)=sin⁡πxf(x) = \sin \pi x is 00 at every integer, so its whole table is 00, but ff is not 00.

Examples

Example P2.3.55. A sequence starts 1,2,4,8,161, 2, 4, 8, 16. Suppose it comes from a polynomial of degree at most 44. Its table has left edge 1,1,1,1,11, 1, 1, 1, 1, since the first five values of 2x2^x give the same edge as 2x2^x itself. Newton's formula gives f(x)=(x0)+(x1)+(x2)+(x3)+(x4)f(x) = \binom{x}{0} + \binom{x}{1} + \binom{x}{2} + \binom{x}{3} + \binom{x}{4}, and f(5)=1+5+10+10+5=31f(5) = 1 + 5 + 10 + 10 + 5 = 31, not 3232. The next value is f(6)=57f(6) = 57. This polynomial counts the regions into which xx hyperplanes in general position cut space of dimension 44, and f(x−1)f(x - 1) counts the regions of a disk cut by all chords between xx points in general position on its circle. It is a warning: a few values do not fix a sequence.

Example P2.3.56. Find ∑0≤k<n(2k+1)2\sum_{0 \le k < n} (2k+1)^2. The values of f(k)=(2k+1)2f(k) = (2k+1)^2 at 0,1,20, 1, 2 are 1,9,251, 9, 25, with differences 8,168, 16 and second difference 88. The left edge is 1,8,81, 8, 8. Newton's formula for sums gives

∑0≤k<n(2k+1)2=(n1)+8(n2)+8(n3)=n+4n(n−1)+4n(n−1)(n−2)3=n(4n2−1)3.\sum_{0 \le k < n} (2k+1)^2 = \binom{n}{1} + 8\binom{n}{2} + 8\binom{n}{3} = n + 4n(n-1) + \frac{4n(n-1)(n-2)}{3} = \frac{n(4n^2 - 1)}{3}.

Check n=3n = 3: 1+9+25=351 + 9 + 25 = 35 and 3⋅35/3=353 \cdot 35/3 = 35.

Example P2.3.57. The corollary on alternating sums with f(x)=x3f(x) = x^3 and n=3n = 3 says that (33)33−(32)23+(31)13−(30)03=3!=6\binom{3}{3} 3^3 - \binom{3}{2} 2^3 + \binom{3}{1} 1^3 - \binom{3}{0} 0^3 = 3! = 6. Indeed 27−24+3−0=627 - 24 + 3 - 0 = 6. With f(x)=x2f(x) = x^2 and n=3n = 3 it says that 9−12+3−0=09 - 12 + 3 - 0 = 0.

Example P2.3.58. Newton's formula for f(x)=cxf(x) = c^x with cc a number. Since Δkcx=(c−1)kcx\Delta^k c^x = (c-1)^k c^x, the edge is (c−1)k(c-1)^k, and the formula gives cn=∑k(nk)(c−1)kc^n = \sum_k \binom{n}{k} (c-1)^k. With c=1+yc = 1 + y this is the binomial theorem (1+y)n=∑k(nk)yk(1+y)^n = \sum_k \binom{n}{k} y^k. So the binomial theorem is a special case of Newton's formula.

Example P2.3.59. The theorem on powers of the difference operator with f(x)=1xf(x) = \frac{1}{x} and x=1x = 1, n=2n = 2: Δ2f(1)=f(3)−2f(2)+f(1)=13−1+1=13\Delta^2 f(1) = f(3) - 2f(2) + f(1) = \frac{1}{3} - 1 + 1 = \frac{1}{3}. On the other side, 1x=(x−1)−1‾\frac{1}{x} = (x - 1)^{\underline{-1}}, so Δ21x=(−1)(−2)(x−1)−3‾=2x(x+1)(x+2)\Delta^2 \frac{1}{x} = (-1)(-2)(x-1)^{\underline{-3}} = \frac{2}{x(x+1)(x+2)}, which is 26=13\frac{2}{6} = \frac{1}{3} at x=1x = 1.

Exercises

  1. [10] Write the difference table of f(x)=x4f(x) = x^4 for 0≤x≤50 \le x \le 5. Use its left edge to write x4x^4 as a combination of falling powers.
  2. [M15] Use Exercise 1 to find ∑0≤k<nk4\sum_{0 \le k < n} k^4 as a polynomial in nn, and factor it.
  3. [M18] A polynomial pp of degree at most 33 has p(0)=1p(0) = 1, p(1)=0p(1) = 0, p(2)=3p(2) = 3 and p(3)=16p(3) = 16. Find p(4)p(4) from the difference table, and find p(x)p(x).
  4. [M22] Let n≥0n \ge 0 and let xx be a number that is not 0,−1,…,−n0, -1, \dots, -n. Show that ∑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)}.
  5. [M15] Show that Δncx=(c−1)ncx\Delta^n c^x = (c-1)^n c^x, and use the theorem on powers of the difference operator to find ∑k(nk)(−1)n−kck\sum_k \binom{n}{k} (-1)^{n-k} c^k.
  6. [M22] Let pp be a polynomial of degree dd such that p(0),p(1),…,p(d)p(0), p(1), \dots, p(d) are integers. Show that p(n)p(n) is an integer for every integer nn, also for n<0n < 0. Give such a pp of degree 22 whose coefficients are not all integers.
  7. [M20] Let qq be the polynomial of degree at most nn with q(k)=2kq(k) = 2^k for 0≤k≤n0 \le k \le n. Show that q(n+1)=2n+1−1q(n+1) = 2^{n+1} - 1.
  8. [M23] Show that ∑0≤k≤n(nk)(−1)n−kkn+1=n!(n+12)\sum_{0 \le k \le n} \binom{n}{k} (-1)^{n-k} k^{n+1} = n! \binom{n+1}{2}.
  9. [M20] Let f:ℤ→ℂf: \mathbb{Z} \to \mathbb{C} satisfy Δd+1f(x)=0\Delta^{d+1} f(x) = 0 for every integer xx. Show that there is a polynomial pp of degree at most dd with f(x)=p(x)f(x) = p(x) for every integer xx, also for x<0x < 0.
  10. [M20] Let m≥0m \ge 0. Show that Sm(n)=∑0≤k<nkmS_m(n) = \sum_{0 \le k < n} k^m is a polynomial in nn of degree m+1m + 1, with leading coefficient 1m+1\frac{1}{m+1} and constant term 00.
  11. [M24] Find ΔkHx\Delta^k H_x at x=0x = 0 for k≥1k \ge 1, and deduce from Newton's formula that Hn=∑1≤k≤n(nk)(−1)k−1kH_n = \sum_{1 \le k \le n} \binom{n}{k} \frac{(-1)^{k-1}}{k}.

Lean

Mathlib's file Mathlib.Algebra.Group.ForwardDiff has most of this section. The theorem on powers of the difference and shift operators is fwdDiff_iter_eq_sum_shift and shift_eq_sum_fwdDiff_iter, Newton's formula for sums is sum_range_shift_eq_sum_fwdDiff_iter, and the nnth difference of a polynomial is Polynomial.fwdDiff_iter_degree_eq_factorial with Polynomial.fwdDiff_iter_eq_zero_of_degree_lt. For powers of the variable the file has fwdDiff_iter_eq_factorial and fwdDiff_iter_pow_eq_zero_of_lt, and for binomial coefficients fwdDiff_iter_choose and fwdDiff_iter_choose_zero. All are proved in Mathlib.

The identity of polynomials in Newton's forward formula, the sums of squares and cubes in the form of equation 1.2.6(12), and the basis of falling powers are not yet stated in the project library. Mathlib has the facts behind the basis: monic_descPochhammer and descPochhammer_natDegree.

Notes and history

Newton found the forward formula in the 1670s and published it in the Principia (1687), Book III, Lemma 5, as a method to pass a curve through given points. James Gregory had found it a few years before him, in 1670. The formula was the main tool of numerical interpolation for three centuries; tables of logarithms and of the positions of planets were filled in with it. The first example of the Examples part is a classic warning about interpolation: the numbers of regions of a circle cut by the chords between nn points in general position are 1,2,4,8,16,311, 2, 4, 8, 16, 31, and the doubling stops at the sixth term.

The difference table of xmx^m and the change of basis to falling powers lead to the Stirling numbers, which Stirling introduced in 1730 for this purpose. Chapter 8 treats them, and Chapter 11 treats the sums of powers in general.

This section ends the chapter. The table shows where the equations of TAOCP 1.2 that the outline gives to this chapter appear.

TAOCP 1.2 Result of P2
1.2.5(18), 1.2.5(19) Definition P2.3.5
1.2.5(20), 1.2.5(21) Proposition P2.3.8
1.2.6(10), 1.2.6(11) Corollary P2.3.23
1.2.6(12) Theorem P2.3.54
1.2.6(34) Corollary P2.3.51
1.2.7(8) Theorem P2.3.37
1.2.7(9) Theorem P2.3.38

The calculus of Newton and Leibniz has a discrete twin. In place of the derivative it has the difference Δf(x)=f(x+1)−f(x)\Delta f(x) = f(x+1) - f(x), and in place of the integral it has the sum. The two calculi have the same shape: there is a fundamental theorem, a rule for products, a rule of integration by parts, and a family of functions whose derivative is easy. In the continuous case that family is the powers xmx^m. In the discrete case it is the falling powers xm‾=x(x−1)⋯(x−m+1)x^{\underline{m}} = x(x-1)\cdots(x-m+1). This chapter builds the discrete calculus and uses it to find closed forms of sums.

Section 3.1 defines the difference and shift operators, the falling and rising powers with exponents of both signs, and the definite sum. Its main result is the fundamental theorem of finite calculus: a sum ∑a≤k<bf(k)\sum_{a \le k < b} f(k) is g(b)−g(a)g(b) - g(a) for each gg with Δg=f\Delta g = f. Section 3.2 proves the rule for the difference of a product and the rule of summation by parts. It shows that the harmonic numbers play the part of the logarithm, and it finds the sums of kxkk x^k, kHkk H_k and (km)Hk\binom{k}{m} H_k. Section 3.3 is about difference tables. It proves that the nnth difference of a polynomial of degree nn is a constant, it proves Newton's forward formula, and it uses the formula to sum powers.

TAOCP uses this material in several places. Section 1.2.5 defines the falling and rising factorial powers in its equations (18) to (21). Section 1.2.6 sums binomial coefficients over the upper index in equations (10) and (11), sums squares in equation (12), and states the rrth difference of a polynomial in equation (34). Section 1.2.7 sums harmonic numbers in equations (8) and (9), with summation by parts. Each of these equations is a theorem or an example of this chapter, and the table at the end of Section 3.3 gives the place of each one.

The chapter assumes P1 and Chapters 1 and 2 of P2. From Chapter 1 it uses the rules for sums, the change of index and the telescoping sum. From Chapter 2 it uses the geometric sum and the sums of squares and cubes as checks. It uses binomial coefficients only through the formula (xm)=xm‾/m!\binom{x}{m} = x^{\underline{m}}/m!, which Section 3.1 states. Chapter 6 develops binomial coefficients in full, and Chapter 8 gives the general change from ordinary powers to falling powers through the Stirling numbers.

The chapter reads with Section 2.6 and Section 5.3 of Concrete Mathematics (GKP94). That book uses the notation ∑abf(x) δx\sum_a^b f(x)\,\delta x for a definite sum, and this chapter uses it too. All functions in the chapter are defined at least on the integers, and their values are real or complex numbers.

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