--- title: "Legendre polynomials" date: 2021-09-08 categories: - Mathematics layout: "concept" --- The **Legendre polynomials** are a set of functions that sometimes arise in physics. They are the eigenfunctions $u(x)$ of **Legendre's differential equation**, which is a ([Sturm-Liouville](/know/concept/sturm-liouville-theory/)) eigenvalue problem for $\ell (\ell + 1)$, where $\ell$ turns out to be a non-negative integer: $$\begin{aligned} \boxed{ (1 - x^2) u'' - 2 x u' + \ell (\ell + 1) u = 0 } \end{aligned}$$ The $\ell$th-degree Legendre polynomial $P_\ell(x)$ is given in the form of a *Rodrigues' formula* by: $$\begin{aligned} P_\ell(x) &= \frac{1}{2^\ell \ell!} \dvn{\ell}{}{x}(x^2 - 1)^\ell \end{aligned}$$ The first handful of Legendre polynomials $P_\ell(x)$ are therefore as follows: $$\begin{gathered} P_0(x) = 1 \qquad \quad P_1(x) = x \qquad \quad P_2(x) = \frac{1}{2} (3 x^2 - 1) \\ P_3(x) = \frac{1}{2} (5 x^3 - 3 x) \qquad \quad P_4(x) = \frac{1}{8} (35 x^4 - 30 x^2 + 3) \end{gathered}$$ And then more $P_\ell$ can be computed quickly using **Bonnet's recursion formula**: $$\begin{aligned} \boxed{ (\ell + 1) P_{\ell + 1}(x) = (2 \ell + 1) x P_\ell(x) - \ell P_{\ell - 1}(x) } \end{aligned}$$ The derivative of a given $P_\ell$ can be calculated recursively using the following relation: $$\begin{aligned} \boxed{ \dv{}{x}P_{\ell + 1} = (\ell + 1) P_\ell(x) + x \dv{}{x}P_\ell(x) } \end{aligned}$$ Noteworthy is that the Legendre polynomials are mutually orthogonal for $x \in [-1, 1]$: $$\begin{aligned} \boxed{ \Inprod{P_m}{P_n} = \int_{-1}^{1} P_m(x) \: P_n(x) \dd{x} = \frac{2}{2 n + 1} \delta_{nm} } \end{aligned}$$ As was to be expected from Sturm-Liouville theory. Likewise, they form a complete basis in the [Hilbert space](/know/concept/hilbert-space/) of piecewise continuous functions $f(x)$ on $x \in [-1, 1]$, meaning: $$\begin{aligned} \boxed{ f(x) = \sum_{\ell = 0}^\infty a_\ell P_\ell(x) = \sum_{\ell = 0}^\infty \frac{\Inprod{P_\ell}{f}}{\Inprod{P_\ell}{P_\ell}} P_\ell(x) } \end{aligned}$$ Each Legendre polynomial $P_\ell$ comes with a set of **associated Legendre polynomials** $P_\ell^m(x)$ of order $m$ and degree $\ell$. These are the non-singular solutions of the **general Legendre equation**, where $m$ and $\ell$ are integers satisfying $-\ell \le m \le \ell$: $$\begin{aligned} \boxed{ (1 - x^2) u'' - 2 x u' + \Big( \ell (\ell + 1) - \frac{m^2}{1 - x^2} \Big) u = 0 } \end{aligned}$$ The $\ell$th-degree $m$th-order associated Legendre polynomial $P_\ell^m$ is as follows for $m \ge 0$: $$\begin{aligned} P_\ell^m(x) = (-1)^m (1 - x^2)^{m/2} \dvn{m}{}{x}P_\ell(x) \end{aligned}$$ Here, the $(-1)^m$ in front is called the **Condon-Shortley phase**, and is omitted by some authors. For negative orders $m$, an additional constant factor is necessary: $$\begin{aligned} P_\ell^{-m}(x) = (-1)^m \frac{(\ell - m)!}{(\ell + m)!} P_\ell^m(x) \end{aligned}$$ Beware, the name is misleading: if $m$ is odd, then $P_\ell^m$ is actually not a polynomial. Moreover, not all $P_\ell^m$ are mutually orthogonal (but some are).