# Polynomial delta function

The function ${k_1(x,y) = (3xy+1)/2}$ has a curious property: for any linear function ${\ell}$, and any point ${y\in \mathbb R}$, the integral ${\int_{-1}^1 \ell(x)k_1(x,y)\,dx}$ evaluates to ${\ell(y)}$. This is easy to check using the fact that odd powers of ${x}$ integrate to zero:

$\displaystyle \frac12 \int_{-1}^1 (ax+b)(3xy+1)\,dx = \frac12 \int_{-1}^1 (3ax^2y+b)\,dx = \frac12(2ay+2b) = ay+b$

More generally, for any integer ${n\ge 0}$ there exists a unique symmetric polynomial ${k_n(x,y)}$ that has degree ${n}$ in ${x}$ and ${y}$ separately and satisfies ${\int_{-1}^1 p(x)k_n(x,y)\,dx = p(y)}$ for all polynomials ${p}$ of degree at most ${n}$. For example, ${k_0(x,y)=1/2}$ (obviously) and

$\displaystyle k_2(x,y)=\frac98+\frac32xy+\frac{15}{8}(x^2+y^2)+\frac{45}{8}x^2y^2$

The formula is not really intuitive, and a 3d plot would not help the matter much. To visualize ${k_n}$, I plotted ${k_n(x,-3/4)}$, ${k_n(x,0)}$, and ${k_n(x,1/2)}$ below (green, red, blue respectively).

For ${y\in [-1,1]}$ and large ${n}$, the function ${k_n(\cdot, y)}$ approaches the Dirac delta at ${y}$, although the convergence is slow, especially when ${|y|}$ is close to ${1}$. I don’t think there is anything good to be said about the case ${|y|>1}$.

The existence and uniqueness of ${k_n}$ are a consequence of the Riesz representation of linear functionals on an inner product space. Indeed, polynomials of degree at most ${n}$ form such a space ${\mathbb P_n}$ with inner product ${\langle p,q\rangle = \int_{-1}^1p(x)q(x)\,dx}$, and the functional ${p\mapsto p(y)}$ is linear for any fixed ${y\in\mathbb R}$. Hence, this functional can be written as ${p\mapsto \langle p, k_y\rangle }$ for some ${k_y}$. The function ${(x,y) \mapsto k_x(y)}$ is a reproducing kernel for this space. Its symmetry is not immediately obvious.

The Legendre polynomials ${P_0,\dots,P_n}$ are an orthogonal basis of ${\mathbb P_n}$; more precisely, ${\widetilde{P}_j = \sqrt{j+1/2}P_j}$ form an orthonormal basis. It’s a general fact about reproducing kernels that

$\displaystyle k(x,y) = \sum_j \widetilde{P}_j(x)\widetilde{P}_j(y)$

(which, incidentally, proves the symmetry ${k(y,x)=k(x,y)}$). Indeed, taking this sum as the definition of ${k}$ and writing ${p = \sum_{j=0}^n c_j \widetilde{P}_j}$, we find

$\displaystyle \langle p, k(\cdot, y)\rangle = \sum_j \widetilde{P}_j(y) \langle p, \widetilde{P}_j\rangle = \sum_j \widetilde{P}_j(y) c_j = p(y)$

This is the Sage code used for the above plots.

n = 20
k = sum([(j+1/2)*legendre_P(j,x)*legendre_P(j,y) for j in range(0,n+1)])
plot(k(x,y=-3/4),(x,-1,1),color='green') + plot(k(x,y=0),(x,-1,1),color='red') +  plot(k(x,y=1/2),(x,-1,1),color='blue')

Higher degrees cause some numerical issues…

Post motivated by Math.SE question

## 2 thoughts on “Polynomial delta function”

1. Shouldn’t the multiplying factor for $$\tilde{P}_j$$ be $$(j+1/2)^{1/2}$$?

1. L says:

You are right; I corrected this. It was a typo; the code with (j+1/2)*legendre_P(j,x)*legendre_P(j,y) was based on sqrt(j+1/2) being the factor, which becomes (j+1/2) when applied to both polynomials.