Matrix-Tree Theorem
Statement
Let be a finite connected graph on vertices with Laplacian matrix (where is the degree matrix and the adjacency matrix). Then the number of spanning trees equals any cofactor of :
where is the matrix obtained by deleting row and column . The result is independent of which row/column is deleted.
Visualization
on vertices : every vertex has degree 2.
Delete row 3 and column 3 to get :
The spanning trees of : there are exactly 3, one for each omitted edge.
Tree 1: 1─2, 1─3 (omit edge 2─3)
Tree 2: 1─2, 2─3 (omit edge 1─3)
Tree 3: 1─3, 2─3 (omit edge 1─2)
— confirmed.
By <a class="concept-link" data-concept="Cayley's Formula ( trees)">Cayley's Formula ( trees), , so . For : . For : .
| Graph | |||
|---|---|---|---|
| 2 | 1 | 1 | |
| 3 | 3 | 3 | |
| 4 | 16 | 16 |
Proof Sketch
- Laplacian: if , if , otherwise. Note .
- Matrix-tree identity: Expand via the Cauchy–Binet formula applied to the signed incidence matrix of . The identity (for any oriented incidence matrix ) reduces the cofactor to a sum over spanning trees.
- Spanning tree terms: By the Cauchy–Binet formula, where is the submatrix of with columns indexed by 's edges. Each , so the sum equals .
- Independence: Symmetry of the argument in shows the cofactor is the same for all .
Connections
The Matrix-Tree Theorem is the algebraic proof of <a class="concept-link" data-concept="Cayley's Formula ( trees)">Cayley's Formula ( trees) and a flagship application of the Determinant MultiplicativityDeterminant MultiplicativityThe determinant of a product equals the product of determinantsRead more → identity (Cauchy–Binet). The Laplacian also features in Rank–Nullity TheoremRank–Nullity TheoremThe dimensions of image and kernel of a linear map sum to the domain dimensionRead more →: has dimension equal to the number of connected components, proved via in Mathlib. The spectral properties of (eigenvalues, Spectral TheoremSpectral TheoremEvery real symmetric matrix is orthogonally diagonalizableRead more →) underlie the algebraic connectivity (Fiedler value) used in graph partitioning.
Lean4 Proof
import Mathlib.Combinatorics.SimpleGraph.LapMatrix
import Mathlib.Data.Matrix.Basic
-- Mathlib provides SimpleGraph.lapMatrix.
-- The full matrix-tree theorem is not yet in Mathlib v4.28.0;
-- we verify the K₃ cofactor directly.
-- The 2×2 submatrix of L(K₃) after deleting row/col 3:
def L33 : Matrix (Fin 2) (Fin 2) ℤ :=
!![2, -1; -1, 2]
theorem K3_spanning_trees : L33.det = 3 := by decideReferenced by
- Handshake LemmaGraph Theory
- Cayley's Formula ($n^{n-2}$ trees)Graph Theory