For a similarity graph with symmetric non-negative weights and degree matrix , let . How do you prove that , how does this show that the number of zero eigenvalues of equals the number of connected components, and why does this justify spectral clustering?
Unsupervised learning, Clustering
Level L4 Advanced. Length Medium. Nature Mat Mathematical.
What's being asked
Whether you can expand the quadratic form and turn it into a statement about which vectors sends to zero.
Key idea
is the similarity between points and , and is diagonal with . Since , is positive semidefinite, and exactly when for every connected pair, i.e. when is constant on each connected component. So the vectors with are spanned by the component indicator vectors , where is 1 on the points of component and 0 elsewhere.
Steps
- Expand: . By symmetry of , . So .
- Draw the consequences: is symmetric and positive semidefinite (PSD: for every ), so its eigenvalues are . Also , since each row of sums to .
- For a PSD matrix, exactly when . The sum of non-negative terms is zero only if for every pair with . Following paths of such pairs, must be constant within each connected component, though it can differ between components.
- Count: the vectors with are exactly the combinations of . These are non-zero and do not overlap, so they are linearly independent. Hence the eigenvalue 0 appears exactly times.
- Link to spectral clustering. Put the eigenvectors for the smallest eigenvalues as columns of and run k-means on the rows of . With separate components, all rows in one component are identical and rows from different components differ, so k-means recovers the components exactly. With weak links between clusters, the rows stay close to this ideal picture.
- Give an example: two concentric rings, joined into a graph by connecting points closer than (smaller than the gap between the rings), form two components. Spectral clustering separates them, although k-means on the raw coordinates cannot.
Common mistakes
- Forgetting the . Each pair is counted twice in .
- Concluding that is constant everywhere. It is constant only within each component.
- Running k-means on the eigenvectors of the largest eigenvalues of instead of the smallest.
How long your answer should be
Half a page of proof plus 2–3 sentences; about 5 minutes.
Last checked on 4 December 2026.
Read this
- von Luxburg (2007), A Tutorial on Spectral Clustering: Section 3.1: Proposition 1 proves f^T L f = 1/2 sum w_ij (f_i - f_j)^2 and that L is PSD; Proposition 2 proves the multiplicity of eigenvalue 0 equals the number of connected components. Section 4 gives the algorithms and Section 7 the perturbation-theory justification.
- MIT OCW: 6.867 Machine Learning: Lecture 18: Spectral clustering, Markov models, which covers the graph Laplacian and clustering with its eigenvectors.
Previous in Unsupervised learning: A linear autoencoder with a -dimensional bottleneck, encoder and decoder , is trained with squared reconstruction error on centred data. How does its solution relate to PCA, and what changes with a nonlinear autoencoder?
Next in Unsupervised learning: In locally linear embedding (LLE), the weights reconstruct a point from its neighbours by minimising subject to . (a) Derive the closed-form weights using the local Gram matrix. (b) For with neighbours and , compute the weights. (c) What is the second stage of LLE, and why is regularisation needed when ?