How can you show that on is a valid kernel by finding a feature map with ? What is Mercer's condition, and why does it show that is not a valid kernel?
Supervised learning, Kernel methods
Level L3 Intermediate. Length Medium. Nature Th+Mat Both.
What's being asked
Whether you understand that a kernel is an inner product in some feature space, and how to test whether a function can be a kernel.
Key idea
A kernel computes an inner product without computing . A symmetric is a valid (Mercer) kernel exactly when every Gram matrix , built on any finite set of points, is positive semidefinite (PSD), meaning for every vector . Expanding gives a 6-dimensional . For , , so even a Gram matrix fails.
Steps
- Expand with and : .
- Read off one feature per term: . The factors are needed so that each product of matching entries gives the coefficient 2. Check that reproduces every term.
- Explain the trick. Methods that use data only through inner products (the SVM dual, kernel ridge regression, kernel PCA) can replace with and never build . This matters when is huge or infinite-dimensional, as for the RBF kernel .
- State Mercer's condition: is symmetric and for every finite set of points and all real numbers .
- Counterexample: for , take the single point . Then , which is not PSD. No feature map can exist, because can never be negative.
Common mistakes
- Leaving out the factors in , so the cross terms come out wrong.
- Checking only symmetry, or only that . The PSD condition must hold for every finite set of points.
- Saying the kernel trick “makes the data linearly separable”. It lets a linear method in feature space act as a nonlinear method in input space.
How long your answer should be
Half a page; 4–5 minutes.
Last checked on 4 December 2026.
Read this
Previous in Supervised learning: Why does the lasso give coefficients that are exactly zero while ridge does not? When the design is orthonormal (), what is the lasso solution and how does it compare with ridge?
Next in Supervised learning: A linear support vector regression (SVR) with an -insensitive loss, and , is trained on five points and learns (so , ). The points are , , , and . Using the dual variables, which points are support vectors, and which have zero training loss?