MathLabs
FormulaProved

Cayley's formula for labeled trees

Statement

For any integer n≥1n \ge 1, the number of trees on nn labeled vertices {1,…,n}\{1,\dots,n\} is nn−2n^{n-2} (with 1−1=11^{-1}=1 for n=1n=1).

Why is it true?

Every labeled tree on nn vertices can be encoded uniquely as a sequence of n−2n-2 vertex labels (its Prüfer code) by repeatedly plucking the smallest-numbered leaf and recording its neighbor; conversely, any such sequence of length n−2n-2 from {1,…,n}\{1,\dots,n\} decodes to a unique tree, so there are nn−2n^{n-2} of them.

Proof sketch

Construct Prüfer's bijection between labeled trees on {1,…,n}\{1,\dots,n\} and sequences in {1,…,n}n−2\{1,\dots,n\}^{n-2}: at each of n−2n-2 steps, delete the leaf with the smallest label and append its unique neighbor's label to the sequence, leaving a single edge at the end. Observe that a vertex vv appears in the Prüfer sequence exactly deg⁡(v)−1\deg(v)-1 times, so the leaves of the original tree are the labels absent from the sequence, which makes each step uniquely reversible and establishes the bijection.

Topics that use this theorem

Related theorems

Step-by-step proofs

No step-by-step proof yet for this theorem.

References

  1. Arthur Cayley (1889). A theorem on trees