Newton–Cotes fixes equally spaced nodes. Gaussian quadrature also chooses the node locations, aiming to integrate the highest possible polynomial degree with just nn function evaluations.

Use the notation in lecture note Sections 5.8–5.9 on [−1,1][-1,1]: nodes x1,…,xnx_1,\ldots,x_n, weights w1,…,wnw_1,\ldots,w_n, and

Qn(f)=∑i=1nwif(xi),En(f)=∫−11f(x) dx−Qn(f).Q_n(f)=\sum_{i=1}^n w_if(x_i),\qquad E_n(f)=\int_{-1}^1f(x)\,dx-Q_n(f).

Here nn counts nodes, unlike the interpolation degree in the earlier Newton–Cotes construction. Uppercase PnP_n denotes the Legendre polynomial as in lecture note Sections 5.8–5.9; lowercase pnp_n denotes a general interpolant [1][1] S. Rojas, “Lecture Notes on Computational Mathematics,” 2025. Course lecture note distributed with MTH2051; local source course-lecture-notes.pdf., [2][2] M. U. School of Mathematics, “MTH2051: Introduction to Computational Mathematics: Course Lecture Notes and Study Workbooks,” 2026. Monash University course materials and study workbooks, Semester 2, 2026., [3][3] R. L. Burden and J. D. Faires, Numerical Analysis, 9th ed. Brooks/Cole, Cengage Learning, 2011..

The upper limit on polynomial exactness

TheoremUpper bound for an n-node function-value rule

No quadrature rule with nn distinct real nodes and only function values can integrate every degree-2n2n polynomial exactly.

Proof

Set ω(x)=∏i=1n(x−xi)\omega(x)=\prod_{i=1}^n(x-x_i). The degree-2n2n polynomial ω2\omega^2 vanishes at every node, so its quadrature value is zero. Its integral is strictly positive because it is nonnegative and not identically zero. Thus the rule fails on this polynomial, regardless of the signs of its weights.

Orthogonality selects the nodes

Use the inner product

⟨p,q⟩=∫−11p(x)q(x) dx.\langle p,q\rangle=\int_{-1}^1p(x)q(x)\,dx.
TheoremCharacterization of Gaussian exactness

For distinct nodes and interpolatory weights wi=∫−11ℓi(x) dxw_i=\int_{-1}^1\ell_i(x)\,dx, exactness through degree 2n−12n-1 holds if and only if ω\omega is orthogonal to every polynomial of degree at most n−1n-1.

Proof

For necessity, ωq\omega q has degree at most 2n−12n-1 when deg⁡q≤n−1\deg q\leq n-1. It vanishes at all nodes, so exactness forces its integral to vanish.

For sufficiency, divide any pp of degree at most 2n−12n-1 as p=ωq+rp=\omega q+r, with deg⁡q≤n−1\deg q\leq n-1 and deg⁡r≤n−1\deg r\leq n-1. Orthogonality makes the integral of ωq\omega q zero, while its node values make its quadrature zero. Interpolatory weights integrate rr exactly. Hence they integrate pp exactly.

Legendre polynomials: construction, roots and recurrence

DefinitionLegendre polynomial

PnP_n has degree nn, is orthogonal to every lower-degree polynomial, and is normalized by Pn(1)=1P_n(1)=1.

TheoremRodrigues construction and basic properties

This polynomial exists uniquely and satisfies

Pn(x)=12nn!dndxn(x2−1)n.P_n(x)=\frac{1}{2^n n!}\frac{d^n}{dx^n}(x^2-1)^n.

It has nn distinct roots, all in (−1,1)(-1,1). Its leading coefficient and squared norm are

σn=(2n)!2n(n!)2,∫−11Pn(x)2 dx=22n+1.\sigma_n=\frac{(2n)!}{2^n(n!)^2},\qquad \int_{-1}^1P_n(x)^2\,dx=\frac2{2n+1}.
Proof

Rodrigues’ formula has degree nn and the displayed leading coefficient. Integrate its product with a lower-degree polynomial qq by parts nn times. The first n−1n-1 derivatives of (x2−1)n(x^2-1)^n vanish at both endpoints, so all boundary terms vanish, and q(n)=0q^{(n)}=0 proves orthogonality. At x=1x=1, differentiating (x−1)n(x+1)n(x-1)^n(x+1)^n exactly nn times leaves the single nonzero term n!2nn!2^n, proving the normalization.

For roots, multiply PnP_n by the product qq of the linear factors corresponding to all its sign-changing roots inside (−1,1)(-1,1). Then PnqP_nq has one sign throughout the interval and a nonzero integral. If there were fewer than nn such roots, deg⁡q<n\deg q<n would contradict orthogonality. There are therefore nn interior roots; the degree forces all to be simple. Two monic orthogonal degree-nn polynomials have a lower-degree difference orthogonal to itself, hence zero. Normalization gives uniqueness of PnP_n.

For the norm, integrate Rodrigues’ formula against PnP_n by parts nn times:

∫−11Pn2=σn2nJn,Jn=∫−11(1−x2)n dx.\int_{-1}^1P_n^2=\frac{\sigma_n}{2^n}J_n, \qquad J_n=\int_{-1}^1(1-x^2)^n\,dx.

Integrating [x(1−x2)n]′[x(1-x^2)^n]' gives (2n+1)Jn=2nJn−1(2n+1)J_n=2nJ_{n-1}. Starting from J0=2J_0=2, this yields

Jn=22n+1(n!)2(2n+1)!.J_n=\frac{2^{2n+1}(n!)^2}{(2n+1)!}.

Substitution of σn\sigma_n gives the norm.

PropositionThree-term recurrence

Starting from P0=1P_0=1, P1=xP_1=x, we have

(n+1)Pn+1=(2n+1)xPn−nPn−1,n≥1.(n+1)P_{n+1}=(2n+1)xP_n-nP_{n-1},\qquad n\geq1.
Proof

Expand xPnxP_n in the orthogonal polynomial basis. For k≤n−2k\leq n-2, ⟨xPn,Pk⟩=⟨Pn,xPk⟩=0\langle xP_n,P_k\rangle=\langle P_n,xP_k\rangle=0. Rodrigues’ formula gives parity, so ⟨xPn,Pn⟩=0\langle xP_n,P_n\rangle=0. Only Pn+1P_{n+1} and Pn−1P_{n-1} remain. Comparing leading coefficients gives (n+1)/(2n+1)(n+1)/(2n+1) for the first; evaluating at one gives n/(2n+1)n/(2n+1) for the second. Rearrange.

The first polynomials are

P0=1,P1=x,P2=3x2−12,P3=5x3−3x2.P_0=1,\quad P_1=x,\quad P_2=\frac{3x^2-1}{2},\quad P_3=\frac{5x^3-3x}{2}.

Choose the roots of PnP_n as nodes. The characterization theorem and the upper bound together prove degree of precision exactly 2n−12n-1.

Quadratic and cubic Legendre polynomials and their roots

Quadratic and cubic Legendre polynomials and their roots

Weights are unique, positive and computable

Once nodes are fixed, integrating Lagrange bases gives the unique weights. Any two weight vectors exact through degree n−1n-1 agree when applied to each ℓi\ell_i, hence agree componentwise.

Positivity also has a short proof. Since ℓi2\ell_i^2 has degree at most 2n−22n-2, Gaussian exactness gives

wi=Qn(ℓi2)=∫−11ℓi(x)2 dx>0.w_i=Q_n(\ell_i^2)=\int_{-1}^1\ell_i(x)^2\,dx>0.

Exactness on constants gives ∑iwi=2\sum_iw_i=2. Reflection symmetry and uniqueness give equal weights at symmetric nodes.

nnNodes and corresponding weightsDegree of precision
1Node 00, weight 221
2Nodes ±1/3\pm1/\sqrt3, weights 1,11,13
3Node 00, weight 8/98/9; nodes ±3/5\pm\sqrt{3/5}, each weight 5/95/95

The constant and quadratic moment conditions derive these weights. For three nodes, let the outer weights be uu and the central weight vv. Then 2u+v=22u+v=2 and 2u(3/5)=2/32u(3/5)=2/3, giving the listed values.

For four nodes the recurrence gives P4(x)=(35x4−30x2+3)/8P_4(x)=(35x^4-30x^2+3)/8.

Its inner and outer pairs have the following nodes and weights:

xinner=±15−23035,winner=18+3036,x_{\mathrm{inner}}=\pm\sqrt{\frac{15-2\sqrt{30}}{35}},\qquad w_{\mathrm{inner}}=\frac{18+\sqrt{30}}{36}, xouter=±15+23035,wouter=18−3036.x_{\mathrm{outer}}=\pm\sqrt{\frac{15+2\sqrt{30}}{35}},\qquad w_{\mathrm{outer}}=\frac{18-\sqrt{30}}{36}.

Solve the quadratic in x2x^2 for the nodes, then substitute into the general weight formula proved below. The larger weights belong to the inner nodes.

Hermite interpolation proves the error

TheoremGauss–Legendre error

For f∈C2n[−1,1]f\in C^{2n}[-1,1], there is ξ∈[−1,1]\xi\in[-1,1] such that

En(f)=f(2n)(ξ)(2n)!22n+1(n!)4(2n+1)[(2n)!]2.E_n(f)=\frac{f^{(2n)}(\xi)}{(2n)!} \frac{2^{2n+1}(n!)^4}{(2n+1)[(2n)!]^2}.
Proof

Construct H2n−1H_{2n-1} matching the function and derivative at every node. Existence and uniqueness follow from finite-dimensional linear algebra: homogeneous conditions force a polynomial of degree at most 2n−12n-1 to be divisible by ω2\omega^2, hence zero; the data map between two dimension-2n2n spaces is invertible.

Gauss is exact on H2n−1H_{2n-1} and its node values equal those of ff, so Qn(f)=∫H2n−1Q_n(f)=\int H_{2n-1}. At any non-node xx, form

Φ(t)=f(t)−H2n−1(t)−Cω(t)2,C=f(x)−H2n−1(x)ω(x)2.\Phi(t)=f(t)-H_{2n-1}(t)-C\omega(t)^2, \qquad C=\frac{f(x)-H_{2n-1}(x)}{\omega(x)^2}.

The nn double node zeros and the additional zero xx give 2n+12n+1 zeros. Repeated Rolle’s theorem gives C=f(2n)(ξx)/(2n)!C=f^{(2n)}(\xi_x)/(2n)!. At nodes the error is zero.

Bound the continuous derivative between its minimum and maximum, multiply by nonnegative ω2\omega^2, and integrate. Divide by ∫ω2>0\int\omega^2>0 and apply the intermediate value theorem to obtain one common ξ\xi. No continuity of ξx\xi_x is needed. Finally, ω=Pn/σn\omega=P_n/\sigma_n, so

∫−11ω2=1σn222n+1=22n+1(n!)4(2n+1)[(2n)!]2.\int_{-1}^1\omega^2 =\frac{1}{\sigma_n^2}\frac2{2n+1} =\frac{2^{2n+1}(n!)^4}{(2n+1)[(2n)!]^2}.

Substitute to conclude.

The derivative coefficients are 1/1351/135 for two nodes and 1/157501/15750 for three. The required derivative order increases with nn; increasing the node count does not imply a fixed convergence power without checking regularity.

Interval mapping and experiment

Map the reference interval onto [a,b][a,b] by

x=c+dξ,c=a+b2,d=b−a2>0.x=c+d\xi,\qquad c=\frac{a+b}{2},\qquad d=\frac{b-a}{2}>0.

Change of variables gives

∫abf(x) dx=d∫−11f(c+dξ) dξ≈d∑iwif(c+dxi).\int_a^b f(x)\,dx =d\int_{-1}^1f(c+d\xi)\,d\xi \approx d\sum_iw_if(c+dx_i).

The lecture note uses ξ\xi for the reference variable; c,dc,d are auxiliary constants defined here. Write the mapped nodes and weights as x~i=c+dxi\widetilde x_i=c+dx_i and w~i=dwi\widetilde w_i=dw_i, distinguished from reference nodes and weights xi,wix_i,w_i. The error constant gains factor d2n+1d^{2n+1}: d2nd^{2n} from the derivative and dd from the integral.

This interactive figure needs JavaScript.

The experiment lists nodes and weights already mapped to [0,1][0,1]. Compare two and three nodes, then increase nn. Node sets are generally not nested, unlike the meshes used by Romberg. For square roots and narrow peaks, inspect the actual error alongside the node count.

Composite Gauss quadrature

Section 5.9 also applies the nn-point rule panel by panel. Keep nn as the number of nodes per panel and use NN for the panel count, with h=(b−a)/Nh=(b-a)/N and yj=a+jhy_j=a+jh. Let Qn(f;[yj,yj+1])Q_n(f;[y_j,y_{j+1}]) be the mapped rule and define

Qn,N(f)=∑j=0N−1Qn(f;[yj,yj+1]).Q_{n,N}(f)=\sum_{j=0}^{N-1}Q_n(f;[y_j,y_{j+1}]).
PropositionGlobal order of composite Gauss quadrature

If f∈C2n[a,b]f\in C^{2n}[a,b] and ∣f(2n)∣≤B2n|f^{(2n)}|\leq B_{2n}, then

∣I−Qn,N(f)∣≤(n!)4(2n+1)[(2n)!]3(b−a)B2nh2n.|I-Q_{n,N}(f)|\leq \frac{(n!)^4}{(2n+1)[(2n)!]^3}(b-a)B_{2n}h^{2n}.
Proof

Multiply the reference-interval error coefficient by (h/2)2n+1(h/2)^{2n+1} for each panel. The local bound is B2nh2n+1(n!)4/((2n+1)[(2n)!]3)B_{2n}h^{2n+1}(n!)^4/((2n+1)[(2n)!]^3). Summing over N=(b−a)/hN=(b-a)/h panels proves the bound. Thus n=1n=1 recovers second-order composite midpoint, and n=2n=2 gives fourth-order global accuracy.

RemarkReference and mapped error constants

The coefficient CnC_n printed in Section 5.9 is inconsistent with its general-interval error expression. The proof above separates the reference coefficient from the scaling (h/2)2n+1(h/2)^{2n+1}. Setting n=1n=1 recovers the midpoint error h3f′′(ξ)/24h^3f''(\xi)/24 as an independent check.

Why the implementation’s general weight formula works

The numerical experiment solves for Legendre roots by Newton iteration and uses

wi=2(1−xi2)[Pn′(xi)]2.w_i=\frac{2}{(1-x_i^2)[P_n'(x_i)]^2}.

This equals the integral of the Lagrange basis, as follows.

Proof

Multiply and subtract the three-term recurrences at xx and yy, then sum over their indices. Adjacent terms telescope, giving the Christoffel–Darboux identity

∑k=0n−12k+12Pk(x)Pk(y)=n2Pn(x)Pn−1(y)−Pn−1(x)Pn(y)x−y.\sum_{k=0}^{n-1}\frac{2k+1}{2}P_k(x)P_k(y) =\frac n2\frac{P_n(x)P_{n-1}(y)-P_{n-1}(x)P_n(y)}{x-y}.

In detail, multiply the index-kk recurrences by Pk(y)P_k(y) and Pk(x)P_k(x) respectively and subtract; adjacent terms have coefficients k+1k+1 and kk, so summation leaves only the last term.

Set y=xiy=x_i. The right side becomes nPn−1(xi)Pn(x)/(2(x−xi))nP_{n-1}(x_i)P_n(x)/(2(x-x_i)). Divide by its limit at xix_i, namely nPn−1(xi)Pn′(xi)/2nP_{n-1}(x_i)P_n'(x_i)/2, to get ℓi(x)\ell_i(x). The integral of the left side is one, since only k=0k=0 is not orthogonal to constants. Hence

wi=2nPn−1(xi)Pn′(xi).w_i=\frac{2}{nP_{n-1}(x_i)P_n'(x_i)}.

To prove the derivative identity, let G=(1−x2)Pn′+nxPnG=(1-x^2)P_n'+nxP_n. Its highest-degree term cancels, so its degree is at most n−1n-1. For every qq of degree at most n−2n-2, integration by parts gives

∫−11Gq=∫−11Pn[(n+2)xq−(1−x2)q′]=0.\int_{-1}^1Gq =\int_{-1}^1P_n\bigl[(n+2)xq-(1-x^2)q'\bigr]=0.

Thus GG is a multiple of Pn−1P_{n-1}. Evaluating at one gives multiplier nn, so G=nPn−1G=nP_{n-1}; the case n=1n=1 is immediate directly. At a root, (1−xi2)Pn′(xi)=nPn−1(xi)(1-x_i^2)P_n'(x_i)=nP_{n-1}(x_i). Substitute into the weight formula.

The denominator is nonzero because roots are interior and simple. Numerical root solving still requires iteration limits and convergence checks, followed by independent polynomial moment checks of nodes and weights.

References

  1. [1] S. Rojas, “Lecture Notes on Computational Mathematics,” 2025. Course lecture note distributed with MTH2051; local source course-lecture-notes.pdf. ↩
  2. [2] M. U. School of Mathematics, “MTH2051: Introduction to Computational Mathematics: Course Lecture Notes and Study Workbooks,” 2026. Monash University course materials and study workbooks, Semester 2, 2026. ↩
  3. [3] R. L. Burden and J. D. Faires, Numerical Analysis, 9th ed. Brooks/Cole, Cengage Learning, 2011. ↩