Module

for

The Trapezoidal Rule for Numerical Integration

   

Theorem  (Trapezoidal Rule)  Consider [Graphics:Images/TrapezoidalRuleMod_gr_1.gif] over [Graphics:Images/TrapezoidalRuleMod_gr_2.gif], where [Graphics:Images/TrapezoidalRuleMod_gr_3.gif]. The trapezoidal rule is  

    
[Graphics:Images/TrapezoidalRuleMod_gr_4.gif].  

This is an numerical approximation to the integral of [Graphics:Images/TrapezoidalRuleMod_gr_5.gif] over [Graphics:Images/TrapezoidalRuleMod_gr_6.gif] and we have the expression  

    
[Graphics:Images/TrapezoidalRuleMod_gr_7.gif].  

The remainder term for the trapezoidal rule is  [Graphics:Images/TrapezoidalRuleMod_gr_8.gif],  where [Graphics:Images/TrapezoidalRuleMod_gr_9.gif] lies somewhere between [Graphics:Images/TrapezoidalRuleMod_gr_10.gif], and have the equality  

    [Graphics:Images/TrapezoidalRuleMod_gr_11.gif].

Proof  Trapezoidal Rule for Numerical Integration  Trapezoidal Rule for Numerical Integration  

 

Composite Trapezoidal Rule

    An intuitive method of finding the area under a curve y = f(x)  is by approximating that area with a series of trapezoids that lie above the intervals  [Graphics:Images/TrapezoidalRuleMod_gr_12.gif].  When several trapezoids are used, we call it the composite trapezoidal rule.  

 

Theorem  (Composite Trapezoidal Rule)  Consider [Graphics:Images/TrapezoidalRuleMod_gr_13.gif] over [Graphics:Images/TrapezoidalRuleMod_gr_14.gif].  Suppose that the interval [Graphics:Images/TrapezoidalRuleMod_gr_15.gif] is subdivided into  m  subintervals  [Graphics:Images/TrapezoidalRuleMod_gr_16.gif]  of equal width  [Graphics:Images/TrapezoidalRuleMod_gr_17.gif]  by using the equally spaced nodes  [Graphics:Images/TrapezoidalRuleMod_gr_18.gif]  for  [Graphics:Images/TrapezoidalRuleMod_gr_19.gif].   The composite trapezoidal rule for m subintervals is  

    
[Graphics:Images/TrapezoidalRuleMod_gr_20.gif].  

This is an numerical approximation to the integral of [Graphics:Images/TrapezoidalRuleMod_gr_21.gif] over [Graphics:Images/TrapezoidalRuleMod_gr_22.gif] and we write  

    
[Graphics:Images/TrapezoidalRuleMod_gr_23.gif].  

 

Remainder term for the Composite Trapezoidal Rule

Corollary  (Trapezoidal Rule: Remainder term)  Suppose that [Graphics:Images/TrapezoidalRuleMod_gr_24.gif] is subdivided into  m  subintervals  [Graphics:Images/TrapezoidalRuleMod_gr_25.gif]  of width  [Graphics:Images/TrapezoidalRuleMod_gr_26.gif].   The composite trapezoidal rule  

    
[Graphics:Images/TrapezoidalRuleMod_gr_27.gif]  

is an numerical approximation to the integral, and  

    
[Graphics:Images/TrapezoidalRuleMod_gr_28.gif].  

Furthermore, if [Graphics:Images/TrapezoidalRuleMod_gr_29.gif],  then there exists a value  c  with  a < c < b  so that the error term  [Graphics:Images/TrapezoidalRuleMod_gr_30.gif]  has the form

    [Graphics:Images/TrapezoidalRuleMod_gr_31.gif].  

This is expressed using the "big [Graphics:Images/TrapezoidalRuleMod_gr_32.gif]" notation  [Graphics:Images/TrapezoidalRuleMod_gr_33.gif].  

Remark.  When the step size is reduced by a factor of [Graphics:Images/TrapezoidalRuleMod_gr_34.gif] the error term  [Graphics:Images/TrapezoidalRuleMod_gr_35.gif] should be reduced by approximately [Graphics:Images/TrapezoidalRuleMod_gr_36.gif].  

Proof  Trapezoidal Rule for Numerical Integration  Trapezoidal Rule for Numerical Integration  

 

Animations (Trapezoidal Rule  Trapezoidal Rule).  

 

Computer Programs  Trapezoidal Rule for Numerical Integration  Trapezoidal Rule for Numerical Integration  

 

Algorithm Composite Trapezoidal Rule.  To approximate the integral  

    [Graphics:Images/TrapezoidalRuleMod_gr_37.gif][Graphics:Images/TrapezoidalRuleMod_gr_38.gif][Graphics:Images/TrapezoidalRuleMod_gr_39.gif],  

by sampling [Graphics:Images/TrapezoidalRuleMod_gr_40.gif] at the [Graphics:Images/TrapezoidalRuleMod_gr_41.gif] equally spaced points  [Graphics:Images/TrapezoidalRuleMod_gr_42.gif]  for  [Graphics:Images/TrapezoidalRuleMod_gr_43.gif],  where  [Graphics:Images/TrapezoidalRuleMod_gr_44.gif].  Notice that  [Graphics:Images/TrapezoidalRuleMod_gr_45.gif]  and  [Graphics:Images/TrapezoidalRuleMod_gr_46.gif].  

 

Mathematica Subroutine (Trapezoidal Rule).

[Graphics:Images/TrapezoidalRuleMod_gr_47.gif]

Or you can use the traditional program.

 

Mathematica Subroutine (Trapezoidal Rule).

[Graphics:Images/TrapezoidalRuleMod_gr_48.gif]

Example 1.  Numerically approximate the integral  [Graphics:Images/TrapezoidalRuleMod_gr_50.gif]  by using the trapezoidal rule with  m = 1, 2, 4, 8, and 16  subintervals.
Solution 1.

 

Example 2.  Numerically approximate the integral  [Graphics:Images/TrapezoidalRuleMod_gr_70.gif]  by using the trapezoidal rule with  m = 50, 100, 200, 400  and 800  subintervals.
Solution 2.

 

Example 3.  Find the analytic value of the integral  [Graphics:Images/TrapezoidalRuleMod_gr_87.gif]  (i.e. find the "true value").   
Solution 3.

 

Example 4.  Use the "true value" in example 3 and find the error for the trapezoidal rule approximations in example 2.  
Solution 4.

 

Example 5.  When the step size is reduced by a factor of [Graphics:Images/TrapezoidalRuleMod_gr_104.gif] the error term  [Graphics:Images/TrapezoidalRuleMod_gr_105.gif] should be reduced by approximately  [Graphics:Images/TrapezoidalRuleMod_gr_106.gif].  Explore this phenomenon.
Solution 5.

 

Example 6.  Numerically approximate the integral [Graphics:Images/TrapezoidalRuleMod_gr_115.gif] by using the trapezoidal rule with  m = 1, 2, 4, 8, and 16  subintervals.
Solution 6.

 

Example 7.  Numerically approximate the integral [Graphics:Images/TrapezoidalRuleMod_gr_134.gif] by using the trapezoidal rule with  m = 50, 100, 200, 400  and 800  subintervals.
Solution 7.

 

Example 8.  Find the analytic value of the integral  [Graphics:Images/TrapezoidalRuleMod_gr_151.gif]  (i.e. find the "true value").  
Solution 8.

 

Example 9.  Use the "true value" in example 8 and find the error for the trapezoidal rule approximations in exercise 7.  
Solution 9.

 

Example 10.  When the step size is reduced by a factor of [Graphics:Images/TrapezoidalRuleMod_gr_168.gif] the error term  [Graphics:Images/TrapezoidalRuleMod_gr_169.gif] should be reduced by approximately  [Graphics:Images/TrapezoidalRuleMod_gr_170.gif].  Explore this phenomenon.
Solution 10.

 

Recursive Integration Rules

Theorem (Successive Trapezoidal Rules)  Suppose that  [Graphics:Images/TrapezoidalRuleMod_gr_179.gif]  and the points  [Graphics:Images/TrapezoidalRuleMod_gr_180.gif]  subdivide [Graphics:Images/TrapezoidalRuleMod_gr_181.gif] into  [Graphics:Images/TrapezoidalRuleMod_gr_182.gif]  subintervals equal width  [Graphics:Images/TrapezoidalRuleMod_gr_183.gif].  The trapezoidal rules [Graphics:Images/TrapezoidalRuleMod_gr_184.gif] obey the relationship  

    
[Graphics:Images/TrapezoidalRuleMod_gr_185.gif][Graphics:Images/TrapezoidalRuleMod_gr_186.gif].  

 

Definition (Sequence of Trapezoidal Rules)  Define  [Graphics:Images/TrapezoidalRuleMod_gr_187.gif],  which is the trapezoidal rule with step size  [Graphics:Images/TrapezoidalRuleMod_gr_188.gif].  Then for each  [Graphics:Images/TrapezoidalRuleMod_gr_189.gif]  define  [Graphics:Images/TrapezoidalRuleMod_gr_190.gif]  is the trapezoidal rule with step size  [Graphics:Images/TrapezoidalRuleMod_gr_191.gif].  

 

Corollary (Recursive Trapezoidal Rule)  Start with  [Graphics:Images/TrapezoidalRuleMod_gr_192.gif].  Then a sequence of trapezoidal rules  [Graphics:Images/TrapezoidalRuleMod_gr_193.gif]  is generated by the recursive formula  

    
[Graphics:Images/TrapezoidalRuleMod_gr_194.gif]  for  [Graphics:Images/TrapezoidalRuleMod_gr_195.gif].  

where  [Graphics:Images/TrapezoidalRuleMod_gr_196.gif].  

 

The recursive trapezoidal rule is used for the Romberg integration algorithm.

 

Various Scenarios and Animations for the Trapezoidal Rule.

Example 11.  Let  [Graphics:Images/TrapezoidalRuleMod_gr_197.gif]  over  [Graphics:Images/TrapezoidalRuleMod_gr_198.gif].  Use the Trapezoidal Rule to approximate the value of the integral.
Solution 11.

 

Animations (Trapezoidal Rule  Trapezoidal Rule).  

 

Research Experience for Undergraduates

Trapezoidal Rule for Numerical Integration  Trapezoidal Rule for Numerical Integration  Internet hyperlinks to web sites and a bibliography of articles.  

 

Download this Mathematica Notebook Trapezoidal Rule for Numerical Integration 

 

Return to Numerical Methods - Numerical Analysis

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

(c) John H. Mathews 2004