Calculate the integral where $P_{n}$ and $P_{m}$ are Legendre Polynomials Calculate the folowing integral:
$$I_{k,m}=\int_{-1}^{1} x(1-x^2)P'_{n}(x)P'_{m} dx $$
So, my attempt to solve this consisted in:
First, I thought of manipulating the folowing relations so i could get $x(1-x^2)P'_{n}(x)P'_{m}$ in function of only $P_{n}(x)$, $P_{m}(x)$, $m$ and $n$ so I could use the ortogonality property
$(n+1)P_{n+1}(x)+nP_{n-1}(x)-x(2n+1)P_{n}(x)=0$
$nP_{n}(x)+P'_{n-1}(x)-xP'_{n}(x)=0$
$(1-x^2)P'_{n}(x)+xnP_{n}(x)-nP_{n-1}(x)=0$
But, I couldn't get rid of x or ended up with the derivatives still in the formula.
My other idea was to use integration by parts:
$u=(1-x^2)P'_{n}(x)$
$du=((1-x^2)P'_{n}(x))'dx=n(n+1)P_{n}(x)dx$
$dv=xP'_{m}$
And i used integration by parts again to find $v$ but it only got more complicated and still had the derivatives on the formula.
Can anyone help me solve this? I would aprecciate ideas on how to start solving it.
 A: The key is to use the fact that the Legendre polynomials are complete. In  other words, the sum:
$$f(x) = \sum_{n=0}^{\infty}a_nP_n(x)$$
can converge to any function $f$ with finitely many discontinuities in $[-1,1]$. Knowthing this, we have:
$$\int_{-1}^1f(x)P_m(x)dx = \sum_{n=0}^\infty a_n\int_{-1}^1P_nP_mdx=a_m\frac2{2m+1}$$
By orthogonality. If $f$ happens to be a polynomial with degree smaller than $m$, then $a_m$ will be $0$, and so the integral of the product of a polynomial with $deg(f) < m$ and $P_m$ will be $0$.
Starting from here, first assume WLOG that $n\geq m$ we can use the substitution you proposed: $(1-x^2)P'_{n}(x)=(n+1)xP_n(x) − (n + 1)P_{n+1}(x)$, and arrive at:
$$I_{n,m}= \int_{-1}^1x(1-x^2)P’_n(x)P’_m(x)dx=n\int_{-1}^1x((n+1)xP_n(x) − (n + 1)P_{n+1}(x))P’_m(x)dx $$
Expand and we have:
$$(n+1)\int_{-1}^1x^2P_{n}(x)P’_m(x)dx - (n+1)\int_{-1}^1xP_{n+1}(x)P’_m(x)dx$$
Consider the first integral. If we approximate $x^2P'_m(x)$ by a sum of Legendre polynomials, it will have no terms with $a_kP_k(x)$ where $k > n + 1$, as it is degree at most $n+1$. Therefore, if $n>m+1$, the first integral will vanish by orthogonality.
Similarly, the second integral is $P_{n+1}$ times a polynomial of degree at most $n$, and so it cannot have any terms in it's series representation with Legendre polynomials, $a_kP_k(x)$ where $k \geq n+1$. So regardless of what $m$ is, the second integral always vanishes.
This means, we have:
$$I_{n,m}=(n+1)\int_{-1}^1x^2P_{n}(x)P’_m(x)dx$$
With only two possible values of $m$, namely: $m=n$, $m=n-1$, or the integral is $0$. Let's start with the second case. If $n=m+1$, then we can use one of the equations you found, namely $nP_{m}(x)+P'_{m-1}(x)-xP'_{m}(x)=0$:
$$I_{n,m}=(n+1)\int_{-1}^1x^2P_{n}(x)P’_m(x)dx=I_{n,n-1}=(n+1)\int_{-1}^1xP_{n}(x)(nP_{n-1}(x)+P'_{n-2}(x))dx$$
$$=n(n+1)\int_{-1}^1xP_{n}(x)P_{n-1}(x)dx+(n+1)\int_{-1}^1xP_{n}(x)P'_{n-2}(x)dx$$
Now the second integral can be evaluated to be $0$ by once again considering that $xP'_{n-2}(x)$ has degree $n-2$. As for the first, we can use the recursive definition of the Legendre polynomial to get:
$$=n(n+1)\int_{-1}^1P_{n-1}(x)\frac{(n+1)P_{n+1}(x)+nP_{n-1}(x)}{2n+1}dx$$
And now once again by orthogonality, we have at last:
$$=\frac{n^2(n+1)}{2n+1}\int_{-1}^1P^2_{n-1}(x)dx=\frac{2n^2(n+1)}{(2n+1)(2n-1)}$$
Now for the first case, where $n=m$:
$$I_{n,n} = \int_{-1}^{1} x(1-x^2)(P'_{n}(x))^2dx$$
The trick now is to use even/oddness. The integrand is a product of two even functions and an odd function ($x$), so the integrand is odd, and integrating an odd function over a symmetric domain will result in $0$. Therefore, this case as well, will be $0$. The only non - zero case is therefore:
$$I_{n,n-1} = \frac{2n^2(n+1)}{(2n+1)(2n-1)}$$
Final comments: I was very mistaken to think that this was doable via simple methods  quickly. Hopefully someone else can find a simpler/faster method. Sorry for any typos, this is quite the long post and I probably managed to make an arithmatic mistake somewhere along the way.
