Rothstein
Rothstein
Quadrature
Margo Rothstein
Georgia College and State University
May 3, 2018
1 Abstract
This paper provides a detailed exploration of the comparison of the Gaussian Quadrature
and the Trapezoid Rule. They are both numerical methods that are used to approximate
integrals. The Gaussian Quadrature is a much better approximation method than the
Trapezoid Rule. We will prove and demonstrate the approximating power of both rules,
and provide some practical applications of the rules as well.
2 Introduction
Integration is the calculation of the the theorem states the following:
area under the curve a function f (x). The
integral of f produces a family of an- Z b
tiderivatives F (x)+c that is used to calculate f (x)dx = F (b) − F (a).
the area, denoted by, a
Z
f (x)dx. There are many methods developed to find
F (x) that will produce the exact area. These
A definite integral calculates the area under methods include integration by parts, par-
the curve of a function f (x) on a specific in- tial fraction decomposition, change of vari-
terval [a, b], denoted by, ables, and trig substitution. However, there
are some functions that can not be inte-
Z b grated exactly. They must be approximated.
f (x)dx. We will discuss two approximation methods
a
in numerical analysis called the Trapezoid
The Fundamental Theorem of Calculus is Rule and the Gaussian Quadrature. The
how a definite integral should be calculated; definition of a Quadrature rule for nodes
1
x1 < x2 < x − 3 < · · · < xn is
Z b Xn
f (x)dx ≈ ci f (xi ).
a i=1
A closed quadrature rule means that f (x)
is evaluated at the endpoints. An open
quadrature rule is when f (x) is not evalu-
ated at the endpoints.
3 Trapezoid Rule
The Trapezoid Rule is a closed rule will format the area of the trapezoid so
Quadrature rule where f (x) is only evalu- that it matches the definition. Note the fol-
ated at the endpoints a and b on the inter- lowing:
val [a, b]. Visually on a graph, we see the Z b
f (a) + f (b)
line that passes through points (a, f (a)) and f (x)dx = (b − a)
a 2
(b, f (b)), which forms a trapezoid with the
x-axis. Thus, the area under the curve can (b − a)
= (f (a) + f (b))
be approximated by the area a Trapezoid, as 2
shown in Figure 1. (b − a) (b − a)
= f (a) + f (b)
2 2
Figure 1 = c1 f (a) + c2 f (b)
y 2
X
= ci f (xi ).
i=1
2
on x0 and x1 . For a linear function f (x) = tions, we will see how the coefficients and
kx + C for some constants k and C, the nodes of the Gaussian Quadrature are spe-
second derivative f 00 (x) = 0. Therefore, cially chosen to produce high accuracy for
whenever f (x) is a linear function, the er- higher degree polynomials. First, we will ex-
ror will be zero and thus the approximation plore some underlying information about the
will be exact. In the next couple of sec- Legendre Polynomials.
Before we learn about the Gaussian why the property of orthogonal functions is
Quadrature, we need to understand the Leg- valuable for the Gaussian Quadrature.
endre Polynomials. The Legendre Poly-
nomials are a set of nonzero polynomials Theorem (1): If {p1 , p2 , ..., pn } is a set of
S = {P1 (x), P2 (x), P3 (x) . . . } that are or- nonzero orthogonal polynomials on the
thogonal on the interval [−1, 1]. By the def- closed interval [a, b] where the degree of
inition of orthogonal, every p i = i for i ∈ {1, 2, ..., n}, then every
( pi has i distinct roots on the interval (a, b).
Z 1
= 0 if i 6= j
Pi (x)Pj (x)dx = By Theorem (1), every Pi (x) ∈ S has i dis-
−1 6= 0 if i = j.
tinct roots on [−1, 1]. We will refer back to
The next Theorem will help us understand these roots in the following section.
3
q q
that 1
and − 13 are the roots of the 2nd a given n, the Gaussian Quadrature is exact
3
degree Legendre polynomial. When we ex- up to polynomials of degree 2n − 1. Clearly,
tend this example to the general nth case, this is a much more accurate method than
we obtain that each xi is a root of the ith the Trapezoid Rule. Table 1 gives the roots
Legendre polynomial. and coefficients up to n = 4.
R1
R1 −1 dx = c1 + c2 + . . . +cn = 2
−1 xdx
= c1 x1 + c2 x2 + . . . +cn xn = 0 Table 1
R 1 2n−2 ... n xi ci
2n−2
−1 x dx = c1 x 1 + . . . +cn xn2n−2 = 2 √1 1
3
1 (−1)2n−1 −1
2n−1 − 2n−1
√ 1
q3
3 5
R1 3 −
−1 x
2n−1 dx = c1 x2n−1
1 + . . . +cn xn2n−1 = 5 9
8
1
− (−1)2n q0 9
2n 2n 3 5
q 5√ 9
√
We have that the Gaussian Quadrature
4 − 15+2 30 90−5 30
is a linear combination of the function f (x) q 35√ 180
√
evaluated at the roots of the nth Legendre − 15−2
35
30 90+5 30
180
√ √
polynomial. In the nth case shown, we can
q
15−2 30 90+5 30
see that the degree of the last polynomial in 35 180
q √ √
15+2 30 90−5 30
the series of equations is 2n − 1. Hence, for 35 180
5 Comparison of Applications
We will look at a simple example that Now, we show the result from the Gaussian
will demonstrate the accuracy of the Gaus- Quadrature with two points.
sian Quadrature and the Trapezoid Rule. r r
1
Consider the integral of f (x) = x2 from
Z
2 1 2 1 2 1 1 2
x dx = ( ) + (− ) = + = .
[−1, 1]. The exact value of this integral can −1 3 3 3 3 3
be found by the standard integration rule for
polynomials. We see that the Gaussian Quadrature pro-
duced the exact answer, while the Trapezoid
1
x3 1 −1 Rule was off by 43 .
Z
1 2
x2 dx = | = −( )= .
−1 3 −1 3 3 3
Consider the integral of a function f (x)
The next integral is the result from using the on [a, b] 6= [−1, 1]. The integral is not
Trapezoid Rule. given on [−1, 1], and therefore the Gaussian
Quadrature cannot be applied directly to it.
Z 1
(1 − (−1)) We must use a substitution for x in order
x2 dx = ((−1)2 +(1)2 ) = (1)(2) =
to2.normalize the function onto [−1, 1]. Let
−1 2
4
a = k1 t1 + k2 and b = k1 t2 + k2 , where t1 interval is half of [−1, 1].
and t2 are the upper and lower bounds of the Z 1 Z 1
−1 1 1 1
interval we want to normalized [a, b] to. In tan (x)dx = tan−1 ( t + ) dt
0 −1 2 2 2
this particular case, [t1 , t2 ] = [−1, 1]; that is, r r
t1 = −1 and t2 = 1. Note that adding and = 1 (tan−1 ( 1 ( 1 )) + 1 ) + 1 (tan−1 ( 1 (− 1 )) + 1 )
subtracting a and b yield the following: 2 2 3 2 2 2 3 2
√ √
1 3 + 3 1 − 3 + 3
= (tan−1 ( )) + (tan−1 ( ))
2 6 2 6
a + b = −k1 + k2 + k1 + k2 = 2k2 ,
≈ 0.4380.
a − b = −k1 + k2 − k1 − k2 = −2k1 .
The error is |0.4388 − 0.4380| ≈ 0.0008.
Therefore, k1 = b−a a+b
2 and k2 = 2 . Hence,
the general x = k1 t + k2 = b−a a+b
2 t + 2 . We
will demonstrate this substitution an the ex- 6 Other Applications
ample where f (x) = ln(x) and [a, b] = [1, 2].
6.1 Improper Integrals
2 1
b−a a + b b − aThe Gaussian Quadrature can be used on
Z Z
ln(x)dx = ln(( t) + ( ))( )dt
1 −1 2 2 2 convergent improper integrals. Consider the
Z 1
t+3 1 following convergent improper integral,
= )( )dt.
ln(
−1 2 2 Z 1 − cos x2
e
q
1
q
1 2
dx.
3 + 3 1 − 3 +3 1 −1 1 − x
= (1) ln( ) + (1) ln( )
2 2 2 2 This function is not exactly integrable us-
≈ 0.09585 + 0.29073 ing standard integration methods, and thus
≈ 0.38658. we need to use a Quadrature rule. Note
− cos x2
that the function f (x) = e 1−x2 is unde-
fined at x = 1 and x = −1. Therefore,
This integral can be exactly solved by us-
a closed Quadrature Rule is not applicable
ing integration by parts, which yeilds ≈
to approximate this integral. The Gaussian
0.38629. The error between the Gaus-
Quadrature is an excellent choice for the ap-
sian Quadrature and the real result is ≈
proximation method due to high accuracy
|0.38629 − 0.38658| = 0.00029. The error is
and no issues with the domain on which we
very close to 0. The Trapezoid Rule yeilds,
evaluate f (x) since for every xi is such that
2
−1 < xi < 1. Table 2 shows the evaluations
2−1
Z
ln(x)dx = (ln(1) + ln(2)) ≈ 0.3465. of the improper integral with increasing val-
1 2 ues of n. The approximations improve as
n → ∞.
The error is |0.38629 − 0.3465| = 0.0397 >
0.00029.
Consider f (x) = tan−1 (x) on [0, 1]. The
5
Table 2 n Gaussian Quadrature
2 1.0597
3 1.1868
4 1.2536
5 1.2954
6 1.3242
7 1.3453
8 1.4364
9 1.3739
10 1.3842
11 1.3926
12 1.3997
Z b Z b −(x−µ)2
1 −3 −2 −1 0 1 2 3
P (a ≤ x ≤ b) = ρdx = √ e 2σ 2 dx Standard deviations
a σ 2π a
6
As shown in Table 3, the approximation is We now display Table 4, showing values ob-
exactly what was desired. Table 4 shows the tained from the Gaussian Quadrature.
approximated values for three other inter-
vals, the integral for which we needed the Table 4
substitution, n (-2,-3) (1,3) (0,2)
Z b Z 1 −( b−a t+ a+b )2
2 2 b−a 2 0.0214 0.1594 0.4798
ρdx = e 2 ( )dt. 3 0.0214 0.1573 0.4771
a −1 2
4 0.0215 0.1573 0.4773
The following are values of density from the
standard distribution table:
P (−2 ≤ x ≤ −3) ≈ 0.0215
P (1 ≤ x ≤ 3) ≈ 0.0.1574
P (0 ≤ x ≤ 2) ≈ 0.47725
7 Conclusion
Our detailed exploration of the Trape- where in mathematics, physics, engineering,
zoid Rule and the Gaussian Quadrature has economics, and any other math-related field.
explicitly exhibited the high approximating This method is a very good one to keep
power of the Gaussian Quadrature verses the in the back pocket of many mathematical
Trapezoid Rule. Integrals show up every- projects.
8 References
(1) Sauer, T.(2012). Numerical Analysis. (2nd ed.). Pearson Higher Ed, 2012.
(2) Mughal, A. M., Ye, X., and Iqbal, K.,(2006). Computational Algorithm for Higher
Order Legendre Polynomial and Gaussian Quadrature Method. ResearchGate.
(3) Patra, P., Das, D., Dash B. (2017). A comparative study of Gauss-Laguerre quadrature
and an open type mixed quadrature by evaluating some improper integrals. Turkish Journal
of Mathematics. John Wiley.
(4) Lowan, A., Davids, N., Levenson, A. Table of the Zeros of the Legendre Polynomials
of order 1-16 and the weight coefficients for Gauss Mechanical Quadrature formula. New
York City, USA.