5.5 Gaussian Quadrature Now we come back to the numerical integration based on the polynomial interpolation 1 I f ( x)dx . 1 The general formula for the numerical integration is n I Ai f ( xi ) . (1.1) i 0 If we take 1 x xj 1 j i xi x j Ai dx , (1.2) Then the formula will be exact for all polynomials f ( x ) of degree n . For example, the trapezoid rule, where there are two points x0 and x1 , A0 A1 x1 x0 , is exact for all 2 polynomials of degree at most 1; the Simpson’s rule, where there are three points x0 1, x2 1, x1 0, A0 x1 x0 x x 4( x1 x0 ) , A2 1 0 , A1 , is exact for all polynomials 6 6 6 of degree at most 3. Question: Can we select the nodes x 0 ,x 1 , ,x n such that, the formula (1.1) and (1.2) is exact for all polynomials of degree at most 2n 1 . Example. n 0, we take x0 0, A0 2. Now the formula is g0 ( f ) A0 f (0) . (1.3) We claim that (1.3) is exact for all polynomials of degree 1 . Solution: Since any polynomials f ( x ) of degree 1 is a linear combination of 1 and x , we only need to check that (1.3) is exact for the trial function 1, x in the following sense 1 1 1dx A0 f (0) 2 g0 (1) , 1 xdx A0 f (0) 2 0 g0 ( x) . 1 1 Example. n 1, we take x0 3 3 , x1 , A0 A1 1. The formula for this case is 3 3 g1 ( f ) f ( 3 3 ) f ( ). 3 3 (1.4) We say that (1.4) is exact for all polynomials of degree 3 . Solution. Again, we only need to check it is exact for trial functions for 1, x, x 2 , x3 . 1 g1 (1) 2 1dx , 1 1 g1 ( x) 0 xdx , 1 g1 ( x 2 ) ( 1 3 2 3 2 ) ( ) 2 x 2 dx , 1 3 3 3 1 g1 ( x3 ) 0 x3dx . 1 Question: What is the general rule? q(x ) = (x - x 0 )(x - x 1 ) (x - x n ) . Theorem (Theorem on Gaussian Quadrature) Suppose q( x) is orthogonal to all polynomials p ( x ) of degree n in the sense 1 q( x) p( x)dx 0 , for all polynomials p ( x ) of degree n . 1 (1.5) Then the formula (1.1) and (1.2) will be exact for all polynomials f ( x ) of degree 2n 1 . Proof. Let f ( x ) be a polynomial of degree 2n 1 . Divided by q( x) , obtaining a quotient p ( x ) and remainder r ( x ) . Then f ( x) q ( x) p ( x) r ( x) , Where p ( x ) is a polynomial of degree n , and r ( x ) is a polynomial of degree n . Using (1.5) and the fact that (1.1) and (1.2) is exact for all polynomial of degree n , we have 1 1 n f ( x)dx q ( x) p ( x)dx r ( x )dx r ( x )dx Ai r ( xi ) . 1 1 1 1 1 1 i 0 2 Note that r ( xi ) f ( xi ) q( xi ) p( xi ) f ( xi ) . Therefore, 1 1 n f ( x)dx r ( x)dx Ai f ( xi ) . 1 1 i 0 Now it is the time to answer the Question before: Can we select the nodes x 0 ,x 1 , ,x n such that, the formula (1.1) and (1.2) is exact for all polynomials of degree at most 2n 1 . We should choose the nodes such that they are the zeros of q(x ) , which is orthogonal to all polynomials p ( x ) of degree n . Furthermore, this can be achieved by the following so called Legendre polynomials. The Legendre polynomials of degree n Ln ( x) 1 dn [( x 2 1) n ] . 2n n ! dx n The properties 2 , mn 2 (1) Ln ( x) Lm ( x) dx . mn 2n 1 1 2n 1 mn 0, 1 (2) The recursive formula (n 1) Ln1 ( x) (2n 1) xLn ( x) nLn1 ( x) . (3) L0 ( x) 1 L1 ( x) x 1 L2 ( x) (3x 2 1) 2 1 L3 ( x) (5 x3 3x) 2 1 L4 ( x) (35 x 4 30 x 2 3) 8 1 L5 ( x) (63x5 70 x3 15 x) 8 3 (4) Lk ( x) (1) k Lk ( x) . (5) 1 L ( x)q( x)dx 0 for all polynomials q( x) of degree n 1. 1 n (6) Ln ( x) has n zeros -1< x 0 < x 1 < < x n-1 < 1. The zeros for the Legendre polynomial: (1) L0 ( x) 1 , no zeros. (2) L1 ( x) x , x0 0 is the unique zero. (3) L2 ( x) 3 3 1 . , x1 (3 x 2 1) , there are two zeros x0 3 3 2 3 3 1 (5 x 3 3 x) , there are three zeros x0 , x1 0, x2 . 2 5 5 1 (5) L4 ( x) (35 x 4 30 x 2 3) , there are four zeros. 8 (4) L3 ( x) Suppose now the zeros of the Legendre polynomial Ln1 ( x) are given as x 0 ,x 1 , ,x n . Then the coefficients can be computed by the following definite integral 1 A j = ò l j (x )dx , -1 where x xi . i j x x j i i 0 n l j ( x) By using the feature that the Gaussian quadrature is exact for all polynomials of degree 2n 1 . One can prove (by using the integration by parts) that Aj 2wn2(1) 1 , where w n+1 (x ) = (x - x 0 )(x - x 1 ) 2 (1 x j )( wn' 1 ( x j )) 2 (x - x n ) . Example. Use the Gaussian quadrature to compute the approximation of the following definite integral 1 I cos xdx 2sin1 1.682941 . 1 4