KU Math 725: Lecture 2/13/2026


Back to main page

On this page:


Today’s goal is to get a formula for $\tau(K_n)$ called Cayley’s formula. Note that

\[L = L(K_n) = \mqty[ n - 1 & -1 & -1 & \cdots -1 \\ -1 & n-1 & -1 & \cdots -1 \\ \vdots & \vdots & \ddots & \vdots \\ -1 & -1 & \cdots & n-1 ]\]

and $L^{n,n}$ is $(n-1)\times(n-1)$ matrix of the same form. By MIT, we have

\[\tau(K_n) = \det L^{n,n}.\]

Clearly the vector

\[\mqty[1 \\ \vdots \\ 1]\]

is an eigenvector for $L^{n,n}$ with eigenvalue $1$. Any vector with a $1$ in one entry and a $-1$ in another entry will be an eigenvector ($0$’s elsewhere). All such vectors have eigenvalues $n$. Thus, our eigenvalues are

\[\tau(K_n) = \det L^{n,n} = n^{n-2}.\]

Notice that this is the number of labeled trees on $n$ vertices! If we label the vertices of $K_n$ as $1, \ldots, n$ then a spanning tree is exactly a labeled tree on $n$ vertices.

[theorem=%counter% (Theorem 2.7)] There is a bijection

\[\begin{align*} \mathcal{P}:\mathcal{T}(K_n) &\to [n]^{n-2} \\ T &\mapsto (p_1, \ldots, p_{n-2}) \end{align*}\]

such that for every vertex $v$,

\[\deg_T(v) = 1 + |\{i\in [n-2] | p_i = v\}|.\]

This called the Prufer code. [/theorem]

[proof=Pseudocode for computing $\mathcal P(T)$] Input: $T\in \mathcal{T}(K_n)$
Output: $\mathcal P(T) \in [n]^{n-2}$

Let $T_0 \coloneqq T$.

for i from 1 to n - 1 do:
    y_i := smallest leaf of T_{i-1}
    p_i = unique neighbor of y_i
    T_i := T_{i-1} - y_i

Then $P(T) = (p_1, \ldots, p_{n-2})$. [/proof]

[proof=Pseudocode for computing $T$ from $(p_1, \ldots, p_{n-2})$] Let

\[\begin{align*} \ell_1 &= \min([n]\setminus \{p_1, \ldots, p_{n-2}\}), \\ &\vdots \ell_i &= \min([n]\setminus \{\ell_1, \ldots, \ell_{i-1}, p_i, \ldots, p_{n-2}\}). \end{align*}\]

$T$ has edges $\ell_i p_i$ and one final edge between the two vertices in $[n]\setminus {\ell_1, \ldtos, \ell_{n-2}}$. [/proof]

[lemma=%counter%] For all $v \in V(T)$,

\[\deg_T(v) = 1 + |\{i \in [n-2] \mid p_i = v\}|.\]

[/lemma]

[proof] As we run the algorithm, every vertex eventually becomes a leaf. Either it is deleted or is one of the two remaining vertices in final $K_2$. To make $v$ into a leaf we needed to remove $\deg_T(v) - 1$ of its neighbors. [/proof]

[corollary=%counter% (Corollary 2.9; Cayley-Prufer formula)]

\[\sum_{T \in \mathcal{T}(K_n)} \prod_{j\in [n]} x^{d_T(j)} = x_1 \cdots x_n (x_1 + \cdots + x_n)^2.\]

[/corollary]