Legendre Polynomials Calculator P_n(x)
Legendre polynomials P_n(x) calculator: Bonnet three-term recurrence, explicit coefficients, roots (Gauss-Legendre nodes), derivatives and L^2 normalization.
Report a calculation error
Help us improve. Describe what is wrong with the calculation.
Result
| Voce | Valore |
|---|
Show full details
Share result
Disclaimer: this calculation is for informational purposes only. For important decisions, consult a qualified professional.
Legendre polynomials
Legendre polynomials P_n(x), introduced by Adrien-Marie Legendre in 1782 while studying the gravitational potential of an ellipsoid, are a sequence of orthogonal polynomials on [-1, 1] with weight w(x) = 1. They are fundamental in mathematical physics, potential theory, quantum mechanics and numerical analysis.
Definition via differential equation
P_n(x) is the unique polynomial of degree n solving the Legendre differential equation:
(1 - x^2) * P_n''(x) - 2x * P_n'(x) + n(n+1) * P_n(x) = 0
normalized by P_n(1) = 1. This equation arises from separating variables in Laplace's equation in spherical coordinates: the angular solutions in theta are exactly P_n(cos(theta)).
Rodrigues' formula
Olinde Rodrigues (1816) provides an explicit definition:
P_n(x) = (1 / (2^n * n!)) * d^n/dx^n [(x^2 - 1)^n]
Expanding (x^2 - 1)^n and differentiating n times yields a degree-n polynomial with alternating parity: P_n is even if n is even, odd if n is odd.
Bonnet's three-term recurrence
The most efficient computation method uses the three-term recurrence:
(n+1) * P_{n+1}(x) = (2n+1) * x * P_n(x) - n * P_{n-1}(x)
with P_0(x) = 1, P_1(x) = x. Proved by Pierre Ossian Bonnet (1844), this recurrence evaluates P_n in O(n) operations with O(1) memory. Numerically stable for |x| <= 1.
First polynomials
- P_0(x) = 1
- P_1(x) = x
- P_2(x) = (3x^2 - 1) / 2
- P_3(x) = (5x^3 - 3x) / 2
- P_4(x) = (35x^4 - 30x^2 + 3) / 8
- P_5(x) = (63x^5 - 70x^3 + 15x) / 8
- P_6(x) = (231x^6 - 315x^4 + 105x^2 - 5) / 16
Orthogonality property
Polynomials are orthogonal on [-1, 1]:
integral_-1^1 P_m(x) * P_n(x) dx = 2/(2n+1) if m = n, 0 otherwise
This makes them a natural basis for function expansion: f(x) = Sigma a_n * P_n(x) with a_n = (2n+1)/2 * integral f * P_n dx. Analogous to Fourier series on [-1, 1] with uniform measure.
Five calculator modes
- Single evaluation: P_n(x) via Bonnet recurrence.
- Sequence: list P_0..P_n for single x.
- Explicit coefficients: polynomial P_n(x) = Sigma a_k * x^k.
- Roots: all n roots in (-1, 1), Gauss-Legendre nodes.
- Derivative P_n'(x): via identity (x^2-1) P_n'(x) = n(x P_n - P_{n-1}).
Gauss-Legendre quadrature
The most important application: nodes x_k (roots of P_n) and weights w_k = 2 / ((1 - x_k^2) * P_n'(x_k)^2) approximate integrals:
integral_-1^1 f(x) dx ~ Sigma_{k=1}^{n} w_k * f(x_k)
exact for polynomials of degree <= 2n-1. Numerically optimal method for quadrature on finite intervals without singularities. Nodes and weights tabulated for n up to 100; beyond, Newton on the recurrence is used.
Applications
- Quantum mechanics: spherical harmonics Y_l^m, hydrogen atom.
- Potential theory: multipole expansion in electrostatics and gravitation.
- Numerical analysis: Gauss-Legendre quadrature.
- Electromagnetism: series expansion for axial-symmetry potentials.
- Statistical mechanics: angular parts of spherical partition functions.
- Statistics: non-parametric tests based on P_n.
History of Legendre polynomials
The polynomials were introduced by the French mathematician Adrien-Marie Legendre in 1782, while studying the gravitational attraction exerted by celestial bodies of ellipsoidal shape. In trying to expand the gravitational potential at a distance in a series, Legendre came upon a family of polynomials with remarkable orthogonality properties. Their role became even more central with the study of spherical harmonics and Laplace's equation, fundamental in mathematical physics. Today Legendre polynomials are an indispensable tool in electrostatics, quantum mechanics, geodesy and numerical analysis, and their roots provide the optimal nodes of Gauss-Legendre quadrature. From an 18th-century celestial mechanics problem grew one of the most used families of special functions in science.
The generating function and notable properties
One of the most elegant features of the Legendre polynomials is their generating function: 1/√(1 − 2xt + t²) = Σ Pₙ(x)tⁿ. Expanding this expression as a power series in the parameter t, the coefficients are exactly the Legendre polynomials. This formula is the same one that appears naturally in the expansion of the Coulomb and gravitational potential, explaining why the polynomials emerge in physics. Among the other notable properties: every Pₙ equals 1 at x = 1 and (−1)ⁿ at x = −1; the polynomials have definite parity, even for even n and odd for odd n; and all n roots of Pₙ are real, distinct and contained in the open interval (−1, 1).
Legendre polynomials in physics
Legendre polynomials are ubiquitous in mathematical physics. In electrostatics and gravitation they provide the multipole expansion of the potential of a charge or mass distribution, separating the monopole, dipole, quadrupole and so on contributions. They are the angular part of the spherical harmonics, solutions of Laplace's equation in spherical coordinates, which describe the vibration modes of a sphere and energy levels. In quantum mechanics they appear in the solution of the hydrogen atom and in the theory of angular momentum, where the orbital quantum numbers correspond to the degree of the polynomial. They also appear in geodesy to model the Earth's gravitational field and in optics for lens aberrations.
Updated July 2026
Comments (0)
Login to leave a comment.
No comments yet. Be the first!