Search the atlas

Quadrature rules and their errors

Derive the two-node Gauss–Legendre rule by matching moments, transfer it to a physical interval and test where polynomial exactness ends.

Two-Point Gaussian Quadrature and Polynomial Exactness

A quadrature rule approximates an integral using a finite set of function evaluations. Gaussian quadrature gains accuracy by choosing where to sample as well as how to weight the samples. Two carefully placed evaluations can integrate every cubic polynomial exactly, although they cannot integrate every smooth function exactly.

Determine nodes and weights from moments

On [−1,1][-1,1], seek a symmetric rule

∫−11f(ξ) dξ≈w[f(−a)+f(a)].\int_{-1}^1 f(\xi)\,d\xi\approx w[f(-a)+f(a)].

For f=1f=1, exactness requires 2w=22w=2, so w=1w=1. For f=ξ2f=\xi^2, it requires 2a2=2/32a^2=2/3, so a=1/3a=1/\sqrt3. Odd powers ξ\xi and ξ3\xi^3 integrate to zero and their sampled contributions cancel by symmetry.

Thus

G2[f]=f(−1/3)+f(1/3)G_2[f]=f(-1/\sqrt3)+f(1/\sqrt3)

is exact on the basis 1,ξ,ξ2,ξ31,\xi,\xi^2,\xi^3, and therefore on every linear combination of them. This is the two-point Gauss–Legendre rule. The broader polynomial-exactness property of Gaussian rules is given in NIST DLMF, section 3.5(v).

The nodes are not endpoints. A function value at the midpoint is also not used. Those choices distinguish the rule from trapezoidal, midpoint and Simpson formulas.

Transfer the rule to an engineering interval

For x∈[A,B]x\in[A,B], set

x=A+B2+B−A2ξ,dx=B−A2 dξ.x=\frac{A+B}{2}+\frac{B-A}{2}\xi,\qquad dx=\frac{B-A}{2}\,d\xi.

The physical quadrature is

∫ABf(x) dx≈B−A2[f(x−)+f(x+)],x±=A+B2±B−A23.\int_A^B f(x)\,dx\approx\frac{B-A}{2}[f(x_-)+f(x_+)],\quad x_\pm=\frac{A+B}{2}\pm\frac{B-A}{2\sqrt3}.

The Jacobian factor carries the interval length. Forgetting it can preserve a plausible-looking weighted sum while giving the wrong dimensions and scale.

For an assigned distributed load on 0≤x≤20\le x\le2 m, use q(x)=[2+3(x/m)+(x/m)3]q(x)=[2+3(x/\mathrm m)+(x/\mathrm m)^3] N/m. The nodes are approximately 0.422650 m and 1.577350 m, each with weight 1 m. The rule gives a total load of 14 N, matching the antiderivative. It is exact because the load is cubic in the physical coordinate under an affine mapping.

Challenge exactness with a fourth-degree term

On [−1,1][-1,1], the exact integral of ξ4\xi^4 is 2/52/5. The two-point rule gives 2/92/9, leaving error 8/458/45. Exactness through degree three does not mean small error for an arbitrarily scaled quartic component.

For a function with a continuous fourth derivative, the error on [A,B][A,B] can be written

I−G2=(B−A)54320f(4)(ζ),A<ζ<B.I-G_2=\frac{(B-A)^5}{4320}f^{(4)}(\zeta),\qquad A<\zeta<B.

The formula needs the stated smoothness. A discontinuity or unresolved narrow peak can evade the two evaluations, so a high formal order alone is not an acceptance test.

Refine and compare with an independent integral

For f(x)=exf(x)=e^x on [0,1][0,1], the exact integral is e−1≈1.71828183e-1\approx1.71828183. One two-point panel gives about 1.71789638, with error 0.00038545. Splitting into two equal panels gives about 1.71825717, reducing the error to about 0.00002466.

For smooth functions, composite two-point Gauss integration has fourth-order global convergence: halving panel length asymptotically reduces error by a factor of 16. That statement describes a refinement regime; it does not certify that any two computed values have entered it.

Applications and checks

Quadrature appears in distributed loads, work, energy, finite-element matrices and transport balances. Count the degree of the complete transformed integrand, including material variation, shape functions and the Jacobian. Exactness for a polynomial in the reference coordinate does not automatically transfer through a curved or nonlinear coordinate mapping.

Independent checks match polynomial moments with exact rational arithmetic, integrate the cubic load analytically and compare composite results with the exponential antiderivative and error bound. The node derivation and counterexample are fully inspectable on paper, so no interactive laboratory or animation is necessary.

Use refinement, alternate integration rules and known conservation or benchmark results to assess the quantity of interest. In finite elements, too little integration can create spurious zero-energy behavior; increasing quadrature cannot repair an incorrect constitutive law or discretization. Treat polynomial exactness as one computational property, not as validation of the engineering model being integrated.

A Peano-Kernel Guide: Curvature Determines the Sign and Size of Quadrature Error

A quadrature rule can be exact for straight lines and still err on a curved function. A Peano kernel shows exactly how the unresolved curvature contributes to the error. It supplies more information than an unexplained constant in a truncation-error formula.

Fix the Error Sign First

On [0,1], define E(f)=∫01f(x) dx−Q(f)E(f)=\int_0^1 f(x)\,dx-Q(f): exact integral minus quadrature. For the trapezoidal rule QT=[f(0)+f(1)]/2Q_T=[f(0)+f(1)]/2 and midpoint rule QM=f(1/2)Q_M=f(1/2), E vanishes for every linear polynomial.

Taylor’s formula with integral remainder can be written

f(x)=f(0)+xf′(0)+∫01(x−t)+f′′(t) dt,f(x)=f(0)+xf'(0)+\int_0^1(x-t)_+ f''(t)\,dt,

where (x−t)+=max⁡(x−t,0)(x-t)_+=\max(x-t,0). Applying E annihilates the first two terms, leaving

E(f)=∫01K(t)f′′(t) dt,K(t)=Ex[(x−t)+].E(f)=\int_0^1 K(t)f''(t)\,dt,\qquad K(t)=E_x[(x-t)_+].

The University of Minnesota numerical-analysis notes develop this representation. Assume sufficient smoothness, here continuous second derivative, so the interchange and bound are justified.

Calculate the Two Kernels

For the trapezoidal rule, applying E to the ramp gives

KT(t)=(1−t)22−1−t2=−t(1−t)2.K_T(t)=\frac{(1-t)^2}{2}-\frac{1-t}{2}=-\frac{t(1-t)}2.

For the midpoint rule,

KM(t)={t2/2,0≤t≤1/2,(1−t)2/2,1/2≤t≤1.K_M(t)=\begin{cases}t^2/2,&0\le t\le1/2,\\(1-t)^2/2,&1/2\le t\le1.\end{cases}

Thus a convex function, with f′′≥0f''\ge0, has ET≤0E_T\le0 and EM≥0E_M\ge0. The trapezoid overestimates its integral; the midpoint underestimates it. Reversing the definition of E reverses both signs, so a memorized sign without a convention is unreliable.

Work Two Examples

For f(x)=x2f(x)=x^2, the integral is 1/3. The trapezoid gives 1/2 and midpoint gives 1/4, hence errors −1/6 and +1/12. Because the second derivative is constant at two, these equal two times the respective kernel integrals.

For f(x)=x4f(x)=x^4, the integral is 1/5, trapezoid is 1/2 and midpoint is 1/16. Errors are −0.3 and +0.1375. Curvature now varies as 12t212t^2; integrating it against the kernels recovers those values. Substituting a derivative sampled at an arbitrary convenient point would not be the same calculation.

Turn a Derivative Bound into an Error Bound

The absolute kernel integrals are 1/12 and 1/24. If ∣f′′∣≤M|f''|\le M throughout an interval of width h, rescaling the coordinate gives single-panel bounds Mh3/12Mh^3/12 and Mh3/24Mh^3/24.

For a uniform composite rule over length L, summing L/h panels gives MLh2/12MLh^2/12 and MLh2/24MLh^2/24. The single-panel cubic power and composite quadratic power describe different objects. For unequal panels, sum their individual Mjhj3M_jh_j^3 bounds with the appropriate constant.

Applications and checks

The kernel connects error to where the curvature occurs and whether its contributions reinforce or cancel. It explains why polynomial exactness does not mean exactness for arbitrary measured signals. Independent numerical kernel integrals are checked against exact polynomial antiderivatives for four test functions.

The bound is only as credible as M and the smoothness assumption. A few sampled second derivatives may miss a sharp feature, while agreement between two quadrature resolutions is an estimate rather than this proof. Noise, discontinuities and unresolved peaks require another error analysis. The explicit kernels and worked values already show the mechanism; an animation would not establish a missing derivative bound.

Back to contents