# Gaussian quadrature

{{#invoke:Hatnote|hatnote}}Template:Main other

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 *n*-point **Gaussian quadrature rule**, named after Carl Friedrich Gauss, is a quadrature rule constructed to yield an exact result for polynomials of degree 2*n* − 1 or less by a suitable choice of the points Template:Mvar and weights Template:Mvar for *i* = 1, ..., *n*. The domain of integration for such a rule is conventionally taken as [−1, 1], so the rule is stated as

Gaussian quadrature as above will only produce accurate results if the function *f*(*x*) is well approximated by a polynomial function within the range [−1, 1]. The method is not, for example, suitable for functions with singularities. However, if the integrated function can be written as , where *g*(*x*) is approximately polynomial and *ω*(*x*) is known, then alternative weights and points that depend on the weighting function *ω*(*x*) may give better results, where

Common weighting functions include (Chebyshev–Gauss) and (Gauss–Hermite).

It can be shown (see Press, et al., or Stoer and Bulirsch) that the evaluation points Template:Mvar are just the roots of a polynomial belonging to a class of orthogonal polynomials.

## Gauss–Legendre quadrature

For the simplest integration problem stated above, i.e. with , the associated polynomials are Legendre polynomials, *P*_{n}(*x*), and the method is usually known as Gauss–Legendre quadrature. With the Template:Mvar-th polynomial normalized to give *P*_{n}(1) = 1, the Template:Mvar-th Gauss node, Template:Mvar, is the Template:Mvar-th root of Template:Mvar; its weight is given by Template:Harv

Some low-order rules for solving the integration problem are listed below.

Number of points, n |
Points, Template:Mvar | Weights, Template:Mvar |
---|---|---|

1 | 0 | 2 |

2 | 1 | |

3 | 0 | |

4 | ||

5 | 0 | |

## 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 the 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 | See Gauss–Legendre quadrature above |

(−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 Template:Mvar be a nontrivial polynomial of degree *n* such that

If we pick the *n* nodes Template:Mvar to be the zeros of Template:Mvar, then there exist *n* weights Template:Mvar which make the Gauss-quadrature computed integral exact for all polynomials *h*(*x*) of degree 2*n* − 1 or less. Furthermore, all these nodes Template:Mvar will lie in the open interval (*a*, *b*) Template:Harv.

The polynomial Template:Mvar 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

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 Template:Mvar and is thus fixed by the values it attains at Template:Mvar different points. Multiplying both sides by *ω*(*x*) and integrating from Template:Mvar to Template:Mvar yields

The weights Template:Mvar 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

In the integrand, writing

yields

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 Eq. (2), the weights are obtained by dividing this by and that yields the expression in Eq. (1).

#### Proof that the weights are positive

Consider the following polynomial of degree 2n-2

where as above the Template:Mvar are the roots of the polynomial . Since the degree of f(x) is less than 2n-1, the Gaussian quadrature formula involving the weights and nodes obtained from applies. Since for j not equal to i, we have

Since both and f(x) are non-negative functions, it follows that .

### Computation of Gaussian quadrature rules

For computing the nodes Template:Mvar and weights Template:Mvar of Gaussian quadrature rules, the fundamental tool is the three-term recurrence relation satisfied by the set of orthogonal polynomials associated to the corresponding weight function. For Template:Mvar points, these nodes and weights can be computed in *O*(*n*^{2}) operations by an algorithm derived by Gautschi (1968).

#### Gautschi's theorem

Gautschi's theorem (Gautschi, 1968) states that orthogonal polynomials with for for a scalar product to be specified later, degree and leading coefficient one (i.e. monic orthogonal polynomials) satisfy the recurrence relation

for where Template:Mvar is the maximal degree which can be taken to be infinity, and where . First of all, it is obvious that 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 three-term recurrence relation: For is a polynomial of degree less or equal to *r* − 1. On the other hand, is orthogonal to every polynomial of degree less or equal to *r* − 1. Therefore, one has and for *s* < *r* − 1. The recurrence relation then simplifies to

or

(the last because of , since differs from by a degree less than Template:Mvar).

#### The Golub-Welsch algorithm

The three-term recurrence relation can be written in the matrix form where , is the th standard basis vector, i.e. , and Template:Mvar is the so-called Jacobi matrix:

The zeros of the polynomials up to degree Template:Mvar 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 Template:Mvar, 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, Template:Harv for further details.

There are alternative methods for obtaining the same weights and nodes in *O*(*n*) operations using the Prüfer Transform.

### Error estimates

The error of a Gaussian quadrature rule can be stated as follows Template:Harv. For an integrand which has 2*n* continuous derivatives,

for some Template:Mvar in (*a*, *b*), where Template:Mvar is the monic (i.e. the leading coefficient is 1) orthogonal polynomial of degree Template:Mvar and where

In the important special case of *ω*(*x*) = 1, we have the error estimate Template:Harv

Stoer and Bulirsch remark that this error estimate is inconvenient in practice, since it may be difficult to estimate the order 2*n* 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.

Important consequence of the above equation is that Gaussian quadrature of order Template:Mvar is accurate for all polynomials up to degree 2*n* − 1.

### Gauss–Kronrod rules

{{#invoke:main|main}}

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 Template:Mvar-point rule in such a way that the resulting rule is of order 3*n* + 1. This allows for computing higher-order estimates while re-using the function values of a lower-order estimate. The difference between a Gauss quadrature rule and its Kronrod extension are often used as an estimate of the approximation error.

### Gauss–Lobatto rules

Also known as **Lobatto quadrature** Template:Harv, 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 2
*n*–3, where*n*is the number of integration points Template:Harv.

Lobatto quadrature of function *f*(*x*) on interval [−1, 1]:

Abscissas: Template:Mvar is the st zero of .

Weights:

Remainder:

Some of the weights are:

Number of points, n |
Points, Template:Mvar | Weights, Template:Mvar |
---|---|---|

## See also

## References

- Template:AS ref
- {{#invoke:Citation/CS1|citation

|CitationClass=journal }}

- {{#invoke:citation/CS1|citation

|CitationClass=citation }}

- Template:Cite news
- Template:Cite news
- Template:Cite news
- Template:Cite news
- {{#invoke:citation/CS1|citation

|CitationClass=citation }}

- {{#invoke:Citation/CS1|citation

|CitationClass=journal }}

- {{#invoke:Citation/CS1|citation

|CitationClass=journal }}

- {{#invoke:citation/CS1|citation

|CitationClass=citation }}

- {{#invoke:Citation/CS1|citation

|CitationClass=journal }}

- {{#invoke:citation/CS1|citation

|CitationClass=citation }}.

- Template:Dlmf
- {{#invoke:citation/CS1|citation

|CitationClass=citation }}

- {{#invoke:citation/CS1|citation

|CitationClass=citation }}

- {{#invoke:citation/CS1|citation

|CitationClass=book }}

## External links

- {{#invoke:citation/CS1|citation

|CitationClass=citation }}

- 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., "Legendre-Gauss 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) Legendre-Gaussian 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.