Self-contained problems on this module's toolkit — induction, sums by the
perturbation method, binomial coefficients, Fibonacci numbers, and the analysis
of Algorithm M. You can work every one without the book: each states the
problem in full, gives a hint to peek at when stuck, and a worked answer
sketch to check against. Every numeric value below is reproduced by a few
lines at a REPL (or the exact-arithmetic code you write in the lab).
Ratings follow Knuth's scale (00–50; M = needs mathematics, ▶ = especially
instructive). Where a problem mirrors a TAOCP exercise, its number is noted for
readers who own Volume 1.
1. Induction warm-up: sum of cubes (Nicomachus) (rating 10 · cf. 1.2.1–1)
Problem. Prove by mathematical induction that
k=1∑nk3=(2n(n+1))2for all n≥1.
That is: the sum of the first n cubes equals the square of the n-th
triangular number.
Hint. Basis n=1 is immediate. For the step, add (n+1)3 to the assumed
formula and factor the result into ((n+1)(n+2)/2)2 — the lesson states
exactly this factoring move.
Answer sketch.Basis:13=1=(1⋅2/2)2. Induction: assume
∑k=1nk3=(n(n+1)/2)2. Then
Problem. Using the perturbation method (compute Sn+1 two ways, by
splitting off the last term and the first term, then solve), derive a closed
form for S=∑k=0nkxk. Specialize to x=2 and confirm the result
∑k=0nk2k=(n−1)2n+1+2.
Hint. You will need the geometric sum ∑k=0nxk=x−1xn+1−1
(derived in the lesson by the same trick) as an input, because splitting off the
first term leaves a ∑xk behind.
Answer sketch. Let S=∑k=0nkxk. Split Sn+1=∑k=0n+1kxk
two ways. Last term: Sn+1=S+(n+1)xn+1. First term (reindex
k→k+1): Sn+1=∑k=0n(k+1)xk+1=x∑k=0nkxk+x∑k=0nxk=xS+xG, where G=x−1xn+1−1. Equating,
S+(n+1)xn+1=xS+xG, so
At x=2: denominator (1−2)2=1, numerator 2−(n+1)2n+1+n2n+2=2+2n+1(2n−(n+1))=(n−1)2n+1+2. So
∑k=0nk2k=(n−1)2n+1+2. (Checks: n=2 gives 1⋅8+2=10=0+2+8; n=4 gives 3⋅32+2=98.)
3. A binomial identity by Pascal's rule: ∑k(kn)=2n (rating 17 · cf. 1.2.6)
Problem. Prove the row-sum identity ∑k=0n(kn)=2n by
induction on n, using Pascal's rule(kn)=(k−1n−1)+(kn−1) (rather than the binomial theorem).
Hint. Let Rn=∑k(kn). Substitute Pascal's rule into Rn and
watch each row-(n−1) term get counted twice.
Answer sketch.Basis:R0=(00)=1=20. Induction: assume
Rn−1=2n−1. Using Pascal's rule on every interior term (with the
boundary convention (−1n−1)=(nn−1)=0),
Each row-(n−1) entry appears once in each of the two shifted sums, so the total
doubles. Hence Rn=2⋅2n−1=2n. ■ (This is the same
addition-formula engine that proves every (kn) is an integer — the
recurrence Rn=2Rn−1 is Pascal's rule summed across a row.)
4. ▶ k! divides any product of k consecutive integers (rating 25 · cf. 1.2.6–10)
Problem. Show directly — without invoking Pascal's rule or an induction on
the triangle — that k! divides the product of any k consecutive integers,
i.e. that
(kn)=k!n(n−1)⋯(n−k+1)
is always an integer for integers n≥k≥0.
Hint. The lesson's combinatorial definition of (kn) is the key:
it counts something, and a count is a non-negative integer regardless of the
formula you compute it with.
Answer sketch. By the lesson's definition, (kn) is the number of
k-element subsets of an n-element set — an integer, because it counts
objects. But that same quantity equals k!n(n−1)⋯(n−k+1): form an
ordered selection of k distinct elements (n(n−1)⋯(n−k+1) ways), then
note each k-subset arises from exactly k! orderings, so dividing by k!
counts unordered subsets. Since the left side (a count) is an integer, k! must
divide the numerator n(n−1)⋯(n−k+1) — the product of k consecutive
integers. ■ This is double counting: the integrality is free once
you see the quotient is really a count. (An alternative prime-power argument —
show each prime p divides the numerator at least as often as the denominator —
also works but is longer; the combinatorial one is the instructive route.)
5. A Fibonacci identity by induction: Cassini (rating 20 · cf. 1.2.8, Eq. 8)
Problem. With Knuth's indexing F0=0, F1=1, Fn+1=Fn+Fn−1,
prove Cassini's identity
Fn−1Fn+1−Fn2=(−1)nfor all n≥1
by induction on n.
Hint. Basis n=1: F0F2−F12=0⋅1−1=−1=(−1)1. For the
step, express Fn+2=Fn+1+Fn and reduce FnFn+2−Fn+12 to the
previous case; the sign flips each time.
(since Fn−Fn+1=−Fn−1) =−(Fn−1Fn+1−Fn2)=−(−1)n=(−1)n+1, which is Cassini at n+1. ■ (Spot check:
n=6, F5F7−F62=5⋅13−82=65−64=1=(−1)6.) The sign
alternation is the algebra behind the classic 8×8→5×13
dissection "paradox" mentioned in the lesson.
6. The variance of A in Algorithm M (rating 27 · cf. 1.2.10)
Problem. Algorithm M scans X[1..n] right-to-left and A counts how often
the running maximum changes (executions of step M4). Its generating function is
Gn(z)=2z+1⋅3z+2⋯nz+n−1.
Show that Var(A)=Hn−Hn(2), where Hn=∑k=1n1/k
and Hn(2)=∑k=1n1/k2, and verify it numerically for n=6
against the exact histogram of A (counts 120,274,225,85,15,1 for
A=0,1,…,5).
Hint. Write A=∑k=1n−1Ik as a sum of independent indicators,
where Ik=1 with probability pk=1/(n−k+1) (the lesson proves position
k is a right-to-left maximum with this probability, and notes the indicators
are independent). For independent indicators, variances add, and
Var(Ik)=pk(1−pk).
Answer sketch. Because the Ik are independent Bernoulli(pk) with
pk=1/(n−k+1), letting j=n−k+1 range over 2,3,…,n,
(Equivalently this drops out of Var(A)=Gn′′(1)+Gn′(1)−Gn′(1)2 with Gn′(1)=E[A]=Hn−1.) Numerical check, n=6: the exact
histogram (120,274,225,85,15,1)/720 has mean E[A]=1044/720=1.45=H6−1 and E[A2]=2204/720, giving Var(A)=E[A2]−E[A]2≈0.95861. And H6−H6(2)=2049−36005369≈2.45−1.49139=0.95861. The two agree. ■ (So the standard
deviation is only about lnn: A is tightly concentrated.)