Legendre Polynomials and Associated Legendre Functions

⚡ Key Takeaways

One line: Legendre polynomials Pn(x)P_n(x) are the orthogonal polynomial solutions to Legendre's differential equation on [−1,1][-1,1], and the associated Legendre functions Pnm(x)P_n^m(x) generalize them to handle the angular part of problems with azimuthal dependence. Key result: {Pn(x)}\{P_n(x)\} form a complete orthogonal basis for L2[−1,1]L^2[-1,1] with ∫−11PmPn dx=22n+1δmn\int_{-1}^{1}P_m P_n\,dx = \frac{2}{2n+1}\delta_{mn}, and the associated functions Pnm(cos⁡θ)eimϕP_n^m(\cos\theta)e^{im\phi} build the spherical harmonics. Where it applies: Solutions of Laplace's and Helmholtz's equations in spherical coordinates — electrostatics, gravitation, quantum mechanics (hydrogen atom), geophysics, and antenna theory. Who/when: Introduced by Adrien-Marie Legendre (1782) studying gravitational potentials; the associated functions developed through the 19th century by Ferrers, Heine, and others.

💡 The Core Insight

A self-adjoint second-order differential operator on a finite interval, with the right boundary behavior, produces a complete orthogonal family of eigenfunctions. For the angular Laplacian on the sphere, that operator is the Legendre operator, its eigenfunctions are the Legendre polynomials (when m=0m=0) and associated Legendre functions (when m≠0m\neq 0), and their eigenvalues ℓ(ℓ+1)\ell(\ell+1) encode angular momentum. Everything else — Rodrigues' formula, recurrences, generating functions, orthogonality — flows from this one Sturm–Liouville structure.

Formal Statement

DefinitionLegendre's Differential Equation

Legendre's equation is the second-order linear ODE

1
(1−x2) d2ydx2−2x dydx+n(n+1) y=0,x∈[−1,1].\quad (1-x^2)\,\frac{d^2y}{dx^2} - 2x\,\frac{dy}{dx} + n(n+1)\,y = 0,\qquad x\in[-1,1].

Derivation hint: Separate variables in ∇2Φ=0\nabla^2\Phi=0 in spherical coordinates; the polar-angle equation in u=cos⁡θu=\cos\theta takes this form with separation constant n(n+1)n(n+1). Here xx is the independent variable (typically x=cos⁡θx=\cos\theta), y(x)y(x) the unknown function, and nn the degree (a real parameter; bounded polynomial solutions exist only for n=0,1,2,…n=0,1,2,\dots). When nn is a non-negative integer, the polynomial solution normalized so that Pn(1)=1P_n(1)=1 is the Legendre polynomial Pn(x)P_n(x).

DefinitionRodrigues' Formula

The Legendre polynomials are given explicitly by

2
Pn(x)=12n n! dndxn(x2−1)n.\quad P_n(x) = \frac{1}{2^n\,n!}\,\frac{d^n}{dx^n}\big(x^2-1\big)^n.

Derivation hint: (x2−1)n(x^2-1)^n is a polynomial annihilated by a clever operator; differentiating nn times produces a degree-nn solution of Legendre's equation; the prefactor enforces Pn(1)=1P_n(1)=1. The first few are P0=1P_0=1, P1=xP_1=x, P2=12(3x2−1)P_2=\tfrac12(3x^2-1), P3=12(5x3−3x)P_3=\tfrac12(5x^3-3x), P4=18(35x4−30x2+3)P_4=\tfrac18(35x^4-30x^2+3).

DefinitionGenerating Function

The generating function packs all Legendre polynomials into one expansion:

3
g(x,t)=(1−2xt+t2)−1/2=∑n=0∞Pn(x) tn,∣t∣<1.\quad g(x,t) = \big(1-2xt+t^2\big)^{-1/2} = \sum_{n=0}^{\infty} P_n(x)\,t^n,\qquad |t|<1.

Derivation hint: Expand 1∣r−r′∣=1r(1−2(r′/r)cos⁡γ+(r′/r)2)−1/2\tfrac{1}{|\mathbf r-\mathbf r'|}=\tfrac{1}{r}(1-2(r'/r)\cos\gamma+(r'/r)^2)^{-1/2} in powers of t=r′/rt=r'/r; the binomial coefficients organize into Legendre polynomials of cos⁡γ\cos\gamma.

DefinitionAssociated Legendre Functions

For integers 0≤m≤n0\le m\le n, the associated Legendre functions are

4
Pnm(x)=(−1)m (1−x2)m/2 dmdxmPn(x),\quad P_n^m(x) = (-1)^m\,(1-x^2)^{m/2}\,\frac{d^m}{dx^m}P_n(x),

Derivation hint: Substitute y=(1−x2)m/2uy=(1-x^2)^{m/2}u into the associated Legendre equation; the function u=dmPn/dxmu=d^m P_n/dx^m satisfies the resulting ODE, recovering PnmP_n^m up to the Condon–Shortley phase (−1)m(-1)^m. with the (−1)m(-1)^m factor being the Condon–Shortley phase (conventions vary). They satisfy the associated Legendre equation

5
(1−x2) y′′−2x y′+[n(n+1)−m21−x2]y=0.\quad (1-x^2)\,y'' - 2x\,y' + \left[n(n+1) - \frac{m^2}{1-x^2}\right]y = 0.

Derivation hint: This is the full polar equation from separating ∇2Φ=0\nabla^2\Phi=0 when the azimuthal solution is eimϕe^{im\phi}, contributing the −m2/sin⁡2θ-m^2/\sin^2\theta term. Note Pn0(x)=Pn(x)P_n^0(x)=P_n(x), and Pnm≡0P_n^m\equiv 0 for m>nm>n.

TheoremOrthogonality and Completeness

The Legendre polynomials are orthogonal on [−1,1][-1,1]:

6
∫−11Pm(x) Pn(x) dx=22n+1 δmn.\quad \int_{-1}^{1} P_m(x)\,P_n(x)\,dx = \frac{2}{2n+1}\,\delta_{mn}.

Derivation hint: Write Legendre's equation in Sturm–Liouville form ddx[(1−x2)y′]=−n(n+1)y\frac{d}{dx}[(1-x^2)y']=-n(n+1)y; subtract the equations for Pm,PnP_m,P_n, integrate, and the boundary term vanishes because (1−x2)→0(1-x^2)\to0 at the endpoints. The associated functions obey, for fixed mm,

7
∫−11Pkm(x) Pnm(x) dx=22n+1 (n+m)!(n−m)! δkn.\quad \int_{-1}^{1} P_k^m(x)\,P_n^m(x)\,dx = \frac{2}{2n+1}\,\frac{(n+m)!}{(n-m)!}\,\delta_{kn}.

Derivation hint: Same Sturm–Liouville argument on Eq. [5] (with weight 1 since the m2m^2 term has no xx-derivative); the factorial factor comes from repeated integration by parts in Rodrigues' form. Both families are complete in L2[−1,1]L^2[-1,1] (for fixed mm in the associated case), so any square-integrable function admits a convergent Legendre series f(x)=∑ncnPn(x)f(x)=\sum_n c_n P_n(x) with cn=2n+12∫−11f(x)Pn(x) dxc_n=\frac{2n+1}{2}\int_{-1}^1 f(x)P_n(x)\,dx.

Why It Holds / Derivation

ProofOrthogonality via Sturm–Liouville

Step 1. Cast Legendre's equation into self-adjoint form. Multiplying Eq. [1] is unnecessary; it is already exact:

ddx ⁣[(1−x2) Pn′]+n(n+1) Pn=0.\frac{d}{dx}\!\left[(1-x^2)\,P_n'\right] + n(n+1)\,P_n = 0.

This is a Sturm–Liouville problem with p(x)=1−x2p(x)=1-x^2, weight w(x)=1w(x)=1, eigenvalue λn=n(n+1)\lambda_n=n(n+1).

Step 2. Write the same equation for PmP_m with eigenvalue λm\lambda_m. Multiply the PnP_n equation by PmP_m and the PmP_m equation by PnP_n, then subtract:

Pmddx[(1−x2)Pn′]−Pnddx[(1−x2)Pm′]+(λn−λm)PmPn=0.P_m\frac{d}{dx}[(1-x^2)P_n'] - P_n\frac{d}{dx}[(1-x^2)P_m'] + (\lambda_n-\lambda_m)P_mP_n = 0.

Step 3. The first two terms combine into a total derivative (Lagrange's identity):

ddx[(1−x2)(PmPn′−PnPm′)]=(λm−λn)PmPn.\frac{d}{dx}\Big[(1-x^2)\big(P_m P_n' - P_n P_m'\big)\Big] = (\lambda_m-\lambda_n)P_mP_n.

Step 4. Integrate over [−1,1][-1,1]. The left side equals [(1−x2)(⋯ )]−11=0\big[(1-x^2)(\cdots)\big]_{-1}^{1}=0 because 1−x21-x^2 vanishes at both endpoints. Thus

(λm−λn)∫−11PmPn dx=0.(\lambda_m-\lambda_n)\int_{-1}^{1}P_mP_n\,dx = 0.

For m≠nm\ne n, λm≠λn\lambda_m\ne\lambda_n, forcing the integral to vanish.

Step 5. For the normalization m=nm=n, use the generating function. Squaring Eq. [3] and integrating:

∫−11dx1−2xt+t2=∑nt2n∫−11Pn2 dx.\int_{-1}^{1}\frac{dx}{1-2xt+t^2} = \sum_{n}t^{2n}\int_{-1}^1 P_n^2\,dx.

The left integral evaluates to 1tln⁡1+t1−t=∑n22n+1t2n\frac{1}{t}\ln\frac{1+t}{1-t}=\sum_n \frac{2}{2n+1}t^{2n}. Matching powers of t2nt^{2n} gives ∫Pn2 dx=22n+1\int P_n^2\,dx=\frac{2}{2n+1}. ■\blacksquare

∎
ProofRodrigues' Formula Solves Legendre's Equation

Step 1. Let v=(x2−1)nv=(x^2-1)^n. Then v′=2nx(x2−1)n−1v'=2nx(x^2-1)^{n-1}, so (x2−1)v′=2nx v(x^2-1)v' = 2nx\,v.

Step 2. Differentiate (x2−1)v′=2nxv(x^2-1)v'=2nxv exactly (n+1)(n+1) times using the Leibniz rule. Each side produces a chain of terms; collecting them yields

(x2−1) v(n+2)+2x v(n+1)−n(n+1) v(n)=0.(x^2-1)\,v^{(n+2)} + 2x\,v^{(n+1)} - n(n+1)\,v^{(n)} = 0.

Step 3. Let w=v(n)=dndxn(x2−1)nw=v^{(n)}=\frac{d^n}{dx^n}(x^2-1)^n. The previous line reads

(1−x2) w′′−2x w′+n(n+1) w=0,(1-x^2)\,w'' - 2x\,w' + n(n+1)\,w = 0,

which is exactly Legendre's equation [1]. Hence ww — and any constant multiple — solves it.

Step 4. The prefactor 1/(2nn!)1/(2^n n!) normalizes so that Pn(1)=1P_n(1)=1: evaluating the highest-order contribution near x=1x=1 gives the factor 2nn!2^n n!, which the prefactor cancels. ■\blacksquare

∎
AL
Adrien-Marie Legendre
1752–1833

A French mathematician whose name attaches to an extraordinary range of results — least squares, elliptic integrals, the prime-counting conjecture, and these polynomials. In 1782 he introduced what he called fonctions de Legendre (later named coefficients) while studying the Newtonian gravitational attraction of spheroids — exactly the multipole problem encoded in Eq. [3]. Legendre worked partly in the shadow of Laplace, who extended the angular theory to the full sphere (Laplace's coefficients, now Spherical Harmonics). A famous portrait long thought to be Legendre was discovered in 2005 to depict a different man; the only authentic likeness is a 1820 caricature.

Building Intuition

🧠 Intuition

Think of [−1,1][-1,1] as the range of cos⁡θ\cos\theta as θ\theta sweeps a sphere from north pole to south pole. Legendre polynomials are the natural "harmonics" of that one-dimensional interval, just as sin⁡(nπx)\sin(n\pi x) are the harmonics of a vibrating string. P0P_0 is constant (a uniform sphere), P1=cos⁡θP_1=\cos\theta is a dipole pattern (top vs. bottom), P2P_2 is a quadrupole (squashing/stretching), and higher nn pack more zeros — exactly nn of them inside (−1,1)(-1,1) — meaning finer angular oscillation. The index mm in the associated functions counts oscillations around the equator (azimuthal wiggles), which is why PnmP_n^m enters only when the problem depends on ϕ\phi. The factor (1−x2)m/2=sin⁡mθ(1-x^2)^{m/2}=\sin^m\theta in Eq. [4] forces these functions to vanish at the poles when m>0m>0 — physically, a pattern with azimuthal structure cannot have a well-defined value exactly on the rotation axis. The generating function [3] is the deepest intuition: it is the statement that the inverse distance between two points expands cleanly in the ratio of their radii. Multipole expansions in physics are not a trick layered on top — they are the Legendre generating function in disguise.

:::svg[The first four Legendre polynomials on [−1,1][-1,1], showing increasing numbers of interior zeros] x P(x) -1 +1 1 P0 P1 P2 P3 All satisfy P_n(1)=1; P_n has exactly n zeros in (-1,1).

Worked Examples

ExampleLegendre Series of a Step Potential

Given: Expand f(x)={+10<x≤1−1−1≤x<0f(x)=\begin{cases}+1 & 0<x\le1\\ -1 & -1\le x<0\end{cases} (a hemispherical sign function) in Legendre polynomials.

Step 1 — coefficient formula. cn=2n+12∫−11f(x)Pn(x) dxc_n=\frac{2n+1}{2}\int_{-1}^1 f(x)P_n(x)\,dx. Since ff is odd, only odd nn survive.

Step 2 — exploit symmetry. For odd nn, f(x)Pn(x)f(x)P_n(x) is even, so

cn=(2n+1)∫01Pn(x) dx.c_n = (2n+1)\int_0^1 P_n(x)\,dx.

Step 3 — evaluate ∫01Pn\int_0^1 P_n. Use the recurrence Pn=12n+1ddx ⁣[Pn+1−Pn−1]P_n=\frac{1}{2n+1}\frac{d}{dx}\!\left[P_{n+1}-P_{n-1}\right], giving ∫01Pn dx=12n+1[Pn+1(1)−Pn−1(1)−Pn+1(0)+Pn−1(0)]\int_0^1 P_n\,dx=\frac{1}{2n+1}\big[P_{n+1}(1)-P_{n-1}(1)-P_{n+1}(0)+P_{n-1}(0)\big]. At x=1x=1 both are 11 and cancel.

Step 4 — plug in n=1n=1. P2(0)=−12P_2(0)=-\tfrac12, P0(0)=1P_0(0)=1, so ∫01P1=13[0−(−12)+1⋅?]\int_0^1 P_1=\frac{1}{3}[0 -(-\tfrac12)+1\cdot? ]... computing cleanly: ∫01P1 dx=∫01x dx=12\int_0^1 P_1\,dx=\int_0^1 x\,dx=\tfrac12, so c1=3⋅12=32c_1=3\cdot\tfrac12=\tfrac32.

Step 5 — next term n=3n=3. ∫01P3 dx=∫0112(5x3−3x) dx=12(54−32)=−18\int_0^1 P_3\,dx=\int_0^1\tfrac12(5x^3-3x)\,dx=\tfrac12(\tfrac54-\tfrac32)=-\tfrac18, so c3=7⋅(−18)=−78c_3=7\cdot(-\tfrac18)=-\tfrac78.

f(x)=32P1(x)−78P3(x)+1116P5(x)−⋯\boxed{f(x)=\tfrac{3}{2}P_1(x)-\tfrac{7}{8}P_3(x)+\tfrac{11}{16}P_5(x)-\cdots}

(dimensionless; coefficients carry the units of ff).

ExampleMultipole Expansion of a Potential

Given: Two point charges +q+q at z=+az=+a and −q-q at z=−az=-a (a physical dipole). Find the potential at a field point (r,θ)(r,\theta) with r>ar>a, in SI units.

Step 1 — exact potential. V=14πε0[q∣r−az^∣−q∣r+az^∣]V=\frac{1}{4\pi\varepsilon_0}\left[\frac{q}{|\mathbf r-a\hat z|}-\frac{q}{|\mathbf r+a\hat z|}\right].

Step 2 — apply the generating function. With t=a/rt=a/r and cos⁡γ=cos⁡θ\cos\gamma=\cos\theta (for +a+a) or −cos⁡θ-\cos\theta (for −a-a),

1∣r∓az^∣=1r∑n=0∞(ar)nPn(±cos⁡θ).\frac{1}{|\mathbf r\mp a\hat z|}=\frac{1}{r}\sum_{n=0}^\infty \left(\frac{a}{r}\right)^n P_n(\pm\cos\theta).

Step 3 — subtract. Using Pn(−x)=(−1)nPn(x)P_n(-x)=(-1)^nP_n(x), even-nn terms cancel and odd-nn terms double:

V=q4πε0r∑n odd2(ar)nPn(cos⁡θ).V=\frac{q}{4\pi\varepsilon_0 r}\sum_{n\,\text{odd}} 2\left(\frac{a}{r}\right)^n P_n(\cos\theta).

Step 4 — leading (n=1n=1) dipole term. With P1=cos⁡θP_1=\cos\theta and dipole moment p=2aqp=2aq,

V≈2qacos⁡θ4πε0r2=pcos⁡θ4πε0r2.V\approx \frac{2qa\cos\theta}{4\pi\varepsilon_0 r^2}=\frac{p\cos\theta}{4\pi\varepsilon_0 r^2}.
V(r,θ)≈pcos⁡θ4πε0 r2 [volts],p=2qa [C ⋅ m].\boxed{V(r,\theta)\approx \dfrac{p\cos\theta}{4\pi\varepsilon_0\,r^2}\ \text{[volts]},\quad p=2qa\ \text{[C}\,\cdot\,\text{m]}.}

The Legendre expansion automatically names the dipole, octupole, ... terms.

Common Misconceptions

⚠️ Common mistake

The two parameters are not interchangeable. In PnmP_n^m, the degree nn (often written ℓ\ell in physics) and the order mm play distinct roles: nn sets the eigenvalue n(n+1)n(n+1) and total angular structure; mm sets azimuthal oscillation and must satisfy ∣m∣≤n|m|\le n. Writing PnmP_n^m with m>nm>n gives identically zero, not an error to "fix."

The Condon–Shortley phase (−1)m(-1)^m is a convention, not a theorem. Different textbooks (and software like older versions of Mathematica vs. SciPy) include or omit it, and may also fold it into the spherical harmonics instead. Always check which convention a formula assumes before combining results.

"Associated Legendre functions are polynomials" — false for odd mm. The factor (1−x2)m/2(1-x^2)^{m/2} is a polynomial only when mm is even; for odd mm it contains 1−x2=sin⁡θ\sqrt{1-x^2}=\sin\theta, so PnmP_n^m is not a polynomial in xx (though it is a nice function of θ\theta).

Counterexample

One might guess that every solution of Legendre's equation [1] is a polynomial. It is not. For integer nn, the equation has a second, linearly independent solution Qn(x)Q_n(x) — the Legendre function of the second kind — which is singular at x=±1x=\pm1. For example,

Q0(x)=12ln⁡1+x1−x,Q1(x)=x2ln⁡1+x1−x−1.Q_0(x)=\tfrac12\ln\frac{1+x}{1-x},\qquad Q_1(x)=\tfrac{x}{2}\ln\frac{1+x}{1-x}-1.

Q0Q_0 diverges logarithmically at the poles x=±1x=\pm1. The physical requirement of boundedness on the whole sphere is what discards QnQ_n and quantizes nn to integers; without that boundary condition the polynomial family alone would be an incomplete answer.

Connections

connection

Legendre polynomials are the α=β=0\alpha=\beta=0 special case of the Jacobi Polynomials and the λ=1/2\lambda=1/2 case of the Gegenbauer Polynomials, placing them in the broad family of Classical Orthogonal Polynomials. Their defining ODE is one instance of the Sturm-Liouville Theory framework, which guarantees the orthogonality and completeness used throughout. Multiplying Pnm(cos⁡θ)P_n^m(\cos\theta) by eimϕe^{im\phi} produces the Spherical Harmonics Ynm(θ,ϕ)Y_n^m(\theta,\phi), the angular eigenfunctions of the Laplace's Equation operator on the sphere and of the quantum Angular Momentum operator L^2\hat L^2. The generating function [3] is the engine of the Multipole Expansion in electromagnetism and gravitation, and the recurrence relations connect to the theory of Three-Term Recurrence Relations satisfied by all orthogonal polynomials.

Real-World Applications

🔬 Where this appears

Historical Development

⏳ History
- 1782 — Adrien-Marie Legendre introduces the polynomials studying the gravitational attraction of spheroids; he calls them coefficients.
- 1785 — Pierre-Simon Laplace develops the full theory of "Laplace coefficients" (spherical harmonics) for the same potential problems, generalizing to azimuthal dependence.
- 1816 — Olinde Rodrigues publishes the differentiation formula now bearing his name (Eq. [2]), though it circulated and was rediscovered by others.
- 1837 — Heine and contemporaries systematize the associated Legendre functions and the function of the second kind QnQ_n.
- 1877 — N.M. Ferrers gives the associated functions in the modern form used on [−1,1][-1,1] (Ferrers functions).
- 1875–1894 — E.W. Hobson's work culminates in his treatise The Theory of Spherical and Ellipsoidal Harmonics (1931), the definitive 19th-century synthesis.
- 1929 — Condon and Shortley fix the phase convention (−1)m(-1)^m in their book The Theory of Atomic Spectra, standardizing usage in physics.
- 1814–1826 — Carl Friedrich Gauss develops Gauss–Legendre quadrature, exploiting the roots of PnP_n for numerical integration.
- 20th c. — Spherical harmonics built from PℓmP_\ell^m become foundational in quantum mechanics (1920s), geophysics, and later computer graphics.

Subtleties & Limits

open-problem

Convergence of Legendre series at endpoints and jumps. Like Fourier series, Legendre expansions of discontinuous functions exhibit a Gibbs phenomenon near jumps — an overshoot that does not vanish as more terms are added — and convergence at x=±1x=\pm1 is delicate, depending on the function's endpoint behavior. The precise pointwise convergence theory (Haar-type conditions, rates of decay of cnc_n) is subtle and parallels but is not identical to the trigonometric case.

Non-integer and complex degree. For non-integer nn, Eq. [1] has no polynomial solution; the bounded-on-the-sphere requirement is what quantizes nn. The general Legendre functions Pνμ(x)P_\nu^\mu(x) of complex degree and order are full-fledged hypergeometric special functions, with branch cuts and analytic-continuation issues that go well beyond the polynomial story — important in scattering theory and the Regge-pole formalism of high-energy physics.

Numerical stability at high order. The factorial factors (n+m)!/(n−m)!(n+m)!/(n-m)! in normalization (Eq. [7]) overflow rapidly; high-degree geomagnetic and gravity models (degree > 2000) require carefully designed recursive, normalized algorithms to evaluate PnmP_n^m without loss of precision — an active engineering concern.

See Also

Spherical Harmonics · Sturm-Liouville Theory · Bessel Functions · Jacobi Polynomials · Multipole Expansion · Gaussian Quadrature · Laplace's Equation · Gegenbauer Polynomials