In Newton-Cotes formula, we choose n+1 evenly spaced points on the interval to do Lagrange interpolation and deduce a formula from the integral of that polynomial. To improve the precision, we will choose n special points in the interval; with the same interpolation–integration approach, we can achieve a degree of exactness of 2n−1.
(Recall: When an algorithm works exactly right for all polynomials of degree ≤m but not for degree m+1, we say that it has a degree of exactness of m. )
One of the typical solutions is to choose the n roots of the Legendre polynomial Pn(x). The Legendre polynomials form a complete orthogonal system on [−1,1] with weight function w(x)=1 (where Pn(x) is a polynomial of degree n), i.e.
∫−11Pm(x)Pn(x)dx=0ifm=n.
With the standardization condition Pn(1)=1 for all n, all the polynomials can be uniquely determined. In fact, by Rodrigues' Formula,
Pn(x)=2nn!1dxndn(x2−1)n.
Let x1,x2,⋯,xn be the roots of Pn(x). We squeeze our target interval [a,b] to [−1,1] and do Lagrange interpolation with points (xi,g(xi)), where g(x) is the transformed f(x). Gaussian Quadrature is then
∫abf(x)dx≈2b−ai=1∑nwif(2b−axi+2a+b)
where the weights wi can be found similarly to the Newton–Cotes αi values, or via the closed form
wi=(1−xi2)[Pn′(xi)]22.
We have known the procedure of Gaussian quadrature. But why are Legendre polynomials so useful that our exactness is doubled? It all comes from the orthogonality. Say we have a polynomial T(x) whose degree is no more than 2n−1. Divide T(x) by Pn(x)and we have T(x)=Q(x)Pn(x)+R(x), where degQ≤n−1,degR≤n−1. We write Q(x) as a linear combination of lower-order Legendre polynomials: Q(x)=∑i=0n−1kiPi(x). Then by the definition of Legendre polynomials, ∫−11Pi(x)Pn(x)=0, thus ∫−11Q(x)Pn(x)=0.
Now we are ready to prove that
∫−11T(x)dx=i=1∑nwiT(xi).
For the left side,
∫−11T(x)dx=∫−11Q(x)Pn(x)dx+∫−11R(x)dx=∫−11R(x)dx.
For the right side,
∀i=1,2,⋯,nPn(xi)=0
i=1∑nwiT(xi)=i=1∑nwi[Q(xi)Pn(xi)+R(xi)]=i=1∑nwiR(xi).
By its construction, an n-point Gaussian quadrature rule is exact for any polynomial of degree up to n−1. Since degR≤n−1, the quadrature gives the exact integral:
∫−11R(x)dx=i=1∑nwiR(xi).
Thus our quadrature works exactly right for T(x). On the other hand, the error
En(f)=(2n+1)[(2n)!]322n+1(n!)4f(2n)(ξ)
for some ξ∈(−1,1).
Therefore, the degree of exactness is 2n−1. Above is all of the magic of Gaussian quadrature.