3

If $t_n$ is the number of ternary trees with n nodes, with $t_0=0$, what would be the convenient manner for finding a recurrent relationship for $t_n$? It is given that $t_1=1, t_2=3, t_3=12$.

A sketch for $t_1, t_2, t_3$ https://drive.google.com/file/d/0Bzsj_3-U1ZOhS2dFaFNyWFlGOHFnLXdtdEFxQkYxbl9JRzNR/view?usp=sharing

I had found this link on the stackexchange: https://oeis.org/A001764

my guesswork is that $t_n$ of the form $C_1t_{n-1}+C_2t_{n-2}+C_3t_{n-3}$

  • Hint: the recurrence can be recovered from the functional equation $$T(z) = 1 + zT(z)^3.$$ Lagrange inversion then yields the closed form. – Marko Riedel Jan 01 '16 at 21:51
  • See also https://math.stackexchange.com/questions/145515/counting-k-ary-labelled-trees/4767385#4767385 – Mike Earnest Sep 11 '23 at 17:35

2 Answers2

6

Graham, Knuth, and Patashnik, Concrete Mathematics, has a nice treatment of this as Example $\mathbf{5}$ in Section $\mathbf{7.8}$, one that does not use integrals. The key is Raney’s lemma, Theorem $\mathbf{2.1}$ in George N. Raney, Functional composition patterns and power series reversion, Trans. Amer Math. Soc. $\mathbf{94}$ $(1960)$, $441$-$451$, which I give here in essentially the form in which it’s presented in Concrete Mathematics.

Lemma: If $\langle x_1,x_2,\ldots,x_m\rangle$ is any sequence of integers with $x_k\le 1$ for $k=1,\ldots, m$ and with $x_1+x_2+\ldots+x_m=\ell>0$, then exactly $\ell$ of the cyclic shifts $$\langle x_1,x_2,\ldots,x_m\rangle,\;\langle x_2,\ldots,x_m,x_1\rangle,\;\ldots,\;\langle x_m,x_1\ldots,x_{m-1}\rangle$$ have all partial sums positive.

We can do the argument for $m$-ary trees just as well as for ternary trees. Let $C_n^{(m)}$ be the number of $m$-ary trees on $n$ nodes. Then it’s pretty clear that

$$C_{n+1}^{(m)}=\sum_{k_1+\ldots+k_m=n}C_{k_1}^{(m)}C_{k_2}^{(m)}\ldots C_{k_m}^{(m)}\;,\tag{1}$$

where $k_1,\ldots,k_m$ range over non-negative integers: $k_1,\ldots,k_m$ are the numbers of nodes in the $m$ subtrees hanging from the root.

Now consider the set $\Sigma_n$ of sequences $\langle x_0,\ldots,x_{mn}\rangle$ such that each $x_k$ is either $1$ or $1-m$, each partial sum is positive, and the total sum is $1$. Such a sequence has length $mn+1$, so it must have exactly $n$ terms that are $1-m$. There are $\binom{mn+1}n$ sequences of length $mn+1$ with $n$ terms equal to $1-m$ and the rest equal to $1$. If we call two such sequences equivalent if they are cyclic shifts of each other, each equivalence class contains $mn+1$ sequences, and the lemma implies that exactly one of them has all partial sums positive. Thus,

$$|\Sigma_n|=\frac1{mn+1}\binom{mn+1}n\;.$$

On the other hand, I claim that

$$|\Sigma_{n+1}|=\sum_{k_1+\ldots+k_m=n}|\Sigma_{k_1}||\Sigma_{k_2}|\ldots|\Sigma_{k_m}|\;,\tag{2}$$

where $k_1,\ldots,k_m$ range over non-negative integers.

Suppose that $\sigma=\langle x_0,\ldots,x_{m(n+1)}\rangle\in\Sigma_{n+1}$. Clearly $x_{m(n+1)}=1-m$. If $s_k=x_0+\ldots+x_k$, let $n_j$ be maximal less than $m(n+1)$ such that $s_{n_j}=j$ for $j=1,\ldots,m$. It’s not hard to check that $n_m=m(n+1)-1$, and that each of the sequences

$$\langle x_0,\ldots,x_{n_1}\rangle,\langle x_{n_1+1},\ldots,x_{n_2}\rangle,\ldots,\langle x_{n_{m-1}+1},\ldots,x_{n_m}\rangle$$

belongs to some $\Sigma_k$. This means that there are natural numbers $k_1,\ldots,k_m$ such that $n_0=mk_1$, and $n_j-n_{j-1}=mk_j+1$ for $j=2,\ldots,m$, and evidently

$$m(n+1)-1=n_m=mk_1+\sum_{j=2}^m(mk_j+1)=m\left(1+\sum_{j=1}^mk_j\right)-1\;,$$

so $\sum_{j=1}^mk_j=n$.

Conversely, if $\sum_{j=1}^mk_j=n$, where each $k_j\in\Bbb N$, and $\sigma_j\in\Sigma_{k_j}$ for $j=1,\ldots,m$, then the sequence obtained by appending $1-m$ to $\sigma_1\sigma_2\ldots\sigma_m$ is in $\Sigma_{n+1}$. The correspondence is bijective, so $(2)$ is established.

Now $(1)$ and $(2)$ are the same recurrence, and $|\Sigma_0|=1$, since the only member of $\Sigma_0$ is $\langle 1\rangle$, so if we set $C_0^{(m)}=1$, then it follows immediately that

$$C_n^{(m)}=|\Sigma_n|=\frac1{mn+1}\binom{mn+1}n=\frac1{(m-1)n+1}\binom{mn}n$$

for each $n\in\Bbb N$. If $m=2$ these are of course the Catalan numbers. For the present case of $m=3$ we have

$$C_n^{(3)}=\frac1{2n+1}\binom{3n}n\;,\tag{3}$$

just as in Marko’s approach. And just as in that approach, we can use $(3)$ to get a simpler recurrence than $(1)$:

$$\begin{align*} C_{n+1}^{(3)}&=\frac1{2n+3}\binom{3n+3}{n+1}\\\\ &=\frac{(3n+3)(3n+2)(3n+1)}{(2n+3)(n+1)(2n+2)(2n+1)}\binom{3n}n\\\\ &=\frac{3(3n+2)(3n+1)}{2(n+1)(2n+1)(2n+3)}\binom{3n}n\\\\ &=\frac{3(3n+2)(3n+1)}{2(n+1)(2n+3)}C_n^{(3)}\;. \end{align*}$$

Brian M. Scott
  • 631,399
5

Suppose we are interested in computing a recurrence for the number of ternary trees where there is one leaf and one ternary tree on one node. This gives the species

$$\mathcal{T} = \epsilon + \mathcal{Z}\mathfrak{S}_{=3}(\mathcal{T})$$

This yields the functional equation

$$T(z) = 1 + z T(z)^3$$

which immediately produces the recurrence $T_0 = 1$ and

$$T_n = \sum_{a=0}^{n-1}\sum_{b=0}^{n-1-a} T_a T_b T_{n-1-a-b}.$$

For the closed form we get the integral

$$T_n = \frac{1}{2\pi i} \int_{|z|=\epsilon} \frac{1}{z^{n+1}} T(z) \; dz.$$

Use the functional equation and put $T(z) = w$ to get $$z = \frac{w-1}{w^3} = \frac{1}{w^2}-\frac{1}{w^3}$$

and $$dz = -\frac{2}{w^3}+\frac{3}{w^4} \; dw$$ to get for the integral (by Lagrange inversion)

$$\frac{1}{2\pi i} \int_{|w-1|=\epsilon} \frac{w^{3n+3}}{(w-1)^{n+1}} w \left(-\frac{2}{w^3}+\frac{3}{w^4}\right) \; dw \\ = \frac{1}{2\pi i} \int_{|w-1|=\epsilon} \frac{1}{(w-1)^{n+1}} \left(-2w^{3n+1}+3 w^{3n}\right) \; dw .$$

This evaluates by inspection to

$$-2{3n+1\choose n} + 3{3n\choose n} =\left( -2\frac{3n+1}{2n+1} + 3\frac{2n+1}{2n+1} \right) {3n\choose n} \\ = \frac{1}{2n+1}{3n\choose n}.$$

Here we have used the fact that $$w^{3n+1} = \sum_{q=0}^{3n+1} {3n+1\choose q} (w-1)^q \quad\text{and}\quad w^{3n} = \sum_{q=0}^{3n} {3n\choose q} (w-1)^q.$$

Addendum. For an alternate recurrence observe that

$$(2n+3) T_{n+1} = {3n+3\choose n+1} = \frac{(3n+3)(3n+2)(3n+1)}{(2n+2)(2n+1)(n+1)} {3n\choose n} \\ = \frac{(3n+3)(3n+2)(3n+1)}{(2n+2)(n+1)} T_n.$$

This yields $$T_{n+1} = \frac{(3n+3)(3n+2)(3n+1)}{(2n+3)(2n+2)(n+1)} T_n \\ = 3\frac{(3n+2)(3n+1)}{(2n+3)(2n+2)} T_n.$$

Marko Riedel
  • 64,728