Gaussian quadrature
In numerical analysis, a quadrature rule is an approximation of the definite integral of a function, usually stated as a weighted sum of function values at specified points within the domain of integration. (See numerical integration for more on quadrature rules.) An npoint Gaussian quadrature rule, named after Carl Friedrich Gauss,[1] is a quadrature rule constructed to yield an exact result for polynomials of degree 2n − 1 or less by a suitable choice of the nodes x_{i} and weights w_{i} for i = 1, …, n. Modern formulation using orthogonal polynomials was developed by Carl Gustav Jacobi 1826.[2] The most common domain of integration for such a rule is taken as [−1, 1], so the rule is stated as
which is exact for polynomials of degree 2n − 1 or less. This exact rule is known as the GaussLegendre quadrature rule. The quadrature rule will only be an accurate approximation to the integral above if f(x) is wellapproximated by a polynomial of degree 2n − 1 or less on [−1, 1].
The GaussLegendre quadrature rule is not typically used for integrable functions with endpoint singularities. Instead, if the integrand can be written as
where g(x) is wellapproximated by a lowdegree polynomial, then alternative nodes and weights will usually give more accurate quadrature rules. These are known as GaussJacobi quadrature rules, i.e.,
Common weights include (Chebyshev–Gauss) and . One may also want to integrate over semiinfinite (GaussLaguerre quadrature) and infinite intervals (Gauss–Hermite quadrature).
It can be shown (see Press, et al., or Stoer and Bulirsch) that the quadrature nodes x_{i} are the roots of a polynomial belonging to a class of orthogonal polynomials (the class orthogonal with respect to a weighted innerproduct). This is a key observation for computing Gauss quadrature nodes and weights.
Gauss–Legendre quadrature
For the simplest integration problem stated above, i.e., f(x) is wellapproximated by polynomials on , the associated orthogonal polynomials are Legendre polynomials, denoted by P_{n}(x). With the nth polynomial normalized to give P_{n}(1) = 1, the ith Gauss node, x_{i}, is the ith root of P_{n} and the weights are given by the formula (Abramowitz & Stegun 1972, p. 887)
Some loworder quadrature rules are tabulated below (over interval [−1, 1], see the section below for other intervals).
Number of points, n  Points, x_{i}  Weights, w_{i}  

1  0  2  
2  ±0.57735…  1  
3  0  0.888889…  
±0.774597…  0.555556…  
4  ±0.339981…  0.652145…  
±0.861136…  0.347855…  
5  0  0.568889…  
±0.538469…  0.478629…  
±0.90618…  0.236927… 
Change of interval
An integral over [a, b] must be changed into an integral over [−1, 1] before applying the Gaussian quadrature rule. This change of interval can be done in the following way:
Applying point Gaussian quadrature rule then results in the following approximation:
Other forms
The integration problem can be expressed in a slightly more general way by introducing a positive weight function ω into the integrand, and allowing an interval other than [−1, 1]. That is, the problem is to calculate
for some choices of a, b, and ω. For a = −1, b = 1, and ω(x) = 1, the problem is the same as that considered above. Other choices lead to other integration rules. Some of these are tabulated below. Equation numbers are given for Abramowitz and Stegun (A & S).
Interval  ω(x)  Orthogonal polynomials  A & S  For more information, see … 

[−1, 1]  1  Legendre polynomials  25.4.29  § Gauss–Legendre quadrature 
(−1, 1)  Jacobi polynomials  25.4.33 (β = 0)  Gauss–Jacobi quadrature  
(−1, 1)  Chebyshev polynomials (first kind)  25.4.38  Chebyshev–Gauss quadrature  
[−1, 1]  Chebyshev polynomials (second kind)  25.4.40  Chebyshev–Gauss quadrature  
[0, ∞)  Laguerre polynomials  25.4.45  Gauss–Laguerre quadrature  
[0, ∞)  Generalized Laguerre polynomials  Gauss–Laguerre quadrature  
(−∞, ∞)  Hermite polynomials  25.4.46  Gauss–Hermite quadrature 
Fundamental theorem
Let p_{n} be a nontrivial polynomial of degree n such that
If we pick the n nodes x_{i} to be the zeros of p_{n}, then there exist n weights w_{i} which make the Gaussquadrature computed integral exact for all polynomials h(x) of degree 2n − 1 or less. Furthermore, all these nodes x_{i} will lie in the open interval (a, b) (Stoer & Bulirsch 2002, pp. 172–175).
The polynomial p_{n} is said to be an orthogonal polynomial of degree n associated to the weight function ω(x). It is unique up to a constant normalization factor. The idea underlying the proof is that, because of its sufficiently low degree, h(x) can be divided by to produce a quotient q(x) of degree strictly lower than n, and a remainder r(x) of still lower degree, so that both will be orthogonal to , by the defining property of . Thus
Because of the choice of nodes x_{i}, the corresponding relation
holds also. The exactness of the computed integral for then follows from corresponding exactness for polynomials of degree only n or less (as is ).
General formula for the weights
The weights can be expressed as

(1)
where is the coefficient of in . To prove this, note that using Lagrange interpolation one can express r(x) in terms of as
because r(x) has degree less than n and is thus fixed by the values it attains at n different points. Multiplying both sides by ω(x) and integrating from a to b yields
The weights w_{i} are thus given by
This integral expression for can be expressed in terms of the orthogonal polynomials and as follows.
We can write
where is the coefficient of in . Taking the limit of x to yields using L'Hôpital's rule
We can thus write the integral expression for the weights as

(2)
In the integrand, writing
yields
provided , because
is a polynomial of degree k − 1 which is then orthogonal to . So, if q(x) is a polynomial of at most nth degree we have
We can evaluate the integral on the right hand side for as follows. Because is a polynomial of degree n − 1, we have
where s(x) is a polynomial of degree . Since s(x) is orthogonal to we have
We can then write
The term in the brackets is a polynomial of degree , which is therefore orthogonal to . The integral can thus be written as
According to equation (2), the weights are obtained by dividing this by and that yields the expression in equation (1).
can also be expressed in terms of the orthogonal polynomials and now . In the 3term recurrence relation the term with vanishes, so in Eq. (1) can be replaced by .
Proof that the weights are positive
Consider the following polynomial of degree
where, as above, the x_{j} are the roots of the polynomial . Clearly . Since the degree of is less than , the Gaussian quadrature formula involving the weights and nodes obtained from applies. Since for j not equal to i, we have
Since both and are nonnegative functions, it follows that .
Computation of Gaussian quadrature rules
There are many algorithms for computing the nodes x_{i} and weights w_{i} of Gaussian quadrature rules. The most popular are the GolubWelsch algorithm requiring O(n^{2}) operations, Newton's method for solving using the threeterm recurrence for evaluation requiring O(n^{2}) operations, and asymptotic formulas for large n requiring O(n) operations.
Recurrence relation
Orthogonal polynomials with for for a scalar product , degree and leading coefficient one (i.e. monic orthogonal polynomials) satisfy the recurrence relation
and scalar product defined
for where n is the maximal degree which can be taken to be infinity, and where . First of all, the polynomials defined by the recurrence relation starting with have leading coefficient one and correct degree. Given the starting point by , the orthogonality of can be shown by induction. For one has
Now if are orthogonal, then also , because in
all scalar products vanish except for the first one and the one where meets the same orthogonal polynomial. Therefore,
However, if the scalar product satisfies (which is the case for Gaussian quadrature), the recurrence relation reduces to a threeterm recurrence relation: For is a polynomial of degree less than or equal to r − 1. On the other hand, is orthogonal to every polynomial of degree less than or equal to r − 1. Therefore, one has and for s < r − 1. The recurrence relation then simplifies to
or
(with the convention ) where
(the last because of , since differs from by a degree less than r).
The GolubWelsch algorithm
The threeterm recurrence relation can be written in matrix form where , is the th standard basis vector, i.e., , and J is the socalled Jacobi matrix:
The zeros of the polynomials up to degree n, which are used as nodes for the Gaussian quadrature can be found by computing the eigenvalues of this tridiagonal matrix. This procedure is known as Golub–Welsch algorithm.
For computing the weights and nodes, it is preferable to consider the symmetric tridiagonal matrix with elements
J and are similar matrices and therefore have the same eigenvalues (the nodes). The weights can be computed from the corresponding eigenvectors: If is a normalized eigenvector (i.e., an eigenvector with euclidean norm equal to one) associated to the eigenvalue x_{j}, the corresponding weight can be computed from the first component of this eigenvector, namely:
where is the integral of the weight function
See, for instance, (Gil, Segura & Temme 2007) for further details.
Error estimates
The error of a Gaussian quadrature rule can be stated as follows (Stoer & Bulirsch 2002, Thm 3.6.24). For an integrand which has 2n continuous derivatives,
for some ξ in (a, b), where p_{n} is the monic (i.e. the leading coefficient is 1) orthogonal polynomial of degree n and where
In the important special case of ω(x) = 1, we have the error estimate (Kahaner, Moler & Nash 1989, §5.2)
Stoer and Bulirsch remark that this error estimate is inconvenient in practice, since it may be difficult to estimate the order 2n derivative, and furthermore the actual error may be much less than a bound established by the derivative. Another approach is to use two Gaussian quadrature rules of different orders, and to estimate the error as the difference between the two results. For this purpose, Gauss–Kronrod quadrature rules can be useful.
Gauss–Kronrod rules
If the interval [a, b] is subdivided, the Gauss evaluation points of the new subintervals never coincide with the previous evaluation points (except at zero for odd numbers), and thus the integrand must be evaluated at every point. Gauss–Kronrod rules are extensions of Gauss quadrature rules generated by adding n + 1 points to an npoint rule in such a way that the resulting rule is of order 2n + 1. This allows for computing higherorder estimates while reusing the function values of a lowerorder estimate. The difference between a Gauss quadrature rule and its Kronrod extension is often used as an estimate of the approximation error.
Gauss–Lobatto rules
Also known as Lobatto quadrature (Abramowitz & Stegun 1972, p. 888), named after Dutch mathematician Rehuel Lobatto. It is similar to Gaussian quadrature with the following differences:
 The integration points include the end points of the integration interval.
 It is accurate for polynomials up to degree 2n – 3, where n is the number of integration points (Quarteroni, Sacco & Saleri 2000).
Lobatto quadrature of function f(x) on interval [−1, 1]:
Abscissas: x_{i} is the st zero of .
Weights:
Remainder:
Some of the weights are:
Number of points, n  Points, x_{i}  Weights, w_{i} 

An adaptive variant of this algorithm with 2 interior nodes[3] is found in GNU Octave and MATLAB as quadl
and integrate
.[4][5]
References
 Implementing an Accurate Generalized Gaussian Quadrature Solution to Find the Elastic Field in a Homogeneous Anisotropic Media
 Abramowitz, Milton; Stegun, Irene Ann, eds. (1983) [June 1964]. "Chapter 25.4, Integration". Handbook of Mathematical Functions with Formulas, Graphs, and Mathematical Tables. Applied Mathematics Series. 55 (Ninth reprint with additional corrections of tenth original printing with corrections (December 1972); first ed.). Washington D.C.; New York: United States Department of Commerce, National Bureau of Standards; Dover Publications. ISBN 9780486612720. LCCN 6460036. MR 0167642. LCCN 6512253.
 Anderson, Donald G. (1965). "Gaussian quadrature formulae for ". Math. Comp. 19 (91): 477–481. doi:10.1090/s00255718196501785691.
 Golub, Gene H.; Welsch, John H. (1969), "Calculation of Gauss Quadrature Rules", Mathematics of Computation, 23 (106): 221–230, doi:10.1090/S0025571869996471, JSTOR 2004418
 Gautschi, Walter (1968). "Construction of Gauss–Christoffel Quadrature Formulas". Math. Comp. 22 (102). pp. 251–270. doi:10.1090/S00255718196802281710. MR 0228171.
 Gautschi, Walter (1970). "On the construction of Gaussian quadrature rules from modified moments". Math. Comp. 24. pp. 245–260. doi:10.1090/S00255718197002851176. MR 0285177.
 Piessens, R. (1971). "Gaussian quadrature formulas for the numerical integration of Bromwich's integral and the inversion of the laplace transform". J. Eng. Math. 5 (1). pp. 1–9. Bibcode:1971JEnMa...5....1P. doi:10.1007/BF01535429.
 Danloy, Bernard (1973). "Numerical construction of Gaussian quadrature formulas for and ". Math. Comp. 27 (124). pp. 861–869. doi:10.1090/S0025571819730331730X. MR 0331730.
 Kahaner, David; Moler, Cleve; Nash, Stephen (1989), Numerical Methods and Software, PrenticeHall, ISBN 9780136272588
 Sagar, Robin P. (1991). "A Gaussian quadrature for the calculation of generalized FermiDirac integrals". Comput. Phys. Commun. 66 (2–3): 271–275. Bibcode:1991CoPhC..66..271S. doi:10.1016/00104655(91)90076W.
 Yakimiw, E. (1996). "Accurate computation of weights in classical GaussChristoffel quadrature rules". J. Comput. Phys. 129 (2): 406–430. Bibcode:1996JCoPh.129..406Y. doi:10.1006/jcph.1996.0258.
 Laurie, Dirk P. (1999), "Accurate recovery of recursion coefficients from Gaussian quadrature formulas", J. Comput. Appl. Math., 112 (1–2): 165–180, doi:10.1016/S03770427(99)002289
 Laurie, Dirk P. (2001). "Computation of Gausstype quadrature formulas". J. Comput. Appl. Math. 127 (1–2): 201–217. Bibcode:2001JCoAM.127..201L. doi:10.1016/S03770427(00)005069.
 Riener, Cordian; Schweighofer, Markus (2018). "Optimization approaches to quadrature: New characterizations of Gaussian quadrature on the line and quadrature with few nodes on plane algebraic curves, on the plane and in higher dimensions". Journal of Complexity. 45: 22–54. arXiv:1607.08404. doi:10.1016/j.jco.2017.10.002.
 Stoer, Josef; Bulirsch, Roland (2002), Introduction to Numerical Analysis (3rd ed.), Springer, ISBN 9780387954523.
 Temme, Nico M. (2010), "§3.5(v): Gauss Quadrature", in Olver, Frank W. J.; Lozier, Daniel M.; Boisvert, Ronald F.; Clark, Charles W. (eds.), NIST Handbook of Mathematical Functions, Cambridge University Press, ISBN 9780521192255, MR 2723248
 Press, WH; Teukolsky, SA; Vetterling, WT; Flannery, BP (2007), "Section 4.6. Gaussian Quadratures and Orthogonal Polynomials", Numerical Recipes: The Art of Scientific Computing (3rd ed.), New York: Cambridge University Press, ISBN 9780521880688
 Gil, Amparo; Segura, Javier; Temme, Nico M. (2007), "§5.3: Gauss quadrature", Numerical Methods for Special Functions, SIAM, ISBN 9780898716344
 Quarteroni, Alfio; Sacco, Riccardo; Saleri, Fausto (2000). Numerical Mathematics. New York: SpringerVerlag. pp. 422, 425. ISBN 0387989595.
 Specific
 Methodus nova integralium valores per approximationem inveniendi. In: Comm. Soc. Sci. Göttingen Math. Band 3, 1815, S. 29–76, Gallica, datiert 1814, auch in Werke, Band 3, 1876, S. 163–196.
 C. G. J. Jacobi: Ueber Gauß’ neue Methode, die Werthe der Integrale näherungsweise zu finden. In: Journal für Reine und Angewandte Mathematik. Band 1, 1826, S. 301–308, (online), und Werke, Band 6.
 Gander, Walter; Gautschi, Walter (2000). "Adaptive Quadrature  Revisited". BIT Numerical Mathematics. 40 (1): 84–101. doi:10.1023/A:1022318402393.
 "Numerical integration  MATLAB integral".
 "Functions of One Variable (GNU Octave)". Retrieved 28 September 2018.
External links
 Hazewinkel, Michiel, ed. (2001) [1994], "Gauss quadrature formula", Encyclopedia of Mathematics, Springer Science+Business Media B.V. / Kluwer Academic Publishers, ISBN 9781556080104
 ALGLIB contains a collection of algorithms for numerical integration (in C# / C++ / Delphi / Visual Basic / etc.)
 GNU Scientific Library — includes C version of QUADPACK algorithms (see also GNU Scientific Library)
 From Lobatto Quadrature to the Euler constant e
 Gaussian Quadrature Rule of Integration – Notes, PPT, Matlab, Mathematica, Maple, Mathcad at Holistic Numerical Methods Institute
 Weisstein, Eric W. "LegendreGauss Quadrature". MathWorld.
 Gaussian Quadrature by Chris Maes and Anton Antonov, Wolfram Demonstrations Project.
 Tabulated weights and abscissae with Mathematica source code, high precision (16 and 256 decimal places) LegendreGaussian quadrature weights and abscissas, for n=2 through n=64, with Mathematica source code.
 Mathematica source code distributed under the GNU LGPL for abscissas and weights generation for arbitrary weighting functions W(x), integration domains and precisions.
 Gaussian Quadrature in Boost.Math, for arbitrary precision and approximation order
 GaussKronrod Quadrature in Boost.Math