Legendre Polynomials

7 minute read

Disclaimer: The following proofs are not rigorous and skip over important steps to make the post easier to read. Full proofs can be found online.

Table of Contents

  1. Summary
  2. Legendre Polynomials
    1. Legendre Differential Equation
    2. Rodrigues’ formula
    3. Properties
  3. Associated Legendre Polynomials
    1. Associated Legendre Differential Equation
    2. Associated Legendre Polynomials/Functions
  4. References

Summary

This post goes over Legendre polynomials, associated Legendre polynomials and their related differential equations. It covers the derivation of the polynomials, solutions to the differential equations and some of their properties.

For reference, the Legendre polynomials (Rodrigues’ formula) are

\[P_n(x) = \frac{1}{2^nn!}\frac{d^n}{dx^n}(x^2 -1)^n\]

Where $n\geq 0$ and is an integer. The associated Legendre polynomials are

\[P_n^m(x) =\frac{1}{2^nn!}(1 - x^2)^{m / 2}\frac{d^{m+n}}{dx^{m+n}}(x^2 -1)^n\]

Where $m$ is an integer and $0 \leq m \leq n$. It can be extended to $-n \leq m \leq n$ and for negative $m$ values, we have:

\[P_n^{-m}(x) = (-1)^m \frac{(n-m)!}{(n+m)!}P_n^m(x)\]

$~$

Legendre Polynomials

Legendre Differential Equation

$~$

The Legendre differential equation is:

\[(1- x^2)P_n''(x) - 2xP_n'(x) + n(n+1)P_n(x) = 0\]

It is a second order ordinary differential equation and can be solved using the Frobenius method, replacing the function by a power series with some restrictions around convergence. In this case, $x=\pm 1$ are regular singular points and if we define the power series around 0 then it will only converge for $x\in(-1, 1)$. The solution found using Frobenius method is hard to use, however there’s an alternate way to obtain a solution with a neat trick which solves the differential equation and gives us Rodrigues’ formula.

Rodrigues’ formula

One way to get Rodrigues’ formula is to pick the function $f_n(x) = f_n = (x^2 -1)^n$, differentiate it twice, express the results in terms of $f_n$ and its derivatives and move all the terms to one side which results in the following differential equation:

\[(1 - x^2) f_n'' + 2x(n-1)f_n' + 2nf_n = 0\]

The idea is to transform this differential equation into a Legendre differential equation then walk back and find the solution.

Differentiate n times both sides, using product rule (general Leibniz rule)

\[\frac{d^n}{dx^n} \left( (1 - x^2) f_n''\right) = \sum_{k=0}^{n} {n \choose k} \frac{d^k}{dx^k} (1 - x^2) \frac{d^{n-k}}{dx^{n-k}} f_n''\] \[\frac{d^n}{dx^n} \left( 2x(n-1)f_n'\right) = 2(n-1) \sum_{k=0}^{n} {n \choose k} \frac{d^k}{dx^k} x \frac{d^{n-k}}{dx^{n-k}} f_n'\] \[\frac{d^n}{dx^n} \left( 2nf_n \right) = 2n f_n^{(n)}\]

Replacing in the differential equation gives

\[2n f_n^{(n)} + \sum_{k=0}^{n} {n \choose k} \frac{d^k}{dx^k} (1 - x^2) \frac{d^{n-k}}{dx^{n-k}} f_n'' + 2(n-1){n \choose k} \frac{d^k}{dx^k} x \frac{d^{n-k}}{dx^{n-k}} f_n' = 0\]

Note that for $k > 2$, the elements in the summation are 0. If we expand the summation for the non-zero terms we get:

\[2n f_n^{(n)} + (1 - x^2) f_n^{(n+2)} + 2x(n-1)f_n^{(n+1)} -2nx f_n^{(n+1)} + 2n(n-1)f_n^{(n)} -n(n-1)f_n^{(n)} = 0\]

Simplifying and combining the terms gives us

\[(1 - x^2) f_n^{(n+2)} - 2xf_n^{(n+1)} + n(n+1)f_n^{(n)} = 0\]

Which is exactly Legendre’s differential equation where $P_n = f_n^{(n)}$. We know that $f_n = (x^2 -1)^n$ which means

\[P_n(x) = \frac{d^n}{dx^n}(x^2 -1)^n\]

We may want to normalize $P_n(x)$ such that $P_n(1) = 1$. For this we need to expand $P_n(x)$ into something we can evaluate at 1. If we use the general Leibniz rule, then differentiate the terms in the summation we get:

\[P_n(x) = \frac{d^n}{dx^n}(x-1)^n (x+1)^n\] \[P_n(x) = \sum_{k=0}^{n} {n \choose k} \frac{d^k}{dx^k} (x-1)^n \frac{d^{n-k}}{dx^{n-k}} (x+1)^n\] \[P_n(x) = \sum_{k=0}^{n} {n \choose k} \frac{n!}{(n-k)!} (x-1)^{n-k} \frac{n!}{k!} (x+1)^k\] \[P_n(x) = \sum_{k=0}^{n} {n \choose k}^2 n!(x-1)^{n-k}(x+1)^k\]

From this we can compute $P_n(1)$, where the only non-zero term is when $k=n$ giving us $P_n(1) = 2^nn!$

For $P_n(-1)$ we get something similar with $k=0$ being the only non-zero term and then $P_n(-1) = (-1)^n 2^nn!$

The final result is

\[P_n(x) = \frac{1}{2^nn!}\frac{d^n}{dx^n}(x^2 -1)^n\]

Which is known as Rodrigues’ formula. Here’s the first few terms of the Legendre polynomial:

\[P_0(x) = 1\] \[P_1(x) = x\] \[P_2(x) = \frac{1}{2}(3x^2-1)\] \[P_3(x) = \frac{1}{2}(5x^3-3x)\] \[P_4(x) = \frac{1}{8}(35x^4-30x^2+3)\]

It’s easier to compute the polynomial expansion using a formula that doesn’t rely on derivatives. One of them is:

\[P_n(x) = \sum_{k=0}^{n} {n \choose k}^2 n!(x-1)^{n-k}(x+1)^k\]

The Wikipedia entry for Legendre polynomials has many more which can be useful in different situations.

$~$

Properties

Legendre polynomials belong to special set of polynomials called the orthogonal polynomials. This set of polynomials has the property that any polynomial in the sequence is orthogonal to each other with respect to some inner product, in this instance, the $L_2$ inner product on the measure space $X$ for functions $f, g$ with measure $\mu$ is

\[\langle f,g \rangle = \int_X f g d\mu\]

See the MathWorld definition for more details. For polynomials, there is a simplification of the above inner product since they are absolutely continuous. Lucky for me because I’m not very good with measure theory. We can have instead

\[\langle f,g \rangle = \int_{a}^{b} f g w(x)dx\]

Where $[a,b]$ is some interval and $w(x)$ a weight function. In the case of Legendre polynomials we’ll conveniently have $w(x)=1$ on the interval $[-1,1].$

To be part of the orthogonal polynomial family, a sequence of polynomials $p_n$ for $n\geq 0$ needs to satisfy two requirements:

  1. $\langle p_n,p_m \rangle = 0$ for $m\neq n$
  2. $\text{deg} \ p_n = n$

The proof of 1. can be found here. It uses Rodrigues’ formula and the fact that $x^2 -1$ is zero at 1 and -1, combined with multiple integrations by parts. For 2. we can see it from the last equation when normalizing $P_n(x)$.

One other property is completeness, I won’t go into details but basically it says that for any piecewise continuous function between $[-1, 1]$ there is a sum of Legendre polynomials scaled by some coefficients that converges in mean to that function as $n$ goes to infinity to the function. This could be useful for approximations.

$~$

Associated Legendre Polynomials

Associated Legendre Differential Equation

There is an extended version of the Legendre differential equation called the associated Legendre differential equation. Its solution can be expressed in terms of the regular Legendre polynomials.

The associated Legendre differential equation is:

\[(1- x^2)\frac{d^2}{dx^2}P_n^m(x) - 2x\frac{d}{dx}P_n^m(x) + \left[n(n+1) - \frac{m^2}{1-x^2} \right] P_n^m(x) = 0\]

Where now the polynomial is in terms of $x$, $m$ and $n$. The solution can also be obtained using Frobenius method and the result will be an infinite series. It’s actually possible to do a change of variable with a very specific function to convert this differential equation into a Legendre differential equation. The trick can be found while doing the Frobenius method.

If we start with the differential equation as

\[(1- x^2)y'' - 2xy' + \left[n(n+1) - \frac{m^2}{1-x^2} \right] y = 0\]

Where $y=y_n^m(x)$. If we substitute $y$ for $y= (1 - x^2)^{m / 2}g(x)$ with $g(x)=g_n(x)$ and the derivatives being:

\[y' = g(x)' (1 -x ^2)^{m / 2} - mx (1 - x^2)^{m /2 -1} g(x)\] \[y'' = g''(x)(1-x^2)^{m / 2} - 2mx(1 -x ^2) ^ {m / 2 -1} g'(x) -m(1-x^2)^{m /2 -1 }g(x) + 2mx^2 (\frac{m}{2} - 1) (1 - x^2) ^ {m /2 - 2}\]

After plugging that in the differential equation, it ends up simplifying very nicely to:

\[(1-x^2)g''(x) - 2x(m+1) g'(x) + n(n+1)g(x) - m(m+1)g(x) = 0\]

Let $h(x) = g’(x)$. If we differentiate the above equation and write it in terms of $h(x)$ we get:

\[(1-x^2)h''(x) - 2x(m+2)h'(x) - (m+1)(m+2)h(x) = 0\]

This means differentiating the equation adds 1 to $m$. If we do the reverse process and start with an equation where $m=0$, and then differentiate it $m$ times we get back the same equation. Turns out the equation when $m=0$ is the regular Legendre differential equation:

\[(1- x^2)P_n''(x) - 2xP_n'(x) + n(n+1)P_n(x) = 0\]

So the solution to our differential equation in terms of $g(x)$ is

\[g(x) = g_n(x) = \frac{d^m}{dx^m} P_n(x)\]

And since $y= (1 - x^2)^{m / 2}g(x)$ then the solution to the associated Legendre differential equation is:

\[y_n^m(x) =(1 - x^2)^{m / 2}\frac{d^m}{dx^m} P_n(x)\]

The usual notation for the solution is $P_n^m(x)$. Like the regular differential equation, the solution is valid in $[-1, 1]$.

$~$

Associated Legendre Polynomials/Functions

The Legendre function is defined as:

\[P_n^m(x) =(1 - x^2)^{m / 2}\frac{d^m}{dx^m} P_n(x)\]

and is a polynomial when $n$ and $m$ are integers with the following constraints: $m\geq0$, $m$ is even and $0\leq m \leq n$. If we want to consider all the values for $m$ and $n$, then $P_n^m(x)$ is called the Legendre function and is not a polynomial anymore.

We can use Rodrigues’ formula derived above to expand $P_n(x)$:

\[P_n^m(x) =\frac{1}{2^nn!}(1 - x^2)^{m / 2}\frac{d^{m+n}}{dx^{m+n}}(x^2 -1)^n\]

With this form, we can extend the range of valid $m$ values to $-n \leq m \leq n$. There’s a proportionality relationship between positive and negative $m$ values and it follows this equation:

\[P_n^{-m}(x) = (-1)^m \frac{(n-m)!}{(n+m)!}P_n^m(x)\]

The proof can be found at this link. The associated Legendre polynomials are usually not orthogonal.

$~$

References

https://en.wikipedia.org/wiki/Legendre_polynomials

https://en.wikipedia.org/wiki/Rodrigues%27_formula

https://en.wikipedia.org/wiki/Orthogonal_polynomials

https://mathworld.wolfram.com/L2-InnerProduct.html

https://mathworld.wolfram.com/AssociatedLegendreDifferentialEquation.html

https://en.wikipedia.org/wiki/Associated_Legendre_polynomials

http://physicspages.com/pdf/Mathematics/Legendre%20polynomials%20-%20orthogonality.pdf

https://www.mat.univie.ac.at/~westra/associatedlegendrefunctions.pdf

https://math.stackexchange.com/questions/2058610/how-to-derive-the-power-series-solution-for-associated-legendre-differential-equ

https://math.stackexchange.com/questions/1076615/properties-of-solutions-to-the-associated-legendre-ode

Comments

    This comment section uses GitHub issues. Join the discussion for this post on this issue.

    Tags:

    Updated: