Legendre Polynomial Calculator

JJ Ben-Joseph headshot JJ Ben-Joseph

Enter a degree and value to evaluate.

What Are Legendre Polynomials?

Legendre polynomials Pn form a sequence of orthogonal polynomials on the interval [-1,1]. They arise naturally in solving Laplace's equation in spherical coordinates and play a central role in physics and engineering. Their orthogonality property means the integral -11PnxPmxdx is zero whenever n and m are different. This property makes them ideal as basis functions in spectral methods and other numerical schemes.

The polynomials satisfy the Legendre differential equation 1-x2y''-2xy'+nn+1y=0. Solutions that remain finite on [-1,1] are precisely the Legendre polynomials. The lowest-order cases are P0=1, P1=x, and P2=3x2-12. Higher degrees follow a recurrence relation.

The standard recurrence relation is

(n+1)Pn+1x=(2n+1)xPnx-nPn-1x)1n+1

This formula enables efficient computation by building polynomials of higher degree from two previous ones. Because the coefficients remain rational, the polynomials feature integer powers of x with rational multipliers, making them straightforward to evaluate.

Legendre polynomials appear across theoretical and applied mathematics. In potential theory and electrostatics, they emerge when separating variables in Laplace's equation with spherical symmetry. They also provide a basis for representing functions on the sphere in spherical harmonics. In numerical analysis, expansions in Legendre polynomials offer spectral accuracy, enabling highly precise approximations with relatively few terms.

The calculator on this page allows you to choose a non-negative integer degree n and a real value x. It then computes Pnx using the recurrence relation. The algorithm starts with P0 and P1, repeatedly applying the formula until it reaches the requested degree. The result is displayed with four decimal places, offering quick feedback for classroom exercises or self‑study.

Legendre polynomials also satisfy orthogonality: -11PnxPmxdx=22n+1δnm. This property means any reasonable function defined on [-1,1] can be approximated as a sum of Legendre polynomials. The coefficients in such an expansion derive from inner products with Pn.

Orthogonal polynomials like Legendre's minimize approximation error in the least-squares sense. When projecting a function onto the space spanned by the first few polynomials, the coefficients produce the best L2 approximation. This concept underlies spectral methods, where high-order polynomials model physical phenomena such as fluid flow or electromagnetic fields with exceptional accuracy.

Historically, Adrien-Marie Legendre introduced these polynomials while studying gravitational potentials. They soon found applications in celestial mechanics, where expansions in Legendre polynomials help compute planetary motions. Today, they remain fundamental in numerical integration techniques like Gauss–Legendre quadrature, which achieves exactness for polynomials up to degree 2n+1 using only n sample points.

By experimenting with this calculator, you gain practical experience with special functions that influence many branches of mathematics. Observing how Pnx behaves for various degrees builds intuition for the oscillatory nature of higher-order polynomials. Because the polynomials are normalized, their magnitude remains bounded on [-1,1], illustrating how orthogonality controls growth even as the degree increases. This interplay between algebraic structure and analytic behavior continues to captivate mathematicians and scientists alike.

Once you become comfortable computing individual polynomials, you can explore their connections to other families like Chebyshev and Hermite polynomials. These families satisfy similar recurrence relations and differential equations, revealing deep links between seemingly distinct areas of mathematics. Many algorithms in approximation theory and numerical computation rely on understanding such relationships. Ultimately, Legendre polynomials exemplify how simple recursions lead to rich mathematical structures with far-reaching implications.

Recording Results

Use the copy button to save evaluated polynomial values when checking homework or compiling tables.

Worked Example

Suppose you want to evaluate the third-degree polynomial at x=0.5. Enter n=3 and x=0.5 in the form. The recurrence builds P2 and P3, ultimately yielding P30.5=50.53-3×0.52=-0.4375. The calculator reports the same value with four decimal places, confirming the algebra.

Table of Low-Degree Polynomials

The first few Legendre polynomials illustrate the pattern of coefficients and symmetry:

nPnx
01
1x
23x2-12
35x3-3x2
435x4-30x2+38

Notice how only even or odd powers appear depending on the degree, reflecting the polynomials’ parity: Pn is even when n is even and odd otherwise.

Comparing Orthogonal Families

Legendre polynomials are one member of a broader family of orthogonal polynomials. Chebyshev polynomials Tn emphasize minimax approximation, while Hermite polynomials Hn arise in quantum mechanics. The choice depends on weighting functions and boundary conditions. The table below contrasts key properties.

FamilyWeight FunctionCommon Application
Legendre1Spherical harmonics, Gauss–Legendre quadrature
Chebyshev11-x2Polynomial approximation, FFT algorithms
Hermitee-x^2Quantum harmonic oscillator, probability

Understanding these distinctions helps analysts select the most effective basis for a given problem. While this page focuses on Legendre forms, experimenting with other families reveals how orthogonality adapts to different contexts.

Limitations and Numerical Stability

For very high degrees, recurrence relations can suffer from numerical instability due to finite precision. Techniques such as Clenshaw recurrences or arbitrary-precision arithmetic mitigate the issue. Additionally, Legendre polynomials assume the domain [-1,1]; mapping other intervals requires a linear transformation x=2t-b-ab-a where t lies in [a,b]. When evaluating outside the standard range, numerical errors may grow quickly.

Related Calculators

Explore further special functions with the Chebyshev Polynomial Calculator or convert between angular coordinates using the Spherical Coordinate Converter.

Related Calculators

Legendre Transform Calculator

Compute the Legendre transform of a convex function at a given slope.

Legendre transform calculator

Chebyshev Polynomial Calculator - Evaluate T_n(x) Precisely

Compute Chebyshev polynomials of the first kind for a given degree and value.

Chebyshev polynomial calculator approximation theory orthogonal polynomials

Laguerre Polynomial Calculator - Evaluate L_n(x)

Compute generalized Laguerre polynomials for given order and variable, with context on orthogonality and series forms.

Laguerre polynomial calculator special functions orthogonal polynomials