Skip to article frontmatterSkip to article content

8.8Gauss quadrature - I

In the quadrature methods studied so far, the nodes were first chosen and then we determine the weights via some function interpolation process. The resulting methods have certain degree of precision in terms of what polynomials they can exactly integrate.

Let us consider the task of computing

I(f)=abw(x)f(x)dxI(f) = \int_a^b w(x) f(x) \ud x

where w(x)w(x) is some fixed positive weight function by a formula of the type

In(f)=j=1nwjf(xj)I_n(f) = \sum_{j=1}^n w_j f(x_j)

Here wjw_j are weights and should not be confused with the weight function w(x)w(x), though they will be related to one another in some way.

The evaluation of ff might be expensive, hence we would like to find quadrature rules that use few number of nodes but have high degree of precision.

8.8.1Unit weight function

Let us take the interval to be [1,+1][-1,+1] and w(x)=1w(x)=1. Then we want to compute

11f(x)dxIn(f)=j=1nwjf(xj)\int_{-1}^1 f(x) \ud x \approx I_n(f) = \sum_{j=1}^n w_j f(x_j)

The error

En(f)=11f(x)j=1nwjf(xj)E_n(f) = \int_{-1}^1 f(x) - \sum_{j=1}^n w_j f(x_j)

Note thet En:C[1,1]RE_n : \cts[-1,1] \to \re is a linear operator and in particular

En(a0+a1x+amxm)=a0En(1)+a1En(x)++amEn(xm)E_n(a_0 + a_1 x + \ldots a_m x^m) = a_0 E_n(1) + a_1 E_n(x) + \ldots + a_m E_n(x^m)

Hence

En(p)=0,pPmE_n(p) = 0, \qquad \forall p \in \poly_m

if and only if

En(xi)=0,0imE_n(x^i) = 0, \qquad 0 \le i \le m

8.8.1.1Case n=1n=1:

The quadrature formula is

I1(f)=w1f(x1)I_1(f) = w_1 f(x_1)

and we have to find w1w_1 and x1x_1. Making it exact for constant and linear polynomial

E1(1)=0    11dxw1=0E1(x)=0    11xdxw1x1=0\begin{align} E_1(1) &= 0 \quad\implies\quad \int_{-1}^1 \ud x - w_1 = 0 \\ E_1(x) &= 0 \quad\implies\quad \int_{-1}^1 x \ud x - w_1 x_1 = 0 \end{align}

which yields

w1=2,x1=0w_1 = 2, \qquad x_1 = 0

so that

11f(x)dx2f(0)\int_{-1}^1 f(x) \ud x \approx 2 f(0)

This is just the midpoint-rule. It uses only one point but is exact for linear polynomials. Note that trapezoidal method uses two points but is also exact only for linear polynomials. In terms of the number of nodes used, the mid-point rule is more optimal since it needs less function evaluation to give same degree of precision.

8.8.1.2Case n=2n=2:

The quadrature formula is

I2(f)=w1f(x1)+w2f(x2)I_2(f) = w_1 f(x_1) + w_2 f(x_2)

and we have to determine four quantities w1,w2,x1,x2w_1, w_2, x_1, x_2. We can try to make the formula exact for upto cubic polynomials

E2(xi)=11xidx[w1x1i+w2x2i]=0,i=0,1,2,3E_2(x^i) = \int_{-1}^1 x^i \ud x - [w_1 x_1^i + w_2 x_2^i] = 0, \qquad i=0,1,2,3

which gives us four equations

w1+w2=2w1x1+w2x2=0w1x12+w2x22=2/3w1x13+w2x23=0\begin{aligned} w_1 + w_2 &= 2 \\ w_1 x_1 + w_2 x_2 &= 0 \\ w_1 x_1^2 + w_2 x_2^2 &= 2/3 \\ w_1 x_1^3 + w_2 x_2^3 &= 0 \end{aligned}

The unique solution is

w1=w2=1,x1=13,x2=13w_1 = w_2 = 1, \qquad x_1 = -\frac{1}{\sqrt{3}}, \qquad x_2 = \frac{1}{\sqrt{3}}

This rule uses 2 points but has degree of precision 3. Simpson rule also has degree of precision 3 but uses 3 points.

8.8.1.3Case of general nn:

There are 2n2n free parameters {wj,xj}\{w_j, x_j\}, j=1,2,,nj=1,2,\ldots,n and we make the quadrature exact for polynomials of degree upto 2n12n-1

En(xi)=0,i=0,1,2,,2n1E_n(x^i) = 0, \qquad i=0,1,2,\ldots,2n-1

which gives 2n2n equations

j=1nwjxji={0i=1,3,,2n12i+1i=0,2,,2n2\sum_{j=1}^n w_j x_j^i = \begin{cases} 0 & i=1,3,\ldots,2n-1 \\ \frac{2}{i+1} & i=0,2,\ldots,2n-2 \end{cases}

We have system of non-linear equations and it is not possible to solve them analytically. We will take a digression to study some properties of orthogonal polynomials which will help us to derive these Gauss quadrature rules.

8.8.2Unit weight: solution for general case

We can find the quadrature rule without having to solve a matrix problem. Let f:[1,1]Rf : [-1,1] \to \re and for some integer n1n \ge 1, let {xj,1jn}\{ x_j, 1 \le j \le n \} be the roots of Legendre polynomial PnP_n and they all lie in [1,1][-1,1] as we show in next chapter. Consider the interpolation at those roots

fn(x)=j=1nf(xj)j(x)f_n(x) = \sum_{j=1}^n f(x_j) \ell_j(x)

where j\ell_j are the degree n1n-1 Lagrange polynomials supported at the roots. Since

f(xj)fn(xj)=0,1jnf(x_j) - f_n(x_j) = 0, \qquad 1 \le j \le n

we can write

f(x)=fn(x)+Pn(x)R(x)f(x) = f_n(x) + P_n(x) R(x)

for some function RR. Now

I(f)=11f(x)dx=11fn(x)dx+11Pn(x)R(x)dx=j=1nwjf(xj)+11Pn(x)R(x)dx=In(f)+11Pn(x)R(x)dx\begin{align*} I(f) &= \int_{-1}^1 f(x) \ud x \\ &= \int_{-1}^1 f_n(x) \ud x + \int_{-1}^1 P_n(x) R(x) \ud x \\ &= \sum_{j=1}^n w_j f(x_j) + \int_{-1}^1 P_n(x) R(x) \ud x \\ &= I_n(f) + \int_{-1}^1 P_n(x) R(x) \ud x \\ \end{align*}

where

In(f)=j=1nwjf(xj),wj=11j(x)dxI_n(f) = \sum_{j=1}^n w_j f(x_j), \qquad w_j = \int_{-1}^1 \ell_j(x) \ud x

If fP2n1f \in \poly_{2n-1} then RPn1R \in \poly_{n-1} and it can be written in Legendre basis

R=a0P0+a1P1++an1Pn111Pn(x)R(x)dx=0,RPn1\begin{gather} R = a_0 P_0 + a_1 P_1 + \ldots + a_{n-1}P_{n-1} \\ \Downarrow \\ \int_{-1}^1 P_n(x) R(x) \ud x = 0, \qquad \forall R \in \poly_{n-1} \end{gather}

Thus

In(f)=I(f),fP2n1I_n(f) = I(f), \qquad \forall f \in \poly_{2n-1}

the quadrature formula has degree of precision atleast 2n12n-1. Later, we will show that this is optimal and derive simpler formulae for the weights.