This is only a partial answer and explains all the zeroes in the table, and the first diagonal of $2$s. I will try to update it soon to cover all the cases.
Recall the Legendre polynomials are
$$P_n(x)=\frac1{2^nn!}\frac{\mathrm d^n}{\mathrm dx^n}(x^2-1)^n$$
Therefore, for any smooth function $f(x)$,
$$\int_{-1}^1P_n(x)f(x)\,\mathrm dx$$
can be evaluated by repeatedly using integration by parts.
$$\int_{-1}^1P_n(x)f(x)\,\mathrm dx=\left[\frac{1}{2^nn!}\frac{\mathrm d^{n-1}}{\mathrm dx^{n-1}}(x^2-1)^nf(x)\right]_{-1}^1-\int_{-1}^1\frac{1}{2^nn!}\frac{\mathrm d^{n-1}}{\mathrm dx^{n-1}}(x^2-1)^nf^{(1)}(x)\,\mathrm dx$$
The first term vanishes and the second term can be again integrated by parts. In the end, you will get
$$\int_{-1}^1P_n(x)f(x)\,\mathrm dx=\frac{1}{2^nn!}\int_{-1}^1f^{(n)}(x)(1-x^2)^n\,\mathrm dx$$
Now, if $f(x)=P_m^\prime(x)$ for $m\leq n$, then $P_m^{(n+1)}=0$ so the integral vanishes. Also, $P_m^{(n+1)}$ is an odd function of $x$ if $m-n$ is even. Thus, in that case, we get that
$$\int_{-1}^1P_n(x)P_m^\prime(x)\,\mathrm dx=0$$
If I call the integral $I(n,m)$ (in your notation $I(j,i)$), then so far we have that
- $I(n,m)=0$ if $m-n$ is even.
- $I(n,m)=0$ if $m\leq n$.
Suppose $m=n+1$, then $P_{n+1}^{(n+1)}(x)$ is simply the coefficient of $x^{n+1}$ times $(n+1)!$, which is $\frac{(2n+2)!}{2^{n+1}(n+1)!}$. Thus,
$$I(n,n+1)=\frac{(2n+2)!}{2^{2n+1}n!(n+1)!}\int_{-1}^1(1-x^2)^n\,\mathrm dx$$
The integral is standard (see here). Thus, after easy cancellations, we obtain
$$I(n,n+1)=2$$
So far,
- $I(n,m)=0$ if $m-n$ is even.
- $I(n,m)=0$ if $m\leq n$.
- $I(n,n+1)=2$.
What remains is to prove $I(n,n+1+2k) = 2, \ k\geq 1$ .
By $$ \frac{d}{dx}P_{n+1}(x) = (n+1)P_n(x) + x \frac{d}{dx}P_n(x). $$ we obtain $$ \begin{align} I(n,n+1+2k) & = \int P_{n}((n+1+2k)P_{n+2k}+xP_{n+2k}) , dx \ & = \int xP_{n}P'{n+2k} , dx \ & = xP{n}P_{n+2k}|{-1}^1 - \int P{n+2k}(P_{n}+xP_{n}') , dx \ \end{align} $$ By the fact that $P_n(1) = 1, P_n(-1) = (-1)^n$ and that $xP_n'$ can be expressed by $P_{0},\dots,P_{n}$, it is esay to obtain $$ I(n,n+1+2k) = 2. $$ Thank you!
– luyipao Apr 21 '24 at 12:19