Kernel Trick – Proof That $K(x,y) = f(x)f(y)$ is a Kernel

kernel trickmathematical-statisticsself-study

I cannot find a proof that $K(x,y)=f(x)f(y)$ is a Kernel for any real valued function $f$ and $x,y\in \mathbb{R}^n$. Obviously it is symmetric but can someone prove that it is positive semidefinite?

My only idea is plugging the function into the defintion of semi-definiteness:

$$\sum_{i=1}^n\sum_{j=1}^nK(x_i, x_j)c_ic_j=\sum_{i=1}^n\sum_{j=1}^nf(x_i)f(x_j)c_ic_j\overset{?}{<}0$$

Since $f$ can also take negative values I do not see why the sum should be non-negative.

Best Answer

$\sum_{i=1}^n\sum_{j=1}^nK(x_i, x_j)c_ic_j=\sum_{i=1}^n\sum_{j=1}^nf(x_i)f(x_j)c_ic_j = (\sum_{i=1}^nf(x_i)c_i)^2 \geq 0$