book-sectionChapter 5

Exercise 5.1 🌟

circle-check

Consider the class GG of binary strings having no three consecutive 0 bits. Such strings are either ∊, a single 0, a double 00, or 1 or 01 or 001 followed by a string with no three consecutive 0 bits. Symbolically, this argument gives the combinatorial construction

G=+Z0+Z0×Z0+(Z1+Z0×Z1+Z0×Z0×Z1)×G.G = ∊ + Z_0 + Z_0×Z_0+(Z_1 + Z_0 × Z_1+Z_0×Z_0 × Z_1) × G.

Theorem 5.1 allows us to translate this immediately into a formula for the generating function G(z)G(z) that enumerates such strings:

G(z)=1+z+z2+(z+z2+z3)G(z)G(z)=1+z+z21zz2z3.G(z) = 1 + z +z^2 + (z + z^2+z^3)G(z) \\ \therefore G(z)=\frac{1+z+z^2}{1-z-z^2-z^3}.

The numerator is consisted of shift factors, as in the example from the book. The denominator is a well-known polynomial describing Tribonacci numbers (see Exercise 4.18). Therefore, the number of strings of length NN with no three consecutive 0 bits is TN+TN+1+TN+2=TN+3T_N+T_{N+1}+T_{N+2}=T_{N+3}, a sequence registered under A000073arrow-up-right.

Exercise 5.2

We can express our class GG symbolically as

G=SEQ(Z1)×SEQ(Z0).G=SEQ(Z_1) \times SEQ(Z_0).

This gives

G(z)=1(1z)2[zN]G(z)=N+1.G(z)=\frac{1}{(1-z)^2} \\[0.2cm] \therefore [z^N]G(z)=N+1.

Exercise 5.3

This is a simple variation of the example from the book. The class UU matches the construction

U=Z+Z×U×U.U = Z_\square + Z_\blacksquare × U × U.

We translate both ZZ classes as zz to get

U(z)=z+zU(z)2U(z)=114z22z.U(z)=z+zU(z)^2 \\[0.2 cm] \therefore U(z)=\frac{1-\sqrt{1-4z^2}}{2z}.
circle-info

It’s always wise to check our OGF. For example, WolframAlpha can expand the generating function with series \frac{1-\sqrt{1-4z^2}}{2z} to order 9.

Exercise 5.4

The total number of binary trees with NN nodes is given by the NNth Catalan number. We need to figure out the number of binary trees with NN nodes without superleaves. The ratio of these numbers specifies the required fraction. The recursive decomposition of our combinatorial structure is

T=Z+Z×T×TZ×Z×Z.T=Z_\square+Z_\blacksquare \times T \times T-Z_\blacksquare \times Z_\blacksquare \times Z_\blacksquare.

Notice that we must exclude a symmetric tree with 3 internal nodes that produces a superleaf at the root. This translates to

T(z)=1+zT(z)2z3T(z)=114z+4z42z.T^\blacksquare(z)=1+zT^\blacksquare(z)^2-z^3 \\[0.2 cm] \therefore T^\blacksquare(z)=\frac{1-\sqrt{1-4z+4z^4}}{2z}.

With the help of WolframAlpha we can confirm that the coefficients divided by the Catalan numbers produce the desired ratios. There is only one caveat, that trees with less than 3 nodes never produce a superleaf, so instead of zero their ratios should give one.

Exercise 5.5 🌟

circle-check

We can regard BB as a series of independent decisions. The combinatorial construction for a decision DD about any single object of size nn in AA is

D=ϵ+Zn    D(z)=1+zn.D=\epsilon+Z_n \implies D(z)=1+z^n.

In other words, we either skip it or include it in our collection. Now, if we have AnA_n distinct objects of size nn in AA, then we make such decisions for every object. The construction is simply a sequence of AnA_n decisions that translates to (1+zn)An(1+z^n)^{A_n}. Finally, the whole product comes from repeating this endeavor for every possible size nn.

The second part of the proof follows from turning a product into a sum by taking a logarithm and employing Taylor expansion of ln(1+x)\ln(1+x). This gives

B(z)=n1(1+zn)An=exp{n1Anln(1+zn)}=exp{n1An(znz2n/2+z3n/3)}(see section 4.2 in the book)=exp{n1Anzn12n1An(z2)n+13n1An(z3)n}=exp{A(z)12A(z2)+13A(z3)}.\begin{align*} B(z) &= \prod_{n \ge 1}(1+z^n)^{A_n} \\ &= \exp\bigg\{ \sum_{n \ge 1} A_n\ln(1+z^n)\bigg\} \\ &= \exp\bigg\{ \sum_{n \ge 1} A_n(z^n-z^{2n}/2+z^{3n}/3- \cdots)\bigg\} \qquad \text{(see section 4.2 in the book)} \\ &= \exp\bigg\{\sum_{n \ge 1} A_nz^n - \frac{1}{2}\sum_{n \ge 1} A_n(z^2)^n + \frac{1}{3}\sum_{n \ge 1} A_n(z^3)^n - \cdots \bigg\} \\ &= \exp\bigg\{A(z) - \frac{1}{2}A(z^2) + \frac{1}{3}A(z^3) - \cdots\bigg\}. \end{align*}

Exercise 5.6 🌟

circle-check

We can regard BB as a series of independent decisions. The combinatorial construction for a decision DD about any single object of size nn in AA is

D=ϵ+Zn+Zn×Zn+Zn×Zn×Zn+=SEQ(Zn)    D(z)=11zn.D=\epsilon+Z_n+Z_n \times Z_n+Z_n \times Z_n \times Z_n + \cdots = SEQ(Z_n) \implies D(z)=\frac{1}{1-z^n}.

In other words, we either skip it, include it once, or twice, or any number of times (infinite geometric series). Now, if we have AnA_n distinct objects of size nn in AA, then we make such decisions for every object. The construction is simply a sequence of AnA_n decisions that translates to 1/(1zn)An1/(1-z^n)^{A_n}. Finally, the whole product comes from repeating this endeavor for every possible size nn.

For the second part of the proof, we follow the same approach as in the previous exercise

B(z)=n11(1zn)An=exp{n1Anln(1zn)}(ln1=0)=exp{n1An(znz2n/2z3n/3)}(see section 4.2 in the book)=exp{n1Anzn+12n1An(z2)n+13n1An(z3)n+}=exp{A(z)+12A(z2)+13A(z3)+}.\begin{align*} B(z) &= \prod_{n \ge 1}\frac{1}{(1-z^n)^{A_n}} \\ &= \exp\bigg\{- \sum_{n \ge 1} A_n\ln(1-z^n)\bigg\} \qquad \text{($\ln 1=0$)} \\ &= \exp\bigg\{-\sum_{n \ge 1} A_n(-z^n-z^{2n}/2-z^{3n}/3- \cdots)\bigg\} \qquad \text{(see section 4.2 in the book)} \\ &= \exp\bigg\{\sum_{n \ge 1} A_nz^n + \frac{1}{2}\sum_{n \ge 1} A_n(z^2)^n + \frac{1}{3}\sum_{n \ge 1} A_n(z^3)^n + \cdots \bigg\} \\ &= \exp\bigg\{A(z) + \frac{1}{2}A(z^2) + \frac{1}{3}A(z^3) + \cdots\bigg\}. \end{align*}

Exercise 5.7

This is a variation of the generalized derangements problem. The combinatorial construction is

PODD=SET(CYC1(Z)+CYC3(Z)+CYC5(Z)+).P^*_{ODD} = SET(CYC_1(Z)+CYC_3(Z)+CYC_5(Z)+\cdots).

The EGF associated with the combinatorial class PODDP^*_{ODD} is

PODD(z)=exp{z+z33+z55+}=exp{ln11zz22z44}=ek1z2k2k1z=e12ln(1z2)1z=1z21z=1+z1z.\begin{align*} P^*_{ODD}(z) &= exp\bigg\{z+\frac{z^3}{3}+\frac{z^5}{5}+\cdots\bigg\} \\[0.3 cm] &=exp\bigg\{\ln \frac{1}{1-z}-\frac{z^2}{2}-\frac{z^4}{4}-\cdots\bigg\} \\[0.3 cm] &=\frac{e^{-\sum_{k \ge 1} \frac{z^{2k}}{2k}}}{1-z} \\[0.3 cm] &=\frac{e^{\frac{1}{2}\ln (1-z^2)}}{1-z} \\[0.3 cm] &=\frac{\sqrt{1-z^2}}{1-z}= \sqrt{\frac{1+z}{1-z}}. \end{align*}

Exercise 5.8

Symbolically, we have the construction

G=SEQ(CYC(Z)),G=SEQ(CYC(Z)),

which, by the cycle and sequence rules in Theorem 5.2, gives the EGF

G(z)=11ln11z=11+ln(1z).G(z)=\frac{1}{1-\ln \frac{1}{1-z}}=\frac{1}{1+\ln (1-z)}.

Exercise 5.9

Symbolically, we have the construction that omits an empty sequence

G=CYC(SEQ1(Z)),G=CYC(SEQ_{\ge 1}(Z)),

which, by the cycle and sequence rules in Theorem 5.2, gives the EGF

G(z)=ln11z1z=ln1z12z.G(z)=\ln \frac{1}{1-\frac{z}{1-z}}=\ln \frac{1-z}{1-2z}.

Exercise 5.10

The proof is available on Analytic Combinatorics by RS and PF book’s websitearrow-up-right (see slide 12).

Exercise 5.11

The first part of the proof is

cA+Bzcc!ucost(c)=aAzaa!ucost(a)+bBzbb!ucost(b)=A(z,u)+B(z,u).\begin{align*} \sum_{c \in A + B} \frac{z^{|c|}}{|c|!} u^{\text{cost}(c)} &= \sum_{a \in A} \frac{z^{|a|}}{|a|!} u^{\text{cost}(a)} + \sum_{b \in B} \frac{z^{|b|}}{|b|!} u^{\text{cost}(b)} \\ &= A(z, u)+B(z, u). \end{align*}

For the labeled product ABA \star B, we have

cABzcc!ucost(c)=aAbB(a+ba)za+b(a+b)!ucost(a)+cost(b)=aAbB(a+b)!a!b!zazb(a+b)!ucost(a)ucost(b)=(aAzaa!ucost(a))(bBzbb!ucost(b))=A(z,u)B(z,u).\begin{align*} \sum_{c \in A \star B} \frac{z^{|c|}}{|c|!} u^{\text{cost}(c)} &= \sum_{a \in A} \sum_{b \in B} \binom{|a| + |b|}{|a|} \frac{z^{|a|+|b|}}{(|a|+|b|)!} u^{\text{cost}(a) + \text{cost}(b)} \\ &= \sum_{a \in A} \sum_{b \in B} \frac{(|a| + |b|)!}{|a|!|b|!} \frac{z^{|a|}z^{|b|}}{(|a|+|b|)!} u^{\text{cost}(a)} u^{\text{cost}(b)} \\ &= \left( \sum_{a \in A} \frac{z^{|a|}}{|a|!} u^{\text{cost}(a)} \right) \left( \sum_{b \in B} \frac{z^{|b|}}{|b|!} u^{\text{cost}(b)} \right) = A(z, u)B(z, u). \end{align*}

Having established both the labelled summation and product, the remainder of the proof proceeds identically to that presented for Theorem 5.2.

Exercise 5.12

Bu(z,1)=z(1(1+u)z)2u=1=z(12z)2=122z(12z)2.B_u(z,1)=\frac{z}{(1-(1+u)z)^2}\bigg|_{u=1}=\frac{z}{(1-2z)^2}=\frac{1}{2}\,\frac{2z}{(1-2z)^2}.

Thus, the average number of 1 bits in a random bitstring of length NN is

[zN]Bu(z,1)2N=N2N12N=N/2.\frac{[z^N]B_u(z,1)}{2^N}=\frac{N2^{N-1}}{2^N}=N/2.

Exercise 5.13

Symbolically, we have the construction (see the book)

G=ϵ+Z0+(Z1+Z0×Z1)×G.G = \epsilon + Z_0 + (Z_1 + Z_0 × Z_1) × G.

We should translate each Z1Z_1 as uzuz, to get

G(z,u)=1+z1uz(1+z).G(z,u)=\frac{1+z}{1-uz(1+z)}.

The cumulative number of 1 bits is

Gu(z,1)=z(1+z)2(1uz(1+z))2u=1=1+z(1zz2)21+z1zz2.G_u(z,1)=\frac{z(1+z)^2}{(1-uz(1+z))^2}\bigg|_{u=1}=\frac{1+z}{(1-z-z^2)^2} - \frac{1+z}{1-z-z^2}.

The second summand is an OGF for FN+2F_{N+2}. The first summand can be rewritten as

1+z(1zz2)2=1+zz2(z1zz2z1zz2).\frac{1+z}{(1-z-z^2)^2}=\frac{1+z}{z^2} \cdot \left(\frac{z}{1-z-z^2} \cdot \frac{z}{1-z-z^2}\right).

The OGF inside parenthesis is a self-convolution of Fibonacci numbersarrow-up-right (there is a closed-form solution). Hence, after combining all components and simplifying, we get that the average number of 1 bits in a random bitstring of length NN having no 00 is

[zN]Gu(z,1)FN+2=4NFN+2(N+2)FN5FN+2.\frac{[z^N]G_u(z,1)}{F_{N+2}}=\frac{4NF_{N+2}-(N+2)F_N}{5F_{N+2}}.

Exercise 5.14

The book contains the formula for the number of derangements DND_N. We can tweak the combinatorial construction, by marking cycles with uu, to derive the cumulative generating function

Du(z,1)=ez1zN0DNzNN!(ln11zz)N2(N1)!zNN!N![zN]Du(z,1)DN=k=2N(Nk)(k1)!DNkDN.D_u(z, 1) = \underbrace{\frac{e^{-z}}{1-z}}_{\sum_{N \ge 0}D_N\frac{z^N}{N!}} \underbrace{\left( \ln \frac{1}{1-z} - z \right)}_{\sum_{N \ge 2}(N-1)!\frac{z^N}{N!}} \\[0.3 cm] \therefore \frac{N! [z^N] D_u(z, 1)}{D_N} = \frac{\sum_{k=2}^N \binom{N}{k} (k-1)! D_{N-k}}{D_N}.

Informally, we already know from the book that in a random permutation, the average number of cycles is HNH_N. Let XX be a random variable counting the number of fixed points (unary cycles) in a random permutation with NN elements. We have X=kXkX=\sum_kX_k, where XkX_k is an indicator random variable telling whether the kkth element remains on its current position. Apparently,

Pr{Xk=1}=1/N    E[X]=kPr{Xk=1}=1.\Pr\{X_k=1\}=1/N \implies \mathbb{E}[X]=\sum_k \Pr\{X_k=1\}=1.

Therefore, the average number of cycles in a random derangement for large NN is HN1\sim H_N-1. Of course, this back-of-the-envelope calculation makes some unjustified assumptions about independence of events, but gives an indication about what happens at the limit.

Exercise 5.15 🌟

circle-check

The total number of binary trees with NN nodes is given by the NNth Catalan number. The recursive decomposition of our combinatorial structure is

T=ϵ+Z+2Z×(Tϵ)+Z×(Tϵ)2.T=\epsilon+Z_\blacksquare+2Z_\blacksquare \times (T - \epsilon)+Z_\blacksquare \times (T - \epsilon)^2.

In plain English, a tree is one of the following:

  1. An empty tree (external node).

  2. A leaf.

  3. A root with one non-empty subtree (either left or right).

  4. A root with two non-empty subtrees; we must mark this root.

This gives the following BGF

T(z,u)=1+z+2z(T(z,u)1)+uz(T(z,u)1)2=12z(1u)14z+4z2(1u)2uz.\begin{align*} T(z,u) &= 1 + z + 2z(T(z,u)-1) + uz(T(z,u)-1)^2 \\[0.3cm] &= \frac{1 - 2z(1-u) - \sqrt{1 - 4z + 4z^2(1-u)}}{2uz}. \end{align*}

Finding a partial derivative directly is quite complicated, even with a help of a computer algebra system. Instead, we will use the functional equation. By differentiating it implicitly, we get

Tu(z,u)=2zTu(z,u)+z(T(z,u)1)2+2uz(T(z,u)1)Tu(z,u)Tu(z,1)=z(T(z,1)1)212zT(z,1)=z(T(z,1)1)214z=z3T(z,1)414z.T_u(z,u) = 2zT_u(z,u) + z(T(z,u)-1)^2 + 2uz(T(z,u)-1)T_u(z,u) \\[0.3cm] \therefore T_u(z,1)= \frac{z(T(z,1)-1)^2}{1 - 2zT(z,1)}= \frac{z(T(z,1)-1)^2}{\sqrt{1-4z}}=\frac{z^3 T(z,1)^4}{\sqrt{1-4z}}.

Recall that T(z)=T(z,1)=1+zT(z,1)2T(z)=T(z,1)=1+zT(z,1)^2, a standard equation for binary trees. This enables the last simplification. Extracting the coefficient is trivial by employing equation (5.72) from the book Concrete Mathematicsarrow-up-right by Graham, Knuth and Patashnik

[zN]Tu(z,1)=(2N2N3).[z^N]T_u(z,1)=\binom{2N-2}{N-3} .
circle-info

The aforementioned book is an indispensable source when dealing with convoluted equations, as it contains numerous identities, like the one we have just used.

The average number of internal nodes in a binary tree of size NN with both children internal is

[zN]Tu(z,1)[zN]T(z,1)=(N1)(N2)2(2N1).\frac{[z^N]T_u(z,1)}{[z^N]T(z,1)}= \frac{(N-1)(N-2)}{2(2N-1)}.
circle-info

The formula checks perfectly for trees in Figure 5.2.

Exercise 5.16

This is a variation of the previous exercise. The only difference is that we must mark the internal node connected to a single non-empty subtree. This gives

T(z,u)=1+z+2uz(T(z,u)1)+z(T(z,u)1)2=1u+1(12z(u+1))(12z(u1))2z.\begin{align*} T(z,u) &= 1 + z + 2uz(T(z,u)-1) + z(T(z,u)-1)^2 \\[0.3cm] &=1-u + \frac{1 - \sqrt{(1-2z(u+1))(1-2z(u-1))}}{2z}. \end{align*}

Following the same approach as previously, we arrive at

Tu(z,1)=2z2T(z,1)214z.T_u(z,1) = \frac{2z^2 T(z,1)^2}{\sqrt{1-4z}}.

Using the same identity as before, we get

[zN]Tu(z,1)[zN]T(z,1)=2(2n2n2)1n+1(2nn)=n212n1.\frac{[z^N]T_u(z,1)}{[z^N]T(z,1)}=\frac{2 \dbinom{2n-2}{n-2}}{\cfrac{1}{n+1} \dbinom{2n}{n}} =\frac{n^2-1}{2n-1}.
circle-info

The formula checks perfectly for trees in Figure 5.2.

Exercise 5.17 🌟

circle-check

The explicit formula for T(z,u)T(z,u) is

T(z,u)=114z+4z2(1u)2z.\boxed{T(z,u) = \frac{1 - \sqrt{1 - 4z + 4z^2(1-u)}}{2z}}.

We should calculate variance as described in Table 3.5, so we need a second partial derivative

2T(z,u)u2u=1=2z3(14z)3/2.\left. \frac{\partial^2 T(z,u)}{\partial u^2} \right|_{u=1} = \frac{2z^3}{(1-4z)^{3/2}}.

To find pn(1)p''_n(1) we should use the following identities (see the previous two exercises)

114z=(2kk)zk(by equation (5.72) with r=0)1(14z)3/2=k+12(2k+2k+1)zk(by the index multiply operation).\frac{1}{\sqrt{1-4z}} = \sum \binom{2k}{k} z^k \qquad \text{(by equation (5.72) with $r=0$)} \\[0.3cm] \frac{1}{(1-4z)^{3/2}} = \sum \frac{k+1}{2} \binom{2k+2}{k+1} z^k \qquad \text{(by the index multiply operation)}.

This gives (after right-shifting 3 positions due to z3z^3 and multplying by two)

pn(1)=(n2)(2n4n2).p''_n(1)=(n-2)\binom{2n-4}{n-2}.

Plugging all components (see also the book) into the variance equation and simplifying gives

σ2=n(n+1)(n1)(n2)2(2n1)2(2n3).\sigma^2 = \frac{n(n+1)(n-1)(n-2)}{2(2n-1)^2(2n-3)}.

Exercise 5.18

We can employ the general Leibniz rulearrow-up-right to get

[zN]ez1z=1N!(0kN(Nk)(1)kez(Nk)!(1z)(Nk)1)z=0=0kN(1)kk!.[z^N]\frac{e^{-z}}{1-z}=\frac{1}{N!}\left(\sum_{0 \le k \le N}\binom{N}{k} (-1)^ke^{-z} (N-k)!(1-z)^{-(N-k)-1}\right)\bigg|_{z=0}=\sum_{0 \le k \le N} \frac{(-1)^k}{k!}.

Exercise 5.19

The root with the smallest modulus is 1/ϕ1/\phi, so β=ϕ\beta=\phi. It is a simple algebra to show that

[zN]f(z)g(z)ϕN+25.[z^N]\frac{f(z)}{g(z)}\sim\frac{\phi^{N+2}}{\sqrt 5}.
circle-exclamation

Exercise 5.20

According to Exercise 2 A(z)=1(1z)2A(z)=\frac{1}{(1-z)^2}. Here, β=1\beta=1, ν=2\nu=2, f(1)=1f(1)=1 and g(1)=2g''(1)=2. Based on Theorem 4.1, an approximation for the number of bitstrings having no occurrence of 01 is

[zN]f(z)g(z)N.[z^N]\frac{f(z)}{g(z)}\sim N.

Exercise 5.21 🌟

circle-check

Let f(z)=exp(z1z)f(z) = \exp\left(\frac{z}{1-z}\right). For the power series expansion of the exponent to converge, we must restrict our domain to z<1|z|<1 (the criterion for a geometric series to converge). Therefore,

[zn]f(z)minx(0,1)exp(x1x)xn.[z^n]f(z) \le \underset{x \in (0,1)}{\min} \frac{\exp\left(\frac{x}{1-x}\right)}{x^n}.

We should set xx to balance the growth of the numerator and the denominator as nn grows. Since we must prove that the bound is a function of n\sqrt n, let’s try

x=11n.x = 1 - \frac{1}{\sqrt{n}}.
circle-info

This is a bit reminiscent of the trial and error process in finding particular solutions of nonhomogeneous differential equations.

We have

exp(x1x)=exp(11n1n)=exp(n1),\exp\left(\frac{x}{1-x}\right) = \exp\left(\frac{1 - \frac{1}{\sqrt{n}}}{\frac{1}{\sqrt{n}}}\right) = \exp(\sqrt{n} - 1),

and

1xn=(11n)n=(11n)n(n)exp(n+1).\frac{1}{x^n} = \left(1 - \frac{1}{\sqrt{n}}\right)^{-n}= \left(1 - \frac{1}{\sqrt{n}}\right)^{\sqrt n (-\sqrt n)} \le \exp(\sqrt n + 1).

See Exercise 4.39 to understand the last step. All in all, this concludes the proof

[zn]f(z)exp(n1)exp(n+1)=exp(2n).[z^n]f(z) \le \exp(\sqrt{n} - 1) \cdot \exp(\sqrt{n} + 1) = \exp(2\sqrt{n}).

We aren’t claiming that C=2C=2 is optimal, just that there is such a constant.

Exercise 5.22

This is a variation of the previous exercise. Let f(z)=k=1(1zk)1f(z)=\prod_{k=1}^\infty (1-z^k)^{-1}. The radius of convergence is z<1|z|<1. To deal with the infinite product, we take the natural logarithm and use the Taylor series expansion ln(1x)=j=1xjj\ln(1-x) = -\sum_{j=1}^\infty \frac{x^j}{j}. This gives

lnf(x)=k=1ln(1xk)=k=1j=1xjkj=j=11jk=1(xj)k(by absolute convergence of sums)=j=11jxj1xj.\begin{align*} \ln f(x) &= -\sum_{k=1}^\infty \ln(1-x^k) \\ &= \sum_{k=1}^\infty \sum_{j=1}^\infty \frac{x^{jk}}{j} \\ &= \sum_{j=1}^\infty \frac{1}{j} \sum_{k=1}^\infty (x^j)^k && \text{(by absolute convergence of sums)} \\ &= \sum_{j=1}^\infty \frac{1}{j} \frac{x^j}{1-x^j}. \end{align*}

To bound this, we can use a standard algebraic identity (recall that 0<x<10 <x<1)

1xj=(1x)(1+x+x2++xj1)(1x)jxj1.1 - x^j = (1-x)(1 + x + x^2 + \dots + x^{j-1}) \ge (1-x) j x^{j-1}.

Substituting this back into our series

xj1xjxj(1x)jxj1=xj(1x)1j(1x).\frac{x^j}{1-x^j} \le \frac{x^j}{(1-x) j x^{j-1}} = \frac{x}{j(1-x)} \le \frac{1}{j(1-x)}.

We have

lnf(x)j=11j(1j(1x))=11xj=11j2π26(1x)f(x)exp(π26(1x)).\ln f(x) \le \sum_{j=1}^\infty \frac{1}{j} \left( \frac{1}{j(1-x)} \right) = \frac{1}{1-x} \sum_{j=1}^\infty \frac{1}{j^2} \le \frac{\pi^2}{6(1-x)} \\ \therefore f(x) \le \exp\left( \frac{\pi^2}{6(1-x)} \right).

We had already encountered the Basel problemarrow-up-right, which was applied above. This gives

[zn]f(z)minx(0,1)f(x)xnminx(0,1)exp(π26(1x)nlnx).[z^n]f(z) \le \underset{x \in (0,1)}{\min} \frac{f(x)}{x^n} \le \underset{x \in (0,1)}{\min}\exp\left( \frac{\pi^2}{6(1-x)} - n \ln x \right).

Let’s attempt with the same candidate

x=11n.x= 1 - \frac{1}{\sqrt{n}}.

We have

π26(1x)=π26(1n)=π26n,\frac{\pi^2}{6(1-x)} = \frac{\pi^2}{6 \left(\frac{1}{\sqrt{n}}\right)} = \frac{\pi^2}{6} \sqrt{n},

and

nlnx=nln(11n)n(1n+1n)ln(1x)Taylor expansion of=n+1.-n \ln x = -n \ln\left(1 - \frac{1}{\sqrt{n}}\right) \le n\underbrace{\left( \frac{1}{\sqrt{n}} + \frac{1}{n} \right)}_{\overset{\text{Taylor expansion of}}{-\ln(1-x)}} = \sqrt{n} + 1.

Our overall bound becomes

[zn]f(z)exp((π26+1)n+1)=O(exp(Cn)).[z^n]f(z) \le \exp\left( \left( \frac{\pi^2}{6} + 1 \right) \sqrt{n} + 1 \right)=O(\exp(C\sqrt n)).
circle-info

For a more precise bound, take a look at the Wikipedia article about the partition functionarrow-up-right.

Exercise 5.23

The GF from Exercise 7 is

PODD(z)=1+z1z.P^*_{ODD}(z) = \sqrt{\frac{1+z}{1-z}}.

Theorem 5.5 immediately gives the result with α=1/2\alpha=1/2

[zN]PODD(z)2πN=1πN/2.[z^N]P^*_{ODD}(z) \sim \frac{\sqrt 2}{\sqrt {\pi N}}= \frac{1}{\sqrt {\pi N/2}}.

Exercise 5.24

For the special case f(z)1f(z) \equiv1, the extension of Theorem 5.5 to three terms is available on Analytic Combinatorics by RS and PF book’s websitearrow-up-right (see slide 14). We will reuse this asymptotic series for deriving a more precise version of Theorem 5.5 below (when handling the term (1z)(αk)(1-z)^{-(\alpha - k)}).

The asymptotic expansion follows from expanding f(z)f(z) in a Taylor series about z=1z=1

f(z)=k=0f(k)(1)k!(z1)k=k=0f(k)(1)k!(1)k(1z)k.f(z) = \sum_{k=0}^{\infty} \frac{f^{(k)}(1)}{k!} (z-1)^k=\sum_{k=0}^{\infty} \frac{f^{(k)}(1)}{k!} (-1)^k(1-z)^k.

This gives

f(z)(1z)α=k=0(1)kf(k)(1)k!(1z)kα=k=0(1)kf(k)(1)k!(1z)(αk).\frac{f(z)}{(1-z)^\alpha} = \sum_{k=0}^{\infty} (-1)^k \frac{f^{(k)}(1)}{k!} (1-z)^{k-\alpha} = \sum_{k=0}^{\infty} (-1)^k \frac{f^{(k)}(1)}{k!} (1-z)^{-(\alpha - k)}.

Substituting the first few terms k[0,2]k \in [0,2] and collecting powers of nn gives

[zn]f(z)(1z)α=nα1Γ(α)f(1)+nα2Γ(α1)(α2f(1)f(1))+nα3Γ(α2)(α(3α1)24f(1)α12f(1)+12f(1))+O ⁣(nα4).\begin{align*} [z^n] \frac{f(z)}{(1-z)^\alpha} &= \frac{n^{\alpha-1}}{\Gamma(\alpha)}\,f(1) \\ &\quad + \frac{n^{\alpha-2}}{\Gamma(\alpha-1)}\left( \frac{\alpha}{2}\,f(1) - f'(1) \right) \\ &\quad + \frac{n^{\alpha-3}}{\Gamma(\alpha-2)}\left( \frac{\alpha(3\alpha-1)}{24}\,f(1) - \frac{\alpha-1}{2}\,f'(1) + \frac{1}{2}\,f''(1) \right) \\ &\quad + O\!\left(n^{\alpha-4}\right). \end{align*}

Exercise 5.25

We follow the steps from the proof of Theorem 5.5. It is a matter to analyze the convolution

[zn]f(z)ln11z=f0n+f1n1++fn11=1n(f0+f111/n+f212/n++fk01k0/n++fn11/n)1nkfk=f(1)n.\begin{align*} [z^n]f(z) \ln \frac{1}{1-z} &= \frac{f_0}{n}+\frac{f_1}{n-1}+ \cdots +\frac{f_{n-1}}{1} \\ &= \frac{1}{n} \left(f_0+\frac{f_1}{1-1/n}+\frac{f_2}{1-2/n}+ \cdots +\frac{f_{k_0}}{1-k_0/n}+\cdots+\frac{f_{n-1}}{1/n}\right) \\ &\sim \frac{1}{n} \sum_k f_k = \frac{f(1)}{n}. \end{align*}

We have split the sum into two parts around the threshold value k0k_0; in spirit, aligned with the Laplace method for sums. A good choice is k0=nk_0 = \lfloor \sqrt{n} \rfloor; the head of the sum captures all of f(1)f(1), where the denominators tend to one.

Assuming that f(z)f(z) converges in a radius r>1r>1, all terms indexed larger than k0k_0 tend to zero exponentially fast (recall that [zn]f(z)=O(rn)[z^n]f(z)=O(r^{-n})). Therefore, the tail sum is negligible.

Exercise 5.26

This is a variation of the previous exercise. From Table 3.1 we know that

[zn]11zln11z=Hn.[z^n] \frac{1}{1-z} \ln \frac{1}{1-z} = H_n.

We setup a convolution, just like in the proof of Theorem 5.5 from the book

[zn]f(z)(11zln11z)=k=0nfkHnk.[z^n] f(z) \left( \frac{1}{1-z} \ln \frac{1}{1-z} \right) = \sum_{k=0}^{n} f_k H_{n-k}.

We split the sum in the same way as previously, so the leading part is

k=0k0fkHnkHnk=0k0fkf(1)lnn.\sum_{k=0}^{k_0} f_k H_{n-k} \sim H_n \sum_{k=0}^{k_0} f_k \sim f(1) \ln n.

This is true, since HnkHnlnnH_{n-k} \sim H_n \sim \ln n for large nn and kk0=nk\le k_0=\sqrt n. The tail sum is negligible for the same reason as in the previous exercise. Therefore,

[zn]f(z)11zln11zf(1)lnn.[z^n] f(z) \frac{1}{1-z} \ln \frac{1}{1-z} \sim f(1) \ln n.

Last updated