If you're seeing this message, it means we're having trouble loading external resources on our website.

If you're behind a web filter, please make sure that the domains *.kastatic.org and *.kasandbox.org are unblocked.

Main content

Riemann approximation introduction

AP.CALC:
LIM‑5 (EU)
,
LIM‑5.A (LO)
,
LIM‑5.A.1 (EK)
,
LIM‑5.A.2 (EK)
,
LIM‑5.A.3 (EK)
,
LIM‑5.A.4 (EK)
Approximating the area under a curve using some rectangles.  This is called a "Riemann sum". Created by Sal Khan.

Want to join the conversation?

  • leaf orange style avatar for user Student
    Hey Sal, I have a question. Are Riemann sums actually useful for anything once you know how to integrate? It seems a lot easier to just learn integration.
    (77 votes)
    Default Khan Academy avatar avatar for user
  • hopper jumping style avatar for user PrimeNoodles
    With my limited knowledge of calculus, the Riemann sums seem pretty inefficient, since you'll always have some space not covered by the rectangles. Is there a way that you can get an exact answer, or is this the best that has been come up with at this time? Of course, I don't know much in calculus yet, since I've only done Alg. 1&2, Geo., and PreCal, so there might be a construct that I don't know of that would answer my question. Thanks to any who will answer this! :)
    (0 votes)
    Default Khan Academy avatar avatar for user
    • piceratops ultimate style avatar for user Just Keith
      You need to do differential calculus before integral calculus.

      But, to answer your question, yes there is a way to get an exact answer. It is what happens when you split the area up into infinitely many rectangles of infinitesimally small widths. That way, you have no error at all. It is called a definite integral.

      But, you really do need to master differential calculus first or you will be lost.
      (22 votes)
  • blobby green style avatar for user Wyatt Butson
    How do you know how many pieces you're suppose to split it in? Like what number are you suppose to divide b-a by?
    (5 votes)
    Default Khan Academy avatar avatar for user
    • leaf blue style avatar for user Stefen
      The number of pieces you use is a function the accuracy (how close to the actual value of the area) you want.
      While this technique has it's place in numerical analysis, you are going to see that as the number of pieces you split the interval into approaches infinity, the value of the result of the sum approaches the actual value of the area - and that this is the foundation for the concept of integration - which is the next section of this track.
      (9 votes)
  • starky ultimate style avatar for user cia d.
    Why did Sal construct 4 rectangles? Why not 5, 6 etc... or is 4 rectangles given in the problem?
    (5 votes)
    Default Khan Academy avatar avatar for user
    • hopper cool style avatar for user Oliver Dahl
      Most of the practice problems of integral calculus asked for 4 equal subsections so I believe it was a choice made by him in this example. Just like you mentioned it is oftentimes already given in the problem. With more rectangles you get a better approximation of the function.
      (7 votes)
  • blobby green style avatar for user jordan_benoit
    At seconds, how do you know that you need four rectangles?
    (3 votes)
    Default Khan Academy avatar avatar for user
  • duskpin tree style avatar for user VikingTheDude
    If the area under the curve is below the x-axis, would it have a negative value?
    (5 votes)
    Default Khan Academy avatar avatar for user
  • blobby green style avatar for user TheAlphaKnight3123
    Are Riemann sums the ones using left endpoints because I asked this question in a different video and im not sure if this video is the one that has now answered my question.
    (3 votes)
    Default Khan Academy avatar avatar for user
    • leaf blue style avatar for user Chris
      Riemann sums can have a left, right, middle, or trapezoidal approximations. The most accurate are usually the trapezoidal and middle rectangle approximations because they only give up a small amount of area. However, Riemann sums will usually give more accurate approximations based on the number of rectangles and trapezoids; for example, an approximation using 4500 left rectangles will be better than simply using four rectangles to express the area under a curve. Similarly, an infinite number of rectangles will have a more accurate approximation of the area instead of simply using 4500 rectangles.
      (2 votes)
  • leafers ultimate style avatar for user Joseph Gabel
    could you figure out the area above the curve by finding the two axis of the area above the graph, and treating it as 1/4 of an oval, and then subtract from the area you are interested in?
    (2 votes)
    Default Khan Academy avatar avatar for user
    • leaf green style avatar for user kubleeka
      The general technique of finding a rectangle that overestimates the area, then using calculus to find the difference instead of computing the area directly, would work.

      But you can't treat it as a quarter of an oval/ellipse, because a parabola isn't an ellipse. At the rightmost part of an oval, the tangent to the curve is vertical. But the tangent to a parabola is never vertical.
      (3 votes)
  • leafers sapling style avatar for user jfeng1737
    What's the difference between using "inscribed" rectangles and "circumscribed" rectangles? I'm doing my calc homework right now haha. Is there a difference in the summation formula?
    (1 vote)
    Default Khan Academy avatar avatar for user
    • blobby green style avatar for user robshowsides
      Inscribed rectangles are inside the curve. So assuming the curve is above the y-axis, each rectangle would get its height from the lowest point in its subinterval, while circumscribed rectangles would take their height from the highest point in each subinterval. For example, for any curve that is always positive and increasing, the inscribed rectangles would give a "left endpoint" riemann sum, while the circumscribed rectangles would give a "right endpoint" riemann sum.
      (5 votes)
  • blobby green style avatar for user j.loves.bus
    Wouldn't finding the over-estimate and the under-estimate of the curve, adding them together, and dividing by two give a more accurate estimate of the area? Though it still wouldn't be completely accurate.
    (1 vote)
    Default Khan Academy avatar avatar for user

Video transcript

What we're going to try to do in this video is approximate the area under the curve y is equal to x squared plus 1 between the intervals x equals 1 and x equals 3. And we're going to approximate it by constructing four rectangles under the curve of equal width. So let's first think about what those rectangles look like, so four rectangles of equal width. So it looks like that, like that, and like that. And I haven't really defined the top of the rectangles just yet. But let's think about what those widths have to be if they're going to be equal width. And we can call that width delta x. So this distance right over here, we're going to call that delta x. So delta x is going to have to be the total distance that we're traveling in x. So we finish at 3. We started at 1. And we want four equal-width rectangles. So it's going to be equal to 1/2. So for example, this first interval between the boundary between the first rectangle and the second is going to be 1.5. Then we go 1/2 to 2. Then we go to 2.5. And then we go 1/2 to 3. Now, let's think about how we'll define the height of the rectangles. For the sake of this video-- we'll see in future videos that there's other ways of doing this-- I'm going to use the left boundary of the rectangle to define the height-- or the function, I should say. I'm going to use the function evaluated at the left boundary to define the height. So for example, for the first rectangle, this point right over here is f of 1. And so I will say that that is the height of our first rectangle. Then we go over here to the left boundary of the second rectangle. We're now looking at the function evaluated at 1.5. So that is f of 1.5. That's the height. And so we get our second rectangle. Then, we get-- I can keep going like this-- we get, for this third rectangle, we have the function evaluated at 2. So that's right over here. That's f of 2. And so then we get our third rectangle. And then, finally, we have our fourth rectangle, the function evaluated at 2.5. So the function evaluated at 2.5 is the height. So this is f of 2.5. Remember, in each of these, I'm just looking at the left boundary of the rectangle and evaluating the function there to get the height of the rectangle. Now that I've set it up in this way, what is the total approximate area using the sum of these rectangles? And clearly, this isn't going to be a perfect approximation. I'm giving up on a bunch of area here. Let me see if I can color that in with a color that I have not used. So I'm giving up. I'm giving up this area. I'm giving up this area. I'm giving up that area. I'm giving up that area there. But this is just an approximation, and maybe if I had many more rectangles, it would be a better approximation. So let's figure out what the areas of each of the rectangles are. So the area of this first rectangle is going to be the height, which is f of 1, times the base, which is delta x. The area of the second rectangle is going to be the height, which we already said was f of 1.5, times the base, times delta x. The height of the third rectangle is going to be the function evaluated at its left boundary, so f of 2-- so plus f of 2 times the base, times delta x. And then, finally, the area of the third rectangle, the height is the function evaluated at 2.5, so plus-- that's a different color than what I wanted to use. I wanted to use that orange color-- so plus the function evaluated at 2.5 times the base. This is going to be equal to our approximate area-- let me make it clear-- approximate area under the curve, just the sum of these rectangles. So let's evaluate this. So this is going to be equal to f of-- it's going to be equal to the function evaluated at 1. 1 squared plus 1 is just 2, so it's going to be 2 times 1/2. Plus the function evaluated at 1.25. 1.25 squared is 2.25. And then you add 1 to it, it becomes 3.25. So plus 3.25 times 1/2. And then we have the function evaluated at 2. Well, 2 squared plus 1 is 5, so it's 5 times 1/2. And then finally, you have the function evaluated at 2.5. 2.5 squared is 6.25 plus 1. So that's 7.25 times 1/2. And just to make the math simpler, we can factor out the 1/2. So this is going to be equal to-- write 1/2 in a neutral color-- 1/2 times 2 plus 3.25 plus 5 plus 7.25, which is equal to 1/2 times-- let's see if I can do this in my head. 2 plus 5 is easy. That's 7. 3 plus 7 is 10. And then we have 0.25 plus 0.25, so it's going to be 10.5 plus 7 is 17.5. So 1/2 times 17.5, which is equal to 8.75, Which, once again, gives us an approximation. And clearly, the way I've drawn it right over here, for the function we're using, it's going to be an underestimate, because we've given up all that pink area that I had colored in before. It's an underestimate, but it's an approximation of the area under the curve. In the next few videos, we're going to try to generalize this to situations where we have an arbitrary function and we have an arbitrary number of rectangles. And we'll also start-- in videos after that, we'll look at rectangles where we define the height not by the left boundary, but by the right boundary, or by the midpoint. Or maybe we don't use rectangles at all. Maybe we might use things like trapezoids. Anyway, have fun.