The Representer Theorem
Even when a kernel method searches over an infinite-dimensional space of possible functions, the theorem guarantees the optimal solution is always a finite weighted sum of kernels centered on the training points — which is the reason kernel methods are computable at all.
Prerequisites: Mercer's Condition and Valid Kernels, The Kernel Trick and Kernel Methods
A kernel method like kernel ridge regression is, technically, searching for the best function in an entire infinite-dimensional space of possible functions — every conceivable smooth curve is a candidate. That should be an intractable search: how do you optimize over infinitely many functions with a computer that only has finite memory? The representer theorem is the result that rescues this: it proves the optimal function, whatever infinite space it was theoretically drawn from, always turns out to be expressible using only a finite number of terms — one per training point. The search space collapses from infinite to exactly dimensions, where is the number of training examples, and that collapse is what makes every kernel method in practical use computationally solvable.
The analogy: mixing paint from only the colors on your palette
Imagine you're told to find the "best" color to paint a wall, searching over every conceivable color in existence — an infinite space. That sounds impossible to search directly. But suppose you're also told: whatever the optimal color turns out to be, it can always be produced as some mixture of exactly the pigments already sitting on your palette, nothing else. Suddenly the infinite search collapses to "how much of each pigment on my palette do I use" — a small, finite, entirely tractable optimization. The representer theorem is exactly this guarantee for kernel methods: whatever function class you're theoretically searching (infinite), the optimal answer is always a mixture of only the kernel functions centered at your training points — your "palette."
The statement
For a broad class of problems — minimize a loss on the training data plus a penalty on the function's complexity, measured by its norm in the kernel's associated function space (its reproducing kernel Hilbert space) —
the representer theorem guarantees the minimizer always has the exact finite form
Plain English: no matter how rich or infinite-dimensional the space theoretically is, the optimal fitted function is always just a weighted sum of "kernel similarity to each training point," with one weight per training example — turning an infinite optimization problem into an -dimensional one, solvable with ordinary linear algebra.
Worked example 1: kernel ridge regression's closed form
For kernel ridge regression specifically, the representer theorem means the fit reduces to solving one linear system for the coefficients :
where is the Gram matrix from Mercer's condition and is the vector of targets. With training points, , , : solving (a system, well within reach of ordinary matrix inversion) gives a specific vector directly — never an infinite-dimensional object, exactly as the theorem promises, regardless of how complex the underlying kernel's implicit feature space is.
Worked example 2: prediction on a new point
Having solved for from three training points using an RBF kernel with , predicting at a new point requires only evaluating the kernel between and each of the three training points and combining: . If , , : . Three multiplications and a sum — no matter how exotic the kernel's implicit feature space, prediction always costs exactly kernel evaluations, a direct consequence of the theorem's finite-sum form.
Every point in an infinite-dimensional space still has to be reached through finitely many building blocks once you fix a basis — the representer theorem is the statement that, for kernel methods, the training points themselves are always sufficient building blocks, however the underlying space is structured.
What this means in practice
The representer theorem is why the kernel trick and finite computation are compatible at all — without it, "optimize over an infinite-dimensional function space" would be a purely theoretical exercise, and kernel SVMs, kernel ridge regression, and Gaussian processes would not exist as practical algorithms. It's also the reason kernel methods scale with the number of training points rather than the number of features: the vector has exactly entries and the Gram matrix is , regardless of whether the feature space the kernel implicitly represents is 10-dimensional or infinite-dimensional.
Whatever theoretically infinite space of functions a kernel method searches, the representer theorem guarantees its true optimum is always a finite sum of kernel evaluations against the training points — collapsing an infinite optimization problem into an -dimensional one and making every practical kernel algorithm computable.
The representer theorem's finite-sum guarantee is exactly why kernel methods scale poorly with the number of training points, not the number of features — the Gram matrix is , so training cost grows at least quadratically (often cubically, for the matrix inversion) in . This is the opposite scaling behavior from most other model classes, and it's a common surprise: a kernel method that trains instantly on 500 points can become computationally infeasible on 500,000, even if the number of features never changed at all.
Related concepts
Practice in interviews
Further reading
- Kimeldorf & Wahba, Some Results on Tchebycheffian Spline Functions (1971)
- Schölkopf, Herbrich & Smola, A Generalized Representer Theorem (2001)