# Integral of product of first derivatives of Legendre polynomials

I have the integral, $$I=\int_{-1}^1 dx P'_m(x) P'_n(x).$$ I tried using $$P_m'(x)=-(m+1)\frac{xP_m(x)-P_{m+1}(x)}{x^2-1},$$ but that yields, $$I=\int_{-1}^1\bigg(\frac{x^2P_mP_n}{(x^2-1)^2}+\frac{P_{m+1}P_{n+1}}{(x^2-1)^2}-\frac{xP_mP_{n+1}}{(x^2-1)^2}-\frac{xP_{m+1}P_n}{(x^2-1)^2}\bigg),$$ which did not seem particularly convenient to me either. Alternatively, using integration by parts, along with $$(1-x^2)P''_m-2xP'_m+m(m+1)P_m=0$$ $$I=P'_mP_n\big\vert_{-1}^1-\int_{-1}^1 dx P_n P''_m=P'_mP_n\big\vert_{-1}^1-\int_{-1}^1\bigg(\frac{2xP_nP'_m}{1-x^2}-m(m+1)\frac{P_nP_m}{1-x^2}\bigg).$$ Stuck either way. Lastly, I tried using the associated Legendre polynomials to cast the original integral as, $$\int_{-1}^1 dx\frac{P_m^1P_n^1}{1-x^2},$$ which I could not find.

I guess the only way out might be to use the Rodrigues formula and churn through all the terms?

Addendum: A brute force evaluation on Mathematica, of both the last expression in terms of the associated Legendre functions, and the initial expression, seems to yield $$I=\int_{-1}^1 dx P'_m(x) P'_n(x)=\int_{-1}^1 dx\frac{P_m^1P_n^1}{1-x^2}=\begin{cases}&k(k+1),\quad k=\mathrm{min}(m,n);\quad m,n \text{ both odd or even}\\&0;\quad \text{otherwise}\end{cases}$$

After integration by parts, it's much easier to use orthogonality. If $$m\leqslant n$$ (say), then $$\int_{-1}^1 P_m'(x)P_n'(x)\,dx=P_m'(x)P_n(x)\Big|_{-1}^1-\int_{-1}^1 P_m''(x)P_n(x)\,dx;$$ the last integral is $$\color{red}{0}$$ because of orthogonality of $$P_n$$ to any polynomial of degree $$, and $$P_n(1)=(-1)^nP_n(-1)=1,\quad P_m'(1)=(-1)^{m-1}P_m'(-1)=m(m+1)/2.$$