3

We know that a tree with n edges have n+1 nodes.So if $|B_{n+1}|$ is the number of all possible ordered trees with n+1 nodes then its true that $C_{n+1} = |B_{n+1}|$ where $C$ is the Catalan number.Let it be $|L_k|$ the number of all possible ordered trees with n+1 nodes and k leaves and Its true that $|B_{n+1}| = \displaystyle\sum_{i=1}^{n}|L_i|$.


If my thinking is correct how can I continue or if you have a better idea please let me know.

2 Answers2

3

Here is a contribution using basic complex variables.

We will compute the number of trees on $n$ nodes and having $q$ leaves.

The combinatorial class equation for ordered rooted trees with leaves marked is $$\def\textsc#1{\dosc#1\csod} \def\dosc#1#2\csod{{\rm #1{\small #2}}} \mathcal{T} = \mathcal{Z}\times \mathcal{U} + \mathcal{Z} \times \textsc{SEQ}_{\ge 1}(\mathcal{T}) \quad\text{or}\quad \mathcal{T} = \mathcal{Z}\times\mathcal{U} + \mathcal{Z} \times \sum_{p\ge 1} \mathcal{T}^p.$$

This yields the functional equation for the generating function $T(z)$ $$T(z) = zu + z\frac{T(z)}{1-T(z)}$$ or $$z = \frac{T(z)}{u+T(z)/(1-T(z))} = \frac{T(z)(1-T(z))}{T(z)+u(1-T(z))}.$$

Note that leaves in addition to being marked as such also carry the node marker so that the total number of nodes includes the leaves. If this is not desired subtract the number of leaves from the number of nodes to get the count of genuine internal nodes.

Starting the computation we seek

$$T_n(u) = \frac{1}{2\pi i} \int_{|z|=\gamma} \frac{1}{z^{n+1}} T(z) \; dz.$$ and will compute this by Lagrange inversion.

Put $w=T(z)$ so that $$dz = \left(\frac{1-2w}{w+u(1-w)} - \frac{w(1-w)}{(w+u(1-w))^2} (1-u) \right) dw.$$

This yields the two integrals $$A = \frac{1}{2\pi i} \int_{|w|=\epsilon} \frac{(w+u(1-w))^{n+1}}{(w(1-w))^{n+1}} w \frac{1-2w}{w+u(1-w)} \; dw \\ = \frac{1}{2\pi i} \int_{|w|=\epsilon} \frac{(w+u(1-w))^{n}}{w^n (1-w)^{n+1}} (-w+(1-w))\;dw \\ = - \frac{1}{2\pi i} \int_{|w|=\epsilon} \frac{(w+u(1-w))^{n}}{w^{n-1} (1-w)^{n+1}} \; dw \\ + \frac{1}{2\pi i} \int_{|w|=\epsilon} \frac{(w+u(1-w))^{n}}{w^n (1-w)^{n}} \; dw.$$

and $$B = -\frac{1}{2\pi i} \int_{|w|=\epsilon} \frac{(w+u(1-w))^{n+1}}{(w(1-w))^{n+1}} w \frac{w(1-w)}{(w+u(1-w))^2} (1-u) \; dw \\ = - (1-u)\frac{1}{2\pi i} \int_{|w|=\epsilon} \frac{(w+u(1-w))^{n-1}}{w^{n-1} (1-w)^{n}} \; dw.$$

We extract the coeffcient in $u$ first. The integral $A$ gives two pieces $$-{n\choose q} \frac{1}{2\pi i} \int_{|w|=\epsilon} \frac{w^{n-q}(1-w)^q}{w^{n-1} (1-w)^{n+1}} \; dw \\ = -{n\choose q} \frac{1}{2\pi i} \int_{|w|=\epsilon} \frac{1}{w^{q-1} (1-w)^{n-q+1}} \; dw = -{n\choose q} {n-2\choose n-q}$$

and $${n\choose q} \frac{1}{2\pi i} \int_{|w|=\epsilon} \frac{w^{n-q}(1-w)^q}{w^{n} (1-w)^{n}} \; dw \\ = {n\choose q} \frac{1}{2\pi i} \int_{|w|=\epsilon} \frac{1}{w^{q} (1-w)^{n-q}} \; dw = {n\choose q} {n-2\choose n-q-1}.$$

The integral in $B$ also gives two pieces $$-{n-1\choose q} \frac{1}{2\pi i} \int_{|w|=\epsilon} \frac{w^{n-1-q} (1-w)^{q}}{w^{n-1} (1-w)^{n}} \; dw \\ = -{n-1\choose q} \frac{1}{2\pi i} \int_{|w|=\epsilon} \frac{1}{w^{q} (1-w)^{n-q}} \; dw = -{n-1\choose q} {n-2\choose n-q-1}.$$

and $${n-1\choose q-1} \frac{1}{2\pi i} \int_{|w|=\epsilon} \frac{w^{n-q} (1-w)^{q-1}}{w^{n-1} (1-w)^{n}} \; dw \\ = {n-1\choose q-1} \frac{1}{2\pi i} \int_{|w|=\epsilon} \frac{1}{w^{q-1} (1-w)^{n-q+1}} \; dw = {n-1\choose q-1} {n-2\choose n-q}.$$

This yields the following answer before simplification: $${n\choose q} {n-2\choose n-q-1}-{n\choose q} {n-2\choose n-q} + {n-1\choose q-1} {n-2\choose n-q} - {n-1\choose q} {n-2\choose n-q-1}.$$

This simplifies to $${n\choose q} {n-2\choose n-q} \left(\frac{n-q}{q-1} - 1 + \frac{q}{n} - \frac{n-q}{n} \frac{n-q}{q-1}\right) \\ = {n\choose q} {n-2\choose n-q} \frac{n-q}{n} \frac{1}{q-1} = \frac{1}{q-1} {n-1\choose q} {n-2\choose n-q} \\ = \frac{1}{n-1} {n-1\choose q} {n-1\choose n-q}.$$

The generating function $T_n(u)$ can be verified using Maple's combstruct package. This is the code.

with(combstruct);

gf_cs :=
proc(n)
    option remember;
    local trees, leaves;

    trees := { T=Union(Prod(Z, U),
                       Prod(Z, Sequence(T, 1<= card))),
               Z=Atom, U=Epsilon };

    leaves :=
    proc(struct)
        if type(struct, function) then
            return add(leaves(op(q, struct)), q=1..nops(struct));
        fi;

        if struct = Z then return 0 fi;
        return 1;
    end;

    add(u^leaves(t), t in allstructs([T, trees], size=n));
end;

CF := (n,q) -> 1/(n-1)*binomial(n-1,q)*binomial(n-1,n-q);

gf_verif := n -> add(CF(n,q)*u^q, q=1..n-1);

This will produce e.g. for $T_9(u)$ the generating function $${u}^{8}+28\,{u}^{7}+196\,{u}^{6}+490\,{u}^{5}+490\,{u}^{4} +196\,{u}^{3}+28\,{u}^{2}+u,$$

which matches the binomial coefficient formula.

Addendum. We show that the counts of the number of trees classified according the number of leaves does indeed add up to the Catalan numbers in order to verify the above computation.

We have the sum $$\frac{1}{n-1}\sum_{q=1}^{n-1} {n-1\choose q} {n-1\choose n-q}.$$

We can extend this to include $q=0$ because the second binomial coefficient is zero in that case: $$\frac{1}{n-1}\sum_{q=0}^{n-1} {n-1\choose q} {n-1\choose n-q}.$$

Put $${n-1\choose n-q} = \frac{1}{2\pi i} \int_{|z|=\epsilon} \frac{(1+z)^{n-1}}{z^{n-q+1}} \; dz.$$

This yields for the sum $$\frac{1}{n-1}\frac{1}{2\pi i} \int_{|z|=\epsilon} \frac{(1+z)^{n-1}}{z^{n+1}} \sum_{q=0}^{n-1} {n-1\choose q} z^q \; dz \\ = \frac{1}{n-1}\frac{1}{2\pi i} \int_{|z|=\epsilon} \frac{(1+z)^{n-1}}{z^{n+1}} (1+z)^{n-1} \; dz \\ = \frac{1}{n-1}\frac{1}{2\pi i} \int_{|z|=\epsilon} \frac{(1+z)^{2n-2}}{z^{n+1}} \; dz \\ = \frac{1}{n-1} {2n-2\choose n}.$$

This is $$\frac{(2n-2)!}{n!\times (n-1)!} = \frac{1}{n} {2n-2\choose n-1}.$$

We now recognize the Catalan number formula shifted by one, obtaining $$ 1, 2, 5, 14, 42, 132, 429, 1430, 4862, 16796, 58786, \ldots $$ from $n=2$ on.

Addendum. The above admits radical simplification, wich can be found at this MSE link.

Marko Riedel
  • 64,728
1

Your thinking looks fairly sound there. All I can think of is the following complicated recurrence from looking at the leftmost sub-tree and enumerating over all possible values for its nodes and its leaves:

$$L_{n, k} = \sum_{i=1}^{n - 1}\prod_{j=1}^{max(k, i)}L_{i, j}L_{n - i, k - j} = \sum_{i=1}^{k}\prod_{j=1}^{i}L_{i, j}L_{n - i, k - j} + \sum_{i = k + 1}^{n - 1}\prod_{j=1}^{k}L_{i, j}L_{n - i, k - j}$$

where $L_{i, j}$ denotes the number of trees with $i$ nodes and $j$ leaves.

Colm Bhandal
  • 4,819