TITLE: Legendre Polynomial Orthogonality Integral
QUESTION [6 upvotes]: I want to show that $$\int_{-1}^{1}L_n(x)L_m(x)dx$$ is zero for $m<n$ and $\frac{2}{2n+1}$ for $m=n$. For $m<n$, I want to apply $(x^2-1)^n=(x-1)^n(x+1)^n$ and integration by parts. For $m=n$ it should be possible to use the substitution $y=\sqrt{x}$. Some relevant formulae: $$\text{Rodrigues' formula:}\hspace{.4cm} L_n(x)=\frac{1}{2^nn!}\frac{d^n}{dx^n}[(x^2-1)^n]$$ $$\text{Beta Integral:}\hspace{.4cm}\int_{0}^{1}x^{\alpha-1}(1-x)^{\beta-1}dx=\frac{\Gamma(\alpha)\Gamma(\beta)}{\Gamma(\alpha+\beta)}$$ $$\text{Gamma identities:}\hspace{.4cm}\Gamma(x+1)=x\Gamma(x),\hspace{.2cm}\Gamma(n+1)=n!$$
For $m=n$, $$I_n=\int_{-1}^{1}L_n^2dx=(\frac{1}{2^{n}n!})^2\int_{-1}^{1}\Big(\frac{d^n}{dx^n}\big[(x^2-1)^n\big]\Big)^2dx= \big(\frac{1}{2^{n}n!}\big)^2\Big[\frac{d^{n-1}}{dx^{n-1}}[(x-1)^n(x+1)^n]\frac{d^n}{dx^n}[(x-1)^n(x+1)^n]\Big\rvert_{-1}^{\hspace{.2cm}1}-\int_{-1}^{1}\frac{d^{n-1}}{dx^{n-1}}[(x-1)^n(x+1)^n]\frac{d^{n+1}}{dx^{n+1}}[(x-1)^n(x+1)^n]\Big]$$
I'm not sure where to where to go from here. Is there something that should cancel? Is there a way to do iterative integration by parts here? How do I get to $\frac{2}{2n+1}$?
--------------------------EDIT-------------------------
I finally got it. Here is the proof.
We want to prove the orthogonality relation $I$ defined by
\begin{equation}
I = \int_{-1}^{1}L_n(x)L_m(x)dx
\end{equation}
is zero for $m\neq n$ and $\dfrac{2}{2n+1}$ for $m=n$. In $I$, we can use Rodrigues' formula to express $L_n$ as 
\begin{equation}
L_n(x)= \frac{1}{2^nn!}\frac{d^n}{dx^n}\big[(x^2-1)^n\big]
\end{equation}
and apply integration by parts, $\int u'v=uv-\int uv'$.
\begin{equation}
\begin{split}
I= \frac{1}{2^nn!}\int_{-1}^{1}\Big(\frac{d^n}{dx^n}\big[(x^2-1)^n\big]L_m(x)\Big)dx \\ =\frac{1}{2^nn!} \Bigg(\frac{d^{n-1}}{dx^{n-1}}\big[(x^2-1)^n\big]L_m(x) \biggr\rvert_{-1}^{1} - \int_{-1}^{1}\frac{d^{n-1}}{dx^{n-1}}\big[(x^2-1)^n\big]L_m^{(1)}(x)dx  \Bigg) \\
= -\frac{1}{2^nn!} \int_{-1}^{1}\frac{d^{n-1}}{dx^{n-1}}\big[(x^2-1)^n\big]L_m^{(1)}(x)dx
        \end{split}
\end{equation}
Repeated integration by parts $n$ times leaves only
\begin{equation}
\begin{split}
I= (-1)^n\frac{1}{2^nn!}\int_{-1}^{1}(x^2-1)^nL_m^{(n)}(x)dx
        \end{split}
\end{equation}
As $L_m$ has polynomial degree $m$, it will become a constant upon differentiation $m$ times. Since $m<n$, $L_m^{(n)}=0$, so $I=0$ for $m<n$. Since the same argument can be made for $L_n$ when $n<m$, $I$ is always zero for $m\neq n$.
For the case $m=n$,
\begin{equation}
\begin{split}
I= (-1)^n\frac{1}{2^nn!}\int_{-1}^{1}(x^2-1)^nL_n^{(n)}(x)dx \\
= (-1)^n\frac{1}{2^n n!}\int_{-1}^{1}(x^2-1)^n  \frac{d^{2n}}{dx^{2n}}\big[(x^2-1)^n\big] dx \\ =(-1)^n\frac{1}{2^{2n} (n!)^2}\int_{-1}^{1}(x^2-1)^n (2n)!dx \\
=\frac{(2n)!}{2^{2n} (n!)^2}\int_{-1}^{1}(1-x^2)^ndx
    \end{split} 
\end{equation}
Considering only the integral $J=\int_{-1}^{1}(x^2-1)^ndx$, use the substitution $x=\sqrt{y}$.
\begin{equation}
\begin{split}
J=2\int_{0}^{1}(1-y)^n \cdot \frac{1}{2\sqrt{y}}dx
    \end{split}
\end{equation}
Letting $\beta=n+1, \alpha=\frac{1}{2}$ and applying the Beta integral,
\begin{equation}
\begin{split}
J=\frac{\Gamma(\frac{1}{2})\Gamma(n+1)}{\Gamma(n+\frac{3}{2})}
    \end{split}
\end{equation}
Using the given Gamma identity for integers,
\begin{equation}
\begin{split}
\Gamma(n+\frac{3}{2})=(n+\frac{1}{2})\Gamma(n+\frac{1}{2}) \\
= (n+\frac{1}{2})(n-\frac{1}{2})(n-\frac{3}{2})\cdot\cdot\cdot\frac{1}{2}\Gamma(\frac{1}{2})
    \end{split}
\end{equation}
and since $\Gamma(n+1)=n!$ we get
\begin{equation}
\begin{split}
J=\frac{n!}{(n+\frac{1}{2})(n-\frac{1}{2})(n-\frac{3}{2})\cdot\cdot\cdot\frac{1}{2}}
    \end{split}
\end{equation}
Then
\begin{equation}
\begin{split}
I=\frac{(2n)!}{2^{2n} (n!)^2}\cdot\frac{n!}{(n+\frac{1}{2})(n-\frac{1}{2})(n-\frac{3}{2})\cdot\cdot\cdot\frac{1}{2}} \\
=\frac{1}{(n+\frac{1}{2})}\frac{(2n)!}{2^{2n}n!(n-\frac{1}{2})(n-\frac{3}{2})\cdot\cdot\cdot\frac{1}{2}} = \frac{1}{\frac{2n+1}{2}}= \frac{2}{2n+1}
    \end{split}
\end{equation}
So
\begin{equation}
I = \int_{-1}^{1}L_n(x)L_n(x)dx = \frac{2}{2n+1}
\end{equation}

REPLY [7 votes]: Here is one approach to prove the orthogonality relation for the Legendre polynomials $P_n (x)$.
We wish to prove
\begin{align*}
\int^1_{-1} P_m (x) P_n (x) \, dx = \begin{cases}
0, & m \neq n\\[1ex]
\displaystyle{\frac{2}{2n + 1}}, & m = n
\end{cases}
\end{align*}
The case $m \neq n$
As $P_m (x)$ and $P_n (x)$ satisfy the Legendre differential equation, namely
$$(1 - x^2) \frac{d^2 P_m}{dx^2} - 2x \frac{dP_m}{dx} + m(m + 1) P_m =
0,$$
and
$$(1 - x^2) \frac{d^2 P_n}{dx^2} - 2x \frac{dP_n}{dx} + n(n + 1) P_n =
0,$$
each of these equations may be rewritten as
\begin{align}
\frac{d}{dx} \left [(1 - x^2) \frac{dP_m}{dx} \right ] + m(m + 1)
P_m &= 0, \qquad (1)
\end{align}
and
\begin{equation}
\frac{d}{dx} \left [(1 - x^2) \frac{dP_n}{dx} \right ] + n(n + 1)
P_n = 0. \qquad (2)
\end{equation}
Multiplying Eq. (1) by $P_n (x)$ and
Eq. (2) by $P_m(x)$ and subtracting we have
$$P_n \frac{d}{dx} \left [(1 - x^2) \frac{dP_m}{dx} \right ] -
P_m \frac{d}{dx} \left [(1 - x^2) \frac{dP_n}{dx} \right ]  + [m(m +
1) - n(n + 1)]P_m P_n = 0. \,\, (*)$$
Now recognising
$$\frac{d}{dx} \left [P_n (1 - x^2) \frac{dP_m}{dx} \right ]
= \frac{dP_n}{dx} (1 - x^2) \frac{dP_m}{dx} + P_n \frac{d}{dx} \left
[(1 - x^2) \frac{dP_m}{dx} \right ],$$
Eq. ($*$) may be rewritten as
$$\frac{d}{dx} \left [P_n(1 - x^2) \frac{dP_m}{dx} \right ]
- \frac{dP_n}{dx} (1 - x^2) \frac{dP_m}{dx} - \frac{d}{dx} \left
  [P_m(1 - x^2) \frac{dP_n}{dx} \right ] + \frac{dP_m}{dx} (1 -
  x^2) \frac{dP_n}{dx} + (m^2 + m - n^2 - n) P_m P_n = 0,$$
which reduces to
$$\frac{d}{dx} \left [P_n(1 - x^2) \frac{dP_m}{dx} \right ]
- \frac{d}{dx} \left [P_m(1 - x^2) \frac{dP_n}{dx} \right ] + (m^2 + m -
  n^2 - n) P_m P_n = 0.$$
On integrating up the above equation with respect to $x$ from $-1$ to 1 we have
\begin{align*}
\int^1_{-1} \left \{\frac{d}{dx} \left [P_n(1 -
x^2) \frac{dP_m}{dx} \right ] 
- \frac{d}{dx} \left [P_m(1 - x^2) \frac{dP_n}{dx} \right ] \right \} dx\\
\hspace{-8.0cm}+ (m^2 + m - n^2 - n) \int^1_{-1} P_m P_n \, dx &= 0\\
\left [P_n(1 - x^2) \frac{dP_m}{dx} - P_m(1 -
  x^2) \frac{dP_n}{dx} \right ]^1_{-1} + (m - n)(m + n +
  1) \int^1_{-1} P_m P_n \, dx &= 0\\
(m - n)(m + n + 1) \int^1_{-1} P_m P_n \, dx &= 0.
\end{align*}
Note the term appearing in the square brackets vanishes at both the upper and lower limits due to the presence of the factor $(1 - x^2)$ . 
So when $m \neq n$, the factor out the front of the integral cancels
and we obtain
$$\int^1_{-1} P_m (x) P_n (x) \, dx = 0,$$
as required to prove.
The case $m = n$
To prove the $m = n$ case let us define
$$A_n = \int^1_{-1} [P_n (x)]^2 \, dx.$$
From Bonnet's recurrence relation for the Legendre polynomials, namely
$$(n + 1) P_{n + 1} (x) - (2n + 1)x P_n (x) + n P_{n - 1} (x) = 0,$$
if we replace $n$ with $n - 1$, after rearranging we have
$$P_n (x) = \frac{2n - 1}{n} x P_{n - 1} (x) - \frac{n - 1}{n} P_{n -
2} (x).$$
Using this result, substituting for one of the $P_n(x)$ terms in the
integral for $A_n$ we have
\begin{align*}
A_n &= \int^1_{-1} P_n (x) P_n (x) \, dx\\ 
&= \int^1_{-1} P_n (x) \left [\frac{2n - 1}{n} x P_{n - 1} (x) - \frac{n - 1}{n} P_{n -
2} (x) \right ] \, dx\\ 
&= \frac{2n - 1}{n} \int^1_{-1} x P_n (x) P_{n - 1} (x) \, dx
- \frac{n - 1}{n} \int^1_{-1} P_n (x) P_{n - 2} (x) \, dx
\end{align*}
But by the orthogonality property, as
$$\int^1_{-1} P_n (x) P_{n - 2} (x) \, dx = 0,$$
this yields
$$A_n (x) = \frac{2n - 1}{n} \int^1_{-1} x P_n (x) P_{n - 1} (x) \, dx.$$
Now from Bonnet's recurrence relation, by making the term $x P_n (x)$ the
subject we have
$$x P_n (x) = \frac{1}{2n + 1} \left [(n + 1) P_{n + 1} (x) + n P_{n -
1} (x) \right ],$$
which on substituting into the integral for $A_n$ one obtains
\begin{align*}
A_n &= \frac{2n - 1}{n} \cdot \frac{n + 1}{2n +
1} \int^1_{-1} \!\! P_{n +
1} (x) P_{n -1} (x) dx + \frac{2n - 1}{2n + 1} \int^1_{-1} [P_{n -
1} (x)]^2 dx\\ 
&= \frac{2n - 1}{2n + 1} A_{n - 1}, \quad n = 1,2,3,\ldots
\end{align*}
where we have again made use of the orthogonality property.
As $P_0 (x) = 1$, a value for $A_0$ can be found. It is
$$A_0 = \int^1_{-1} [P_0 (x)]^2 \, dx = \int^1_{-1} dx = 2.$$
So we have
\begin{align*}
A_n &= \frac{2n - 1}{2n + 1} A_{n - 1}\\ 
&= \frac{2n - 1}{2n + 1} \cdot \frac{2n - 3}{2n - 1} A_{n -
2}\\ 
& \hspace{1.0cm} \vdots\\
&= \frac{2n - 1}{2n + 1} \cdot \frac{2n - 3}{2n -
1} \cdots \frac{3}{5} \cdot \frac{1}{3} A_0\\ 
&= \frac{2n - 1}{2n + 1} \cdot \frac{2n - 3}{2n -
1} \cdots \frac{3}{5} \cdot \frac{1}{3} \cdot 2\\ 
&= \frac{2}{2n + 1}
\end{align*}
Hence
$$\int^1_{-1} [P_n (x)]^2 \, dx = \frac{2}{2n + 1},$$
and completes the proof.