# Proof associated Legendre polynomials are orthogonal: integral doesn't solve

Wondering why Mathematica can't solve this integral:

Integrate[
LegendreP[l1, 1, x] *
LegendreP[l2, 1, x], {x, -1, 1}]


Mathematica outputs: $$\int_{-1}^1 P_{\text{l1}}^1(x) P_{\text{l2}}^1(x) \, dx$$

But I see there is an analytical solution: $$\int_{-1}^{1} P^{m}_{l}(x) P^{m}_{k}(x)dx=\frac{2}{2l + 1}\frac{(l + m)!}{(l - m)!}\delta_{lk}$$ Where $$\delta_{lk}$$ is Kronecker delta

The solution looks like it involves integration by parts and trig substitution. I'm wondering why Mathematica can't solve it, or if there is some way to modify the input so that Mathematica can figure it out. Trying to build intuition on how to use Mathematica and what are it's limits.

I also tried forming the function myself but it didn't help:

p[x_, l_, m_] := ((-1)^m/(2^l l!)*(1 - x^2)^(m/2) * D[(y^2 - 1)^l, {y, l + m}]) /. y -> x;
Integrate[p[x, l1, 1] * p[x, l2, 1], {x, -1, 1}]

• I believe that your relation is only true if l1 and l2 are integers. However, it doesn't look like Mathematica can find a result, even using Assuming[{l1, l2} \[Element] Integers && l1 > 0 && l2 > 0,...] Aug 22, 2021 at 17:20
• Quasi-duplicate: (151618); and (155030), (231472) Aug 22, 2021 at 18:59

As Michael E2 points out, you can 'guess' the answer as follows:

tt = Table[
Integrate[LegendreP[l1, 1, x]*LegendreP[l2, 1, x], {x, -1, 1}]
, {l1, 1, 5}, {l2, 1, 5}]


FindSequenceFunction[Diagonal[tt], n]// FullSimplify


Update

To find the general recurence:

tt2 = Table[
tt = Table[
Integrate[
LegendreP[l1, k, x]*LegendreP[l2, k, x], {x, -1, 1}], {l1, 1,
10}, {l2, 1, 10}];
{k,FindSequenceFunction[Diagonal[tt], n] // FullSimplify},
{k, 0, 5}]


Then

FindSequenceFunction[tt2, k]


• Ah, thanks. Though the answer gets really messy if I try to vary m as well (set to constant 1 in example). Aug 23, 2021 at 13:56
• @Frank see update Aug 23, 2021 at 21:15