Riemann Sums and Definite Integrals Math 142, Section 01, Spring 2009 At the end of the last lesson we saw that we can approximate the area under the curve sin (x2 ) by breaking that figure up into pieces whose areas can be well approximated by trapezoids. These notes focus on formalizing that idea. Our goal for this lesson is to define Riemann sums and the definite integral, and to do some computations with these. 1. Riemann Sums and Definite Integrals In what follows we will be adding together long lists of numbers, so we begin by introducing a convenient shorthand for this. For instance, we will write 3 X j j=0 P to represent the sum 0 + 1 + 2 + 3. We is a command to sum P refer to this as summation notation. The P what follows. The j = 0 below the tells us to start at 0, P the 3 above the tells us to stop when we get to 3. Thus, j runs from 0 to 3. The j on the inside of the tells us to add each of the numbers j = 0, j = 1, j = 2, j = 3. As another example, lets write 4 + 9 + 16 + 25 + 36 + 49 in this notation. First, 4 + 9 + 16 + 25 + 36 + 49 = 22 + 32 + 42 + 52 + 62 + 72 , so we are adding together the squares, starting from the second square to the seventh. Therefore 4 + 9 + 16 + 25 + 36 + 49 = 7 X j2. j=2 This is not the only representation of our sum in this notation. For instance, 6 X (j + 1)2 = (1 + 1)2 + (2 + 1)2 + (3 + 1)2 + (4 + 1)2 + (5 + 1)2 + (6 + 1)2 j=1 = 4 + 9 + 16 + 25 + 36 + 49. Notice that summation notation is just a notation. It allows us to write long sums in a very compact notation. It does not provide us with a method for quickly finding the sum, just a way to quickly write down a sum. We can now define Riemann sums and definite integrals. Suppose f (x) is defined on an interval [a, b] and let n be a positive integer. We define ∆x = x0 = a, x1 = a + ∆x, x2 = a + 2∆x, x3 = a + 3∆x, . . . b−a n , xj = a + j∆x where j is any integer from 0 to n. I may occasionally refere to the points xj as the partition points. Notice xn = a + n b−a n = b. The nth right hand sum of f (x) on [a, b] is Rn = f (x1 )∆x + f (x2 )∆x + f (x3 )∆x + . . . + f (xn )∆x = n X j=1 1 f (xj )∆x. 2 The nth left hand sum of f (x) on [a, b] is Ln = f (x0 )∆x + f (x1 )∆x + f (x2 )∆x + . . . + f (xn−1 )∆x = n−1 X f (xj )∆x. j=0 Ln and Rn are both refered to as Riemann sums. Actually, Riemann sums refers to a much larger class of expressions, of which both Rn and Ln are special cases. We will not look into the more general Riemann sums in this class. For most functions (including all bounded continuous functions), the left and the right hand sums approach a common value as n → ∞: lim Ln = lim Rn . n→∞ n→∞ Rb The definite integral of f (x) on [a, b], denoted a f (x) dx, is this common value: Z b f (x) dx = lim Rn = lim Ln . n→∞ a n→∞ After the next few examples we’ll get a better idea of what all of this means. For now, I just want to Rb R point out that the definite integral a f (x) dx and the indefinite integral f (x) dx are two totally different R types of objects. The indefinite integral is the family of all antiderivatives of f (x). Thus, f (x) dx is a family of functions. The definite integral is just a number. However, a little later we’ll see that these two integrals are actually very closely related. Remark: The definite integral is defined as a limit of approximating sums. There is always the possibility that that the approximating sums do not have a limit. Thus, we say that a function is integrable provided that the limits defining the definite integral exist. We won’t worry about this condition too much since nearly every function we’ll run into will be integrable. Bounded continuous function are always integrable. Even functions with a finite number of jumps or holes are always continuous. We can find functions with infinitely many jumps which are integrable. While non-integrable functions do exist, we have to look really hard to find them! Example 1: We compute R4 and L4 for f (x) = x2 on [0, 1]. Since n = 4 then ∆x = x0 x1 x2 x3 x4 =0 = 0.25 = 0.5 = 0.75 =1 1−0 4 = 0.25. Also, f (x0 ) = 02 = 0 f (x1 ) = 0.252 = 0.0625 f (x2 ) = 0.52 = 0.25 f (x3 ) = 0.752 = 0.5625 f (x4 ) = 12 = 1. Therefore, R4 = f (x1 )∆x + f (x2 )∆x + f (x3 )∆x + f (x4 )∆x = 0.0625 · 0.25 + 0.25 · 0.25 + 0.5625 · 0.25 + 1 · 0.25 = 0.468750 and L4 = f (x0 )∆x + f (x1 )∆x + f (x2 )∆x + f (x3 )∆x = 0 · 0.25 + 0.0625 · 0.25 + 0.25 · 0.25 + 0.5625 · 0.25 = 0.21875. What did we just compute here? We should think of each f (xj ) · ∆x as giving us the area of a rectangle, a rectangle with width ∆x and height f (xj ). R4 and L4 are each areas of certain figures, figures that are made out of four rectangles. We divide the interval [0, 1] into n = 4 equal pieces, each with width ∆x = 1−0 4 . The xj ’s are the endpoints of these subintervals. On each subinterval we build a rectangle whose height is determined by the curve f (x) = x2 . The only difference between a left hand sum and a right hand sum is that for a right hand sum the height of each rectangle is determined by plugging the 3 right endpoint of the subinterval into f (x) = x2 whereas for a left hand sum the height of each rectangle is determined by plugging the left endpoint of the subinterval into f (x) = x2 . Now go to http://www.slu.edu/~classes/maymk/Riemann/Riemann.html and enter f (x) = x2 , xmax = 1, xmin = 0, and select either “Left Hand Sum” or “Right Hand Sum” from the second drop down menu. Set “Number of partitions” to 4. This shows us L4 or R4 . Now watch as you increase n. Ln and Rn are now sums of areas of lots of very thin rectangles. As n gets very large, it appears that Ln and Rn are getting closer and closer to each other, as well as getting closer and closer to the area the curve R 1 under 2 2 y = x . Now, the definite integral is the common value of the limits of Ln and Rn , so 0 x dx is the area under the curve y = x2 , from 0 to 1. Using the Riemann sum applet1 we see Z 1 1 x2 dx = 3 0 The definite integral notation is very suggestive of what we are doing here. We should think of f (x) dx Rb as denoting the area of an infinitesimally thin rectangle, with height f (x) and dx, and a is a command to add up the areas of this infinite family of infinitesimally thin rectangles. For very large n we have Z b n X f (x) dx ≈ f (xj )∆x. a j=1 We think of dx as being the infinitesimal version of ∆x and Rb a as the infinitesimal version of Pn j=1 . Notice that, for our example, Ln is always smaller than 13 whereas Rn is always larger than 31 . Why? y = x2 is increasing on [0, 1] so the left hand rectangles will always be under the curve whereas the right hand rectangles will always extend over the curve. Suppose now that we have to resort to approximating the area using either left or right hand sums (thus we ignore the fact that we know the area is 13 ), and suppose our approximation is required to be accurate to within ±0.01 of the true value. How many partitions will we need to get that degree of accuracy? That is, how large does n need to be? There is an interesting error bound which gives us this n. Lets suppose we are using Ln . Thus, we want to find n so that Z 1 x2 dx − Ln ≤ 0.01. 0 R1 x2 dx so if we can find n so that Rn −Ln ≤ 0.01 then that same n will give But Rn ≥ 0 But we can compute the exact value of Rn − Ln . Formally, R1 0 x2 dx−Ln ≤ 0.01. Rn − Ln = (f (x1 )∆x + f (x2 )∆x + . . . + f (xn )∆x) − (f (x0 )∆x + f (x1 )∆x + . . . + f (xn−1 )∆x) Rn and Ln share a lot of terms so most of the terms cancel out. What’s left over is b−a Rn − Ln = f (xn )∆x − f (x0 )∆x = (f (b) − f (a)) · , n 2 where we plugged in x0 = a, xn = b and ∆x = b−a n . In our example. f (x) = x , a = 0 and b = 1 so 2 2 Rn − Ln = (1 −0 n)(1−0) = n1 . Now, we want Rn − Ln ≤ 0.01 so we need the applet and check that both L100 and R100 are within ±0.01 of 13 . 1 n ≤ 0.01 so n ≥ 100. Go back to We record this error bound in general. Error Bound for Increasing Functions. If f (x) is increasing on [a, b] then, for all n, Z b Ln ≤ f (x) dx ≤ Rn . a 1Or better, refering to our notes from last week 4 Furthermore, b b−a f (x) dx − Ln ≤ (f (b) − f (a)) · . n a Z b b−a Rn − f (x) dx ≤ (f (b) − f (a)) · . n a Error Bound for Decreasing Functions. If f (x) is decreasing on [a, b] then, for all n, Z b f (x) dx ≤ Ln . Rn ≤ Z a Furthermore, b b−a f (x) dx ≤ (f (a) − f (b)) · Ln − . n a Z b b−a f (x) dx − Rn ≤ (f (a) − f (b)) · . n a Z There are a lot of ideas in what we just did, so you’ll probably need to work through a couple examples Rb before all of these ideas sink in. Our next example shows that a f (x) dx is not always an area. However, Rb a f (x) dx is always very similar to an area, even if it is not exactly an area. Example 2: Find L3 and R3 for f (θ) = sin θ on the interval [ π2 , 3π 2 ]. Solution: n = 3, a = π2 , b = 3π 2 , θ0 θ1 θ2 θ3 ∆θ = = = = = π 3 π 2 π π 5π 2 + 3 = 6 π π 7π 2 + 23 = 6 3π 2 f (θ0 ) = sin ( π2 ) = 1 f (θ1 ) = sin ( 5π 6 ) = 1/2 f (θ2 ) = sin ( 7π 6 ) = −1/2 f (θ3 ) = sin ( 3π 2 ) = −1 so L3 = (sin θ0 )∆θ + (sin θ1 )∆θ + (sin θ2 )∆θ π 1 π −1 π · =1· + · + 3 2 3 2 3 π = 3 R3 = (sin θ1 )∆θ + (sin θ2 )∆θ + (sin θ3 )∆θ 1 π −1 π π = · + · + (−1) · 2 3 2 3 3 −π . = 3 L3 and R3 can’t be the areas of the rectangles. Why? For one thing, R3 is negative! We can still think of the terms in L3 and R3 as being areas of rectangles, except instead of adding together the areas of all the rectangles, we instead add the areas of all of the rectangles above the horizontal axis, then subtract the areas of the rectangles which lie below the horizontal axis. This is often refered to as the “net area,” where we undestand the “area” of something below the axis to be negative. Again, go to the Riemann sum applet, enter this function and let the number of partitions grow. Notice R 3π/2 that π/2 sin θ dθ appears to be very close zero2. We can actually see this in a number of ways. First, using 2We’ll show this integral is actually zero in a moment. The applet might only give something very close to zero. This is due to rounding when you input π. If you round π as 3.14 then it is unfair to expect the computer to compute the integral to an accuracy any better than ±0.01. 5 a computer to calculate either Rn or Ln for very large n and using these Rn or Ln ’s as approximations. Notice that in this example Ln is always larger than the integral and Rn is smaller. This is exactly the reverse from last time. This is to be expected as our function is decreasing on the interval of integration. How large does n need to be to guarantee that our left or right hand sums are within, say 0.01 of the integral? Lets use Rn . Since our function is decreasing we use the error bound Z 3π/2 3π π (sin ( π2 ) − sin ( 3π 2π 2 ))( 2 − 2 ) sin θ dθ − Rn ≤ = n n π/2 Thus, Rn is within 0.01 of the actual value of the integral provided 2π n ≤ 0.01, so n ≥ 2π · 100 = 628.3. We take n = 629. R 3π/2 Another way to compute π/2 sin θ dθ : The definite integral is the net area. So we take the area between sin θ and the horizontal axis, from θ = π2 to θ = π. From this we subtract the area betwen the horizontal axis and the curve sin θ from θ = π to θ = 3π 2 . But notice the symmetry here: There is exactly as much area above the axis as there is below, so the net area is 0. Notice that we can compute sometimes compute definite integrals without using either Ln or Rn . R7 Example 3 : Lets compute the integral 0 f (x) dx, where f (x) is the function sketched in the accompanying illustrations, without explicitly using approximating sums. To do this integral we need only break up the figure into pieces that have easily computed areas. First there is a semi-circle of radius 2, so from 0 to 4, the integral is 21 π · (2)2 = 2π. Next, there is a right triangle with base 1 and height 2, thus its area is 12 · 2 = 1. For the final piece of the integral we can again usse symmetry to see the part above and the R7 part below the axes cancel out. Thus, 0 f (x) dx = 2π + 1. We do one more example before moving on to the next section. In examples 1 and 2 we found how large n had to be to guarantee that a left or right hand sum approximated the integral up to a given level of accuracy. This seemed artificial in both of those examples. Why would we want to know how accurate an approximation is to a certain area if we could compute the area exactly? Why would we even be using an approximation if we know the exact answer? Sometimes we won’t be able to find the exact value of the integral, the only available method is to use approximating sums. In a situation like this, it is of practical interest to know how many rectangles are needed to get an approximation accurate to within a certain tolerance. R1 2 Example 4: Approximate 0 e−x using a right hand sum. Your answer should be within ±0.001. 2 Solution: From 0 to 1, e−x is decreasing, so Z 1 2 2 (e−(0) − e−(1) ) · (1 − 0) 1 − e−1 0.63212 −x2 = = . 0≤ e dx − Rn ≤ n n n 0 R1 2 To guarantee Rn − 0 e−x dx ≤ 0.001 it suffices to have 0.63212 ≤ 0.001 so n ≥ 1000 · 0.63212 = 632.12. n 2 Thus, n = 633 should work. Using the Riemann sum applet, we see R633 = 0.460362. Since e−x is decreasing on the interval of integration we know that R633 is larger than the true value of the integral. Also, by our choice of n, we know R633 is not off by more than 0.001 from the true value of the integral. Thus, Z 1 2 0.459362 ≤ e−x dx ≤ 0.460362. 0 2. Other Approximating Sums and Order of Approximation(Optional) You are not responsible for the material in this section. Most likely I will only make a few passing references to this material in class. However, it is interesting to note that Ln and Rn are not the only sums that can be used to approximate the definite integral. If you’ve looked at the pull down menu on the 6 Riemann sum applet, you are already familar with what are called midpoint sums, trapezoidal sums, and Simpson’s rule. The first two are mostly self explanatory. We proceed like we do for Ln and Rn , but for the midpoint rule the height of the rectangle is based on the middle point in the interval, not an endpoint. The midpoint rule typically gives better approximations3 than either Ln or Rn . For the trapezoidal sums, we again proceed like we did for Ln and Rn , but this time we use a trapezoid instead of a rectangle. Things appear to be even better with the trapezoids. One can quantify this idea that one method provides better approximations than another method by looking at how the error estimates depend on n. For Ln and Rn , we saw the error estimates had an n in 00 the denominator. (People in theoretical computer science would write this as O( n1 ), “big - oh of n1 ) This means that every time we increase n by a factor of 10, our approximation will be accurate to another digit. It turns out that the error estimates for trapezoids and midpoint sums have an n2 in the denominator, i.e, they are O( n12 ). This means that every time we increase n by a factor of 10, our approximation will be accurate to another two digits. There’s another method, called Simpson’s rule. Instead of using trapezoids, we use figures that have a little piece of a parabola on top. This method has an error estimate with an n4 in the denominator. This means that everytime we increase n be a factor of 10, our approximation will be accurate to another 4 digits. Another generalization allows us to use rectangles of varying widths rather than taking rectangles all with the same width. Sometimes we chose the height of the rectangle to be the highest point in the subinterval, other times the height is chosen to be the lowest point in the subinterval, sometimes we chose the height of the rectangle randomly. We will only use Ln and Rn in this course since these are the easiest to explicitly write down. The point of this discusion is to merely point out that there lots of other choices used, both in practical and theoretical applications. 3Taking the limit as n goes to infinity, all of these sums converge to the integral. When we say that one method is a better approximation than another we mean that the one method requires a much smaller n to obtain a fixed degree of accuracy than the other method.
© Copyright 2026 Paperzz