taocp

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

Exercise · Volume 1 · 1.2.9-22

Exercise 1.2.9-22

stated in Lean solution written

RatingM21
MarkersM (mathematical)
KindK3, find a value: compute a number, a set or a closed form from the written solution
SectionSection 1.2.9 of Volume 1. Companion chapter: Generating functions

The task

Find a generating function G(z)G(z) with [zn]G(z)=∑(rk0)(rk1)(rk2)⋯[z^n]G(z)=\sum\binom r{k_0}\binom r{k_1}\binom r{k_2}\cdots, over all k0+2k1+4k2+⋯=nk_0+2k_1+4k_2+\cdots=n.

The exact wording is in your copy of the book.

Hints

Open one hint at a time. Try the exercise again after each.

Hint 1

The right side is a coefficient of a product with one factor for each power 2j2^j.

Hint 2

Use the binomial series (19) in each factor, then the identity ∏j(1+z2j)=11−z\prod_j(1+z^{2^j})=\frac1{1-z}.

Solution

Show the solution

For each j≥0j\ge0 the series (1+z2j)r=∑k(rk)z2jk(1+z^{2^j})^r=\sum_k\binom rkz^{2^jk} marks the number kjk_j with the exponent 2jkj2^jk_j. The coefficient of znz^n in ∏j≥0(1+z2j)r\prod_{j\ge0}(1+z^{2^j})^r is the sum of ∏j(rkj)\prod_j\binom r{k_j} over all k0+2k1+4k2+⋯=nk_0+2k_1+4k_2+\cdots=n. This is the sum in the exercise, and only jj with 2j≤n2^j\le n matter, so the product is a well defined formal series.

Now (1−z)∏j<J(1+z2j)=1−z2J(1-z)\prod_{j<J}(1+z^{2^j})=1-z^{2^J}, by induction on JJ using (1−z2J)(1+z2J)=1−z2J+1(1-z^{2^J})(1+z^{2^J})=1-z^{2^{J+1}}. So ∏j≥0(1+z2j)=1/(1−z)\prod_{j\ge0}(1+z^{2^j})=1/(1-z) as formal series, which says that every integer has exactly one binary representation. Raising to the power rr gives

G(z)=1(1−z)r,[zn]G(z)=(n+r−1n)=(−1)n(−rn).G(z)=\frac1{(1-z)^r},\qquad[z^n]G(z)=\binom{n+r-1}n=(-1)^n\binom{-r}n.

This holds for every complex number rr, with (n+r−1n)=r(r+1)⋯(r+n−1)/n!\binom{n+r-1}n=r(r+1)\cdots(r+n-1)/n!.

Check

For r=3r=3 and n=4n=4 the solutions of k0+2k1+4k2=4k_0+2k_1+4k_2=4 are (4,0,0)(4,0,0), (2,1,0)(2,1,0), (0,2,0)(0,2,0) and (0,0,1)(0,0,1). The terms are (34)=0\binom34=0, (32)(31)=9\binom32\binom31=9, (30)(32)=3\binom30\binom32=3 and (30)(30)(31)=3\binom30\binom30\binom31=3. The sum is 15=(64)15=\binom64, which is (n+r−1n)\binom{n+r-1}n. Python checks r=3r=3 for n≤8n\le8.

Remarks

For r=1r=1 the coefficient is 11, the binary representation. For r=2r=2 the sum counts the binary partitions of nn with two colors of every power of 22, which is n+1n+1.

This solution is drafted, and a person has not reviewed it yet. The source.

In Lean

stated The statement is in Lean and it builds. The proof is not in Lean yet.

The status is computed from the Lean build. The node of the map.

Something is wrong? Report it.