next up previous
Next: The Definite Integral - Up: No Title Previous: No Title

The Definite Integral - Part 1


The purpose of this lab is to introduce you to the definite integral and to Maple commands for computing definite integrals.



There are two main ways to think of the definite integral. The easiest one to understand, and the one we'll consider first, is as a means for computing areas (and volumes). The second way the definite integral is used is as a sum. That is, we use the definite integral to ``add things up''. Here are some applications (some are seen in the later calculus courses).

Of course, when we use a definite integral to compute an area or a volume, we are adding up area or volume. So you might ask why make a distinction? The answer is that the notion of an integral as a means of computing an area or volume is much more concrete and is easier to understand.

We have learned in class that the definite integral is defined as a limit of sums, so it makes sense that the integral should be thought of as a sum. We have also seen in class that the indefinite integral, or anti-derivative, can be used to evaluate definite integrals. The computation of the intergral as a limit of sums although harder than finding antiderivitaves is most often the only option, since :

  1. Many functions don't have anti-deriviatives that can be written down as formulas. Definite integrals of such function must be done using numerical techniques, which always depend on the definition of the integral as a sum.
  2. In many applications of the integral in engineering and science, you aren't given the function which is to be integrated but instead must derive it. The derivation always depends on the definition of the integral as a sum.

Partitions and rectangular approximations to area

Suppose f(x) is a non-negative, continuous function defined on some interval [a,b]. Then by the area under the curve y=f(x) between x=a and x=b we mean the area of the region bounded above by the graph of f(x), below by the x axis, on the left by the vertical line x=a, and on the right by the vertical line x=b.

The rectangular area approximations we will describe in this section depend on subdividing the interval [a,b] into subintervals of equal length. For example, dividing the interval [0,4] into four uniform pieces produces the subintervals [0,1], [1,2], [2,3], and [3,4]. The next step is to approximate the area above each subinterval with a rectangle, with the height of the rectangle being chosen according to some rule. In particular, we will consider the following rules:

left endpoint rule
The height of the rectangle is the value of the function f(x) at the left-hand endpoint of the subinterval.

right endpoint rule
The height of the rectangle is the value of the function f(x) at the right-hand endpoint of the subinterval.

midpoint rule
The height of the rectangle is the value of the function f(x) at the midpoint of the subinterval.

The Maple student package has commands for visualizing these three rectangular area approximations. To use them, you first must load the package via the with command. Then try the three commands given below. Make sure you understand the differences between the three different rectangular approximations. Take a moment to see that the different rules choose rectangles which in each case will either underestimate or overestimate the area. Even the midpoint rule, whose rectangles usually have heights more appropriate than those for the left endpoint and right endpoint rules, will produce an approximation which is not exact.

  > with(student):

  > rightbox(x^2,x=0..4);

  > leftbox(x^2,x=0..4);

  > middlebox(x^2,x=0..4);

There are also Maple commands leftsum, rightsum, and middlesum to sum the areas of the rectangles, see the examples below. Note the use of evalf to obtain numerical answers.

  > rightsum(x^2,x=0..4);


  > evalf(rightsum(x^2,x=0..4));


  > middlesum(x^2,x=0..4);


  > evalf(middlesum(x^2,x=0..4));


The Maple commands above use the short-hand summation notation. Since there are only four terms in the sums above, it isn't hard to write them out explicitly, as follows.


However, if the number of terms in the sum is large, summation notation saves a lot of time and space.

It should be clear from the graphs that adding up the areas of the rectangles only approximates the area under the curve. However, by increasing the number of subintervals the accuracy of the approximation can be increased. All of the Maple commands described so far in this lab permit a third argument to specify the number of subintervals. The default is 4 subintervals. See the example below for the area under y=x from x=0 to x=2 using the rightsum command with 4, 10, 20 and 100 subintervals. (As this region describes a right triangle with height 2 and base 2, this area can be easily calculated to be exactly 2.) Try it yourself with the leftsum and middlesum commands.

  > evalf(rightsum(x,x=0..2));


  > evalf(rightsum(x,x=0..2,10));


  > evalf(rightsum(x,x=0..2,20));


  > evalf(rightsum(x,x=0..2,100));


Since, in this trivial example, we knew that the area is exactly 2, it appears that, as the number of subintervals increases, the rectangular approximation becomes more accurate.

Computing areas as definite integrals with Maple

In the example in the previous section, we saw that increasing the number of subintervals gave a better approximation to the area. In such a case, it seems reasonable that taking a limit as the number of subintervals goes to infinity should give the exact answer. This is exactly the idea in defining the definite integral.

When this limit as the number of subintervals goes to infinity exists, we have special notation for this limit and write it as


We will learn later on that if the function f(x) is continuous on the interval [a,b], then this limit always exists and we can write


where A is the area under the curve y=f(x) between x=a and x=b.

The Fundamental Theorem of Calculus (FTOC) provides a connection between the definite integral and the indefinite integral (a.k.a. the antiderivitave). That is, the FTOC provides a way to evaluate definite integrals if an anti-derivative can be found for f(x). We'll spend a lot of time later in the course developing ways to do this, but for now we'll let Maple do the work.

The basic maple command for performing definite and indefinite integrals is the int command. The syntax is very similar to that of the leftsum and rightsum commands, except you don't need to specify the number of subintervals. This should make sense, if you recall that the definite integral is defined as a limit of a rectangular sum as the number of subintervals goes to infinity. In the section on rectangular approximations, we used two examples. The first was the function tex2html_wrap_inline411 on the interval [0,4] and the second was the function y=x on the interval [0,2]. We would express the areas under these two curves with our integral notation as




Using Maple, we would compute these two definite integrals as shown below.

  > int(x^2,x=0..4);


  > int(x,x=0..2);


Notice that Maple gives an exact answer, as a fraction. If you want a decimal approximation to an integral, you just put an evalf command around the int command, as shown below.

  > evalf(int(x^2,x=0..4));


In the exercises, we'll ask you to compare rectangular approximations to integrals. In doing so, you'll need to apply several commands to the same function. To save typing and prevent errors, you can define the function as a function or an expression in Maple first and then use it in subsequent int, leftsum, etc. commands. For example, suppose you were given the function tex2html_wrap_inline419 on the interval tex2html_wrap_inline421 . Then you can define this function in Maple with the command

  > f := x -> x*sin(x);


and then use this definition to save typing as shown below.

  > int(f(x),x=0..Pi);


  > evalf(leftsum(f(x),x=0..Pi,4));


You can also simply give the expression corresponding to f(x) a label in Maple, and then use that label in subsequent commands as shown below. However, notice the difference between the two methods. You are urged you to choose one or the other, so you don't mix the syntax up.

  > p := x*sin(x);


  > int(p,x=0..Pi);



  1. For each of the following functions and intervals determine the area under the curve with the int command. Also, choose one of the three rectangular approximations leftsum, middlesum or rightsum and determine the minimum number of subintervals required so that your rectangular approximation agrees with the integral to four decimal places. Don't use the same rectangular approximation method for every part; please use each method at least once. Also, plot each function to verify that it is non-negative over the interval in question.
    1. displaymath425

    2. displaymath426

    3. displaymath427

    4. displaymath428

  2. Consider the function f(x) = x on the interval [0,4]. Verify that the middlesum command gives the exact value for the area independently of the number of subintervals you specify. Can you explain this? Hint - look at the graph produced by the middlebox command.

next up previous
Next: The Definite Integral - Up: No Title Previous: No Title

William W. Farr
Tue Sep 9 11:18:41 EDT 1997