A tree, in mathematics, is a set of points joined by lines in such a way that from any point one can reach any other by exactly one path, with no loops. Trees are everywhere today: in computer networks, in family trees, in search algorithms, in the evolution of species. The first person to study them as mathematical objects, and to give them that name, was Cayley.

From calculus to trees

Cayley reached trees by an unexpected route. In 1857 he was studying expressions formed by differential operators applied one on top of another, and noticed that the way they nested could be drawn as a trunk that branches. In the paper On the theory of the analytical forms called trees, he counted how many such forms there are with a given number of branches.

The figures in Cayley's 1857 paper on the "analytical forms called trees": the only rooted tree with two points, the two with three points and the four with four points. It is the first time a graph is drawn as a mathematical object in its own right.
The figures in Cayley’s 1857 paper on the “analytical forms called trees”: the only rooted tree with two points, the two with three points and the four with four points. It is the first time a graph is drawn as a mathematical object in its own right.Arthur Cayley, Philosophical Magazine 13 (1857) · Wikimedia Commons · public domain

For rooted trees without numbers on the vertices, Cayley found the sequence

$$1, \ 1, \ 2, \ 4, \ 9, \ 20, \ 48, \ 115, \ \ldots$$

for $1, 2, 3, 4, \ldots$ points, using an infinite product that works as a counting machine. The figure shows the cases of $2$, $3$ and $4$ points: $1$, $2$ and $4$ trees.

Isomers

In 1874 Cayley applied the same idea to chemistry. An alkane molecule, such as methane $\text{CH}_4$ or butane $\text{C}_4\text{H}_{10}$, has formula $\text{C}_n\text{H}_{2n+2}$; the carbon atoms form a tree in which each carbon has at most four neighbours, and the hydrogens fill in the rest. Molecules with the same formula and different trees are isomers, different substances. Counting isomers is counting trees. Cayley obtained

$$1, \ 1, \ 1, \ 2, \ 3, \ 5, \ 9, \ 18, \ 35, \ 75, \ \ldots$$

for $n = 1, 2, 3, \ldots$ carbons, with some errors in the larger values, corrected later. It was the beginning of mathematical chemistry, and the word graph itself was born soon afterwards, in 1878, from a comparison Sylvester drew between trees and chemical formulas.

The formula nⁿ⁻²

In 1889, in a three-page paper, A theorem on trees, Cayley took up another problem: how many different trees can be formed on $n$ vertices numbered $1$ to $n$? For $n = 3$ there are $3$: the middle vertex can be $1$, $2$ or $3$. For $n = 4$ there are $16$: $4$ “stars”, with one central vertex joined to the other three, and $12$ “paths”, because there are $4! = 24$ orders for four vertices in a row and each path is counted twice, once from each end. Cayley stated that, in general, the number is

$$n^{n-2}.$$

For $n = 3$, $3^1 = 3$; for $n = 4$, $4^2 = 16$; for $n = 5$, $5^3 = 125$. Carl Borchardt had already reached the result in 1860, using determinants, but it kept Cayley’s name. Cayley’s proof was more a sketch than a proof.

The Prüfer code

The most beautiful proof came in 1918, from Heinz Prüfer. The idea is to assign to each tree a sequence of $n - 2$ numbers between $1$ and $n$, in such a way that each tree gives a different sequence and every sequence comes from some tree. Since there are $n^{n-2}$ sequences, there are $n^{n-2}$ trees.

The rule is: while the tree has more than two vertices, remove the leaf (a vertex with only one neighbour) with the smallest number and write down its neighbour. The sequence of neighbours written down is the code. In the figure, draw trees at random and look at their codes:

To go back from the code to the tree, one follows the reverse path: the numbers that do not appear in the code are exactly the leaves, and at each step the smallest available leaf is joined to the next number of the code.

Exercise: decoding (4, 4, 2, 2)

Find the tree on $6$ vertices whose Prüfer code is $(4, 4, 2, 2)$.

The numbers that do not appear, $1$, $3$, $5$ and $6$, are the initial leaves. The smallest is $1$: join $1$ to $4$. Then the smallest leaf is $3$: join $3$ to $4$. Now $4$ no longer appears in the rest of the code, and has become a leaf; it is the smallest: join $4$ to $2$. The smallest leaf is now $5$: join $5$ to $2$. Vertices $2$ and $6$ are left, and they are joined. The tree has edges $1$–$4$, $3$–$4$, $4$–$2$, $5$–$2$ and $2$–$6$. Encoding it again, one removes $1$ (writes $4$), $3$ (writes $4$), $4$ (writes $2$) and $5$ (writes $2$): back to $(4, 4, 2, 2)$.

Exercise: the isomers of butane and pentane

Draw the carbon trees with $4$ and with $5$ vertices, without numbers, in which each vertex has at most four neighbours, and check Cayley’s values $2$ and $3$.

With $4$ carbons: the chain $\text{C–C–C–C}$, butane, and the star with one central carbon joined to three, isobutane. That makes $2$. With $5$ carbons: the chain of five, pentane; a chain of four with a branch on the second carbon, isopentane; and one central carbon joined to four, neopentane. A branch on the third carbon of a chain of four gives the same tree as on the second, read backwards. That makes $3$.

Sources: Arthur Cayley, “On the theory of the analytical forms called trees”, Philosophical Magazine 13 (1857), “On the mathematical theory of isomers”, Philosophical Magazine 47 (1874), and “A theorem on trees”, Quarterly Journal of Mathematics 23 (1889) · Heinz Prüfer, “Neuer Beweis eines Satzes über Permutationen”, Archiv der Mathematik und Physik 27 (1918) · Norman Biggs, E. Keith Lloyd and Robin Wilson, Graph Theory 1736–1936 (1976).


All topics on Arthur Cayley · ← Abstract groups · The octonions →

Image credits.