# Chapter 07.05: Gauss Quadrature Rule of Integration

## Learning Objective

After successful completion of this lesson, you should be able to:

1) derive the Gauss quadrature method for integration.

## Introduction

The two-point Gauss quadrature rule is an extension of the trapezoidal rule approximation where the arguments of the function are not predetermined. In single-segment trapezoidal rule for approximating the integral $\displaystyle \int_{a}^{b}{f(x)dx},$the end-points $$a$$ and $$b$$ are chosen as the quadrature points, but in the two-point Gaussian quadrature rule, two points $$x_{1}$$ and $$x_{2}$$ somewhere between the end-points $$a$$ and $$b$$ are chosen. How do we find these quadrature points is a question, and so is why we wish to find these points? The answer to the “why” question is to gain more accuracy for the same order of computational time over the trapezoidal rule. The derivation and the example following will answer both these questions.

Before we derive the two-point Gaussian quadrature rule, we derive the trapezoidal rule from the method of undetermined coefficients. Why? Because that is the method used to derive the two-point Gaussian quadrature rule as well.

## Trapezoidal Rule Derivation Using Method of Undetermined Coefficients

Choose the integral $$\displaystyle \int_{a}^{b}{f(x)dx}$$ approximated as follows.

$\int_{a}^{b}{f(x)dx} \approx c_{1}f(a) + c_{2}f(b)\;\;\;\;\;\;\;\;\;\;\;\; (1)$

The coefficients $$c_{1}$$ and $$c_{2}$$ are undetermined. We find these coefficients such that right-hand side is exact for integrals of first-order polynomial $$a_{0} + a_{1}x$$.

From exact integration

$\begin{split} \int_{a}^{b}{\left( a_{0} + a_{1}x \right){dx}} &= \left\lbrack a_{0}x + a_{1}\frac{x^{2}}{2} \right\rbrack_{a}^{b}\\ &= a_{0}\left( b - a \right) + a_{1}\left( \frac{b^{2} - a^{2}}{2} \right)\;\;\;\;\;\;\;\;\;\;\;\; (2) \end{split}$

But we want the right-hand side of Equation (1) to give the same result as Equation (2) for $$f(x) = a_{0} + a_{1}x$$ which gives

$\begin{split} c_{1}f(a) + c_{2}f(b) &= c_{1}(a_{0} + a_{1}b) + c_{2}(a_{0} + a_{1}b)\\ &= a_{0} \left( c_{1} + c_{2} \right) + a_{1}\left( c_{1}a + c_{2}b \right)\;\;\;\;\;\;\;\;\;\;\;\; (3) \end{split}$

Hence from Equations (2) and (3),

$a_{0}\left( b - a \right) + a_{1}\left( \frac{b^{2} - a^{2}}{2} \right) = a_{0}\left( c_{1} + c_{2} \right) + a_{1}\left( c_{1}a + c_{2}b \right)\;\;\;\;\;\;\;\;\;\;\;\; (4)$

Since $$a_{0}$$ and $$a_{1}$$ are arbitrary constants for the chosen general straight line, the coefficients of $$a_{0}$$ and $$a_{1}$$ need to be equal. That gives

$c_{1} + c_{2} = b - a\;\;\;\;\;\;\;\;\;\;\;\; (5a)$

$c_{1}a + c_{2}b = \frac{b^{2} - a^{2}}{2}\;\;\;\;\;\;\;\;\;\;\;\; (5b)$

Multiplying Equation (5a) by $$a$$ and subtracting from Equation (5b) gives

$c_{2} = \frac{b - a}{2}\;\;\;\;\;\;\;\;\;\;\;\; (6a)$

Substituting the value of $$c_{2}$$ from Equation (6a) in Equation (5a) gives

$c_{1} = \frac{b - a}{2}\;\;\;\;\;\;\;\;\;\;\;\; (6b)$

Therefore

$\begin{split} \int_{a}^{b}f(x)dx &\approx c_{1}f(a) + c_{2}f(b)\\ &= \frac{b - a}{2}f(a) + \frac{b - a}{2}f(b)\;\;\;\;\;\;\;\;\;\;\;\; (7) \end{split}$

## Two-point Gaussian Quadrature Rule Using Method of Undetermined Coefficients

In the two-point Gauss quadrature rule, an integral instead of Equation (1) is approximated as

$\int_{a}^{b}{f(x)dx \approx c_{1}f(x_{1}) + c_{2}f(x_{2})}\;\;\;\;\;\;\;\;\;\;\;\; (8)$

The quadrature points are the two additional unknowns. There are four unknowns in Equation (8) – the two quadrature points $$x_{1}$$, $$x_{2}$$, and the two weights $$c_{1}$$ and $$c_{2}$$. Hence, these are found by assuming that the formula gives exact results for integrating a general third-order polynomial, $$f(x) = a_{0} + a_{1}x + a_{2}x^{2} + a_{3}x^{3}$$.

$\begin{split} \int_a^bf(x)dx &= \int_a^b(a_0+a_1x+a_2x^2+a_3x^3)dx\\ &= \begin{bmatrix}\displaystyle a_0x+a_1\frac{x^2}{2}+a_2\frac{x^3}{3}+a_3\frac{x^4}{4} \end{bmatrix}_{a}^{b}\\ &= a_{0}\left( b - a \right) + a_{1}\left( \frac{b^{2} - a^{2}}{2} \right) + a_{2}\left( \frac{b^{3} - a^{3}}{3} \right) + a_{3}\left( \frac{b^{4} - a^{4}}{4} \right)\;\;\;\;\;\;\;\;\;\;\;\; (9)\end{split}$

But we want the right-hand side of Equation (8) to give the same result as Equation (9) for $$f(x) = a_{0} + a_{1}x + a_{2}x^{2} + a_{3}x^{3}$$ which is

$c_{1}f(x_{1}) + c_{2}f(x_{2})= c_{1}\left( a_{0} + a_{1}x_{1} + a_{2}x_{1}^{2} + a_{3}x_{1}^{3} \right) + c_{2}\left( a_{0} + a_{1}x_{2} + a_{2}x_{2}^{2} + a_{3}x_{2}^{3} \right)\;\;\;\;\;\;\;\;\;\;\;\; (10)$

Equating Equations (9) and (10) gives

$\begin{split} &a_0(b-a)+a_1(\frac{b^2-a^2}{2})+a_2(\frac{b^3-a^3}{3})+a_3(\frac{b^4-a^4}{4}) \\ &= c_1(a_0+a_1x_1+a_2x_1^2+a_3x_1^3) + c_2(a_0+a_1x_2+a_2x_2^2+a_3x_2^3)\\ &= a_0(c_1+c_2)+a_1(c_1x_1+c_2x_2)+a_2(c_1x_1^2+c_2x_2^2)+a_3(c_1x_1^3+c_2x_2^3)\;\;\;\;\;\;\;\;\;\;\;\; (11)\end{split}$

Since in Equation (11), the constants $$a_{0},$$ $$a_{1},$$ $$a_{2},$$ and $$a_{3}$$ are arbitrary in the $$f(x) = a_{0} + a_{1}x + a_{2}x^{2} + a_{3}x^{3}$$, the coefficients of $$a_{0},$$ $$a_{1},$$ $$a_{2},$$ and $$a_{3}$$ must be equal. This equating gives us four equations as follows.

$b - a = c_{1} + c_{2}$

$\frac{b^{2} - a^{2}}{2} = c_{1}x_{1} + c_{2}x_{2}$

$\frac{b^{3} - a^{3}}{3} = c_{1}{x_{1}}^{2} + c_{2}{x_{2}}^{2}$

$\frac{b^{4} - a^{4}}{4} = c_{1}{x_{1}}^{3} + c_{2}{x_{2}}^{3}\;\;\;\;\;\;\;\;\;\;\;\; (12a-d)$

Without proof, we can find that the above four simultaneous nonlinear equations have only one acceptable solution

$c_{1} = \frac{b - a}{2}$

$c_{2} = \frac{b - a}{2}$

$x_{1} = \left( \frac{b - a}{2} \right)\left( - \frac{1}{\sqrt{3}} \right) + \frac{b + a}{2}$

$x_{2} = \left( \frac{b - a}{2} \right)\left( \frac{1}{\sqrt{3}} \right) + \frac{b + a}{2}\;\;\;\;\;\;\;\;\;\;\;\; (13)$

Hence from Equations (1) and (13),

$\begin{split} \int_{a}^{b}{f(x)dx} &\approx c_{1}f\left( x_{1} \right) + c_{2}f\left( x_{2} \right)\\ &= \frac{b - a}{2}f\left( \frac{b - a}{2}\left( - \frac{1}{\sqrt{3}} \right) + \frac{b + a}{2} \right)\\ \ \ \ &+ \frac{b - a}{2}f\left( \frac{b - a}{2}\left( \frac{1}{\sqrt{3}} \right) + \frac{b + a}{2} \right)\;\;\;\;\;\;\;\;\;\;\;\; (14) \end{split}$

## One-point Gaussian Quadrature Rule Using Method of Undetermined Coefficients

Since we derived the two-point Gaussian quadrature rule without showing complete proof because of its length, we show the complete proof of the one-point Gauss quadrature rule. The derivation is based on approximating the integral by using the function value at a single point $$x_1$$ and giving it some weight $$c_1$$ and is given by

$\int_{a}^{b}{f(x){dx}} \approx c_{1}f\left( x_{1} \right)\;\;\;\;\;\;\;\;\;\;\;\; (15)$

To derive the values of $$c_{1}$$ and$$\ x_{1}$$, we assume the formula in Equation (15) gives exact values for an integral of a linear polynomial of the form $$a_{0} + a_{1}x$$.

$\begin{split} \int_{a}^{b}{{(a}_{0} + a_{1}x)dx} &= \left\lbrack a_{0}x + \frac{a_{1}x^{2}}{2} \right\rbrack\begin{matrix} b \\ \\ a \\ \end{matrix}\\ &= a_{0}(b\ - \ a) + a_{1}\left( \frac{b^{2} - a^{2}}{2} \right)\;\;\;\;\;\;\;\;\;\;\;\; (16) \end{split}$

From the assumed formula

$\begin{split} c_{1}f(x_{1}) &= c_{1}{(a}_{0} + a_{1}x_{1})\\ &= c_{1}a_{0} + c_{1}{a_{1}x}_{1}\;\;\;\;\;\;\;\;\;\;\;\; (17) \end{split}$

Equating Equations (16) and (17) gives

$a_{0}(c_{1}) + a_{1}{(c}_{1}x_{1}) = a_{0}(b\ - \ a) + a_{1}\left( \frac{b^{2} - a^{2}}{2} \right)$

Since $$a_{0}$$ and $$a_{1}$$ are arbitrary, we can equate the coefficients of $$a_{0}$$ and $$a_{1}$$, giving

$c_{1} = b - a\;\;\;\;\;\;\;\;\;\;\;\; (18)$

$c_{1}x_{1} = \left( \frac{b^{2} - a^{2}}{2} \right)\;\;\;\;\;\;\;\;\;\;\;\; (19)$

Using Equation (18) in Equation (19) gives

$(b - a)x_{1} = \frac{b^{2} - a^{2}}{2}$

$x_{1} = \frac{b + a}{2}\;\;\;\;\;\;\;\;\;\;\;\; (20)$

Therefore, one-point Gauss quadrature rule can be expressed as

$\begin{split} \int_{a}^{b}{f\left( x \right)dx} &\approx c_{1}f\left( x_{1} \right)\\ &=(b-a)f(\frac{b+a}{2})\;\;\;\;\;\;\;\;\;\;\;\; (21) \end{split}$

## Learning Objectives

After successful completion of this lesson, you should be able to:

1) use the Gauss quadrature rule to approximate definite integrals.

## Recap

In the previous lesson, you learned the theory of the Gauss quadrature rule. In this lesson, we apply the formulas of the rule to approximate definite integrals.

### Example 1

The following integral is given

$\int_{0.1}^{1.3}{5xe^{- 2x}{dx}}$

a)  Use the two-point Gauss quadrature rule to estimate the value of the integral.

b)  Find the true error for part (a).

c)  Find the absolute relative true error for part (a).

Solution

a) The two-point Gauss quadrature rule is given by

$\int_{a}^{b}{f(x)dx} \approx c_{1}f\left( x_{1} \right) + c_{2}f\left( x_{2} \right)$

where

$c_{1} = \frac{b - a}{2}$

$x_{1} = \frac{b - a}{2}\left( - \frac{1}{\sqrt{3}} \right) + \frac{b + a}{2}$

$c_{2} = \frac{b - a}{2}$

$x_{2} = \frac{b - a}{2}\left( \frac{1}{\sqrt{3}} \right) + \frac{b + a}{2}$

For this example

$f\displaystyle (x) = 5xe^{- 2x},\ a = 0.1,\ b = 1.3$

So

$c_{1} = \frac{1.3 - 0.1}{2} = 0.6$

$x_{1} = \frac{1.3 - 0.1}{2}\left( - \frac{1}{\sqrt{3}} \right) + \frac{1.3 + 0.1}{2} = 0.35359$

$c_{2} = \frac{1.3 - 0.1}{2} = 0.6$

$x_{2} = \frac{1.3 - 0.1}{2}\left( \frac{1}{\sqrt{3}} \right) + \frac{1.3 + 0.1}{2} = 1.0461$

Then

$\begin{split} \int_{0.1}^{1.3}{f(x)dx} &\approx c_{1}f\left( x_{1} \right) + c_{2}f\left( x_{2} \right)\\ &= 0.6f(0.35359) + 0.6f(1.04641) \end{split}$

Finding the values of the function at the two quadrature points

$\begin{split} f(0.35359) &= 5(0.35359)e^{- 2(0.35359)}\\ &= 0.87166 \end{split}$

$\begin{split} f(1.04641) &= 5(1.04641)e^{- 2(1.04641)}\\ &= 0.64531 \end{split}$

we get

$\begin{split} \int_{0.1}^{1.3}{f(x)dx} &\approx 0.6 \times 0.87166 + 0.6 \times 0.64531\\ &= 0.91018 \end{split}$

b) The exact value of the above integral can be found as

$\int_{0.1}^{1.3}{5xe^{- 2x}dx = 0.89386}$

The true error

$\begin{split} E_{t} &= \text{True Value} - \text{Approximate Value}\\ &= 0.89386\ -\ 0.91018\\ &= - 0.01632 \end{split}$

c) The absolute relative true error $$\left| \varepsilon_{t} \right|$$ is

$\begin{split} \left| \varepsilon_{t} \right| &= \left| \frac{\text{True Value} - \text{Approximate Value}}{\text{True Value}} \right| \times 100\\ &=\left|\frac{\mathrm{0.89386\ }-0.91018}{\mathrm{0.89386\ }}\right|\times100\\ &= 1.8258\% \end{split}$

### Example 2

The following integral is given

$\int_{0.1}^{1.3}{{5xe}^{- 2x}{dx}}$

a)  Use the one-point Gaussian quadrature rule to estimate the value of the integral.

b)  Find the true error for part (a).

c)  Find the absolute relative true error, $$\left| \epsilon_{t} \right|$$, for part (a).

Solution

a)

$\int_{a}^{b}{f(x)dx} \approx (b - a)f\left( \frac{a + b}{2} \right)$

where

$a = 0.1$

$b = 1.3$

$\begin{split} \int_{0.1}^{1.3}{f(x)dx} &\approx (1.3 - 0.1)f\left( \frac{1.3 + 0.1}{2} \right)\\ &= \left( 1.2 \right)f\left( 0.7 \right)\\ &= \left( 1.2 \right)\left( {5\left( 0.7 \right)e}^{- 2\left( 0.7 \right)} \right)\\ &= 1.0357 \end{split}$

b)  The true value is

$\begin{split} E_{t} &= \text {True value} - \text{Approximate value}\\ &= 0.89386 - 1.0357\\ &= - 0.14183 \end{split}$

c)  The absolute relative true error, $$\left| \epsilon_{t} \right|$$, would be

$\begin{split} \left| \epsilon_{t} \right| &= \left| \frac{\text{True error}}{\text{True value}} \right| \times 100\\ &= \left| \frac{- 0.14183}{0.89386} \right| \times 100 \\ &= 15.86\% \end{split}$

### Example 3

Use two-point Gauss quadrature rule to approximate the distance covered by a rocket from $$t = 8$$ to $$t = 30$$ seconds as given by

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

Also, find the absolute relative true error.

Solution

First, change the limits of integration from $$\left\lbrack 8,30 \right\rbrack$$ to $$\left\lbrack - 1,1 \right\rbrack$$ then

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

The weighting factors and function argument values for the two point rule are,

$c_{1} = 1.000000000$

$x_{1} = - 0.577350269$

$c_{2} = 1.000000000$

$x_{2} = 0.577350269$

Now we can use the Gauss quadrature formula

$\begin{split} 11\int_{- 1}^{1}{f\left( 11x + 19 \right)\text{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.44\ \text{m}\end{split}$

where

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

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

The absolute relative true error, $$\left| \epsilon_{t} \right|$$, is (True value = $$11061.34\ \text{m}$$)

$\begin{split} \left| \epsilon_{t} \right| &= \left| \frac{11061.34 - 11058.44}{11061.34} \right| \times 100\\ &= 0.0262\% \end{split}$

## Learning Objectives

After successful completion of this lesson, you should be able to:

1) apply higher-point Gauss quadrature formulas to estimate integrals

2) use a table of abscissas and weights to apply the Gauss quadrature rule.

## Introduction

We have discussed one-point and two-point Gauss quadrature rules in a previous lesson. So, how do higher-point Gauss quadrature rules work? For example, the three-point Gauss quadrature rule is given by

$\int_{a}^{b}{f(x)dx} \approx c_{1}f(x_{1}) + c_{2}f(x_{2}) + c_{3}f(x_{3})\;\;\;\;\;\;\;\;\;\;\;\; (1)$

The coefficients (also called weighting factors) $$c_{1}$$, $$c_{2}$$, and $$c_{3}$$, and the function arguments $$x_{1}$$, $$x_{2}$$ and $$x_{3}$$ are calculated by assuming the formula gives exact expressions for integrating a fifth-order polynomial

$\int_{a}^{b}{\left( a_{0} + a_{1}x + a_{2}x^{2} + a_{3}x^{3} + a_{4}x^{4} + a_{5}x^{5} \right){dx}}$.

General $$n$$ -point rules would approximate an integral as

$\int_{a}^{b}{f(x)dx} \approx c_{1}f(x_{1}) + c_{2}f(x_{2}) + ....... + c_{n}f(x_{n})\;\;\;\;\;\;\;\;\;\;\;\; (2)$

## Arguments and weighing factors for n-point Gauss quadrature rules

In handbooks (see Table 1), coefficients and arguments for $$n$$-point Gauss quadrature rule are not given for integrals of the form $$\displaystyle \int_{a}^{b}{f(x)dx}$$ but for integrals of the form $$\displaystyle \int_{- 1}^{1}{g(x)dx}$$, that is,

$\int_{- 1}^{1}{g(x)dx \approx \sum_{i = 1}^{n}{c_{i}g(x_{i})}}\;\;\;\;\;\;\;\;\;\;\;\; (3)$

Table 1 Weighting factors $$c$$ and function arguments $$x$$ used in Gauss quadrature formulas

Points Weighting Factors Function Arguments
$$1$$ $$c_{1} = 2.000000000$$ $$x_{1} = 0.000000000$$
$$2$$

$$c_{1} = 1.000000000$$

$$c_{2} = 1.000000000$$

$$x_{1} = - 0.577350269$$

$$x_{2} = 0.577350269$$

$$3$$

$$c_{1} = 0.555555556$$

$$c_{2} = 0.888888889$$

$$c_{3} = 0.555555556$$

$$x_{1} = - 0.774596669$$

$$x_{2} = 0.000000000$$

$$x_{3} = 0.774596669$$

$$4$$

$$c_{1} = 0.347854845$$

$$c_{2} = 0.652145155$$

$$c_{3} = 0.652145155$$

$$c_{4} = 0.347854845$$

$$x_{1} = - 0.861136312$$

$$x_{2} = - 0.339981044$$

$$x_{3} = 0.339981044$$

$$x_{4} = 0.861136312$$

$$5$$

$$c_{1} = 0.236926885$$

$$c_{2} = 0.478628670$$

$$c_{3} = 0.568888889$$

$$c_{4} = 0.478628670$$

$$c_{5} = 0.236926885$$

$$x_{1} = - 0.906179846$$

$$x_{2} = - 0.538469310$$

$$x_{3} = 0.000000000$$

$$x_{4} = 0.538469310$$

$$x_{5} = 0.906179846$$

$$6$$

$$c_{1} = 0.171324492$$

$$c_{2} = 0.360761573$$

$$c_{3} = 0.467913935$$

$$c_{4} = 0.467913935$$

$$c_{5} = 0.360761573$$

$$c_{6} = 0.171324492$$

$$x_{1} = - 0.932469514$$

$$x_{2} = - 0.661209386$$

$$x_{3} = - 0.238619186$$

$$x_{4} = 0.238619186$$

$$x_{5} = 0.661209386$$

$$x_{6} = 0.932469514$$

## So if the table is given for integrals with [-1,1] integration limits, how does one solve for integrals with [a,b] integration limits.

The answer lies in that any integral with limits of $$\left\lbrack a,b \right\rbrack$$ can be converted into an integral with limits $$\left\lbrack - 1,1 \right\rbrack$$. Let

$x = mt + c\;\;\;\;\;\;\;\;\;\;\;\; (4)$

If $$x = a,$$ then $$t = - 1$$

If $$x = b,$$ then $$t = + 1$$

such that

$\begin{split} &a = m( - 1) + c\\ &b = m(1) + c\;\;\;\;\;\;\;\;\;\;\;\; (5a,b) \end{split}$

Solving the two Equations (5a) and (5b) simultaneously gives

$\begin{split} &m = \frac{b - a}{2}\\ &c = \frac{b + a}{2}\;\;\;\;\;\;\;\;\;\;\;\; (6a,b) \end{split}$

Hence from Equations (4), (6a), (6b),

$\begin{split} &x = \frac{b - a}{2}t + \frac{b + a}{2}\\ &dx = \frac{b - a}{2}{dt} \end{split}$

Substituting values of $$x$$ and $${dx}$$ into the integral gives us

$\begin{split} \int_{a}^{b}{f(x)dx} &= \int_{- 1}^{1}{f\left( \frac{b - a}{2}t + \frac{b + a}{2} \right)\frac{b - a}{2}{dt}}\\ & =\int_{-1}^{1} f\left(\frac{b-a}{2}x + \frac{b+a}{2} \right)\frac{b-a}{2}dx\;\;\;\;\;\;\;\;\;\;\;\; (7)\end{split}$

Hence, any integral of the form $$\displaystyle \int_{a}^{b}{f(x)dx}$$ can be converted to an $$\displaystyle \int_{- 1}^{1}{g(x)dx}$$, and Table 1 can be used to estimate integrals.

### Example 1

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

$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.34\ \text{m}$$

Solution

First, change the limits of integration from $$\left\lbrack 8,30 \right\rbrack$$ to $$\left\lbrack - 1,1 \right\rbrack$$ using Equation (7) gives

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

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

$\begin{split} c_{1} &= 1.000000000\\ x_{1} &= - 0.577350269\\ c_{2} &= 1.000000000\\ x_{2} &= 0.577350269 \end{split}$

Now we can use the Gauss quadrature formula

$\begin{split} 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.44\ \text{m} \end{split}$

since

$\begin{split} f(12.64915) &= 2000\ln\left\lbrack \frac{140000}{140000 - 2100(12.64915)} \right\rbrack - 9.8(12.64915)\\ &= 296.8317\\ f(25.35085) &= 2000\ln\left\lbrack \frac{140000}{140000 - 2100(25.35085)} \right\rbrack - 9.8(25.35085)\\ &= 708.4811 \end{split}$

The absolute relative true error, $$\left| \epsilon_{t} \right|$$, is (True value = $$11061.34\ \text{m}$$)

$\begin{split} \left| \epsilon_{t} \right| &= \left| \frac{11061.34 - 11058.44}{11061.34} \right| \times 100\\ &= 0.0262\% \end{split}$

### Example 2

Use three-point Gauss quadrature rule to approximate the distance in meters covered by a rocket from $$t = 8$$ to $$t = 30$$ as given by

$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.34\ \text{m}$$

Solution

First, change the limits of integration from $$\left\lbrack 8,30 \right\rbrack$$ to $$\left\lbrack - 1,1 \right\rbrack$$ using Equation (7) gives

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

The weighting factors and function argument values are

$\begin{split} c_{1} &= 0.555555556\\ x_{1} &= - 0.774596669\\ c_{2} &= 0.888888889\\ x_{2} &= 0.000000000\\ c_{3} &= 0.555555556\\ x_{3} &= 0.774596669 \end{split}$

and the formula is

$\begin{split} 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) + c_{3}f\left( 11x_{3} + 19 \right) \right\rbrack\\ &= 11\begin{bmatrix} \& 0.5555556f\left( 11( - .7745967) + 19 \right) + 0.8888889f\left( 11(0.0000000) + 19 \right) \\ + 0.5555556f\left( 11(0.7745967) + 19 \right) \\ \end{bmatrix}\\ &= 11\left\lbrack 0.55556f(10.47944) + 0.88889f(19.00000) + 0.55556f(27.52056) \right\rbrack\\ &= 11\left\lbrack 0.55556 \times 239.3327 + 0.88889 \times 484.7455 + 0.55556 \times 795.1069 \right\rbrack\\ &= 11061.31\ \text{m} \end{split}$

since

$\begin{split} f(10.47944) &= 2000\ln\left\lbrack \frac{140000}{140000 - 2100(10.47944)} \right\rbrack - 9.8(10.47944)\\ &= 239.3327\\ f(19.00000) &= 2000\ln\left\lbrack \frac{140000}{140000 - 2100(19.00000)} \right\rbrack - 9.8(19.00000)\\ &= 484.7455\\ f(27.52056) &= 2000\ln\left\lbrack \frac{140000}{140000 - 2100(27.52056)} \right\rbrack - 9.8(27.52056)\\ &= 795.1069 \end{split}$

The absolute relative true error, $$\left| \epsilon_{t} \right|$$, is (True value = $$11061.34\ \text{m}$$)

$\begin{split} \left| \epsilon_{t} \right| &= \left| \frac{11061.34 - 11061.31}{11061.34} \right| \times 100\\ &= 0.0003\% \end{split}$

## So does Gaussian quadrature require that the integral must be transformed to the integral limit of [-1,1]?

No, the limits do not need to be transformed. Gaussian quadrature rule can be written for any limits of integration.

It is just the weights and abscissas are given for the limits of integration of $$[-1,1]$$. So if the $$n$$-point Gaussian quadrature rule for $$[-1,1]$$ limits is given as

$\int_{- 1}^{1}{g(x)dx \approx \sum_{i = 1}^{n}{c_{i}g(x_{i})}}$

and we also know that

$\int_{a}^{b}{f\left( x \right)dx = \frac{b - a}{2}\int_{- 1}^{1}{f\left( \frac{b - a}{2}x + \frac{b + a}{2} \right){dx}}}$

then the n-point Gaussian quadrature rule for $$[a,b]$$ limits of integration can also be found.

$\begin{split} \int_{a}^{b}{f\left( x \right)dx} &= \frac{b - a}{2}\int_{- 1}^{1}{f\left( \frac{b - a}{2}x + \frac{b + a}{2} \right){dx}} \\ &\approx \frac{b - a}{2}\sum_{i = 1}^{n}{c_{i}f\left( \frac{b - a}{2}x_{i} + \frac{b + a}{2} \right)}\\ &= \sum_{i = 1}^{n}{C_{i}f(X_{i})} \end{split}$

where

$\begin{split} &C_{i} = \frac{b - a}{2}c_{i}\\ &X_{i} = \frac{b - a}{2}x_{i} + \frac{b + a}{2} \end{split}$

## Appendix

### Example A.1

For an integral $$\int_{- 1}^{1}{f(x)dx},$$ derive the two-point Gauss quadrature rule

$\int_{- 1}^{1}{f(x)dx} \approx c_{1}f(x_{1}) + c_{2}f(x_{2})$

Solution

Assuming the formula

$\int_{- 1}^{1}{f(x)dx} = c_{1}f\left( x_{1} \right) + c_{2}f\left( x_{2} \right)\;\;\;\;\;\;\;\;\;\;\;\; (A1.1)$

gives exact values for integrals $$\displaystyle \int_{- 1}^{1}{1dx}$$, $$\displaystyle \int_{- 1}^{1}{xdx}$$, $$\displaystyle \int_{- 1}^{1}{x^{2}{dx}}$$, and $$\displaystyle \int_{- 1}^{1}{x^{3}{dx}}$$ . Then

$\begin{split} &\int_{- 1}^{1}{1{dx}} = 2 = c_{1} + c_{2}\;\;\;\;\;\;\;\;\;\;\;\; (A1.2)\\ &\int_{- 1}^{1}{xdx} = 0 = c_{1}x_{1} + c_{2}x_{2}\;\;\;\;\;\;\;\;\;\;\;\; (A1.3)\\ &\int_{- 1}^{1}{x^{2}{dx}} = \frac{2}{3} = c_{1}{x_{1}}^{2} + c_{2}{x_{2}}^{2}\;\;\;\;\;\;\;\;\;\;\;\; (A1.4)\\ &\int_{- 1}^{1}{x^{3}{dx}} = 0 = c_{1}{x_{1}}^{3} + c_{2}{x_{2}}^{3}\;\;\;\;\;\;\;\;\;\;\;\; (A1.5) \end{split}$

Multiplying Equation (E1.3) by $${x_{1}}^{2}$$ and subtracting from Equation (E1.5) gives

$c_{2}x_{2}\left( {x_{1}}^{2} - {x_{2}}^{2} \right) = 0\;\;\;\;\;\;\;\;\;\;\;\; (A1.6)$

The solution to the above equation is

$\begin{split} c_{2} &= 0 \text{, or/and}\\ x_{2} &= 0\text{, or/and}\\ x_{1} &= x_{2}\text{, or/and}\\ x_{1} &= - x_{2}. \end{split}$

I.  $$c_{2} = 0$$ is not acceptable as Equations (A1.2-A1.5) reduce to $$c_{1} = 2,$$ $$c_{1}x_{1} = 0,$$ $$\displaystyle c_{1}x_{1}^{2} = \frac{2}{3},$$ and $$c_{1}x_{1}^{3} = 0$$. But since $$c_{1} = 2$$, then $$x_{1} = 0$$ from $$c_{1}x_{1} = 0$$, but $$x_{1} = 0$$ conflicts with $$\displaystyle c_{1}x_{1}^{2} = \frac{2}{3}$$.

II. $$x_{2} = 0$$ is not acceptable as Equations (A1.2-A1.5) reduce to $$c_{1} + c_{2} = 2$$, $$c_{1}x_{1} = 0,$$ $$\displaystyle c_{1}x_{1}^{2} = \frac{2}{3},$$ and $$c_{1}x_{1}^{3} = 0$$. Since $$c_{1}x_{1} = 0$$, then $$c_{1}$$ or $$x_{1}$$ has to be zero, but this violates $$\displaystyle c_{1}x_{1}^{2} = \frac{2}{3} \neq 0$$.

III. $$x_{1} = x_{2}$$ is not acceptable as Equations (A1.2-A1.5) reduce to $$c_{1} + c_{2} = 2$$, $$c_{1}x_{1} + c_{2}x_{1} = 0,$$ $$\displaystyle c_{1}x_{1}^{2} + c_{2}{x_{1}}^{2} = \frac{2}{3},$$ and $$c_{1}x_{1}^{3} + c_{2}x_{1}^{3} = 0$$. If $$x_{1} \neq 0$$, then $$c_{1}x_{1} + c_{2}x_{1} = 0$$ gives $$c_{1} + c_{2} = 0$$, and that violates $$c_{1} + c_{2} = 2$$. If $$x_{1} = 0$$, then that violates $$\displaystyle c_{1}x_{1}^{2} + c_{2}{x_{1}}^{2} = \frac{2}{3} \neq 0$$.

That leaves the solution of $$x_{1} = - x_{2}$$ as the only possible acceptable solution, and in fact, it does not have violations (see it for yourself)

$x_{1} = - x_{2}\;\;\;\;\;\;\;\;\;\;\;\; (A1.7)$

Substituting (A1.7) in Equation (A1.3) gives

$c_{1} = c_{2}\;\;\;\;\;\;\;\;\;\;\;\; (A1.8)$

From Equations (A1.2) and (A1.8),

$c_{1} = c_{2} = 1\;\;\;\;\;\;\;\;\;\;\;\; (A1.9)$

Equations (A1.4) and (A1.9) gives

${x_{1}}^{2} + {x_{2}}^{2} = \frac{2}{3}\;\;\;\;\;\;\;\;\;\;\;\; (A1.10)$

Since Equation (A1.7) requires that the two results be of opposite sign, we get

$\begin{split} &x_{1} = -\frac{1}{\sqrt{3}}\\ &x_{2} = \frac{1}{\sqrt{3}} \end{split}$

or

$\begin{split} &x_{1} = \frac{1}{\sqrt{3}}\\ &x_{2} = -\frac{1}{\sqrt{3}} \end{split}$

Both these solutions though lead to a unique solution as

$\begin{split} \int_{- 1}^{1}{f(x){dx}} &= c_{1}f(x_{1}) + c_{2}f(x_{2})\;\;\;\;\;\;\;\;\;\;\;\; (A1.11)\\ &= 1f\left( - \frac{1}{\sqrt{3}} \right) + 1f\left( \frac{1}{\sqrt{3}} \right)\\ &= f\left( - \frac{1}{\sqrt{3}} \right) + f\left( \frac{1}{\sqrt{3}} \right) \end{split}$

### Example A.2

What would be the formula for

$\int_{a}^{b} f(x) d x=c_{1} f(a)+c_{2} f(b)$

if you want the above formula to give you exact values of integral $$\displaystyle \int_{a}^{b}{\left( a_{0}x + b_{0}x^{2} \right){dx}},$$ that is, a linear combination of $$x$$ and $$x^{2}$$.

Solution

If the formula is exact for a linear combination of $$x$$ and $$x^{2}$$, then

$\begin{split} &\int_{a}^{b} x d x=\frac{b^{2}-a^{2}}{2}=c_{1} a+c_{2} b\\ &\int_{a}^{b}{x^{2}{dx} = \frac{b^{3} - a^{3}}{3} = c_{1}a^{2} + c_{2}b^{2}}\;\;\;\;\;\;\;\;\;\;\;\; (A2.1) \end{split}$

Solving the two Equations (A2.1) simultaneously gives

$\left[\begin{array}{cc} a & b \\ a^{2} & b^{2} \end{array}\right]\left[\begin{array}{l} \mathrm{c}_{1} \\ \mathrm{c}_{2} \end{array}\right]=\left[\begin{array}{l} \frac{b^{2}-a^{2}}{2} \\ \frac{b^{3}-a^{3}}{3} \end{array}\right]$

$\begin{split} c_{1} &=-\frac{1}{6} \frac{-a b-b^{2}+2 a^{2}}{a}\\ c_{2} &= - \frac{1}{6}\frac{a^{2} + {ab} - 2b^{2}}{b}\;\;\;\;\;\;\;\;\;\;\;\; (A2.2) \end{split}$

So

$\int_{a}^{b}{f(x){dx} = - \frac{1}{6}\frac{- {ab} - b^{2} + 2a^{2}}{a}f(a) - \frac{1}{6}\frac{a^{2} + {ab} - 2b^{2}}{b}f(b)}\;\;\;\;\;\;\;\;\;\;\;\; (A2.3)$

Let us see if the formula works.

Evaluate $$\displaystyle \int_{2}^{5}{\left( 2x^{2} - 3x \right){dx}}$$ using Equation (A2.3)

$\begin{split} \int_{2}^{5}{\left( 2x^{2} - 3x \right){dx}} &\approx c_{1}f(a) + c_{2}f(b)\\ &= - \frac{1}{6}\frac{- (2)(5) - 5^{2} + 2(2)^{2}}{2}\left\lbrack 2(2)^{2} - 3(2) \right\rbrack - \frac{1}{6}\frac{2^{2} + 2(5) - 2(5)^{2}}{5}\lbrack 2(5)^{2} - 3(5)\rbrack\\ &= 46.5 \end{split}$

The exact value of $$\displaystyle \int_{2}^{5}{\left( 2x^{2} - 3x \right){dx}}$$ is given by

$\begin{split} \int_{2}^{5}\left( 2x^{2} - 3x \right){dx} &= \left\lbrack \frac{2x^{3}}{3} - \frac{3x^{2}}{2} \right\rbrack_{2}^{5}\\ &= 46.5 \end{split}$

Any surprises?

Now evaluate $$\displaystyle \int_{2}^{5}{3dx}$$ using Equation (A2.3)

$\begin{split} \int_{2}^{5}{3dx} &\approx c_{1}f(a) + c_{2}f(b)\\ &= - \frac{1}{6}\frac{- 2(5) - 5^{2} + 2(2)^{2}}{2}(3) - \frac{1}{6}\frac{2^{2} + 2(5) - 2(5)^{2}}{5}(3)\\ &= 10.35 \end{split}$

The exact value of $$\displaystyle \int_{2}^{5}{3dx}$$ is given by

$\begin{split} \int_{2}^{5}{3dx} &= \left\lbrack 3x \right\rbrack_{2}^{5}\\ &= 9 \end{split}$

Because the formula will only give exact values for linear combinations of $$x$$ and $$x^{2}$$, it does not work exactly even for a simple integral of $$\displaystyle \int_{2}^{5}{3dx}$$.

Do you see now why we chose $$a_{0} + a_{1}x$$ as the integrand for which the formula

$\int_{a}^{b}{f(x)dx \approx \ }c_{1}f(a) + c_{2}f(b)$

gives us exact values?

## Multiple Choice Test

(1). $$\displaystyle \int_{5}^{10}{f(x)dx}$$ is exactly

(A)  $$\displaystyle \int_{- 1}^{1}{f(2.5x + 7.5)\ dx}$$

(B)  $$\displaystyle 2.5\int_{- 1}^{1}{f(2.5x + 7.5)\ dx}$$

(C)  $$\displaystyle 5\int_{- 1}^{1}{f(5x + 5)\ dx}$$

(D)  $$\displaystyle 5\int_{- 1}^{1}{(2.5x + 7.5)f(x)\ dx}$$

(2). For a definite integral of any third order polynomial, the two-point Gauss quadrature rule will give the same results as the

(A) $$1$$-segment trapezoidal rule

(B) $$2$$-segment trapezoidal rule

(C) $$3$$-segment trapezoidal rule

(D) Simpson’s $$1/3$$ rule

(3). The estimated value of $$\displaystyle \int_{0.2}^{2.2}{xe^{x}{dx}}$$ by using the two-point Gauss quadrature rule is most nearly

(A) $$11.672$$

(B) $$11.807$$

(C) $$12.811$$

(D) $$14.633$$

(4). A scientist uses the one-point Gauss quadrature rule based on getting exact results of integration for functions $$f(x) = 1$$ and $$x$$. The one-point Gauss quadrature rule approximation for $$\displaystyle \int_{a}^{b}{f(x)dx}$$ is

(A) $$\displaystyle \frac{b - a}{2}\left\lbrack f(a) + f(b) \right\rbrack$$

(B) $$\displaystyle (b - a)f\left( \frac{a + b}{2} \right)$$

(C) $$\displaystyle \frac{b - a}{2}\left\lbrack f\left( \frac{b - a}{2}\left\{ - \frac{1}{\sqrt{3}} \right\} + \frac{b + a}{2} \right) + f\left( \frac{b - a}{2}\left\{ \frac{1}{\sqrt{3}} \right\} + \frac{b + a}{2} \right) \right\rbrack$$

(D) $$(b - a)f(a)$$

(5). A scientist develops an approximate formula for integration as

$\displaystyle \int_{a}^{b}{f(x)dx \approx c_{1}f(x_{1}),}\ \text{where}\ a \leq x_{1} \leq b$

The values of $$c_{1}$$ and $$x_{1}$$ are found by assuming that the formula is exact for functions of the form $$a_{0}x + a_{1}x^{2}$$. The resulting formula would therefore be exact for integrating

(A) $$f(x) = 2$$

(B) $$f(x) = 2 + 3x + 5x^{2}$$

(C) $$f(x) = 5x^{2}$$

(D) $$f(x) = 2 + 3x$$

(6). You are asked to estimate the water flow rate in a pipe of radius $$2 m$$ at a remote area location with a harsh environment. You already know that velocity varies along the radial location, but you do not know how it varies. The flow rate $$Q$$ is given by

$\displaystyle Q = \int_{0}^{2}{2\pi rVdr}$

To save money, you are allowed to put only two velocity probes (these probes send the data to the central office in New York, NY via satellite) in the pipe. Radial location, $$r$$ is measured from the center of the pipe, that is, $$r = 0$$. Radial location, $$r = 2m$$ is at the pipe radius. The radial locations you would suggest for the two velocity probes for the most accurate calculation of the flow rate are

(A) $$0\ \text{m}, 2\ \text{m}$$

(B) $$1\ \text{m}, 2\ \text{m}$$

(C) $$0\ \text{m}, 1\ \text{m}$$

(D) $$0.42\ \text{m}, 1.58\ \text{m}$$

For the complete solution, go to

## Problem Set

(1). Find the value of the integral $$\displaystyle \int_{1}^{5}{7e^{- 2t}}{dt}$$ using

a)  2-point Gaussian quadrature rule,

b)  3-point Gaussian quadrature rule.

Answer: $$a)\ 0.35285$$
$$b)\ 0.45812$$

(2). The upward velocity of a rocket is given by

$v(t) = 200\ln(t + 1) - 10t,\ t > 0$

where $$t$$ is given in seconds and $$v$$ is given in m/s.

a)  Use 2-point Gauss quadrature rule to calculate the distance covered by the rocket from $$t = 0\ \text{s}$$ to $$t = 5\ \text{s}$$.

b)  What is the true value of the distance covered by the rocket from $$t = 0\ \text{s}$$ to $$t = 5\ \text{s}$$?

c)  What is the true error in part (a)?

d)  What is the relative true error in part (a)?

e)  What is the absolute relative true error in percentage for part (a).

f)  Use 3-point Gauss quadrature rule to calculate the distance covered by the rocket from $$t = 0\ \text{s}$$ to $$t = 5\ \text{s}$$.

Answer: $$a)\ 1034.6\ \text{m}$$
$$b)\ 1025.1\ \text{m}$$
$$c)\ -9.4458\ \text{m}$$
$$d)\ -0.0092144$$
$$e)\ 0.92144\%$$
$$f)\ 1026.2\ \text{m}$$

(3). The velocity of a body is given by

$v(t) = t + 1,\ 0 < t < 2,$ $= 33,\ 2 < t < 5$

where the velocity, $$v(t)$$ is given in m/s and $$t$$ is in seconds.

a)  Find the distance covered by the body between $$1 < t < 1.9\ \text{s}$$ by using the two-point Gauss quadrature rule. Find the absolute relative true error.

b)  Find the distance covered by the body between $$1 < t < 3.9\ \text{s}$$ by using the four-point Gauss quadrature rule. Find the absolute relative true error.

Answer: $$a)\ 2.2049,\ 0\%$$
$$b)\ 51.75,\ 20.62\% (exact=65.2)$$

(4). The one-point Gauss quadrature rule is defined as

$\int_{a}^{b}{f(x)dx} \approx c_{1}f(x_{1}),\ a \leq x_{1} \leq b$

The values of $$c_{1}$$ and $$x_{1}$$ are found by assuming that the one-point formula is exact for any first order polynomial. Find $$c_{1}$$ and $$x_{1}$$ in the above one-point Gauss quadrature rule.

Answer: $$c_1 = b-a,\ x_1 = \displaystyle \frac{b+a}{2}$$

(5). A scientist develops an approximate formula for integration as

$\int_{a}^{b}{f(x)dx} \approx c_{1}f(x_{1}),\ \text{where}\ a \leq x_{1} \leq b$

The values of $$c_{1}$$ and $$x_{1}$$ are found by assuming that the formula is exact for the functions of the form $$a_{0}x + a_{1}x^{2}$$ polynomial. Find $$c_{1}$$ and $$x_{1}$$.

Answer: $$x_1 = \displaystyle \frac{2(b^2+a^2+ab)}{3(b+a)}$$

$$c_1 = \displaystyle \frac{3(b-a)(b+a)^2}{4(b^2+a^2+ab)}$$

(6). A scientist develops an approximate formula for integration as

$\int_{a}^{b}{f(x)dx} \approx c_{1}f(a) + c_{2}f(b).$

The values of $$c_{1}$$ and $$c_{2}$$ are found by assuming that the formula is exact for the functions of the form $$a_{0}x + a_{1}x^{2}$$ polynomial.

a)  Find the values of $$c_{1}$$ and $$c_{2}$$.

b)  Verify the formula works exactly for the integral $\int_{2}^{7}{(3x^{2} + 5x)dx}$

c)  Verify the formula does not work exactly for the integral of $\int_{2}^{7}{2dx}$

Answer: $$a)\ \displaystyle c_1 = -\frac{1}{6}\frac{-ab-b^2+2a^2}{a},\ c_2 = -\frac{1}{6}\frac{a^2+ab-2b^2}{b}$$

b) $$447.50$$ by formula as well as exact method

c) $$12.976$$ by formula; $$10$$ by exact method