A real positive-semidefinite kernel satisfies . This follows from positivity of its two-point kernel matrix. If a diagonal value is zero, the corresponding off-diagonal values must also vanish.
For input coordinates, the homogeneous quadratic polynomial kernel has a weighted quadratic feature map with distinct monomials. Computing an inner product of already stored mapped vectors costs arithmetic operations, whereas costs using the input vectors. Here denotes big O notation. Higher fixed degrees can make the dimension gap much larger.
Sample count still matters. With training examples, materializing a dense kernel matrix stores numbers and requires distinct evaluations using symmetry. A dense direct solve for kernel ridge regression typically takes operations after constructing the kernel matrix, while a dual prediction with nonzero coefficients uses kernel evaluations. Explicit finite feature maps can be preferable when is small relative to , and a stored primal weight vector can make prediction depend on rather than on . The kernel trick by Ryan Giordano (sections Ridge regression and The polynomial kernel) explains the change from feature-coordinate equations to training-example equations; neither representation is universally faster.
The kernel trick saves explicit feature construction when the positive-semidefinite kernel is economical to evaluate; it does not remove the cost of optimization, choose a useful positive-semidefinite kernel, or establish generalization. Random Fourier features illustrate a different tradeoff: replacing the exact Gaussian kernel with a finite approximate feature map can reduce dependence on the sample count while introducing approximation error.
If the weight vector lies in the linear span of the training feature map outputs, write . Then
This is a dual representation: coefficients weight training examples rather than feature coordinates. They need not be positive, and need not be unique when the kernel matrix is singular. Some kernel methods instead write with under their own optimization constraints.[ref] The formula is an algebraic conversion for a weight vector in this linear span, not a claim about every possible weight vector. The representer theorem gives a broader reason this form appears in regularized kernel methods.
For the XOR separation by a product feature, let have rows . The Gram matrix of those rows, equivalently the kernel matrix, is
Its eigenvalues are , so it is a positive semidefinite matrix of rank two, not an invertible matrix. More generally, for any real coefficient vector and any finite set of inputs,
This proves the positive-semidefinite kernel condition for the displayed polynomial kernel on all of , rather than checking only this square.
Here , so the explicit choice gives and . Consequently
For the new input , the four polynomial kernel evaluations are . Their weighted sum is , and the sign function predicts . No explicit feature map is needed for this calculation. These coefficients were constructed to reproduce the chosen separator; no fitting algorithm or generalization guarantee is being asserted.
Figure 1.
Quadratic kernel Gram matrix and a dual prediction for a new input
. Both panels use the same ordered four square corners. The Gram matrix has eigenvalues eight, eight, zero, zero. The new-input column contains four kernel evaluations, whose signed weighted contributions sum to minus one half. Details.
Suppose is a positive-semidefinite kernel for every and its diagonal entries are integrable. Positivity of each kernel matrix gives
The Cauchy-Schwarz inequality makes every entry integrable, and integrating each nonnegative finite quadratic form shows that is again a positive-semidefinite kernel.
Kernel principal component analysis Created 2026-09-24 Updated 2026-10-14
Kernel principal component analysis diagonalizes a centered kernel matrix to perform principal component analysis in an implicit feature space.
Kernel ridge regression Created 2026-09-24 Updated 2026-10-14
Kernel ridge regression minimizes empirical squared error plus the squared norm in a Reproducing kernel Hilbert space. The representer theorem reduces it to ridge regression with the kernel matrix as its feature Gram matrix.
For the kernel support vector machine objective , assume , , and that the kernel matrix is invertible. The subdifferential optimality equation gives
Thus strict margins greater than one force zero coefficients, while misclassified observations have nonzero coefficients. Invertibility matters: a singular kernel matrix allows coefficient changes in its null space without changing the fitted function or objective.
Use the normalization
This is ridge regression; the penalty is the squared Euclidean norm. The centering removes the need for an intercept. Differentiating gives the normal equation
For every nonzero , . The coefficient matrix is therefore a positive-definite matrix, even if the design matrix has deficient matrix rank. The objective is a strictly convex function, so the unique minimizer is the closed-form ridge regression estimator, with fitted values
For the primal-dual identity for ridge regression, put and observe
Both parenthesized matrices are positive-definite matrices. Multiplying by their inverses gives
Thus the same fitted vector has the dual expression
No inverse of or alone was needed. This is also the kernel-ridge hat matrix for the linear kernel.
Here a positive-definite kernel means a symmetric real-valued function whose every finite kernel matrix is positive semidefinite: for all , and ,
This is the usual positive-semidefinite kernel convention; strict positivity for distinct points is not required. In particular . Write , and . Positivity of the two-point kernel matrix implies
If , substitute to obtain . If , the affine expression can be nonnegative for every only if . Both cases give the Cauchy-Schwarz inequality for positive-semidefinite kernels:
The zero-diagonal case is essential when the positive-definite kernel is not strictly positive.
To construct a feature map, let be the real vector space of finite formal linear combinations of symbols , one for each . Define a symmetric bilinear form by
The positive-definite kernel property makes this a positive semidefinite bilinear form. It need not yet be an inner product: distinct formal vectors can have zero squared length. The same quadratic-polynomial argument, now applied to , proves
Therefore implies for every . The set
is the radical of a bilinear form, hence a linear subspace. Set
The quotient vector space has a well-defined inner product: changing representatives by elements of changes no pairing, and a zero-length class is exactly the zero class. It is therefore an inner product space.
Define . By construction,
Every positive-definite kernel thus has a feature representation, including degenerate kernels and the zero kernel. This is its canonical feature space of a positive-semidefinite kernel. The construction already gives the requested inner product space.
A real positive-definite kernel is a symmetric function such that, for every finite collection and every ,
Thus every kernel matrix is a positive semidefinite matrix; “positive definite” here does not require strict positivity. A Reproducing kernel Hilbert space is a Hilbert space of functions on in which every point evaluation is a continuous linear functional. Its reproducing property is with , and . For a sum of positive-definite kernels, the quadratic form of its kernel matrix is a sum of nonnegative quadratic forms. Symmetry also survives summation. Consequently
For the representer theorem, put . This is a closed finite-dimensional vector space. The orthogonal decomposition by a closed subspace gives , where and . The reproducing property implies for every observed input, and therefore
Since , any minimizer must lie in . For , the reproducing property gives the evaluation vector and . Hence . If minimizes , its representation yields a minimizing . Conversely, if minimizes , then, for any , representing gives . Thus
This is an equivalence of minimizers, not an existence or uniqueness assertion: the loss function is arbitrary. A singular kernel matrix also allows nonunique coefficients, since differences in represent the zero function. Strict convexity of the loss was not used.
Now use the stated minimum-norm description of a sum of reproducing-kernel Hilbert spaces. Let . If the minimizing tuple did not attain the minimum total squared norm among decompositions of , replacing it by that unique minimum-norm tuple would preserve the loss function and strictly lower the penalty. This contradicts optimality. Therefore
For an arbitrary , take its minimum-norm decomposition . Then , proving that minimizes .
Choose from the representer theorem for this minimizing sum, and define . Write for the component kernel matrices. Then
By uniqueness of the minimum-norm decomposition, for every . This proves the common representer coefficients for a sum of kernels conclusion:
The same coefficient vector works simultaneously. Even when is singular, changing that vector by leaves every component unchanged: forces each nonnegative squared component norm to vanish.
For and labels , with squared-norm penalty normalized as , the kernel soft-margin support vector machine solves
Here is the hinge loss building block, and is column of the symmetric kernel matrix. The prediction is
with a fixed class choice, for example , when the score is zero. Other positive rescalings of the penalty change numerical coefficients in the optimality equation but not the zero-coefficient conclusion.
For a finite convex function , its subdifferential at is
For , affine composition preserves the defining convexity inequality: for ,
If , the subgradient inequality gives , proving .
Conversely, let and first suppose . For every , the function is constant along . Applying the subgradient inequality for both signs of shows . Thus is in the span of , or with . Substituting gives for every real . Hence . If , is constant and ; since finite convex on all of has a nonempty subdifferential at , as well. This handles the case in which the suggested orthogonal projection would be undefined. Therefore
This proves the subdifferential under scalar affine composition identity with all its degenerate cases.
Let be a fitted support-vector-machine margin. The subdifferential of the hinge loss yields choices
Applying the affine-composition identity and the subdifferential sum rule to the convex objective, its optimum satisfies
The second equation is the intercept condition. Since is invertible, multiplying the first by gives the kernel support-vector coefficient from hinge activity formula
In particular Invertibility is needed for this statement about the chosen coefficients: for with two positive labels, and give zero objective and both margins equal to two, while both coefficients are nonzero. A singular kernel matrix allows coefficient changes in the null space without changing the fitted function.
At prediction time, the sum can omit all zero coefficients, requiring only the number of evaluations of the positive-definite kernel corresponding to retained support vectors rather than all . This need not remove the cost of forming or solving with a dense training kernel matrix. Every misclassified point has , including a score-zero tie assigned to the opposite class, so and . Thus many classification errors imply many active support vectors and little prediction-time sparsity benefit. Correctly classified points inside the unit margin can also have nonzero coefficients; a point exactly on the margin need not have a nonzero coefficient.
Use the unscaled penalty convention consistent with the displayed bound:
For an objective with averaged squared loss, the corresponding penalty parameter would be . We retain the unscaled throughout.
By the representer theorem, the kernel ridge regression minimizer lies in the span of . A valid coefficient vector is , giving
The kernel matrix is a positive semidefinite matrix, so the inverse exists even if is singular. In the coefficient objective , this choice satisfies ; there is no need to cancel . The function itself is unique because of the strictly convex squared Hilbert norm. The matrix is the kernel-ridge hat matrix in the present normalization.
Let . Since , the zero mean and covariance assumption give the exact bias-variance decomposition for linear prediction
No normality of the noise is required for this identity.
Choose an orthonormal eigenbasis of , with eigenvalues . Its shrinkage factors are , so
The first bound follows from and from each shrinkage factor being at most one.
To control the bias by the Reproducing kernel Hilbert space norm, for define
The reproducing property gives and
If , the corresponding unscaled kernel combination has Hilbert norm squared , so . There is therefore no bias component in a zero-eigenvalue direction. For the remaining directions,
The scalar bound is again , and the final step is Bessel inequality. Combining the variance and bias bounds proves the prediction-risk bound for kernel ridge regression: