BREAKING NEWS

## Summary

Comparison between 2-point Gaussian and trapezoidal quadrature. The blue line is the polynomial ${\textstyle y(x)=7x^{3}-8x^{2}-3x+3}$, whose integral in [−1, 1] is 23. The trapezoidal rule returns the integral of the orange dashed line, equal to ${\textstyle y(-1)+y(1)=-10}$. The 2-point Gaussian quadrature rule returns the integral of the black dashed curve, equal to ${\textstyle y\left(-{\sqrt {\frac {1}{3}}}\right)+y\left({\sqrt {\frac {1}{3}}}\right)={\frac {2}{3}}}$. Such a result is exact, since the green region has the same area as the sum of the red regions.

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,[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 xi and weights wi for i = 1, ..., n. The 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

${\displaystyle \int _{-1}^{1}f(x)\,dx\approx \sum _{i=1}^{n}w_{i}f(x_{i}),}$

which is exact for polynomials of degree 2n − 1 or less. This exact rule is known as the Gauss-Legendre quadrature rule. The quadrature rule will only be an accurate approximation to the integral above if f(x) is well-approximated by a polynomial of degree 2n − 1 or less on [−1, 1].

The Gauss-Legendre quadrature rule is not typically used for integrable functions with endpoint singularities. Instead, if the integrand can be written as

${\displaystyle f(x)=\left(1-x\right)^{\alpha }\left(1+x\right)^{\beta }g(x),\quad \alpha ,\beta >-1,}$

where g(x) is well-approximated by a low-degree polynomial, then alternative nodes ${\displaystyle x_{i}'}$ and weights ${\displaystyle w_{i}'}$ will usually give more accurate quadrature rules. These are known as Gauss-Jacobi quadrature rules, i.e.,

${\displaystyle \int _{-1}^{1}f(x)\,dx=\int _{-1}^{1}\left(1-x\right)^{\alpha }\left(1+x\right)^{\beta }g(x)\,dx\approx \sum _{i=1}^{n}w_{i}'g\left(x_{i}'\right).}$

Common weights include ${\textstyle {\frac {1}{\sqrt {1-x^{2}}}}}$ (Chebyshev–Gauss) and ${\displaystyle {\sqrt {1-x^{2}}}}$. One may also want to integrate over semi-infinite (Gauss-Laguerre quadrature) and infinite intervals (Gauss–Hermite quadrature).

It can be shown (see Press, et al., or Stoer and Bulirsch) that the quadrature nodes xi are the roots of a polynomial belonging to a class of orthogonal polynomials (the class orthogonal with respect to a weighted inner-product). This is a key observation for computing Gauss quadrature nodes and weights.

Graphs of Legendre polynomials (up to n = 5)

For the simplest integration problem stated above, i.e., f(x) is well-approximated by polynomials on ${\displaystyle [-1,1]}$, the associated orthogonal polynomials are Legendre polynomials, denoted by Pn(x). With the n-th polynomial normalized to give Pn(1) = 1, the i-th Gauss node, xi, is the i-th root of Pn and the weights are given by the formula (Abramowitz & Stegun 1972, p. 887)

${\displaystyle w_{i}={\frac {2}{\left(1-x_{i}^{2}\right)\left[P'_{n}(x_{i})\right]^{2}}}.}$

Some low-order quadrature rules are tabulated below (over interval [−1, 1], see the section below for other intervals).

Number of points, n Points, xi Weights, wi
1 0 2
2 ${\displaystyle \pm {\frac {1}{\sqrt {3}}}}$ ±0.57735... 1
3 0 ${\displaystyle {\frac {8}{9}}}$ 0.888889...
${\displaystyle \pm {\sqrt {\frac {3}{5}}}}$ ±0.774597... ${\displaystyle {\frac {5}{9}}}$ 0.555556...
4 ${\displaystyle \pm {\sqrt {{\frac {3}{7}}-{\frac {2}{7}}{\sqrt {\frac {6}{5}}}}}}$ ±0.339981... ${\displaystyle {\frac {18+{\sqrt {30}}}{36}}}$ 0.652145...
${\displaystyle \pm {\sqrt {{\frac {3}{7}}+{\frac {2}{7}}{\sqrt {\frac {6}{5}}}}}}$ ±0.861136... ${\displaystyle {\frac {18-{\sqrt {30}}}{36}}}$ 0.347855...
5 0 ${\displaystyle {\frac {128}{225}}}$ 0.568889...
${\displaystyle \pm {\frac {1}{3}}{\sqrt {5-2{\sqrt {\frac {10}{7}}}}}}$ ±0.538469... ${\displaystyle {\frac {322+13{\sqrt {70}}}{900}}}$ 0.478629...
${\displaystyle \pm {\frac {1}{3}}{\sqrt {5+2{\sqrt {\frac {10}{7}}}}}}$ ±0.90618... ${\displaystyle {\frac {322-13{\sqrt {70}}}{900}}}$ 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:

${\displaystyle \int _{a}^{b}f(x)\,dx=\int _{-1}^{1}f\left({\frac {b-a}{2}}\xi +{\frac {a+b}{2}}\right)\,{\frac {dx}{d\xi }}d\xi }$

with ${\displaystyle {\frac {dx}{d\xi }}={\frac {b-a}{2}}}$

Applying ${\displaystyle n}$ point Gaussian quadrature ${\displaystyle (\xi ,w)}$ rule then results in the following approximation:

${\displaystyle \int _{a}^{b}f(x)\,dx\approx {\frac {b-a}{2}}\sum _{i=1}^{n}w_{i}f\left({\frac {b-a}{2}}\xi _{i}+{\frac {a+b}{2}}\right).}$

## Example of Two-Point Gauss Quadrature Rule

Use two-point Gauss quadrature rule to approximate the distance in meters covered by a rocket from ${\displaystyle t=8s}$ to ${\displaystyle t=30s,}$ as given by

${\displaystyle x=\int _{8}^{30}{\left(2000\ln \left\lbrack {\frac {140000}{140000-2100t}}\right\rbrack -9.8t\right){dt}}}$

Change the limits so that one can use the weights and abscissas given in Table 1. Also, find the absolute relative true error. The true value is given as 11061.34m

Solution

First, change the limits of integration from ${\displaystyle \left\lbrack 8,30\right\rbrack }$ to ${\displaystyle \left\lbrack -1,1\right\rbrack }$ gives

{\displaystyle {\begin{aligned}\int _{8}^{30}{f(t)dt}&={\frac {30-8}{2}}\int _{-1}^{1}{f\left({\frac {30-8}{2}}x+{\frac {30+8}{2}}\right){dx}}\\&=11\int _{-1}^{1}{f\left(11x+19\right){dx}}\end{aligned}}}

Next, get weighting factors and function argument values from Table 1 for the two-point rule,

${\displaystyle c_{1}=1.000000000}$

${\displaystyle x_{1}=-0.577350269}$

${\displaystyle c_{2}=1.000000000}$

${\displaystyle x_{2}=0.577350269}$

Now we can use the Gauss quadrature formula

{\displaystyle {\begin{aligned}11\int _{-1}^{1}{f\left(11x+19\right){dx}}&\approx 11\left\lbrack c_{1}f\left(11x_{1}+19\right)+c_{2}f\left(11x_{2}+19\right)\right\rbrack \\&=11\left\lbrack f\left(11(-0.5773503)+19\right)+f\left(11(0.5773503)+19\right)\right\rbrack \\&=11\left\lbrack f(12.64915)+f(25.35085)\right\rbrack \\&=11\left\lbrack (296.8317)+(708.4811)\right\rbrack \\&=11058.44m\end{aligned}}}

since

{\displaystyle {\begin{aligned}f(12.64915)&=2000\ln \left\lbrack {\frac {140000}{140000-2100(12.64915)}}\right\rbrack -9.8(12.64915)\\&=296.8317\end{aligned}}}

{\displaystyle {\begin{aligned}f(25.35085)&=2000\ln \left\lbrack {\frac {140000}{140000-2100(25.35085)}}\right\rbrack -9.8(25.35085)\\&=708.4811\end{aligned}}}

Given that the true value is 11061.34m, the absolute relative true error, ${\displaystyle \left|\epsilon _{t}\right|}$ is

{\displaystyle {\begin{aligned}\left|\epsilon _{t}\right|&=\left|{\frac {11061.34-11058.44}{11061.34}}\right|\times 100\\&=0.0262\%\end{aligned}}}

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

${\displaystyle \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).

Interval ω(x) Orthogonal polynomials A & S For more information, see ...
[−1, 1] 1 Legendre polynomials 25.4.29 § Gauss–Legendre quadrature
(−1, 1) ${\displaystyle \left(1-x\right)^{\alpha }\left(1+x\right)^{\beta },\quad \alpha ,\beta >-1}$ Jacobi polynomials 25.4.33 (β = 0) Gauss–Jacobi quadrature
(−1, 1) ${\displaystyle {\frac {1}{\sqrt {1-x^{2}}}}}$ Chebyshev polynomials (first kind) 25.4.38 Chebyshev–Gauss quadrature
[−1, 1] ${\displaystyle {\sqrt {1-x^{2}}}}$ Chebyshev polynomials (second kind) 25.4.40 Chebyshev–Gauss quadrature
[0, ∞) ${\displaystyle e^{-x}\,}$ Laguerre polynomials 25.4.45 Gauss–Laguerre quadrature
[0, ∞) ${\displaystyle x^{\alpha }e^{-x},\quad \alpha >-1}$ Generalized Laguerre polynomials Gauss–Laguerre quadrature
(−∞, ∞) ${\displaystyle e^{-x^{2}}}$ Hermite polynomials 25.4.46 Gauss–Hermite quadrature

### Fundamental theorem

Let pn be a nontrivial polynomial of degree n such that

${\displaystyle \int _{a}^{b}\omega (x)\,x^{k}p_{n}(x)\,dx=0,\quad {\text{for all }}k=0,1,\ldots ,n-1.}$

Note that this will be true for all the orthogonal polynomials above, because each pn is constructed to be orthogonal to the other polynomials pj for jn, and xk is in the span of that set.

If we pick the n nodes xi to be the zeros of pn, then there exist n weights wi which make the Gauss-quadrature computed integral exact for all polynomials h(x) of degree 2n − 1 or less. Furthermore, all these nodes xi will lie in the open interval (a, b) (Stoer & Bulirsch 2002, pp. 172–175).

To prove the first part of this claim, let h(x) be any polynomial of degree 2n − 1 or less. Divide it by the orthogonal polynomial pn to get

${\displaystyle h(x)=p_{n}(x)\,q(x)+r(x).}$

where q(x) is the quotient, of degree n − 1 or less (because the sum of its degree and that of the divisor pn must equal that of the dividend), and r(x) is the remainder, also of degree n − 1 or less (because the degree of the remainder is always less than that of the divisor). Since pn is by assumption orthogonal to all monomials of degree less than n, it must be orthogonal to the quotient q(x). Therefore

${\displaystyle \int _{a}^{b}\omega (x)\,h(x)\,dx=\int _{a}^{b}\omega (x)\,{\big (}\,p_{n}(x)q(x)+r(x)\,{\big )}\,dx=\int _{a}^{b}\omega (x)\,r(x)\,dx.}$

Since the remainder r(x) is of degree n − 1 or less, we can interpolate it exactly using n interpolation points with Lagrange polynomials li(x), where

${\displaystyle l_{i}(x)=\prod _{j\neq i}{\frac {x-x_{j}}{x_{i}-x_{j}}}.}$

We have

${\displaystyle r(x)=\sum _{i=1}^{n}l_{i}(x)\,r(x_{i}).}$

Then its integral will equal

${\displaystyle \int _{a}^{b}\omega (x)\,r(x)\,dx=\int _{a}^{b}\omega (x)\,\sum _{i=1}^{n}l_{i}(x)\,r(x_{i})\,dx=\sum _{i=1}^{n}\,r(x_{i})\,\int _{a}^{b}\omega (x)\,l_{i}(x)\,dx=\sum _{i=1}^{n}\,r(x_{i})\,w_{i},}$

where wi, the weight associated with the node xi, is defined to equal the weighted integral of li(x) (see below for other formulas for the weights). But all the xi are roots of pn, so the division formula above tells us that

${\displaystyle h(x_{i})=p_{n}(x_{i})\,q(x_{i})+r(x_{i})=r(x_{i}),}$

for all i. Thus we finally have

${\displaystyle \int _{a}^{b}\omega (x)\,h(x)\,dx=\int _{a}^{b}\omega (x)\,r(x)\,dx=\sum _{i=1}^{n}w_{i}\,r(x_{i})=\sum _{i=1}^{n}w_{i}\,h(x_{i}).}$

This proves that for any polynomial h(x) of degree 2n − 1 or less, its integral is given exactly by the Gaussian quadrature sum.

To prove the second part of the claim, consider the factored form of the polynomial pn. Any complex conjugate roots will yield a quadratic factor that is either strictly positive or strictly negative over the entire real line. Any factors for roots outside the interval from a to b will not change sign over that interval. Finally, for factors corresponding to roots xi inside the interval from a to b that are of odd multiplicity, multiply pn by one more factor to make a new polynomial

${\displaystyle p_{n}(x)\,\prod _{i}(x-x_{i}).}$

This polynomial cannot change sign over the interval from a to b because all its roots there are now of even multiplicity. So the integral

${\displaystyle \int _{a}^{b}p_{n}(x)\,\left(\prod _{i}(x-x_{i})\right)\,\omega (x)\,dx\neq 0,}$

since the weight function ω(x) is always non-negative. But pn is orthogonal to all polynomials of degree n-1 or less, so the degree of the product

${\displaystyle \prod _{i}(x-x_{i})}$

must be at least n. Therefore pn has n distinct roots, all real, in the interval from a to b.

#### General formula for the weights

The weights can be expressed as

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

(1)

where ${\displaystyle a_{k}}$ is the coefficient of ${\displaystyle x^{k}}$ in ${\displaystyle p_{k}(x)}$. To prove this, note that using Lagrange interpolation one can express r(x) in terms of ${\displaystyle r(x_{i})}$ as

${\displaystyle 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 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

${\displaystyle \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 wi are thus given by

${\displaystyle 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}$

This integral expression for ${\displaystyle w_{i}}$ can be expressed in terms of the orthogonal polynomials ${\displaystyle p_{n}(x)}$ and ${\displaystyle p_{n-1}(x)}$ as follows.

We can write

${\displaystyle \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)}}}$

where ${\displaystyle a_{n}}$ is the coefficient of ${\displaystyle x^{n}}$ in ${\displaystyle p_{n}(x)}$. Taking the limit of x to ${\displaystyle x_{i}}$ yields using L'Hôpital's rule

${\displaystyle \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

${\displaystyle 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

${\displaystyle {\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

${\displaystyle \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}$

provided ${\displaystyle k\leq n}$, because

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

is a polynomial of degree k − 1 which is then orthogonal to ${\displaystyle p_{n}(x)}$. So, if q(x) is a polynomial of at most nth degree we have

${\displaystyle \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 ${\displaystyle q(x)=p_{n-1}(x)}$ as follows. Because ${\displaystyle {\frac {p_{n}(x)}{x-x_{i}}}}$ is a polynomial of degree n − 1, we have

${\displaystyle {\frac {p_{n}(x)}{x-x_{i}}}=a_{n}x^{n-1}+s(x)}$

where s(x) is a polynomial of degree ${\displaystyle n-2}$. Since s(x) is orthogonal to ${\displaystyle p_{n-1}(x)}$ we have

${\displaystyle \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

${\displaystyle 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 ${\displaystyle n-2}$, which is therefore orthogonal to ${\displaystyle p_{n-1}(x)}$. The integral can thus be written as

${\displaystyle \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 equation (2), the weights are obtained by dividing this by ${\displaystyle p'_{n}(x_{i})}$ and that yields the expression in equation (1).

${\displaystyle w_{i}}$ can also be expressed in terms of the orthogonal polynomials ${\displaystyle p_{n}(x)}$ and now ${\displaystyle p_{n+1}(x)}$. In the 3-term recurrence relation ${\displaystyle p_{n+1}(x_{i})=(a)p_{n}(x_{i})+(b)p_{n-1}(x_{i})}$ the term with ${\displaystyle p_{n}(x_{i})}$ vanishes, so ${\displaystyle p_{n-1}(x_{i})}$ in Eq. (1) can be replaced by ${\textstyle {\frac {1}{b}}p_{n+1}\left(x_{i}\right)}$.

#### Proof that the weights are positive

Consider the following polynomial of degree ${\displaystyle 2n-2}$

${\displaystyle f(x)=\prod _{\begin{smallmatrix}1\leq j\leq n\\j\neq i\end{smallmatrix}}{\frac {\left(x-x_{j}\right)^{2}}{\left(x_{i}-x_{j}\right)^{2}}}}$

where, as above, the xj are the roots of the polynomial ${\displaystyle p_{n}(x)}$. Clearly ${\displaystyle f(x_{j})=\delta _{ij}}$. Since the degree of ${\displaystyle f(x)}$ is less than ${\displaystyle 2n-1}$, the Gaussian quadrature formula involving the weights and nodes obtained from ${\displaystyle p_{n}(x)}$ applies. Since ${\displaystyle f(x_{j})=0}$ for j not equal to i, we have

${\displaystyle \int _{a}^{b}\omega (x)f(x)dx=\sum _{j=1}^{N}w_{j}f(x_{j})=\sum _{j=1}^{N}\delta _{ij}w_{j}=w_{i}>0.}$

Since both ${\displaystyle \omega (x)}$ and ${\displaystyle f(x)}$ are non-negative functions, it follows that ${\displaystyle w_{i}>0}$.

### Computation of Gaussian quadrature rules

There are many algorithms for computing the nodes xi and weights wi of Gaussian quadrature rules. The most popular are the Golub-Welsch algorithm requiring O(n2) operations, Newton's method for solving ${\displaystyle p_{n}(x)=0}$ using the three-term recurrence for evaluation requiring O(n2) operations, and asymptotic formulas for large n requiring O(n) operations.

#### Recurrence relation

Orthogonal polynomials ${\displaystyle p_{r}}$ with ${\displaystyle (p_{r},p_{s})=0}$ for ${\displaystyle r\neq s}$ for a scalar product ${\displaystyle (\,\,)}$, degree ${\displaystyle (p_{r})=r}$ and leading coefficient one (i.e. monic orthogonal polynomials) satisfy the recurrence relation

${\displaystyle p_{r+1}(x)=(x-a_{r,r})p_{r}(x)-a_{r,r-1}p_{r-1}(x)\cdots -a_{r,0}p_{0}(x)}$

and scalar product defined

${\displaystyle (f(x),g(x))=\int _{a}^{b}\omega (x)f(x)g(x)dx}$

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

${\displaystyle (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.}$

Now if ${\displaystyle p_{0},p_{1},\ldots ,p_{r}}$ are orthogonal, then also ${\displaystyle p_{r+1}}$, because in

${\displaystyle (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})\cdots -a_{r,0}(p_{0},p_{s})}$

all scalar products vanish except for the first one and the one where ${\displaystyle p_{s}}$ meets the same orthogonal polynomial. Therefore,

${\displaystyle (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 ${\displaystyle (xf,g)=(f,xg)}$ (which is the case for Gaussian quadrature), the recurrence relation reduces to a three-term recurrence relation: For ${\displaystyle s is a polynomial of degree less than or equal to r − 1. On the other hand, ${\displaystyle p_{r}}$ is orthogonal to every polynomial of degree less than or equal to r − 1. Therefore, one has ${\displaystyle (xp_{r},p_{s})=(p_{r},xp_{s})=0}$ and ${\displaystyle a_{r,s}=0}$ for s < r − 1. The recurrence relation then simplifies to

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

or

${\displaystyle p_{r+1}(x)=(x-a_{r})p_{r}(x)-b_{r}p_{r-1}(x)}$

(with the convention ${\displaystyle p_{-1}(x)\equiv 0}$) where

${\displaystyle 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 last because of ${\displaystyle (xp_{r},p_{r-1})=(p_{r},xp_{r-1})=(p_{r},p_{r})}$, since ${\displaystyle xp_{r-1}}$ differs from ${\displaystyle p_{r}}$ by a degree less than r).

#### The Golub-Welsch algorithm

The three-term recurrence relation can be written in matrix form ${\displaystyle J{\tilde {P}}=x{\tilde {P}}-p_{n}(x)\times \mathbf {e} _{n}}$ where ${\displaystyle {\tilde {P}}={\begin{bmatrix}p_{0}(x)&p_{1}(x)&\ldots &p_{n-1}(x)\end{bmatrix}}^{\mathsf {T}}}$, ${\displaystyle \mathbf {e} _{n}}$ is the ${\displaystyle n}$th standard basis vector, i.e., ${\displaystyle \mathbf {e} _{n}={\begin{bmatrix}0&\ldots &0&1\end{bmatrix}}^{\mathsf {T}}}$, and J is the so-called Jacobi matrix:

${\displaystyle \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 ${\displaystyle x_{j}}$ 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 ${\displaystyle {\mathcal {J}}}$ with elements

{\displaystyle {\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 ${\displaystyle {\mathcal {J}}}$ are similar matrices and therefore have the same eigenvalues (the nodes). The weights can be computed from the corresponding eigenvectors: If ${\displaystyle \phi ^{(j)}}$ is a normalized eigenvector (i.e., an eigenvector with euclidean norm equal to one) associated to the eigenvalue xj, the corresponding weight can be computed from the first component of this eigenvector, namely:

${\displaystyle w_{j}=\mu _{0}\left(\phi _{1}^{(j)}\right)^{2}}$

where ${\displaystyle \mu _{0}}$ is the integral of the weight function

${\displaystyle \mu _{0}=\int _{a}^{b}\omega (x)dx.}$

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,

${\displaystyle \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 ξ in (a, b), where pn is the monic (i.e. the leading coefficient is 1) orthogonal polynomial of degree n and where

${\displaystyle (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 (Kahaner, Moler & Nash 1989, §5.2)

${\displaystyle {\frac {\left(b-a\right)^{2n+1}\left(n!\right)^{4}}{(2n+1)\left[\left(2n\right)!\right]^{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.

### 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 n-point rule in such a way that the resulting rule is of order 2n + 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 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:

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 (Quarteroni, Sacco & Saleri 2000).

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

${\displaystyle \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}.}$

Abscissas: xi is the ${\displaystyle (i-1)}$st zero of ${\displaystyle P'_{n-1}(x)}$, here ${\displaystyle P_{m}(x)}$denotes the standard Legendre polynomial of m-th degree and the dash denotes the derivative.

Weights:

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

Remainder:

${\displaystyle R_{n}={\frac {-n\left(n-1\right)^{3}2^{2n-1}\left[\left(n-2\right)!\right]^{4}}{(2n-1)\left[\left(2n-2\right)!\right]^{3}}}f^{(2n-2)}(\xi ),\qquad -1<\xi <1.}$

Some of the weights are:

Number of points, n Points, xi Weights, wi
${\displaystyle 3}$ ${\displaystyle 0}$ ${\displaystyle {\frac {4}{3}}}$
${\displaystyle \pm 1}$ ${\displaystyle {\frac {1}{3}}}$
${\displaystyle 4}$ ${\displaystyle \pm {\sqrt {\frac {1}{5}}}}$ ${\displaystyle {\frac {5}{6}}}$
${\displaystyle \pm 1}$ ${\displaystyle {\frac {1}{6}}}$
${\displaystyle 5}$ ${\displaystyle 0}$ ${\displaystyle {\frac {32}{45}}}$
${\displaystyle \pm {\sqrt {\frac {3}{7}}}}$ ${\displaystyle {\frac {49}{90}}}$
${\displaystyle \pm 1}$ ${\displaystyle {\frac {1}{10}}}$
${\displaystyle 6}$ ${\displaystyle \pm {\sqrt {{\frac {1}{3}}-{\frac {2{\sqrt {7}}}{21}}}}}$ ${\displaystyle {\frac {14+{\sqrt {7}}}{30}}}$
${\displaystyle \pm {\sqrt {{\frac {1}{3}}+{\frac {2{\sqrt {7}}}{21}}}}}$ ${\displaystyle {\frac {14-{\sqrt {7}}}{30}}}$
${\displaystyle \pm 1}$ ${\displaystyle {\frac {1}{15}}}$
${\displaystyle 7}$ ${\displaystyle 0}$ ${\displaystyle {\frac {256}{525}}}$
${\displaystyle \pm {\sqrt {{\frac {5}{11}}-{\frac {2}{11}}{\sqrt {\frac {5}{3}}}}}}$ ${\displaystyle {\frac {124+7{\sqrt {15}}}{350}}}$
${\displaystyle \pm {\sqrt {{\frac {5}{11}}+{\frac {2}{11}}{\sqrt {\frac {5}{3}}}}}}$ ${\displaystyle {\frac {124-7{\sqrt {15}}}{350}}}$
${\displaystyle \pm 1}$ ${\displaystyle {\frac {1}{21}}}$

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 978-0-486-61272-0. LCCN 64-60036. MR 0167642. LCCN 65-12253.
• Anderson, Donald G. (1965). "Gaussian quadrature formulae for ${\displaystyle \int _{0}^{1}-\ln(x)f(x)dx}$". Math. Comp. 19 (91): 477–481. doi:10.1090/s0025-5718-1965-0178569-1.
• Golub, Gene H.; Welsch, John H. (1969), "Calculation of Gauss Quadrature Rules", Mathematics of Computation, 23 (106): 221–230, doi:10.1090/S0025-5718-69-99647-1, JSTOR 2004418
• Gautschi, Walter (1968). "Construction of Gauss–Christoffel Quadrature Formulas". Math. Comp. 22 (102). pp. 251–270. doi:10.1090/S0025-5718-1968-0228171-0. MR 0228171.
• Gautschi, Walter (1970). "On the construction of Gaussian quadrature rules from modified moments". Math. Comp. 24. pp. 245–260. doi:10.1090/S0025-5718-1970-0285117-6. 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 ${\displaystyle \int _{0}^{1}(-\log x)x^{\alpha }f(x)dx}$ and ${\displaystyle \int _{0}^{\infty }E_{m}(x)f(x)dx}$". Math. Comp. 27 (124). pp. 861–869. doi:10.1090/S0025-5718-1973-0331730-X. MR 0331730.
• Kahaner, David; Moler, Cleve; Nash, Stephen (1989), Numerical Methods and Software, Prentice-Hall, ISBN 978-0-13-627258-8
• Sagar, Robin P. (1991). "A Gaussian quadrature for the calculation of generalized Fermi-Dirac integrals". Comput. Phys. Commun. 66 (2–3): 271–275. Bibcode:1991CoPhC..66..271S. doi:10.1016/0010-4655(91)90076-W.
• Yakimiw, E. (1996). "Accurate computation of weights in classical Gauss-Christoffel 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/S0377-0427(99)00228-9
• Laurie, Dirk P. (2001). "Computation of Gauss-type quadrature formulas". J. Comput. Appl. Math. 127 (1–2): 201–217. Bibcode:2001JCoAM.127..201L. doi:10.1016/S0377-0427(00)00506-9.
• 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 978-0-387-95452-3.
• 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 978-0-521-19225-5, 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 978-0-521-88068-8
• Gil, Amparo; Segura, Javier; Temme, Nico M. (2007), "§5.3: Gauss quadrature", Numerical Methods for Special Functions, SIAM, ISBN 978-0-89871-634-4
• Quarteroni, Alfio; Sacco, Riccardo; Saleri, Fausto (2000). Numerical Mathematics. New York: Springer-Verlag. pp. 422, 425. ISBN 0-387-98959-5.
• Walter Gautschi: "A Software Repository for Gaussian Quadratures and Christoffel Functions", SIAM, ISBN 978-1-611976-34-2 (2020).
Specific
1. ^ 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.
2. ^ 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.
3. ^ Gander, Walter; Gautschi, Walter (2000). "Adaptive Quadrature - Revisited". BIT Numerical Mathematics. 40 (1): 84–101. doi:10.1023/A:1022318402393.
4. ^ "Numerical integration - MATLAB integral".
5. ^ "Functions of One Variable (GNU Octave)". Retrieved 28 September 2018.