12-4 Number of different binary trees

Let bnb_n denote the number of different binary trees with nn nodes. In this problem, you will find a formula for bnb_n, as well as an asymptotic estimate.

a. Show that b0=1b_0 = 1 and that, for n1n \ge 1,

bn=k=0n1bkbn1k.b_n = \sum_{k = 0}^{n - 1} b_k b_{n - 1 - k}.

b. Referring to Problem 4-4 for the definition of a generating function, let B(x)B(x) be the generating function

B(x)=n=0bnxn.B(x) = \sum_{n = 0}^\infty b_n x^n.

Show that B(x)=xB(x)2+1B(x) = xB(x)^2 + 1, and hence one way to express B(x)B(x) in closed form is

B(x)=12x(114x).B(x) = \frac{1}{2x} (1 - \sqrt{1 - 4x}).

The Taylor expansion of f(x)f(x) around the point x=ax = a is given by

f(x)=k=0f(k)(a)k!(xa)k,f(x) = \sum_{k = 0}^\infty \frac{f^{(k)}(a)}{k!} (x - a)^k,

where f(k)(x)f^{(k)}(x) is the kkth derivative of ff evaluated at xx.

c. Show that

bn=1n+1(2nn)b_n = \frac{1}{n + 1} \binom{2n}{n}

(the nnth Catalan number) by using the Taylor expansion of 14x\sqrt{1 - 4x} around x=0x = 0. (If you wish, instead of using the Taylor expansion, you may use the generalization of the binomial expansion (C.4) to nonintegral exponents nn, where for any real number nn and for any integer kk, we interpret (nk)\binom{n}{k} to be n(n1)(nk+1)/k!n(n - 1) \cdots (n - k + 1) / k! if k0k \ge 0, and 00 otherwise.)

d. Show that

bn=4nπn3/2(1+O(1/n)).b_n = \frac{4^n}{\sqrt{\pi}n^{3 / 2}} (1 + O(1 / n)).

a. A root with two subtree.

b.

B(x)2=(b0x0+b1x1+b2x2+)2=b02x0+(b0b1+b1b0)x1+(b0b2+b1b1+b2b0)x2+=k=00bkb0kx0+k=01bkb1kx1+k=02bkb2kx2+ \begin{aligned} B(x)^2 & = (b_0 x^0 + b_1 x^1 + b_2 x^2 + \cdots)^2 \\ & = b_0^2 x^0 + (b_0 b_1 + b_1 b_0) x^1 + (b_0 b_2 + b_1 b_1 + b_2 b_0) x^2 + \cdots \\ & = \sum_{k = 0}^0 b_k b_{0 - k} x^0 + \sum_{k = 0}^1 b_k b_{1 - k} x^1 + \sum_{k = 0}^2 b_k b_{2 - k} x^2 + \cdots \end{aligned}

xB(x)2+1=1+k=00bkb11kx1+k=02bkb21kx3+k=02bkb31kx2+=1+b1x1+b2x2+b3x3+=b0x0+b1x1+b2x2+b3x3+=n=0bnxn=B(x). \begin{aligned} xB(x)^2 + 1 & = 1 + \sum_{k = 0}^0 b_k b_{1 - 1 - k} x^1 + \sum_{k = 0}^2 b_k b_{2-1 - k} x^3 + \sum_{k = 0}^2 b_k b_{3-1 - k} x^2 + \cdots \\ & = 1 + b_1 x^1 + b_2 x^2 + b_3 x^3 + \cdots \\ & = b_0 x^0 + b_1 x^1 + b_2 x^2 + b_3 x^3 + \cdots \\ & = \sum_{n = 0}^\infty b_n x^n \\ & = B(x). \end{aligned}

xB(x)2+1=x14x2(1+14x214x)+1=14x(2214x)1+1=12x(114x)=B(x). \begin{aligned} x B(x)^2 + 1 & = x \cdot \frac{1}{4x^2} (1 + 1 - 4x - 2\sqrt{1 - 4x}) + 1 \\ & = \frac{1}{4x} (2 - 2\sqrt{1 - 4x}) - 1 + 1 \\ & = \frac{1}{2x} (1 - \sqrt{1 - 4x}) \\ & = B(x). \end{aligned}

c. Let f(x)=14xf(x) = \sqrt{1 - 4x}, the numerator of the derivative is

2(12)(32)(52)=2ki=0k2(2k+1)=2k(2(k1))!2k1(k1)!=2(2(k1))!(k1)!. \begin{aligned} 2 \cdot (1 \cdot 2) \cdot (3 \cdot 2) \cdot (5 \cdot 2) \cdots & = 2^k \cdot \prod_{i = 0}^{k - 2} (2k + 1) \\ & = 2^k \cdot \frac{(2(k - 1))!}{2^{k - 1}(k - 1)!} \\ & = \frac{2(2(k - 1))!}{(k - 1)!}. \end{aligned}

f(x)=12x2x24x310x428x5.f(x) = 1 - 2x - 2x^2 - 4 x^3 - 10x^4 - 28x^5 - \cdots.

The coefficient is 2(2(k1))!k!(k1)!\frac{2(2(k - 1))!}{k!(k - 1)!}.

B(x)=12x(1f(x))=1+x+2x2+5x3+14x4+=n=0(2n)!(n+1)!n!x=n=01n+1(2n)!n!n!x=n=01n+1(2nn)x. \begin{aligned} B(x) & = \frac{1}{2x}(1 - f(x)) \\ & = 1 + x + 2x^2 + 5x^3 + 14x^4 + \cdots \\ & = \sum_{n = 0}^\infty \frac{(2n)!}{(n + 1)!n!} x \\ & = \sum_{n = 0}^\infty \frac{1}{n + 1} \frac{(2n)!}{n!n!} x \\ & = \sum_{n = 0}^\infty \frac{1}{n + 1} \binom{2n}{n} x. \end{aligned}

bn=1n+1(2nn).b_n = \frac{1}{n + 1} \binom{2n}{n}.

d.

bn=1n+1(2n)!n!n!1n+14πn(2n/e)2n2πn(n/e)2n=1n+14nπn=(1n+(1n+11n))4nπn=(1n1n2+n)4nπn=1n(11n+1)4nπn=4nπn3/2(1+O(1/n)). \begin{aligned} b_n & = \frac{1}{n + 1} \frac{(2n)!}{n!n!} \\ & \approx \frac{1}{n + 1} \frac{\sqrt{4 \pi n}(2n / e)^{2n}}{2 \pi n (n / e)^{2n}} \\ & = \frac{1}{n + 1} \frac{4^n}{\sqrt{\pi n} } \\ & = (\frac{1}{n} + (\frac{1}{n + 1} - \frac{1}{n})) \frac{4^n}{\sqrt{\pi n}} \\ & = (\frac{1}{n} - \frac{1}{n^2 + n}) \frac{4^n}{\sqrt{\pi n}} \\ & = \frac{1}{n} (1 - \frac{1}{n + 1}) \frac{4^n}{\sqrt{\pi n}} \\ & = \frac{4^n}{\sqrt{\pi}n^{3 / 2}} (1 + O(1 / n)). \end{aligned}