Chapter 5: Analytic Combinatorics
Exercise 5.1 ๐
This exercise illustrates the symbolic method and its efficacy in simplifying the analysis of combinatorial structures. A formal language is employed to define the combinatorial class, which corresponds to an associated generating function. Extracting coefficients then involves identifying the relevant values pertaining to the object under consideration.
Consider the class G 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
Theorem 5.1 allows us to translate this immediately into a formula for the generating function G(z) that enumerates such strings:
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 N with no three consecutive 0 bits is TNโ+TN+1โ+TN+2โ=TN+3โ, a sequence registered under A000073.
Exercise 5.2
We can express our class G symbolically as
This gives
Exercise 5.3
This is a simple variation of the example from the book. The class U matches the construction
We translate both Z classes as z to get
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 N nodes is given by the Nth Catalan number. We need to figure out the number of binary trees with N nodes without superleaves. The ratio of these numbers specifies the required fraction. The recursive decomposition of our combinatorial structure is
Notice that we must exclude a symmetric tree with 3 internal nodes that produces a superleaf at the root. This translates to
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; trees with less than 3 nodes never produce a superleaf, so instead of zero their ratios should give one.
Exercise 5.5 ๐
This exercise introduces a new operation set of, where B is defined as the collection of all finite subsets of A.
We can regard B as a series of independent decisions. The combinatorial construction for a decision D about any single object of size n in A is
In other words, we either skip it or include it in our collection. Now, if we have Anโ distinct objects of size n in A, then we make such decisions for every object. The construction is simply a sequence of Anโ decisions that translates to (1+zn)Anโ. Finally, the whole product comes from repeating this endeavor for every possible size n.
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). This gives
The above derivation assumes that A0โ=0, which is a general precondition for any composition of GFs to be valid (see Exercise 3.41).
Exercise 5.6 ๐
This exercise introduces a new operation multiset of, where B is defined as the collection of all finite multisets of A (subsets with repetitions allowed).
We can regard B as a series of independent decisions. The combinatorial construction for a decision D about any single object of size n in A is
In other words, we either skip it, include it once, or twice, or any number of times (infinite geometric series). Now, if we have Anโ distinct objects of size n in A, then we make such decisions for every object. The construction is simply a sequence of Anโ decisions that translates to 1/(1โzn)Anโ. Finally, the whole product comes from repeating this endeavor for every possible size n.
For the second part of the proof, we follow the same approach as in the previous exercise (including the remark about A0โ=0)
Exercise 5.7
The combinatorial construction is
The EGF associated with the combinatorial class PODDโโ is
Exercise 5.8
Symbolically, we have the construction
which, by the cycle and sequence rules in Theorem 5.2, gives the EGF
Exercise 5.9
Symbolically, we have the construction that omits an empty sequence
which, by the cycle and sequence rules in Theorem 5.2, gives the EGF
Exercise 5.10
The proof is available on Analytic Combinatorics by RS and PF bookโs website (see slide 12).
Exercise 5.11
The first part of the proof is
For the labeled product AโB, we have
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
Thus, the average number of 1 bits in a random bitstring of length N is
Exercise 5.13
Symbolically, we have the construction (see the book)
We should translate each Z1โ as uz, to get
The cumulative number of 1 bits is
The second summand is an OGF for FN+2โ. The first summand can be rewritten as
The OGF inside parenthesis is a self-convolution of Fibonacci numbers (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 N having no 00 is
Exercise 5.14
The book contains the formula for the number of derangements DNโ. We can tweak the combinatorial construction, by marking cycles with u, to derive the cumulative generating function
Informally, we already know from the book, that in a random permutation the average number of cycles is HNโ. Let X be a random variable counting the number of fixed points (unary cycles) in a random permutation with N elements. We have X=โkโXkโ, where Xkโ is an indicator random variable telling whether the kth element remains on its current position. Apparently,
Therefore, the average number of cycles in a random derangement for large N is โผHNโโ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 ๐
This exercise illustrates the symbolic method for parameters in great detail.
The total number of binary trees with N nodes is given by the Nth Catalan number. The recursive decomposition of our combinatorial structure is
In plain English, a tree is one of the following:
An empty tree (external node).
A leaf.
A root with one non-empty subtree (either left or right).
A root with two non-empty subtrees; we must mark this root.
This gives the following BGF
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
Recall that T(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 Mathematics by Graham, Knuth and Patashnik
The aforementioned book is an indispensable source when dealing with convoluted equations, as it contains numerous identities, like the one weโve just used.
The average number of internal nodes in a binary tree of size N with both children internal is
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
Following the same approach as previously, we arrive at
Using the same identity as before, we get
The formula checks perfectly for trees in Figure 5.2.
Exercise 5.17 ๐
This exercise demonstrates how the symbolic method helps in finding various moments that would be very difficult to attain by other means.
The explicit formula for T(z,u) is
We should calculate variance as described in Table 3.5, so we need a second partial derivative
To find pnโฒโฒโ(1) we should use the following identities
This gives (after right-shifting 3 positions due to z3 and multplying by two)
Plugging all components (see also the book for pnโฒโ(1)) into the formula for variance and simplifying gives
Exercise 5.18
We can employ the general Leibniz rule to get
Exercise 5.19
The root with the smallest modulus is 1/ฯ, so ฮฒ=ฯ. It is a simple algebra to show that
The book incorrectly has N in the exponent instead of N+2.
Exercise 5.20
According to Exercise 5.2 A(z)=(1โz)21โ. Here, ฮฒ=1, ฮฝ=2, f(1)=1 and gโฒโฒ(1)=2. Based on Theorem 4.1, an approximation for the number of bitstrings having no occurrence of 01 is
Exercise 5.21 ๐
This exercise showcases the methodology of using the radius-of-convergence bounds.
Let f(z)=exp(1โzzโ). For the power series expansion of the exponent to converge, we must restrict our domain to โฃzโฃ<1 (the criterion for a geometric series to converge). Therefore,
We should set x to balance the growth of the numerator and the denominator as n grows. Since we must prove that the bound is a function of nโ, letโs try
This is a bit reminiscent of the trial and error process in finding particular solutions of nonhomogeneous differential equations.
Weโve
and
See Exercise 4.39 to understand the last step. All in all, this concludes the proof that
We arenโt claiming that C=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โโ(1โzk)โ1. The radius of convergence is โฃzโฃ<1. To deal with the infinite product, we take the natural logarithm and use the Taylor series expansion ln(1โx)=โโj=1โโjxjโ. This gives
To bound this, we can use a standard algebraic identity (recall that 0<x<1)
Substituting this back into our series
Weโve
We had already encountered the Basel problem, which was applied above. This gives
Letโs attempt with the same candidate
Weโve
and
Our overall bound becomes
For a more precise bound, take a look at the Wikipedia article about the partition function.
Exercise 5.23
The GF from Exercise 5.7 is
Theorem 5.5 immediately gives the result with ฮฑ=1/2
Exercise 5.24
For the special case f(z)โก1, the extension of Theorem 5.5 to three terms is available on Analytic Combinatorics by RS and PF bookโs website (see slide 14). Weโll reuse it for deriving a more precise version of Theorem 5.5.
The asymptotic expansion follows from expanding f(z) into a Taylor series about z=1
This gives
Substituting the first few terms kโ[0,2] and collecting powers of n gives
where
Exercise 5.25
We follow the steps from the proof of Theorem 5.5
Weโve split the sum into two parts around the threshold value k0โ; in spirit, aligned with the Laplace method for sums. A good choice is k0โ=โnโโ; the head of the sum captures all of f(1), where the denominators tend to one. Assuming that f(z) has a radius of convergence r>1, all terms indexed larger than k0โ tend to zero exponentially fast (recall that [zn]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
We setup a convolution, just like in the proof of Theorem 5.5 from the book
We split the sum in the same way as previously, so the leading part is
This is true, since HnโkโโผHnโโผlnn for large n and kโคk0โ=nโ. The tail sum is negligible for the same reason as in the previous exercise. Therefore,
Last updated