On this page
Most numerical integration rules you meet first fix the sample points. The trapezoidal rule and Simpson's rule use equally spaced points and then work out the weights. Gaussian quadrature asks a better question: if you may also choose where the points go, how much accuracy can you squeeze out of the same number of function evaluations?
What is Gaussian quadrature?
A quadrature rule replaces an integral by a weighted sum: ∫ f(x) dx ≈ w₁f(x₁) + … + wₙf(xₙ). With n points you have 2n unknowns, n nodes and n weights, so you can match 1, x, x², …, x^(2n−1).
An n-point Gaussian rule is constructed to give an exact result for polynomials of degree 2n − 1 or less, according to the Wikipedia article on Gaussian quadrature, which names the method after Carl Friedrich Gauss. The same article says the modern formulation using orthogonal polynomials was developed by Carl Gustav Jacobi in 1826.
Compare Simpson's rule: three points, but it is exact only up to degree three, as the Wikipedia article on Simpson's rule states (refresher: trapezoidal rule and Simpson's rule with a worked example).
How do you derive the 2-point Gauss rule?
Work on [−1, 1] and look for w₁f(x₁) + w₂f(x₂) that is exact for f = 1, x, x² and x³. Each gives one equation:
f = 1: w₁ + w₂ = 2
f = x: w₁x₁ + w₂x₂ = 0
f = x²: w₁x₁² + w₂x₂² = 2/3
f = x³: w₁x₁³ + w₂x₂³ = 0
By symmetry, try x₂ = −x₁ and w₁ = w₂ = 1 (from equation 1). Equations 2 and 4 then hold because odd powers cancel. Equation 3 becomes 2x₁² = 2/3, so x₁² = 1/3.
The 2-point Gauss–Legendre rule is ∫ f(x) dx from −1 to 1 ≈ f(−1/√3) + f(1/√3), with nodes ±0.57735 and weights 1, matching the table in the Gaussian quadrature article.
Check it on f(x) = 0.5 + 0.6x + 0.9x² − 0.8x³. The exact integral over [−1, 1] is 1 + 0.6 = 1.6, and f(−1/√3) + f(1/√3) = 2(0.5 + 0.3) = 1.6. Exact, from two samples.
Is Gaussian quadrature more accurate than Simpson's rule?
Take ∫ e^x dx from 0 to 1. The exact value is e − 1 = 1.7182818.
Simpson's rule (3 evaluations): (1/6)[e⁰ + 4e^0.5 + e¹] = (1 + 6.5948851 + 2.7182818)/6 = 1.7188612. Error about 0.00058.
Gauss, 2 points (2 evaluations): nodes 0.5 ± 0.2886751, that is 0.2113249 and 0.7886751, each with weight 1/2. The sum is e^0.5 × cosh(0.2886751) = 1.6487213 × 1.0419568 = 1.7178964. Error about 0.00039.
Gauss, 3 points (3 evaluations): nodes 0.5 and 0.5 ± 0.3872983, weights 4/9 and 5/18. The result is 1.7182810. Error about 0.0000008.
Simpson's error for one panel is −(b−a)⁵/2880 times f⁗(ξ), from the Simpson's rule article; the 2-point Gauss error is (b−a)⁵/4320 times f⁗(ξ), from the general formula in the Gaussian quadrature article. Smaller constant, one fewer evaluation.
That is what the e^x test shows: two Gauss points already beat three Simpson points, and with the same three evaluations Gauss lands roughly 700 times closer to the exact value.
Why are the nodes the roots of Legendre polynomials?
The nodes ±1/√3 are exactly the roots of P₂(x) = (3x² − 1)/2, and not by accident.
In the NIST Digital Library of Mathematical Functions, §3.5(v), the Gauss rule takes its nodes as the zeros of the orthogonal polynomial pₙ for the weight function, and is exact for any polynomial of degree ≤ 2n − 1. For weight 1 on [−1, 1], DLMF names these the (monic) Legendre polynomials.
The reason in one line: divide any polynomial q of degree 2n − 1 by Pₙ to get q = sPₙ + r, with s and r of degree below n. The integral of sPₙ is zero because Pₙ is orthogonal to every lower-degree polynomial. At the roots of Pₙ, q equals r. So a rule exact for r is exact for q too, and n nodes with the right weights are always exact for a polynomial of degree below n. Our post on Legendre polynomials P₀ to P₃, worked by hand builds the orthogonality you need, and Lagrange interpolation explains why n points pin down r.
How can you practise Gaussian quadrature?
Rederive the 2-point rule from the four equations without looking.
Map it to [0, 2] and integrate x³ + x; check you get 6 exactly.
Find the roots of P₃ and confirm the weights 8/9 and 5/9 on f = 1 and f = x².
Repeat the e^x race on [0, 2] and see how the errors grow with (b−a)⁵.
If orthogonality still feels shaky, the Fermi Concept Library gives each mathematics concept its own lesson and its place in the map. When a step goes wrong, the Fermi Problem Library has a step-by-step solver that explains the reasoning rather than printing an answer.



