Chapter 5

Numerical integration

In this chapter, we study how to approximate the definite of some smooth functions. An idea is to use an interpolating F (x) to evaluate the integral. Thus we have

b b f(x) dx F (x) dx. ≈ Za Za Our purpose is how to design such an interpolation so that the error is mini- mized.

5.1 Closed Newton-Cotes Formulas

We would like to design a quadrature for the following integral:

b f(x) dx. Za

One point formula: If F (x) is a constant interpolation at x0, then the above integral is approximated by (b a)f(x ) called a rectangle rule. One can − 0 show that there exist ξ0 and ξ0 in [a, b] such that the following hold.

2 b (b a) b+a (b a)f(x0)+ −2 f ′(ξ0), if x0 = 2 f(x) dx = − 3 6 (5.1) (b a) b+a a (b a)f(x )+ − f (ξ ), if x = . Z  − 0 24 ′′ 1 0 2 Thus one point formula is exact for constant polynomial(except mid point rule), so it is called a 0-th order method.

1 2 CHAPTER 5.

Two point formula-trapezoidal rule:

b b a (b a)3 f(x) dx = − (f(a)+ f(b)) − f ′′(ξ). (5.2) 2 − 12 Za This is exact for linear , hence it is a first order method.

Newton-Cotes Rules

Assume we have nodes x , ,x in [a, b] are equally spaced. We use an 0 · · · n interpolating polynomial p(x) to replace the integral.

b b n n f(x) dx p(x) dx = cip(xi)= cif(xi). a ≈ a Z Z Xi=0 Xi=0 For example, if we use the Lagrange interpolating polynomial, we have

n pn(x)= f(xi)Ln,i(x), (5.3) Xi=0 where n (x xj) Ln,i(x)= − , 0 i n. (xi xj) ≤ ≤ i=i Y6 − We let b n b n f(x) dx f(xi) Ln,i(x) dx = Bn,if(xi), a ∼ a Z Xi=0 Z Xi=0 where b Bn,i = Ln,i(x) dx. Za This is the Newton-Cotes formula. If x0 = a and xn = b, then we say it is a closed Newton-Cotes formula. Otherwise, it is called an open Newton-Cotes formula. Mid point rule is an open Newton-Cotes formula.

Three point formula-Simpson rule

Use an interpolation at three equally spaced points x0,x1,x2 : Let

x2 x2 f(x) dx p (x) dx, (5.4) ≈ 2 Zx0 Zx0 5.1. CLOSED NEWTON-COTES FORMULAS 3 where p2(x) is the Lagrange interpolation. For simplicity, we assume x0 = h, x = 0 and x = h. Then − 1 2 x(x h) (x + h)(x h) (x + h)x p = f(x ) − + f(x ) − + f(x ) . 2 0 2h2 1 h2 2 2h2 − Integrating, we obtain

h 1 2 2 = 2 (f0 2f1 + f2)x + ( hf0 + hf2)x + 2h dx h 2h − − Z− 1 h3   = (f 2f + f ) + 4h3f 2h2 3 0 − 1 2 1   h = (f + 4f + f ). 3 0 1 2

Hence we get the following rule, called the Simpson’s rule

x2 h f(x) dx (f(x ) + 4f(x )+ f(x )) s (f). (5.5) ∼ 3 0 1 2 ≡ 1 Zx0 One can readily check that this is exact for a polynomial up to degree three, even if we used a quadratic polynomial approximation. Hence this is a third order method. In fact one can show that

x2 h h5 f(x) dx = (f(x ) + 4f(x )+ f(x )) f (4)(ξ ), ξ [x ,x ]. (5.6) 3 0 1 2 − 90 1 1 ∈ 0 2 Zx0 Similar phenomenon arises for all even n. Derive formula for n = 3 and n = 4.

Error of numerical integration

We consider Newton-Cotes formula. We assume the following situation:

Let a x0

(n) (n+1) f (x0) n f (ξ) n+1 f(x)= f(x )+ f ′(x )(x x )+ + (x x ) + (x x ) 0 0 − 0 · · · n! − 0 (n + 1)! − 0 or Newton’s interpolating polynomial pn(f)= f(x0)+f[x0,x1](x x0)+ +f[x0,x1, ,xn](x x0) (x xn 1). − · · · · · · − · · · − − 4 CHAPTER 5. NUMERICAL INTEGRATION

By the error formula, we have

f(x)= p (f)+ f[x ,x , ,x ,x](x x ) (x x ). n 0 1 · · · n − 0 · · · − n

Integrating the error term of Newton’s formula we have

n n b b f (n+1)(ξ) E(f)= f[x0,x1, ,xn,x] (x xi)dx = (x xi)dx. a · · · − a (n + 1)! − Z Yi=0 Z Yi=0 Since the term n (x x ) does not change sign on each subinterval (x ,x ), i=0 − i s s+1 we can use meanQ value theorem to see the above quantity is

(n+1) ¯ xs+1 n (n+1) ¯ f (ξs) f (ξs) n+2 (x xi)dx = O(h ), (n + 1)! xs − (n + 1)! × Z Yi=0 for some ξ¯ (x ,x ). A more precise error formula is as follows:(See s ∈ s s+1 Issacson-Keller)

Theorem 5.1.1. The error by Newton-Cotes formula is

n f (n+2)(ξ¯) b (x x ) (x x )dx, if n is even (n + 2)! − 0 − i  Za i=0 E(f)=  (n+1) b n Y (5.7)  f (ξ¯)  (x xi)dx, if n is odd. (n + 1)! − Za i=0  Y  As noted earlier, we have one higher order of accuracy for even n.

Semi-Simpson rule

If n is odd, we can approximate

xn−1 f(x) dx Zx0 by Simpson’s rule, but to apply Simpson’s rule to

xn f(x) dx Zx0 we split the integral into two parts:

xn xn−1 xn f(x) dx = f(x) dx + f(x) dx Zx0 Zx0 Zxn−1 5.1. CLOSED NEWTON-COTES FORMULAS 5 and we can apply Simpson’s rule to the first integral. But how to approximate the second integral (we need the same order method)?

One idea is to add an extra point, say xn 2 and use a quadratic interpo- − lation:

(x xn 1)(x xn) (x xn 2)(x xn) (x xn 2)(x xn 1) p2(x)= fn 2 − − − +fn 1 − − − +fn − − − − . − ( h)( 2h) − (h)( h) (2h)(h) − − −

Change of variable: x xn 1 = th gives − − (t 1)(t 2) t(t 1) p2(x)= fn 2 − − fn 1t(t 2) + fn − . − 2 − − − 2

Thus

xn 2 (t 1)(t 2) t(t 1) f(x) dx h fn 2 − − fn 1t(t 2) + fn − dt ≈ − 2 − − − 2 Zxn−1 Z1 h = ( f(xn 2) + 8f(xn 1) + 5f(xn)). 12 − − −

x1 Ex. Derive an integration rule for x0 f(x) dx using the data at x0,x1 and x (assume h = x x = x x .) 2 1 − 0 2 − 1 R

Composite Simpson’s rule

If the domain is large, divide it by even number of intervals and applying Simpson’s rule to a pair of subintervals, one can find a more accurate approx- imation. Let x = a + ih, h = (b a)/2n. Then i −

b x2 x4 x2n f(x) dx = f(x) dx + f(x) dx + + f(x) dx. · · · Za Zx0 Zx2 Zx2n−2 If Simpson’s rule is used for each integral, we obtain

n b h f(x) dx [f(x2i 2) + 4f(x2i 1)+ f(x2i)]. a ∼ 3 − − Z Xi=1 To avoid repetitions it is rearranged as

n n h f(x0) + 2 f(x2i 2) + 4 f(x2i 1)+ f(x2n) . 3 " − − # Xi=2 Xi=1 6 CHAPTER 5. NUMERICAL INTEGRATION

5.2 Open Newton-Cotes Formulas

b We consider approximation of integral a f(x)dx by interpolating at n + 1 interior points R

x = a + h, x = a + 2h, ,x = a + (n + 1)h. 0 1 · · · n

Here h = (b a)/(n+2).This rule is useful when we cannot use or do not want − to use end points.

3 (1) n = 0 : b f(x)dx 2hf(x ). Error: h f (ξ) a ≈ 0 3 ′′ R 3 (2) n = 1 : b f(x)dx 3h (f(x )+ f(x )). Error: 3h f (ξ) a ≈ 2 0 1 4 ′′ R 5 (3) n = 2 : b f(x)dx 4h (2f(x ) f(x ) + 2f(x )). Error: 14h f (4)(ξ) a ≈ 3 0 − 1 2 45 R Notice that even cases are more accurate. How to find the coefficients? One way is to integrate the Lagrange inter- polation b n f(x) dx wif(xi), (5.8) a ∼ Z Xi=0 where b wi = Ln,i(x) dx. Za Another method is to let the formula (5.8) be exact for all monomials xi, (i = 0, 1, ,n.) For n = 3 · · · b 5h f(x) dx (11f(x )+ f(x )+ f(x ) + 11f(x )) (5.9) ∼ 24 0 1 2 3 Za Remark 5.2.1. In general, open Cotes rules are used much less than the closed rule. However, there are instances where end points not available.

5.3 Gaussian quadrature-unequal intervals

We now consider a quadrature with unequal intervals. Check that the quadra- ture 1 . 1 1 f(x) dx = f( )+ f( ) 1 − 3 3 Z− r r 5.3. GAUSSIAN QUADRATURE-UNEQUAL INTERVALS 7 is exact up to degree 3. The degree of precision of the following quadrature is 5. 1 . 5 3 8 5 3 f(x) dx = f( )+ f(0) + f( ). 1 9 − 5 9 9 5 Z− r r General three point formula with weight is of the form:

α0f(β0)+ α1f(β1)+ α2f(β2).

More generally, we consider

b n f(x)w(x)dx Aif(xi), (5.10) a ≈ Z Xi=0 where w is a fixed positive weight . Here we have freedom of choice of xi as well as the coefficients. This weight may be useful if we need to evaluate an integral of functions of the form g(x)= f(x)w(x). This formula is exact for polynomial of degree up to n if and only if(let f(x)= Ln,i(x)) b n x xj Ai = w(x) − dx. xi xj Za j=i Y6 − Note that there are no restrictions on the nodes. By placing nodes at proper places, we can obtain 2n + 1 order of approximation.

Example 5.3.1. Let w(x) = (1 x2) 1/2. Then − − n 1 f(x) π dx f(x ) 2 1/2 k 1 (1 x ) ≈ n + 1 Z− − Xk=0 with x = cos( (k+1/2)π ), k = 0, ,n is exact for a polynomial degree up to k n+1 · · · 2n + 1.

Example 5.3.2. With n = 1 on [ 1, 1], x = cos(π/4) = 1/√2 and x = − 0 1 cos(3π/4) = 1/√2. So − 1 x2 π dx (f(x )+ f(x )) 2 1/2 0 1 1 (1 x ) ≈ 2 Z− − π 1 1 = ( + ) 2 2 2 π = . 2 8 CHAPTER 5. NUMERICAL INTEGRATION

It can be shown that this is exact.

Inner Product Space

We define the inner product of functions w.r.t a (positive) weight function w(x) over an interval [a, b]. Given f, g V (V is a vector space of functions ∈ defined over [a, b]), let

b (f, g)= f(x)g(x)w(x) dx. (5.11) Za It can easily be shown that it satisfies usual properties of inner product:

(1) (f,f) 0 for all f and (f,f) = 0 only if f = 0. ≥ (2) (f, g) = (g,f)

(3) (αf + βf,h)= α(f, h)+ β(g, h) for scalar α, β.

If V = Pn the set of all polynomials degree less than equal to n. The obvious basis for V is 1,x,x2, ,xn . But we would like to have an orthogonal basis. { · · · } Thus we use Gram-Schmidt process. Let w(x) = 1, [a, b] = [ 1, 1] and −

m = 1,m = x,m = x2, ,m = xn. 0 1 2 · · · n

We find p0 = 1 and

(p0,m1) p1(x) = m1 p0(x) − (p0,p0) 1 1 = x ( 1 xw(x) dx) 1 − 2 1 · · = x Z−

(p0,m2) (p1,m2) p2(x) = m2 p0(x) p1(x) − (p0,p0) − (p1,p1) 1 1 2 1 2 1 2 = x ( 1 x dx) 1 ( p1 x dx) p1(x) − 2 1 · · − (p1,p1) 1 · · Z− Z− 1 = x2 − 3

Note these are not normalized. 5.3. GAUSSIAN QUADRATURE-UNEQUAL INTERVALS 9

Theorem 5.3.3. Let q be a nonzero polynomial of degree n + 1 which is orthogonal to P (the set of all polynomials of degree n) with respect to the n ≤ weight w, i.e, we have

b q(x)p(x)w(x)dx = 0, for all p(x) P . ∈ n Za If x ,x , ,x are the zeros of q, then the quadrature formula (5.10) is exact 0 1 · · · n for all f P . ∈ 2n+1 Proof. Let f P . Dividing f by q, we obtain the quotient p and remainder ∈ 2n+1 r. Hence f = qp + r (degree of p and ,r

b b n n fwdx = rw dx = Air(xi)= Aif(xi). a a Z Z Xi=0 Xi=0

Now the remaining task is to find and their zeros. Fortunately, some cases are well-known: Let [ 1, 1]. Then with w = 1, the − are ortho-normal polynomials on [ 1, 1]. i.e, − 1 pn(x)pm(x) dx = δnm. 1 Z−

1 3 p0(x) = , p1(x)= x √2 r2 5 1 2 7 1 3 p2(x) = (3x 1), p3(x)= (5x 3x) r2 2 − r2 2 − 9 1 4 2 11 1 5 3 p4(x) = (35x 30x + 3), p5(x)= (63x 70x + 15x) r2 8 − r 2 8 − 13 1 6 4 2 p6(x) = (7 33x 63 5x + 35 3x 5) r 2 24 · − · · − ,..., 1 1/2 1 dn p (x) = n + (x2 1)n. n 2 n! 2n dxn −   10 CHAPTER 5. NUMERICAL INTEGRATION

Exercise 5.3.4. Let

1 dn Φ (x)= (x2 1)n n n! 2n dxn −

Then

(1) Φ (1) = 1, Φ ( 1) = ( 1)n n n − −

(2) Φn is generated by the recursive formula

2n + 1 n Φn+1 = xΦn Φn 1, Φ0 = 1, Φ1 = x n + 1 − n + 1 −

(3) Φn(x) is a solution of Legendre differential equation

2 (1 x )y′′ 2xy′ + n(n + 1)y = 0. − −

5.3.1 Error of Gaussian quadrature

Lemma 5.3.5. In Gaussian quadrature, the coefficients are positive and their sum is b w(x)dx. In particular, if [a, b] = [ 1, 1] and w 1, then n A = a − ≡ i=0 i 2. R P Proof. Fix n and let q be a polynomial of degree n + 1 which is orthogonal to P . The zeros of q are denoted by x , ,x . Let p(x) = q(x)/(x x ) for n 0 · · · n − j some j. Since p2 is of degree at most 2n, Gaussian quadrature with x , ,x 0 · · · n will be exact for p2. Hence

b n 2 2 2 0 < p (x)w(x)dx = Aip (xi)= Ajp (xj) a Z Xi=0 so that Aj > 0. Now use Gaussian quadrature for f(x) = 1 to see

b n w(x)dx = Ai. a Z Xi=0

Theorem 5.3.6. For any f C2n+2[a, b], the error term E in the Gaussian ∈ quadrature b n f(x)w(x)dx = Aif(xi)+ E a Z Xi=0 5.4. MORE ON GAUSS TYPE QUADRATURE 11 satisfies f (2n+2)(ξ) b E = q2(x)w(x)dx (2n + 2)! Za for some a< ξ¯ < b and q(x)= n (x x ). i=0 − i Q References

(1) Philip J. Davis and P. Rabinowitz. Methods of Numerical Integration, 2nd ed, 1984. AP.

(2) Philip J. Davis, Interpolation and Approximation, 1963 Dover

(3) Hildebrand, F.B. Introduction to , 1956, McGraw- Hill.

(4) Carl-Erik Froberg, Numerical mathematics, 1985 Benjamin/Cummings Pub. Company inc. pp. 288–296.

(5) http:/mathworld.wolfram.com/Chebyshev-GaussQuadrature.html

(6) http:/mathworld.wolfram.com/LobattoQuadrature.html

(7) http:/mathworld.wolfram.com/RadauQuadrature.html

(8) Handbook of Mathematical Functions with Formulas, Graphs and Math- ematical Tables, Abramowitz, M. and Stegun

5.4 More on Gauss type quadrature

We now consider the case w(x) = 1. One example is w(x)= exp( x)(Gauss- 6 − Laguerre) which is useful in ∞ f(x)exp( x)dx. 0 − Let Φ (x) for i = 0, ,n be orthonormal polynomials w.r.t weight w(x). i · · · R Observe n Φ (x) axΦ (x)= α Φ (x) (5.12) n+1 − n i i Xi=0 for some scalar a and αi. HW. Determine a and αi using the orthogonality. Show that α = 0 for i = n 2,n 3, , 0. i − − · · · 12 CHAPTER 5. NUMERICAL INTEGRATION

General Gauss Chebysheff quadrature

If we use w(x) = 1 the corresponding orthogonal polynomials are the √1 x2 Chebysheff polynomial− of first kind and using these, we obtain the Gauss

Chebysheff quadrature. The nodes xi are the zeros of orthogonal polynomial w.r.t. w(x)= 1 . √1 x2 − It is known that the Chebysheff polynomial satisfies

1 1 T (x)T (x) dx = c δ m n 2 mn mn 1 √1 x Z− − and hence the interpolating points are the Chebysheff points:

2k + 1 x = cos π , k = 0, ,n k 2(n + 1) · · ·  

Thus Gauss Chebysheff quadrature with weight w(x) = 1 based on √1 x2 n + 1 points for [ 1, 1] is − − 1 n f(x)w(x) dx = Aif(xi), 1 Z− Xi=0 where x , i = 0, ,n are the zeros of T (x) and it can be shown that i · · · n+1 1 Ln,i(x) π Ai = dx = , i = 0, ,n 2 1 √1 x n + 1 · · · Z− −

Remark 5.4.1. The first two Chebysheff polynomials are T0(x) = 1, T1(x)= x and in general 1 1 Tn(x)= n 1 cos(n cos− (x)) (5.13) 2 − and hence 2k + 1 x = cos π . k 2n   Notice the points are densely packed near the boundary; thus it may be good for function which is unbounded near the boundary. Find the coefficients in

Tn+1(x)= axTn(x)+ αTn 1(x) (5.14) − for n 2. If we use w(x)= √1 x2 instead, we obtain Chebysheff polynomial ≥ − of second kind and hence obtain Gauss Chebysheff quadrature of second kind 5.4. MORE ON GAUSS TYPE QUADRATURE 13 which will not be discussed further.

Theorem 5.4.2. If q(x) is a monic polynomial of degree n then

1 max Tn(x) = max q(x) . [ 1,1] | | 2n 1 ≤ [ 1,1] | | − − −

Thus Tn(x) has the ’smallest’ size(measured in maximum norm) among all polynomial of degree n. Stated another way, its deviation from 0 is smallest.

Proof. Suppose there is a monic poly. p(x) such that

1 n p(x) < 2 − , x 1. | | | |≤

Let y = cos(iπ/n), 0 i n. Then T (y ) = ( 1)i21 n. Since T is a monic i ≤ ≤ n i − − n poly. of degree n

i 1 n i ( 1) p(y ) p(y ) < 2 − = ( 1) T (y ). − i ≤ | i | − n i

Hence ( 1)i(T (y ) p(y )) > 0 (0 i n). − n i − i ≤ ≤ This means the polynomial T (x) p(x) oscillates n+1 times in sign and hence n − must have at least n roots in ( 1, 1). This is impossible since T (x) p(x) is − n − degree n 1. − Recall

n f (n+1)(ξ(x)) f(x) p (x)= (x x ). (5.15) − n (n + 1)! − i Yi=0 We cannot control the coefficient term. However, we can control

ω(x) = (x x )(x x ) (x x ). − 0 − 1 · · · − n

This is minmized over [ 1, 1] by choosing the nodes the n + 1 Chebysheff − points. The use of Chebysheff points gives the interpolating polynomial that min- imizes the maximum f(x) p(x) ( f p ). It can be shown that | − | k − k∞ 1 L (x) π w = i dx = , i = 0, ,n i 2 1 √1 x n + 1 · · · Z− − 14 CHAPTER 5. NUMERICAL INTEGRATION

Proof. Observe that for all k = 0, 1, ,n · · ·

(x x )L (x)= c p (x) − k k k n+1

Thus

1 wi = Li(x) dx 1 Z− 1 c p (x) = i n+1 dx 1 (x xi) Z− −

1 Example 5.4.3. Use G-Chebysheff quadrature n = 4 to approximate 1 cos(πx) dx. − R 1 1 1 cos(πx) dx = cos(πx) 1 x2 dx 2 1 1 − √1 x Z− Z− 1 p − = f(x)w(x) dx 1 Z− π π 3π 5π 7π = f(cos( )) + f(cos( )) + f(cos( )) + f(cos( )) + 5 10 10 10 10 · · ·   It is always possible to generate orthogonal polynomials by

pn+1(x)= xpn(x) αn+1pn(x) βn+1pn 1(x), (5.16) − − − where

(pn,xpn) αn+1 = (pn,pn) (pn,xpn 1) βn+1 = − (pn 1,pn 1) − − and p 1(x) = 0. −

Gauss Lobatto quadrature

Let φ be the Legendre polynomial of degree n on [ 1, 1] and let x , i = n − i 0, ,n be the zeros of p = φn+1(x)+ λφn(x)+ µφn 1(x). Here λ, µ are · · · − chosen so that p( 1) = p(1) = 0. Then we have x = 1 and x = 1. Now − 0 − n 5.4. MORE ON GAUSS TYPE QUADRATURE 15 consider the following quadrature

n 1 − A0f(x0)+ Anf(xn)+ Aif(xi) (5.17) Xi=1 1 to approximate 1 f(x)dx. Here we Ai’s are determined by letting the above − quadrature is exact for f = 1, x, ,xn. R · · · Theorem 5.4.4. The quadrature (5.17) is exact for polynomials degree up to 2n 1. − Proof. First λ, µ are determined by p( 1) = p(1) = 0. Assume the formula is − exact for Pn. Let f be in P2n 1. Then dividing f by p, we can write f = pq +r − for some q Pn 2 and r Pn. ∈ − ∈ 1 1 1 f(x)dx = pq dx + r dx 1 1 1 Z− Z− Z− 1 = 0+ r dx( orthogonality ) 1 n Z− = Air(xi)( since r is degree n ) i=0 Xn = A f(x )( since p(x )=0 for i = 0, ,n). i i i · · · Xi=0

Some difficulty may arise if one tries to find the interpolation points xi. Example 5.4.5. For n = 3, we first note that

p = 35x4 30x2 +3+ λ(5x3 3x)+ µ(3x2 1). − − −

Using p( 1) = 0, we get λ = 0,µ = 4. Hence ± −

p(x) = 35x4 42x2 + 7 = 7(5x2 1)(x2 1). − − −

Thus x = 1 , x = 1 . 1 − √5 2 √5 When n = 3, there is a special method to find the formula. Assume the following symmetric formula:

A f( 1) + A f( x )+ A f(x )+ A f(1). 0 − 1 − 1 1 1 0 16 CHAPTER 5. NUMERICAL INTEGRATION

By symmetry, it is exact for any odd degree polynomial. We can find A0, A1 2 4 and x1 by imposing the condition that it is exact for f = 1,x ,x .

A0 + A1 = 1 1 A + A x2 = 0 1 1 3 1 A + A x4 = . 0 1 1 5

Solving we get x = 1 . Thus, the Gauss-Lobatto formula in this case is 1 − √5 1 5 1 5 1 1 f( 1) + f( )+ f( )+ f(1). 6 − 6 −√5 6 √5 6

(For other general formula, See p355 Num. anal. by Jeffery Leader, Addison Wesley or Beurling’s book.)

Assume the formula

n A f( 1) + A f( x )+ A f(x ) 0 − n − 1 i i Xi=1 is exact up to degree 2n 1. where the sum is up to n/2 for n even and up to − (n + 1)/2 for n odd.

n 1 − f = 1 : A0 + An + Ai = 2 Xi=1 n 1 − f = x : A + A + A x = 0 − 0 n i i i=1 : X · · · n 1 − 2 f = xk : A + A + A xk = 0 n i i k + 1 Xi=1 · · · n 1 − 2 f = xn : A + A + A xn = 0 n i i n + 1 Xi=1 for even k. 5.4. MORE ON GAUSS TYPE QUADRATURE 17

Weight and points of Gauss Lobatto quadrature

Let Φn(x) be the unnormalized Legendre polynomial of degree n and let

φn(x) be its normalized(leading coefficient is 1) Legendre polynomial. Let (2n)! kn = 2n(n!)2 be the leading coefficients of Φn(x). Then general Gauss Lobatto quadrature based on n + 1 points for [ 1, 1] is − n 1 1 2 − f(x)dx = (f( 1) + f(1)) + Aif(xi), 1 n(n + 1) − Z− Xi=1 where x , i = 1, ,n 1 are zeros of φ (x), the derivative of Legendre poly- i · · · − n′ nomial of degree n and

2 Ai = 2 2 n(n + 1)knφn(xi)

The error is of the form (2n) E = cnf (ξ) which is exact up to degree 2n 1 compared to the 2n + 1(Gauss quadrature); − we have given up the freedom of location of points.

General Gauss Radau quadrature

Let Φn(x) be the unnormalized Legendre polynomial of degree n and let φn(x) be its normalized(leading coefficient is 1) Legendre polynomial. Let kn = (2n)! 2n(n!)2 be the leading coefficients of Φn(x). Then the general Gauss Radau quadrature based on n + 1 points(the point 1 plus n points in the open − interval) for [ 1, 1] is − n 1 2 f(x)dx = 2 f( 1) + Aif(xi) 1 (n + 1) − Z− Xi=1 where x , i = 1, ,n are the zeros of i · · ·

knφn(x)+ kn+1φn+1(x) x 1 − and 1 xi Ai = 2− 2 2 , i = 1, ,n (n + 1) knφn(xi) · · · 18 CHAPTER 5. NUMERICAL INTEGRATION

The error is of the form (2n+1) E = dnf (ξ).