= Gaussian quadrature
{c}
{wiki}
<Gaussian quadrature> is a <quadrature rule> that chooses both sample locations and coefficients to achieve unusually high <polynomial> exactness. For a finite <interval> $[a,b]$ with $a<b$, assume the integration weight $w$ is integrable and positive almost everywhere. Define
$$
I_w(f)=\int_a^b f(x)w(x)\,dx,\qquad Q_n(f)=\sum_{i=1}^n A_i f(x_i),\qquad n\geq1.
$$
Let $p_n$ be the <monic orthogonal polynomial> of <polynomial degree> $n$ for the <inner product> $\langle u,v\rangle_w=\int_a^b u(x)v(x)w(x)\,dx$: it satisfies $\langle p_n,q\rangle_w=0$ for every <polynomial> $q$ of <polynomial degree> below $n$. The <polynomial roots> of $p_n$ are distinct and inside $(a,b)$; take them as the nodes $x_i$. Integrate the <Lagrange cardinal polynomials> $\ell_i$ to obtain $A_i=I_w(\ell_i)$. These coefficients are positive, and
$$
Q_n(f)=I_w(f)\qquad\text{for every polynomial }f\text{ with }\deg f\leq2n-1.
$$
The integration weight $w(x)$ and the discrete coefficients $A_i$ play different roles: $w$ specifies the <integral> being approximated, while $A_i$ tell us how much each sample contributes.https://dlmf.nist.gov/3.5#v[Nico M. Temme, NIST Digital Library of Mathematical Functions, §3.5(v), Gauss quadrature: nodes, coefficients and exactness]{ref}
A proof outline explains the gain over simply integrating an arbitrary <polynomial interpolation>. Use <polynomial division> to write $f=p_nq+r$, with $\deg q\leq n-1$ and $\deg r\leq n-1$. <Orthogonality> makes $I_w(p_nq)=0$, and sampling at the <polynomial roots> of $p_n$ makes $Q_n(p_nq)=0$. The <Lagrange cardinal polynomials> recover $r$ exactly, so both expressions agree. Also $A_i=Q_n(\ell_i^2)=I_w(\ell_i^2)>0$, since $\ell_i^2$ has <polynomial degree> $2n-2$. This is the mechanism behind <positive weights of Gaussian quadrature>.
For a concrete two-node example, set $w=1$ on $[-1,1]$. The <Legendre polynomial> $P_2(x)=(3x^2-1)/2$ has <polynomial roots> $x=\pm1/\sqrt3$. Its <monic polynomial> version $p_2=x^2-1/3$ has zero <integral> against both $1$ and $x$, as required. Symmetry and exactness for the constant <polynomial> give $A_1=A_2=1$. Thus the Gauss–Legendre instance of <Gaussian quadrature> is
$$
\int_{-1}^1 f(x)\,dx\ \approx\ f(-1/\sqrt3)+f(1/\sqrt3).
$$
Direct evaluation on $1,x,x^2,x^3$ gives $2,0,2/3,0$, exactly their <integrals>. For the <polynomial> $f(x)=1+x+x^2+x^3$, two samples therefore give $8/3$ exactly. But for $x^4$ the rule gives $2/9$, whereas the <integral> is $2/5$: the error $I_1-Q_2$ is $8/45$.
\Image[/gaussian-quadrature-chebyshev-legendre-exactness.png]
{title=Analytical illustration of two-node Gauss–Legendre sampling: exact monomial integrals through degree three and failure at degree four}
The ceiling $2n-1$ is sharp for $n$ distinct real nodes under the positive-weight assumptions. Their squared nodal <polynomial> $\prod_i(x-x_i)^2$ has <polynomial degree> $2n$, is zero at every sample, and has a strictly positive weighted <integral>. Thus no such <quadrature rule> integrates every <polynomial> of <polynomial degree> $2n$ exactly. Nor does <Gaussian quadrature> integrate every nonpolynomial <function> exactly: the same two-node example gives $Q_2(|x|)=2/\sqrt3$, while $I_1(|x|)=1$.
<Gaussian quadrature> is useful when evaluations are costly and a modest <polynomial> captures the integrand well. More precisely, for a <continuous function> $f$ and any <polynomial> $r$ of <polynomial degree> at most $2n-1$, positivity and constant exactness give
$$
|I_w(f)-Q_n(f)|\leq2I_w(1)\,\|f-r\|_\infty.
$$
The <uniform norm> on $[a,b]$ measures the approximation between samples. This bound connects <quadrature rule> accuracy to <uniform approximation>, rather than promising an error from sample count alone. Corners, sharp unresolved features and <roundoff error> require their own assessment; the <absolute value function> example already shows why <polynomial> exactness is a qualified guarantee.
Back to article page