maths2u
Tier
⌕ Search ⌘K
Theorem

Gaussian quadrature

T-117Home MU-308Threads change
Statement

Let \(n \in \mathbb{N}\), \(n \geq 1\). There exist nodes \(x_1 \lt x_2 \lt \cdots \lt x_n\) in the open interval \((-1,1)\), namely the roots of the degree-\(n\) Legendre polynomial \(P_n\), and weights \(w_1,\dots,w_n \gt 0\), namely \(w_i = \int_{-1}^{1} \ell_i(x)\,dx\) where \(\ell_i\) is the \(i\)-th Lagrange basis polynomial on the nodes \(\{x_j\}\), such that \[ \int_{-1}^{1} f(x)\,dx = \sum_{i=1}^{n} w_i f(x_i) \] holds exactly for every polynomial \(f\) of degree at most \(2n-1\). Moreover no \(n\)-point quadrature rule (any choice of \(n\) nodes and \(n\) weights) is exact for every polynomial of degree \(2n\); the degree of precision \(2n-1\) is the maximum attainable with \(n\) nodes, and it is achieved if and only if the nodes are the roots of \(P_n\).

Why it matters

An \(n\)-point interpolatory rule built from an arbitrary node set is exact only up to degree \(n-1\) — you pay for \(n\) function evaluations and get back only \(n\) degrees of polynomial exactness. Gauss quadrature shows that by choosing the nodes intelligently, rather than fixing them in advance (equally spaced, say), the same \(n\) evaluations buy exactness up to degree \(2n-1\): double the return on the same computational budget. This is the paradigm example of "optimal design" in numerical analysis — the free parameters (node positions) are spent on raising accuracy rather than on convenience of placement.

The result underlies virtually every high-order numerical integration routine in scientific computing, spectral methods for PDEs (collocation at Gauss/Gauss–Lobatto points), and quadrature-based finite element assembly, precisely because for smooth integrands the error decays faster than any fixed power of \(1/n\) (spectral accuracy).

Hypotheses
Nodes are the roots of the degree-\(n\) orthogonal polynomial \(P_n\) associated with the weight function on \([-1,1]\). If the nodes are instead equally spaced (Newton–Cotes), the resulting \(n\)-point rule is exact only up to degree \(n-1\) or \(n\) (with parity), not \(2n-1\); e.g. the 2-point trapezoidal rule on \([-1,1]\) is exact for linear polynomials only, while the 2-point Gauss rule is exact up to cubics.
The exactness claim is restricted to polynomials \(f\) of degree \(\leq 2n-1\). For a generic smooth \(f\) that is not a polynomial, the rule is only approximate; e.g. \(\int_{-1}^1 e^x\,dx\) is not reproduced exactly by any finite \(n\), only approximated with an error controlled by \(f^{(2n)}\).
The weight function \(w(x)\) (here \(w \equiv 1\)) is nonnegative, not identically zero, and has finite moments \(\mu_k = \int_{-1}^1 x^k w(x)\,dx\) for all \(k \leq 2n\), so that the associated orthogonal polynomial family is well defined with real, simple roots inside the interval. If \(w\) changes sign on \((-1,1)\), the bilinear form \(\langle p,q\rangle = \int p(x)q(x)w(x)\,dx\) need not be an inner product; the Gram determinant of \(\{1,x,\dots,x^n\}\) can vanish or go negative, and the "orthogonal polynomial" \(P_n\) can acquire complex roots or real roots outside \((-1,1)\), destroying the interpolatory quadrature construction (nodes outside the domain, or fewer than \(n\) real nodes).
Proof
1
\text{Fix any } n \text{ distinct nodes } x_1,\dots,x_n \in [-1,1], \text{ let } \ell_i(x)=\prod_{j\neq i}\frac{x-x_j}{x_i-x_j}, \quad w_i := \int_{-1}^{1}\ell_i(x)\,dx.
Definition of the interpolatory quadrature rule built on these nodes: the unique degree \(\leq n-1\) interpolant of \(f\) at the \(x_i\) is \(\sum_i f(x_i)\ell_i(x)\), and integrating it term by term gives \(\sum_i w_i f(x_i)\). Since \(\ell_i(x_j)=\delta_{ij}\) (Lagrange basis property), this rule is automatically exact for every polynomial of degree \(\leq n-1\), by linearity of the integral and of interpolation on that subspace. A
2
\text{Let } P_n \text{ be the (unique up to scaling) degree-}n\text{ polynomial with } \int_{-1}^{1}P_n(x)q(x)\,dx = 0 \ \ \forall\, q \text{ with } \deg q \leq n-1.
Existence and uniqueness: apply Gram–Schmidt orthogonalisation to \(1,x,x^2,\dots\) under the inner product \(\langle p,q\rangle=\int_{-1}^1 pq\,dx\), which is a genuine inner product on polynomials because the weight \(w\equiv 1\) is positive on \([-1,1]\) (this is exactly where Hypothesis 3 is used). The resulting \(P_n\) is the degree-\(n\) Legendre polynomial (up to normalisation). This is the classical orthogonal-polynomial construction. B
3
\text{Lemma: } P_n \text{ has } n \text{ real, simple roots, all lying in } (-1,1).
Suppose \(P_n\) changes sign at only \(m \lt n\) points \(\xi_1,\dots,\xi_m \in (-1,1)\) (counted with odd multiplicity). Let \(q(x)=\prod_{j=1}^m(x-\xi_j)\), a polynomial of degree \(m \leq n-1\). Then \(P_n(x)q(x)\) does not change sign on \([-1,1]\) (by construction of \(q\), each sign change of \(P_n\) is cancelled) and is not identically zero, so \(\int_{-1}^1 P_n q\,dx \neq 0\). But orthogonality from Step 2 forces \(\int_{-1}^1 P_n q\,dx = 0\) since \(\deg q \leq n-1\), a contradiction. Hence \(P_n\) has at least \(n\) sign changes in \((-1,1)\); since \(\deg P_n = n\) it has at most \(n\) roots (fundamental theorem of algebra), so exactly \(n\), all real, simple, interior to \((-1,1)\). C
4
\text{Set } x_1,\dots,x_n := \text{ the roots of } P_n \text{ from Step 3, and take the interpolatory weights } w_i \text{ of Step 1 at these nodes.}
This is the definition of the Gauss(-Legendre) rule: node choice from Step 2–3, weight choice from Step 1. A
5
\text{Let } \deg f \leq 2n-1. \text{ Polynomial division gives } f = qP_n + r, \quad \deg q \leq n-1,\ \deg r \leq n-1.
Euclidean division algorithm for polynomials: dividing \(f\) (degree \(\leq 2n-1\)) by \(P_n\) (degree \(n\)) yields a quotient of degree \(\leq (2n-1)-n = n-1\) and a remainder of degree \(\lt n\), i.e. \(\leq n-1\). B
6
\int_{-1}^{1} f(x)\,dx = \int_{-1}^{1} q(x)P_n(x)\,dx + \int_{-1}^{1} r(x)\,dx = 0 + \int_{-1}^{1} r(x)\,dx,
The first integral vanishes by the orthogonality property of \(P_n\) from Step 2, applicable because \(\deg q \leq n-1\). B
7
f(x_i) = q(x_i)P_n(x_i) + r(x_i) = r(x_i), \qquad i=1,\dots,n,
Since \(x_i\) are roots of \(P_n\) (Step 3), \(P_n(x_i)=0\), so the division identity evaluated at each node collapses to \(f(x_i)=r(x_i)\). A
8
\sum_{i=1}^{n} w_i f(x_i) = \sum_{i=1}^{n} w_i r(x_i) = \int_{-1}^{1} r(x)\,dx = \int_{-1}^{1} f(x)\,dx.
First equality by Step 7. Second equality because \(\deg r \leq n-1\) and the rule of Step 1 is exact for all polynomials of degree \(\leq n-1\). Third equality is Step 6. This chain establishes exactness of the Gauss rule for all \(f\) of degree \(\leq 2n-1\), completing the main claim. B
9
w_i = \int_{-1}^{1} \ell_i(x)^2\,dx \gt 0, \qquad i=1,\dots,n.
Apply the exactness just proved to \(f=\ell_i^2\), which has degree \(2n-2 \leq 2n-1\): \(\int_{-1}^1 \ell_i^2\,dx = \sum_j w_j \ell_i(x_j)^2 = w_i\) since \(\ell_i(x_j)=\delta_{ij}\) kills every term but \(j=i\). The integral of a nonnegative function that is not identically zero (a nonconstant polynomial) is strictly positive, so \(w_i \gt 0\). A
10
\text{No } n\text{-point rule (any nodes } y_1,\dots,y_n\text{, any weights) is exact for every polynomial of degree } 2n.
Take \(g(x) = \prod_{i=1}^n (x-y_i)^2\), degree exactly \(2n\), with \(g \geq 0\) on \([-1,1]\) and \(g \not\equiv 0\), so \(\int_{-1}^1 g\,dx \gt 0\). Any quadrature rule using precisely these nodes \(y_i\) gives \(\sum_i w_i g(y_i) = 0\), since \(g(y_i)=0\) for every \(i\) by construction. If the rule were exact for all degree-\(2n\) polynomials, it would force \(\int_{-1}^1 g\,dx = 0\), contradicting positivity. Hence \(2n-1\) is the maximal degree of precision achievable by any \(n\)-point rule, and by Steps 1–8 it is achieved exactly when the nodes are the roots of \(P_n\). C
Result
\int_{-1}^{1} f(x)\,dx = \sum_{i=1}^{n} w_i f(x_i) \quad \text{exactly for all } \deg f \leq 2n-1, \quad \{x_i\} = \text{roots of } P_n,\ w_i \gt 0.

Reading. Placing the \(n\) quadrature nodes at the zeros of the degree-\(n\) Legendre polynomial, rather than anywhere else, doubles the polynomial degree that \(n\) function evaluations can integrate exactly, from \(n-1\) (generic interpolatory rule) to \(2n-1\); this is the best that any \(n\)-node rule can do, and the associated weights are automatically positive.

Scope. Stated here for the unweighted integral on \([-1,1]\) (Gauss–Legendre). The identical argument, replacing \(P_n\) by the orthogonal polynomial family for a different weight \(w(x)\) (Chebyshev, Laguerre on \([0,\infty)\), Hermite on \(\mathbb{R}\)), yields Gauss–Chebyshev, Gauss–Laguerre, Gauss–Hermite quadrature with the same \(2n-1\) exactness property. An interval \([a,b]\) is handled by the affine map \(x=\tfrac{b-a}{2}t+\tfrac{a+b}{2}\), which rescales the rule but preserves exactness degree. The exactness statement itself concerns only polynomials; for general \(f\) it becomes an asymptotic error estimate requiring \(f \in C^{2n}\).

Corollaries & converses
  • Error formula (free corollary). If \(f \in C^{2n}[-1,1]\), then \(\int_{-1}^1 f\,dx - \sum_i w_i f(x_i) = \dfrac{f^{(2n)}(\eta)}{(2n)!}\int_{-1}^1 P_n(x)^2/k_n^2\,dx\) for some \(\eta \in (-1,1)\) (\(k_n\) the leading coefficient of \(P_n\)); this follows by applying Hermite interpolation error theory to the degree \(2n-1\) polynomial osculating \(f\) at the double nodes \(x_i\), and does not require reproving Steps 1–9.
  • Positivity is not an extra hypothesis — Step 9 shows it is forced by exactness itself, so the rule is numerically stable (no catastrophic cancellation from mixed-sign weights) for free.
  • Converse of the optimality statement holds: Step 10 shows \(2n-1\) cannot be beaten by any node choice, and Steps 1–9 show it is attained if and only if the nodes are chosen as the roots of the degree-\(n\) member of the orthogonal family — any other node set of size \(n\) achieves strictly lower degree of precision (this "only if" direction is a standard strengthening: if degree \(2n-1\) is achieved, the node polynomial \(\prod(x-x_i)\) must be orthogonal to all lower-degree polynomials, forcing it to equal \(P_n\) up to scale).
  • Does not converge for arbitrary continuous \(f\). Exactness on polynomials of bounded degree does not imply \(\sum_i w_i f(x_i) \to \int f\) as \(n \to \infty\) for every continuous \(f\); convergence for all \(f \in C[-1,1]\) requires the extra fact that weights are positive and sum to the fixed total \(\int_{-1}^1 1\,dx = 2\) (a Pólya-type theorem), which does hold here by Step 9 — so convergence for all continuous \(f\) is a genuine (separate) consequence, not automatic from exactness alone.
Fails without
  • Drop "nodes = roots of \(P_n\)": take \(n=2\) with the equally spaced nodes \(x=\pm 1\) (trapezoidal rule) instead of \(\pm 1/\sqrt3\). Weights forced to \(w_1=w_2=1\) by exactness on constants and the symmetric setup. Test on \(f(x)=x^3\): exact integral is \(0\); interpolatory weights still give \(0\) (odd function) — but test on \(f(x)=x^2\): exact integral \(2/3\); trapezoidal gives \(1^2\cdot1+(-1)^2\cdot1=2\), not \(2/3\). Degree of precision has collapsed to \(1\), far below the Gauss value \(2n-1=3\).
  • Drop positivity/finiteness of the weight function (Hypothesis 3): take the sign-changing "weight" \(w(x)=x\) on \([-1,1]\). Then \(\langle p,q\rangle = \int_{-1}^1 pq\,x\,dx\) is not positive definite (e.g. \(\langle 1,1\rangle = \int_{-1}^1 x\,dx = 0\)), so the Gram–Schmidt construction of Step 2 breaks down at the first step: there is no degree-1 "orthogonal polynomial" with a genuine sign-definite norm, and the resulting node-defining polynomial can have a root at \(x=0\) with multiplicity issues or fail to have all its roots simple and interior, so the quadrature built from its roots is not guaranteed exact even to degree \(n-1\).
  • Restrict attention to polynomials only, drop smoothness for the error formula: take \(f(x)=|x|^{2n+0.5}\), which is not \(C^{2n}\) at \(0\). The Gauss rule is still well defined and gives some numerical value, but the error formula of the first corollary does not apply, and empirically the observed convergence rate as \(n\) increases is algebraic (limited by the finite smoothness) rather than spectral, unlike for analytic \(f\).
Common errors
  • Claiming the degree of precision is \(2n\) rather than \(2n-1\) — Step 10 shows \(2n\) is never attainable with \(n\) nodes, no matter how they are chosen.
  • Using Chebyshev nodes (roots of \(T_n\)) when the problem calls for the unweighted integral — Chebyshev nodes are optimal for the weight \(w(x)=1/\sqrt{1-x^2}\) (Gauss–Chebyshev), not for \(w\equiv1\); mixing up the two gives a rule that is not exact to degree \(2n-1\) for the plain integral.
  • Forgetting the Jacobian when mapping \([a,b]\) to \([-1,1]\): using nodes/weights straight from the \([-1,1]\) table without the factor \(\frac{b-a}{2}\) multiplying the weights (and the affine node transform) silently rescales the answer.
  • Assuming the rule converges for any continuous \(f\) at the same spectral rate as for smooth \(f\); convergence rate depends heavily on the smoothness/analyticity of \(f\), and for functions with nearby singularities in the complex plane the rate can be only algebraic.
  • Believing the nodes are equally spaced or symmetric by "obvious" design rather than derived: the symmetry \(x_i = -x_{n+1-i}\) is a genuine consequence of \(P_n\) being even or odd (parity of Legendre polynomials), not an assumption built into the construction.
Discussion

Gauss's original 1814 derivation used continued fractions arising from the asymptotic expansion of \(\int \frac{dx}{x-z}\); it was Jacobi in 1826 who recognised that the nodes are exactly the roots of the Legendre polynomials, giving the orthogonal-polynomial proof reproduced above and turning an isolated trick into a template — replace \(P_n\) by any classical orthogonal family and the same argument manufactures Gauss–Chebyshev, Gauss–Laguerre, Gauss–Hermite, and Gauss–Jacobi rules, each optimal for its own weight function and domain.

The deeper structural fact is that Gauss quadrature is really about moments: an \(n\)-point rule with node/weight pairs \((x_i,w_i)\) is exact to degree \(2n-1\) precisely when it reproduces the first \(2n\) moments \(\mu_k=\int x^k w(x)\,dx\), \(k=0,\dots,2n-1\), of the measure. This is the classical Gauss–Christoffel moment problem, and it connects quadrature to Padé approximation of the Stieltjes transform of the measure and, via the three-term recurrence of orthogonal polynomials, to the eigenvalues of a tridiagonal Jacobi matrix — the Golub–Welsch algorithm computes Gauss nodes and weights as eigenvalues and (scaled) first eigenvector components of that matrix, which is how essentially all production-quality quadrature libraries generate the tables.

A subtler point often missed: exactness to degree \(2n-1\) is an algebraic statement about a specific finite-dimensional test space (polynomials), and it says nothing directly about approximation of non-polynomial \(f\) without invoking a separate convergence theorem. The reason Gauss quadrature performs so well in practice on smooth non-polynomial integrands is a consequence of the theory of best polynomial approximation (Chebyshev/Weierstrass): a function analytic in a Bernstein ellipse containing \([-1,1]\) is approximated by degree-\((2n-1)\) polynomials with error decaying geometrically in \(n\), and Gauss quadrature inherits this rate because it is exact on the approximating polynomial and its error is controlled (via the error formula corollary) by the same derivative growth.

Common misconception: that "Gaussian quadrature" refers to a single fixed rule. It is a family, one rule per \(n\) and per weight/domain pair, and the nodes for different \(n\) are not nested (the 2-point and 3-point Gauss–Legendre node sets share no points), unlike Gauss–Kronrod extensions which are deliberately built to nest an existing Gauss rule inside a higher-order one for adaptive error estimation.

Worked examples
1
\text{Verify the } n=2 \text{ Gauss–Legendre rule exactly integrates } f(x)=x^3+x^2+x+1 \text{ over } [-1,1].
\(P_2(x) = \tfrac12(3x^2-1)\), roots \(x=\pm 1/\sqrt3\); by symmetry and Step 9, \(w_1=w_2=1\) (checked below). Degree of \(f\) is \(3 = 2\cdot2-1\), exactly at the boundary of guaranteed exactness. A
2
\int_{-1}^{1}(x^3+x^2+x+1)\,dx = \Big[\tfrac{x^4}{4}+\tfrac{x^3}{3}+\tfrac{x^2}{2}+x\Big]_{-1}^{1} = 0 + \tfrac{2}{3} + 0 + 2 = \tfrac{8}{3}.
Direct antiderivative evaluation; odd-power terms \(x^3,x\) vanish by symmetry of the interval. A
3
f\!\left(\tfrac{1}{\sqrt3}\right)+f\!\left(-\tfrac{1}{\sqrt3}\right) = 2\left(\tfrac{1}{\sqrt3}\right)^2 + 2 = \tfrac23+2 = \tfrac83.
The odd-degree terms \(x^3,x\) cancel between the two symmetric nodes, leaving twice the even-degree terms evaluated at \(1/\sqrt3\). With \(w_1=w_2=1\) the quadrature sum equals this. A
\sum_{i=1}^{2} w_i f(x_i) = \tfrac83 = \int_{-1}^1 f(x)\,dx

Reading. The 2-point rule, using only 2 evaluations, exactly reproduces the integral of a cubic — a 1-point (midpoint) rule could not do this, confirming the \(2n-1=3\) exactness bound.

1
\text{Approximate } \int_0^{\pi}\sin x\,dx \text{ (exact value } 2\text{) using the 3-point Gauss–Legendre rule.}
Map \([0,\pi]\) to \([-1,1]\) via \(x=\tfrac{\pi}{2}(t+1)\), \(dx=\tfrac{\pi}{2}dt\); nodes/weights for \(n=3\) are \(t=0\ (w=8/9)\), \(t=\pm\sqrt{3/5}\approx\pm0.7746\ (w=5/9\) each\()\), the roots of \(P_3(t)=\tfrac12(5t^3-3t)\). B
2
t=0 \Rightarrow x=\tfrac{\pi}{2}\approx1.5708,\ \sin x = 1; \qquad t=\pm0.7746 \Rightarrow x\approx2.7875,\,0.3541,\ \sin x \approx 0.3467 \text{ (both, since } x_++x_-=\pi\text{)}.
Direct evaluation of the affine map and of \(\sin\) at the transformed nodes; the two off-centre \(x\)-values are supplementary angles, giving equal sine values. A
3
\sum w_i \sin x_i = \tfrac89(1) + \tfrac59(0.3467) + \tfrac59(0.3467) \approx 0.8889 + 0.3852 = 1.2741; \quad \int_0^\pi \sin x\,dx \approx \tfrac{\pi}{2}(1.2741) \approx 2.0011.
Weighted sum in \(t\), then multiply by the Jacobian \(\tfrac{\pi}{2}\) of the affine map to recover the integral over \([0,\pi]\). A
\int_0^{\pi}\sin x\,dx \approx 2.0011 \quad (\text{exact } = 2,\ \text{relative error} \approx 5\times10^{-4})

Reading. Although \(\sin x\) is not a polynomial, 3 evaluations (degree-of-precision 5) already achieve sub-percent accuracy, illustrating the rapid (spectral) convergence the exactness theorem enables for smooth integrands, via the error-formula corollary.

Problems
  1. Show directly that the 1-point Gauss rule (\(n=1\)) is \(x_1=0\), \(w_1=2\) (the midpoint rule), and verify it is exact for \(f(x)=3x+1\) but not for \(f(x)=x^2\), confirming the degree of precision is exactly \(2n-1=1\).
    Solution\(P_1(x)=x\) (the degree-1 Legendre polynomial, orthogonal to constants: \(\int_{-1}^1 x\cdot1\,dx=0\)), whose only root is \(x_1=0\). The interpolatory weight is \(w_1=\int_{-1}^1 \ell_1(x)\,dx=\int_{-1}^1 1\,dx=2\) (since \(\ell_1\equiv1\) for a single node). Test \(f(x)=3x+1\): exact integral \(\int_{-1}^1(3x+1)dx=0+2=2\); quadrature: \(2\cdot f(0)=2\cdot1=2\). Matches — degree 1 exactness confirmed. Test \(f(x)=x^2\): exact integral \(\int_{-1}^1x^2dx=2/3\); quadrature: \(2\cdot f(0)=2\cdot0=0\). Does not match, so degree 2 fails, confirming \(2n-1=1\) is the sharp bound for \(n=1\).
  2. Derive the weights \(w_1,w_2\) of the \(n=2\) Gauss–Legendre rule from the Lagrange-basis definition \(w_i=\int_{-1}^1\ell_i(x)\,dx\), using nodes \(x_{1,2}=\mp1/\sqrt3\), and confirm \(w_1=w_2=1\).
    SolutionWith \(x_1=-1/\sqrt3\), \(x_2=1/\sqrt3\): \(\ell_1(x)=\dfrac{x-x_2}{x_1-x_2}=\dfrac{x-1/\sqrt3}{-2/\sqrt3}\). Then \(w_1=\int_{-1}^1\ell_1(x)dx = \dfrac{1}{-2/\sqrt3}\int_{-1}^1\left(x-\tfrac1{\sqrt3}\right)dx = \dfrac{-\sqrt3}{2}\left(0-\tfrac{2}{\sqrt3}\right)=\dfrac{-\sqrt3}{2}\cdot\left(-\tfrac{2}{\sqrt3}\right)=1.\) By the symmetric construction (or repeating the computation with \(\ell_2\)), \(w_2=1\) as well. This matches the general fact \(w_i=\int\ell_i^2dx\) from Step 9 of the proof, since here \(\ell_1=\ell_2\) up to sign structure that squares away.
  3. Find the roots of \(P_2(x)=\tfrac12(3x^2-1)\) and confirm they lie in \((-1,1)\) and are the Gauss–Legendre nodes for \(n=2\).
    SolutionSet \(P_2(x)=0\): \(3x^2-1=0 \Rightarrow x^2=1/3 \Rightarrow x=\pm1/\sqrt3\approx\pm0.5774\), both in \((-1,1)\), two distinct real roots as guaranteed by Step 3 of the proof (\(n=2\) roots for a degree-2 polynomial, all simple and interior). These are exactly the nodes used in Worked Example 1.
  4. Using \(w_i=\int_{-1}^1\ell_i(x)^2dx\) (Step 9), explain why Gaussian quadrature weights can never be negative, and contrast with the (known) fact that some non-Gauss interpolatory rules — e.g. Newton–Cotes rules for \(n\geq 8\)/9 points — do have negative weights.
    SolutionBecause the Gauss weight formula \(w_i=\int_{-1}^1\ell_i(x)^2dx\) is derived by applying the theorem's own exactness (degree \(2n-2\leq2n-1\)) to the manifestly nonnegative polynomial \(\ell_i^2\), positivity is forced: an integral of a nonnegative, non-identically-zero function over an interval of positive length is strictly positive. General (non-Gauss) interpolatory rules have weights \(w_i=\int\ell_i(x)dx\) with no sign constraint, because \(\ell_i\) itself changes sign (it is 1 at \(x_i\) and 0 at the other nodes, but oscillates in between for large \(n\) with fixed, e.g. equally spaced, nodes) — this is exactly what happens for high-order Newton–Cotes, producing negative weights and numerical instability, a defect Gauss quadrature is structurally immune to.
  5. Use the 3-point Gauss–Legendre rule (nodes \(t=0,\pm\sqrt{3/5}\), weights \(8/9,5/9,5/9\)) to approximate \(\int_0^1 e^x\,dx\) (exact value \(e-1\approx1.71828\)), after mapping \([0,1]\) to \([-1,1]\), and comment on the size of the error relative to the degree-of-precision bound.
    SolutionMap \(x=\tfrac12(t+1)\), \(dx=\tfrac12dt\). Nodes in \(x\): \(t=0\Rightarrow x=0.5\); \(t=0.7746\Rightarrow x=0.8873\); \(t=-0.7746\Rightarrow x=0.1127\). Evaluate \(e^x\): \(e^{0.5}\approx1.64872\), \(e^{0.8873}\approx2.42846\), \(e^{0.1127}\approx1.11930\). Weighted sum: \(\tfrac89(1.64872)+\tfrac59(2.42846)+\tfrac59(1.11930) = 1.46553 + 1.34914 + 0.62183 = 3.43650\). Multiply by Jacobian \(\tfrac12\): \(1.71825\). Compare to exact \(e-1=1.71828\); error \(\approx3\times10^{-5}\), far smaller than would be predicted from a crude degree-of-precision-5 polynomial approximation alone, because \(e^x\) is entire (analytic everywhere), so the error-formula corollary's \(f^{(2n)}\) factor is well-behaved and the geometric (spectral) convergence of the Discussion section is already visible at \(n=3\).