← Wiki Index / Computation & Algorithms / Gauss–Legendre Quadrature
💻 Computation & Algorithms

Gauss–Legendre Quadrature

Gauss–Legendre quadrature is an optimal n-point numerical integration rule over [−1, 1] that places nodes at the roots of the n-th Legendre polynomial to integrate polynomials of degree up to 2n − 1 with zero truncation error.

Gauss–Legendre Quadrature is a high-order numerical integration algorithm in computation and algorithms and numerical analysis that approximates the definite integral of a continuous function f(x) over the canonical interval [−1, 1] (or any finite interval [a, b] via affine coordinate transformation) as a weighted sum of n function evaluations at non-equispaced interior nodes x1, x2, ..., xn. Introduced by Carl Friedrich Gauss in an 1814 memoir using continued-fraction expansions of hypergeometric series and reformulated in terms of orthogonal Legendre polynomials Pn(x) by Carl Gustav Jacob Jacobi in 1826, it is the archetype of the broader family of Gaussian quadrature rules.

Whereas Newton–Cotes formulas such as the trapezoidal rule, Simpson's rule, and Romberg's method fix the n evaluation nodes at predetermined equally spaced grid points—leaving only the n weights wi free to match polynomials of degree at most n − 1 (or n for odd n)—Gauss–Legendre quadrature optimizes both the n node positions xi and the n weights wi simultaneously. Exploiting all 2n degrees of freedom achieves the maximal possible algebraic degree of precision 2n − 1: an n-point Gauss–Legendre rule integrates every polynomial of degree ≤ 2n − 1 with zero truncation error, avoids the Runge phenomenon of high-degree equispaced interpolation, and converges geometrically for analytic integrands.

Orthogonal Polynomial Derivation, Nodes, and Weights

Maximal Degree of Precision via Legendre Polynomial Roots

A general n-point quadrature rule with unit weight function ω(x) = 1 on [−1, 1] takes the form:

∫−11 f(x) dx ≈ ∑i=1..n wi f(xi)

Let Pn(x) denote the n-th Legendre polynomial, defined by Rodrigues' formula Pn(x) = (2n n!)−1 (dn/dxn)[(x2 − 1)n] or the three-term recurrence (k + 1)Pk+1(x) = (2k + 1)*xPk*(x) − kPk−1(x) with P0(x) = 1 and P1(x) = x. The Legendre polynomials form an orthogonal family in L2([−1, 1]):

∫−11 Pm(x) Pn(x) dx = ( 2 / (2n + 1) ) δmn

Consequently, Pn(x) is orthogonal to every polynomial q(x) of degree ≤ n − 1: ∫−11 Pn(x)q(x) dx = 0. Furthermore, all n roots of Pn(x) are real, simple, symmetric about the origin, and lie inside the open interval (−1, 1).

To see why placing the nodes x1, ..., xn at the roots of Pn(x) (Pn(xi) = 0) yields precision 2n − 1, let p(x) be any polynomial of degree ≤ 2n − 1. Dividing p(x) by Pn(x) using polynomial Euclidean division gives:

p(x) = q(x) Pn(x) + r(x), where deg(q) ≤ n − 1 and deg(r) ≤ n − 1

Integrating p(x) over [−1, 1], the first term vanishes by orthogonality of Pn(x) to q(x). Evaluating p(x) at the roots xi of Pn(x) gives p(xi) = q(xi) · 0 + r(xi) = r(xi). Choosing the n interpolatory Lagrange weights wi = ∫−11 ℓi(x) dx (which integrate degree-(n − 1) polynomials r(x) with zero error) yields:

∫−11 p(x) dx = ∫−11 r(x) dx = ∑i=1..n wi r(xi) = ∑i=1..n wi p(xi)

Conversely, no n-point rule can attain degree of precision 2n, because the degree-2n non-negative polynomial πn2(x) = ∏i=1..n (x − xi)2 has a positive integral ∫−11 πn2(x) dx > 0 while evaluating to zero at all n nodes.

Weight Formula, Positivity, and Affine Interval Transformation

Using the Christoffel–Darboux identity for Legendre polynomials, each quadrature weight wi has the closed-form expression:

wi = 2 / [ (1 − xi2) ( Pn′(xi) )2 ] > 0, with ∑i=1..n wi = 2

Because every weight wi is positive (in contrast to high-order Newton–Cotes rules, which develop large alternating negative weights for n ≥ 9), Gauss–Legendre quadrature is unconditionally stable against roundoff amplification in IEEE 754 arithmetic and converges for every Riemann-integrable function as n → ∞ (Steklov's theorem). To integrate over an arbitrary finite interval [a, b], the affine change of variables t = ((b − a) / 2)x + (a + b) / 2 maps [−1, 1] onto [a, b]:

∫ab f(t) dt = ( (b − a) / 2 ) ∫−11 f( ((b − a)/2)x + (a + b)/2 ) dx ≈ ( (b − a) / 2 ) ∑i=1..n wi f(ti)
Order nLegendre Polynomial Pn(x)Quadrature Nodes xi ∈ (−1, 1)Quadrature Weights wiExact Polynomial Degree 2n − 1
n = 1P1(x) = xx1 = 0w1 = 2Degree 1 (Midpoint rule)
n = 2P2(x) = (3x2 − 1)/2x1,2 = ±1/√3 ≈ ±0.5773502692w1,2 = 1Degree 3 (Cubic polynomials)
n = 3P3(x) = (5x3 − 3x)/2x1,3 = ±√(3/5) ≈ ±0.7745966692; x2 = 0w1,3 = 5/9; w2 = 8/9Degree 5 (Quintic polynomials)
n = 4P4(x) = (35*x*4 − 30*x*2 + 3)/8±√(3/7 − (2/7)√(6/5)) ≈ ±0.339981; ±√(3/7 + (2/7)√(6/5)) ≈ ±0.861136(18 + √30)/36 ≈ 0.652145; (18 − √30)/36 ≈ 0.347855Degree 7
n = 5P5(x) = (63*x*5 − 70*x*3 + 15*x*)/80; ±(1/3)√(5 − 2√(10/7)) ≈ ±0.538469; ±(1/3)√(5 + 2√(10/7)) ≈ ±0.906180128/225; (322 + 13√70)/900; (322 − 13√70)/900Degree 9

Truncation Error, Golub–Welsch Eigenvalue Algorithm, and Gauss–Kronrod Extensions

Peano Kernel Error Formula and Geometric Convergence

For a function f ∈ C2n([a, b]), Hermite osculatory interpolation yields the classical truncation error remainder for some ξ ∈ (a, b):

*En*[f] = ∫ab f(t) dt − ( (b − a) / 2 ) ∑i=1..n wi f(ti) = [ (b − a)2n+1 (n!)4 / ( (2n + 1) ((2n)!)3 ) ] f(2n)(ξ)

By Stirling's approximation, the factorial coefficient decays as (π / 4n)2, and for any function f(z) analytic inside a Bernstein ellipse Eρ in the complex plane with foci at ±1 and semiaxes summing to ρ > 1, the quadrature error decays geometrically as O(ρ−2n).

Computing Nodes and Weights: Golub–Welsch Versus Glaser–Liu–Rokhlin

To compute (xi, wi) numerically for arbitrary n, Gene Golub and John Welsch (1969) formulated the Golub–Welsch algorithm, which constructs the symmetric tridiagonal Jacobi matrix Jn ∈ ℝn×n from the three-term recurrence coefficients (zero diagonal, super/subdiagonal entries βk = k / √(4k2 − 1) for k = 1, ..., n − 1). The eigenvalues of Jn (computed via the symmetric tridiagonal QR algorithm) are the roots xi, and the weights equal twice the square of the first component of each normalized eigenvector (wi = 2 q1,i2) in O(n2) operations. For large n ≥ 100, asymptotic Newton's method root-finders initialized by Tricomi–Bessel expansions (Glaser, Liu, & Rokhlin, 2007; Hale & Townsend, 2013) compute all n nodes and weights in O(n) linear time to full machine precision.

Because the roots of Pn(x) and P2n(x) do not overlap (except x = 0 for odd n), doubling n in a naive adaptive integrator discards all previous function evaluations. Gauss–Kronrod quadrature (such as the G7–K15 and G10–K21 pairs in QUADPACK) remedies this by interleaving n + 1 Kronrod nodes (roots of the Stieltjes polynomial En+1(x)) between the n Gauss nodes, reusing all n existing evaluations to produce an embedded (2n + 1)-point rule of degree 3n + 1 (or 3n + 2) for a-posteriori error control. In multidimensional scientific computing, tensor-product Gauss–Legendre points serve as the standard stiffness-matrix integration quadrature across isoparametric finite elements and spectral-element fluid dynamics solvers.

Frequently Asked Questions

Why are Gauss–Legendre nodes clustered near the endpoints ±1 rather than equally spaced?

The roots of Pn(x) satisfy the asymptotic angular relation xi ≈ −cos((4i − 1)π / (4n + 2)), projecting uniform angles onto the horizontal diameter of the unit circle. This Chebyshev-like O(1/n2) clustering near ±1 counteracts the growth of the polynomial nodal product ∏(x − xi) near the boundaries, preventing the wild boundary oscillations (Runge's phenomenon) that destabilize high-order equispaced Newton–Cotes formulas.

When can Romberg's method or the trapezoidal rule outperform Gauss–Legendre quadrature?

Gauss–Legendre quadrature is optimal for general smooth non-periodic functions on finite intervals, achieving degree 2n − 1. However, for smooth periodic functions integrated over a full period (or functions decaying doubly exponentially after a tanh-sinh transformation), the simple equispaced trapezoidal rule and Romberg's method enjoy Euler–Maclaurin boundary cancellation of all odd derivatives and allow complete 100% node reuse when halving the step size.

How does Gauss–Legendre quadrature handle integrands with endpoint singularities?

Because all Gauss–Legendre nodes xi lie strictly inside the open interval (−1, 1), the rule never evaluates f(x) at x = ±1 and can be applied directly to integrable endpoint singularities such as f(x) = (1 − x)−1/2 without dividing by zero. However, because f(2n)(x) diverges at the endpoint, convergence slows from geometric to algebraic unless the algebraic singularity is absorbed into a weighted Gauss–Jacobi quadrature rule with weight ω(x) = (1 − x)α(1 + x)β.

References

  1. Gauss, C. F. (1814). "Methodus nova integralium valores per approximationem inveniendi." Commentationes Societatis Regiae Scientiarum Gottingensis Recentiores, 3, 39–76. https://gdz.sub.uni-goettingen.de/id/PPN35283028X_0003
  2. Golub, G. H., & Welsch, J. H. (1969). "Calculation of Gauss quadrature rules." Mathematics of Computation, 23(106), 221–230. https://doi.org/10.1090/S0025-5718-69-99647-1
  3. Laurie, D. P. (1997). "Calculation of Gauss-Kronrod quadrature rules." Mathematics of Computation, 66(219), 1133–1145. https://doi.org/10.1090/S0025-5718-97-00861-2
  4. Trefethen, L. N. (2008). "Is Gauss quadrature better than Clenshaw–Curtis?" SIAM Review, 50(1), 67–87. https://doi.org/10.1137/060659831
  5. Hale, N., & Townsend, A. (2013). "Fast and accurate computation of Gauss–Legendre and Gauss–Jacobi quadrature nodes and weights." SIAM Journal on Scientific Computing, 35(2), A652–A674. https://doi.org/10.1137/120889873
🧬 Support Open Science
Explore interactive science games on LowKey Games or browse scientific apparel & accessories in the CRV Science Shop.
💡 Spot an inaccuracy or have primary literature to expand this article?
Submit a citation or revision note using your shared CRV Science / LowKey Games profile ID.
Suggest Revision