The Kernel Polynomial Method
Spectral Methods
What you need to know first 15 concepts, 6 layers
The requisite-knowledge inventory for this page, bottom-up: the primitives at the base, combined upward until you reach what this page assumes. Skim the layers you already own; start wherever the ground gets unfamiliar.
- base
- Linear algebraconcept
- L1
- Chebyshev polynomials & nodes
- Linear systems (Ax = b)concept
- Matrix eigenvalue problems
- Orthogonality & projectionconcept
- Stochastic trace estimationconcept
- Symmetric / Hermitian operatorsconcept
- The eigenvalue problem (Ax = λx)concept
- L2
- Density of statesconcept
- Gaussian elimination
- Krylov subspacesconcept
- Power iteration
- L3
- L4
- L5
- ↳you are here
8 of these are concepts without a dedicated page yet — the grey chips. Following the linked ones first makes the rest land.
You have a huge sparse Hamiltonian and you want its density of states — how many quantum states sit at each energy. Diagonalizing for every eigenvalue is hopeless at scale, and wasteful: you only want a smooth curve. The Kernel Polynomial Method gets it from a few hundred sparse matrix–vector products, by expanding the spectrum in Chebyshev polynomials. It is the same moment-and-recurrence machinery as Lanczos, wearing Chebyshev's clothes. Five ways in.
The density of states is built from every eigenvalue of . For a lattice model with millions or billions of sites, computing all of them is out of the question — and pointless, because the answer you want is a smooth curve, not a list of numbers.
So don't ask for the eigenvalues. Ask for the shape of their distribution directly. KPM computes to whatever resolution you pay for, using only the one thing a sparse matrix is good at: multiplying a vector. No eigensolver, no dense storage.
Rescale so its whole spectrum lands inside — call it . Now is a function on that interval, and any such function has a Chebyshev expansion:
The expansion coefficients are the Chebyshev moments of the density, . Truncating at moments gives a resolution that sharpens like — more moments, finer features. The whole problem reduces to: get the moments.
Here is the key identity. Because is a polynomial, the moment is a trace of a matrix polynomial:
And you never form . The Chebyshev polynomials obey a three-term recurrence, so apply it to a vector: , , and . Each step is one sparse matrix–vector product. If that recurrence looks familiar, it should — it is the same three-term structure that makes Lanczos cheap. KPM and Lanczos are two bases for the same moment problem.
One problem remains: still sums a diagonal over all basis states. The escape is stochastic trace estimation. For a random vector whose components are independent with unit variance,
A handful of random probes — often just 10–30, independent of system size — gives every moment at once: run the recurrence on each and accumulate the inner products. This is the same Hutchinson trick that estimates and elsewhere, and it is why KPM scales to operators you could never even store as a dense matrix.
Cut the Chebyshev series off at terms and you get Gibbs oscillations — the reconstructed density rings around sharp features and can dip below zero, which is nonsense for a density. The fix, and the method's namesake, is to multiply each moment by a damping factor: .
That sequence is the kernel. The Jackson kernel is the standard choice: it convolves the exact density with a near-Gaussian of width , killing the ringing while keeping the result everywhere non-negative. Truncation becomes honest broadening instead of artefacts. Toggle it in the demo below and watch the wiggles vanish — that one trick is the difference between a usable spectrum and a noisy one.
Watch the spectrum resolve
Two tight-binding lattices, their density of states reconstructed live from precomputed Chebyshev moments. Drag and the curve sharpens toward the exact answer (dashed); the 1D chain reveals its square-root van Hove edges, the 2D square its logarithmic peak at the band center. Then turn the Jackson kernel off and watch Gibbs ringing take over — the red line is zero, and an honest density never crosses it.
The Jackson kernel turns truncation into a smooth ~0.13-wide broadening — sharper as N grows, no ringing.
The moments, in code
The entire method is the Chebyshev recurrence on a few random vectors. There is no eigensolver anywhere — only sparse matrix–vector products and inner products. Reconstruction (summing the series with the Jackson kernel) is a few lines more; the demo above does it in your browser on every slider tick.
import numpy as np, scipy.sparse as sp
def kpm_moments(H, Emin, Emax, Nmax, R, eps=0.04):
"""Chebyshev moments mu_n = (1/D) Tr T_n(H~), never forming T_n(H)."""
D = H.shape[0]
a = (Emax - Emin) / (2 - eps) # rescale spectrum into (-1, 1)
b = (Emax + Emin) / 2
Ht = (H - b * sp.identity(D)) / a
mu = np.zeros(Nmax)
for _ in range(R): # R random probe vectors
v = np.random.standard_normal(D) # E[v v^T] = I => E[v^T A v] = Tr A
t0, t1 = v, Ht @ v # T_0|v> = |v>, T_1|v> = H~|v>
mu[0] += v @ t0
mu[1] += v @ t1
for n in range(2, Nmax):
t2 = 2 * (Ht @ t1) - t0 # T_{n+1} = 2 H~ T_n - T_{n-1}
mu[n] += v @ t2 # accumulate <v|T_n(H~)|v>
t0, t1 = t1, t2
return mu / (R * D), a, b # Validated: KPM density of states vs the known answer
# mu_0 N=256, Jackson integral
1D chain -> exact 0.9995 matches 1/(π√(4−E²)) ∫ρ = 1.00
2D square -> exact 0.9992 matches diagonalization (log peak at 0)
# 3000-site chain: 256 matvecs × 24 probes — never a 3000×3000 dense solve.
# the same Chebyshev recurrence is the engine; only the basis differs from Lanczos. Where this fits
KPM is the fourth costume of a single idea that runs through this site: encode an operator's spectrum in a few moments and read physics off them. Lanczos does it in the Krylov basis and gives a continued fraction; KPM does it in the Chebyshev basis and gives a density. The same machinery computes optical spectra in Liouville–Lanczos TDDFT, network response in spiking networks, and strength functions in the nuclear shell model. Next steps: the spectral function of a chosen state (local DOS), KPM for Green's functions and conductivity, and the kernel-vs-resolution trade pushed to the band-edge singularities where it bites hardest.