{{#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 2n − 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

$\int _{-1}^{1}f(x)\,dx\approx \sum _{i=1}^{n}w_{i}f(x_{i}).$ 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 $f(x)=\omega (x)g(x)\,$ , where g(x) is approximately polynomial and ω(x) is known, then alternative weights $w_{i}'$ and points $x_{i}'$ that depend on the weighting function ω(x) may give better results, where

$\int _{-1}^{1}f(x)\,dx=\int _{-1}^{1}\omega (x)g(x)\,dx\approx \sum _{i=1}^{n}w_{i}'g(x_{i}').$ 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.

For the simplest integration problem stated above, i.e. with $\omega (x)=1$ , the associated polynomials are Legendre polynomials, Pn(x), and the method is usually known as Gauss–Legendre quadrature. With the Template:Mvar-th polynomial normalized to give Pn(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

$w_{i}={\frac {2}{\left(1-x_{i}^{2}\right)[P'_{n}(x_{i})]^{2}}}.$ Some low-order rules for solving the integration problem are listed below.

## 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:

$\int _{a}^{b}f(x)\,dx={\frac {b-a}{2}}\int _{-1}^{1}f\left({\frac {b-a}{2}}z+{\frac {a+b}{2}}\right)\,dz.$ Applying the Gaussian quadrature rule then results in the following approximation:

$\int _{a}^{b}f(x)\,dx\approx {\frac {b-a}{2}}\sum _{i=1}^{n}w_{i}f\left({\frac {b-a}{2}}z_{i}+{\frac {a+b}{2}}\right).$ ## 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

$\int _{a}^{b}\omega (x)\,f(x)\,dx$ 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).

### Fundamental theorem

Let Template:Mvar be a nontrivial polynomial of degree n such that

$\int _{a}^{b}\omega (x)\,x^{k}p_{n}(x)\,dx=0,\quad {\text{for all }}k=0,1,\ldots ,n-1.$ 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 2n − 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 $p_{n}(x)$ 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 $p_{n}(x)$ , by the defining property of $p_{n}(x)$ . Thus

$\int _{a}^{b}\omega (x)\,h(x)\,dx=\int _{a}^{b}\omega (x)\,r(x)\,dx.$ Because of the choice of nodes xi, the corresponding relation

$\sum _{i=1}^{n}w_{i}h(x_{i})=\sum _{i=1}^{n}w_{i}r(x_{i})$ holds also. The exactness of the computed integral for $h(x)$ then follows from corresponding exactness for polynomials of degree only n or less (as is $r(x)$ ).

#### General formula for the weights

The weights can be expressed as

$w_{i}={\frac {a_{n}}{a_{n-1}}}{\frac {\int _{a}^{b}\omega (x)p_{n-1}(x)^{2}dx}{p'_{n}(x_{i})p_{n-1}(x_{i})}}$ (1)
$r(x)=\sum _{i=1}^{n}r(x_{i})\prod _{\begin{smallmatrix}1\leq j\leq n\\j\neq i\end{smallmatrix}}{\frac {x-x_{j}}{x_{i}-x_{j}}}$ 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

$\int _{a}^{b}\omega (x)r(x)dx=\sum _{i=1}^{n}r(x_{i})\int _{a}^{b}\omega (x)\prod _{\begin{smallmatrix}1\leq j\leq n\\j\neq i\end{smallmatrix}}{\frac {x-x_{j}}{x_{i}-x_{j}}}dx$ The weights Template:Mvar are thus given by

$w_{i}=\int _{a}^{b}\omega (x)\prod _{\begin{smallmatrix}1\leq j\leq n\\j\neq i\end{smallmatrix}}{\frac {x-x_{j}}{x_{i}-x_{j}}}dx$ We can write

$\prod _{\begin{smallmatrix}1\leq j\leq n\\j\neq i\end{smallmatrix}}\left(x-x_{j}\right)={\frac {\prod _{1\leq j\leq n}\left(x-x_{j}\right)}{x-x_{i}}}={\frac {p_{n}(x)}{a_{n}\left(x-x_{i}\right)}}$ $\prod _{\begin{smallmatrix}1\leq j\leq n\\j\neq i\end{smallmatrix}}\left(x_{i}-x_{j}\right)={\frac {p'_{n}(x_{i})}{a_{n}}}$ We can thus write the integral expression for the weights as

$w_{i}={\frac {1}{p'_{n}(x_{i})}}\int _{a}^{b}\omega (x){\frac {p_{n}(x)}{x-x_{i}}}dx$ (2)

In the integrand, writing

${\frac {1}{x-x_{i}}}={\frac {1-\left({\frac {x}{x_{i}}}\right)^{k}}{x-x_{i}}}+\left({\frac {x}{x_{i}}}\right)^{k}{\frac {1}{x-x_{i}}}$ yields

$\int _{a}^{b}\omega (x){\frac {x^{k}p_{n}(x)}{x-x_{i}}}dx=x_{i}^{k}\int _{a}^{b}\omega (x){\frac {p_{n}(x)}{x-x_{i}}}dx$ ${\frac {1-\left({\frac {x}{x_{i}}}\right)^{k}}{x-x_{i}}}$ is a polynomial of degree k-1 which is then orthogonal to $p_{n}(x)$ . So, if q(x) is a polynomial of at most nth degree we have

$\int _{a}^{b}\omega (x){\frac {p_{n}(x)}{x-x_{i}}}dx={\frac {1}{q(x_{i})}}\int _{a}^{b}\omega (x){\frac {q(x)p_{n}(x)}{x-x_{i}}}dx$ We can evaluate the integral on the right hand side for $q(x)=p_{n-1}(x)$ as follows. Because ${\frac {p_{n}(x)}{x-x_{i}}}$ is a polynomial of degree n-1, we have

${\frac {p_{n}(x)}{x-x_{i}}}=a_{n}x^{n-1}+s(x)$ $\int _{a}^{b}\omega (x){\frac {p_{n}(x)}{x-x_{i}}}dx={\frac {a_{n}}{p_{n-1}(x_{i})}}\int _{a}^{b}\omega (x)p_{n-1}(x)x^{n-1}dx$ We can then write

$x^{n-1}=\left(x^{n-1}-{\frac {p_{n-1}(x)}{a_{n-1}}}\right)+{\frac {p_{n-1}(x)}{a_{n-1}}}$ The term in the brackets is a polynomial of degree $n-2$ , which is therefore orthogonal to $p_{n-1}(x)$ . The integral can thus be written as

$\int _{a}^{b}\omega (x){\frac {p_{n}(x)}{x-x_{i}}}dx={\frac {a_{n}}{a_{n-1}p_{n-1}(x_{i})}}\int _{a}^{b}\omega (x)p_{n-1}(x)^{2}dx$ According to Eq. (2), the weights are obtained by dividing this by $p'_{n}(x_{i})$ and that yields the expression in Eq. (1).

#### Proof that the weights are positive

Consider the following polynomial of degree 2n-2

$f(x)=\prod _{\begin{smallmatrix}1\leq j\leq n\\j\neq i\end{smallmatrix}}(x-x_{j})^{2}$ where as above the Template:Mvar are the roots of the polynomial $p_{n}(x)$ . Since the degree of f(x) is less than 2n-1, the Gaussian quadrature formula involving the weights and nodes obtained from $p_{n}(x)$ applies. Since $f(x_{j})=0$ for j not equal to i, we have

$\int _{a}^{b}\omega (x)f(x)dx=\sum _{j=1}^{N}w_{j}f(x_{j})=w_{i}f(x_{i}).$ ### 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(n2) operations by an algorithm derived by Gautschi (1968).

#### Gautschi's theorem

$p_{r+1}(x)=(x-a_{r,r})p_{r}(x)-a_{r,r-1}p_{r-1}(x)\ldots -a_{r,0}p_{0}(x)$ for $r=0,1,\ldots ,n-1$ where Template:Mvar is the maximal degree which can be taken to be infinity, and where $a_{r,s}=(xp_{r},p_{s})/(p_{s},p_{s})$ . First of all, it is obvious that the polynomials defined by the recurrence relation starting with $p_{0}(x)=1$ have leading coefficient one and correct degree. Given the starting point by $p_{0}$ , the orthogonality of $p_{r}$ can be shown by induction. For $r=s=0$ one has

$(p_{1},p_{0})=((x-a_{0,0}p_{0},p_{0})=(xp_{0},p_{0})-a_{0,0}(p_{0},p_{0})=(xp_{0},p_{0})-(xp_{0},p_{0})=0.$ $(p_{r+1},p_{s})=(xp_{r},p_{s})-a_{r,r}(p_{r},p_{s})-a_{r,r-1}(p_{r-1},p_{s})\ldots -a_{r,0}(p_{0},p_{s})$ all scalar products vanish except for the first one and the one where $p_{s}$ meets the same orthogonal polynomial. Therefore,

$(p_{r+1},p_{s})=(xp_{r},p_{s})-a_{r,s}(p_{s},p_{s})=(xp_{r},p_{s})-(xp_{r},p_{s})=0.$ However, if the scalar product satisfies $(xf,g)=(f,xg)$ (which is the case for Gaussian quadrature), the recurrence relation reduces to a three-term recurrence relation: For $s\leq r-1,xp_{s}$ is a polynomial of degree less or equal to r − 1. On the other hand, $p_{r}$ is orthogonal to every polynomial of degree less or equal to r − 1. Therefore, one has $(xp_{r},p_{s})=(p_{r},xp_{s})=0$ and $a_{r,s}=0$ for s < r − 1. The recurrence relation then simplifies to

$p_{r+1}(x)=(x-a_{r,r})p_{r}(x)-a_{r,r-1}p_{r-1}(x)$ or

$p_{r+1}(x)=(x-a_{r})p_{r}(x)-b_{r}p_{r-1}(x)$ $a_{r}:={\frac {(xp_{r},p_{r})}{(p_{r},p_{r})}},\qquad b_{r}:={\frac {(xp_{r},p_{r-1})}{(p_{r-1},p_{r-1})}}={\frac {(p_{r},p_{r})}{(p_{r-1},p_{r-1})}}$ #### The Golub-Welsch algorithm

$\mathbf {J} ={\begin{pmatrix}a_{0}&1&0&\ldots &\ldots &\ldots \\b_{1}&a_{1}&1&0&\ldots &\ldots \\0&b_{2}&a_{2}&1&0&\ldots \\0&\ldots &\ldots &\ldots &\ldots &0\\\ldots &\ldots &0&b_{n-2}&a_{n-2}&1\\\ldots &\ldots &\ldots &0&b_{n-1}&a_{n-1}\end{pmatrix}}$ The zeros $x_{j}$ 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 ${\mathcal {J}}$ with elements

{\begin{aligned}{\mathcal {J}}_{i,i}&=J_{i,i}=a_{i-1}&&i=1,\ldots ,n\\{\mathcal {J}}_{i-1,i}={\mathcal {J}}_{i,i-1}&={\sqrt {J_{i,i-1}J_{i-1,i}}}={\sqrt {b_{i-1}}}&&i=2,\ldots ,n.\end{aligned}} J and ${\mathcal {J}}$ are similar matrices and therefore have the same eigenvalues (the nodes). The weights can be computed from the corresponding eigenvectors: If $\phi ^{(j)}$ 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:

$w_{j}=\mu _{0}\left(\phi _{1}^{(j)}\right)^{2}$ $\mu _{0}=\int _{a}^{b}\omega (x)dx.$ 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 2n continuous derivatives,

$\int _{a}^{b}\omega (x)\,f(x)\,dx-\sum _{i=1}^{n}w_{i}\,f(x_{i})={\frac {f^{(2n)}(\xi )}{(2n)!}}\,(p_{n},p_{n})$ 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

$(f,g)=\int _{a}^{b}\omega (x)f(x)g(x)\,dx.$ In the important special case of ω(x) = 1, we have the error estimate Template:Harv

${\frac {(b-a)^{2n+1}(n!)^{4}}{(2n+1)[(2n)!]^{3}}}f^{(2n)}(\xi ),\qquad a<\xi 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.

Important consequence of the above equation is that Gaussian quadrature of order Template:Mvar is accurate for all polynomials up to degree 2n − 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 3n + 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:

1. The integration points include the end points of the integration interval.
2. It is accurate for polynomials up to degree 2n–3, where n is the number of integration points Template:Harv.

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

$\int _{-1}^{1}{f(x)\,dx}={\frac {2}{n(n-1)}}[f(1)+f(-1)]+\sum _{i=2}^{n-1}{w_{i}f(x_{i})}+R_{n}.$ Weights:

$w_{i}={\frac {2}{n(n-1)[P_{n-1}(x_{i})]^{2}}},\qquad x_{i}\neq \pm 1.$ Remainder:

$R_{n}={\frac {-n(n-1)^{3}2^{2n-1}[(n-2)!]^{4}}{(2n-1)[(2n-2)!]^{3}}}f^{(2n-2)}(\xi ),\qquad -1<\xi <1.$ Some of the weights are: