Recall that the method of moments approach to numerical integration based upon sampling ,
imposes exact results for a finite number of members of a basis set
The trapezoid, Simpson formulas arise from the monomial basis set , in which case
but any basis set can be chosen. Instead of prescribing the sampling points a priori, which typically leads to an error , the sampling points can be chosen to minimize the error . For the monomial basis this leads to a system of equations
for the unknown quadrature weights and the sampling points . The system is nonlinear, but can be solved in an insightful manner exploiting the properties of orthogonal polynomials known as Gauss quadrature.
The basic idea is to consider a Hilbert function space with the scalar product
and orthonormal basis set ,
Assume that are polynomials of degree . A polynomial of degree can be factored as
where is the quotient polynomial of degree , and is the remainder polynomial of degree . The weighted integral of is therefore
Since is an orthonormal set, , and the integral becomes
The integral of the remainder polynomial can be exactly evaluated through an point quadrature
that however evaluates rather than the original integrand . However, evaluation of the factorization (1) at the roots of , , , gives
stating that the values of the remainder at these nodes are the same as those of the polynomial. This implies that
is an exact quadrature of order , . The weights can be determined through any of the previously outlined methods, e.g., method of moments
which is now a linear system that can be readily solved. Alternatively, the weights are also directly given as integrals of the Lagrange polynomials based upon the nodes that are roots of