Riemann Sum

Riemann Sum approximates a definite integral by dividing the area under a curve into rectangles; it connects intuition to formal integration.

abf(x)dx=limni=1nf(xi)Δx\int_a^b f(x)\,dx = \lim_{n \to \infty} \sum_{i=1}^{n} f(x_i^*)\,\Delta x

Solve a problem with Riemann Sum

Type the problem. The solver will use Riemann Sum where Riemann Sum is the right tool, and tell you when it is not.

Drag one in or paste from the clipboard. JPEG, PNG or WebP. You get the transcription to check before anything is solved.

How to get a better answer
  • Paste the whole problem, including the instruction word — "simplify", "solve for x" and "factor" lead to three different answers.
  • Say what you have already tried. "I got x = 4 and the book says 2" turns a solution into a diagnosis.
  • Set the level in the settings button. A calculus shortcut is not a better answer if you have not met derivatives yet.
  • For a photo, get the whole problem in frame and hold the page flat — you get the transcription to fix before anything is solved.

What each symbol means

What Riemann Sum takes
ff
aa
bb
nn
xx
Riemann Sum
SymbolMeaning
ffThe function whose area under the curve you're approximating; for a function like f(x)=x2f(x) = x^2, different inputs give different heights.
aaThe left endpoint of the interval (x-value where you start); the integral always needs a starting point.
bbThe right endpoint of the interval (x-value where you stop); must be greater than aa or the meaning changes.
nnThe number of rectangles you're dividing the region into; larger nn gives better approximations but more computation.
xxThe variable of integration, representing positions along the horizontal axis; the heights of rectangles are determined by plugging x-values into ff.

When to use it

Use Riemann Sums when you need to approximate a definite integral or understand how integration connects to area.

Level

Usually taught in: Calculus I · Appears on: AP Calculus

Worked examples

1. Approximate a linear function with right rectangles

Problem

Approximate 03xdx\int_0^3 x \, dx using n=3n = 3 right rectangles.
  1. Δx=ban=303=1\Delta x = \frac{b - a}{n} = \frac{3 - 0}{3} = 1

    The width of each rectangle is the total interval length divided by the number of rectangles.

  2. x1=1,x2=2,x3=3x_1 = 1, \quad x_2 = 2, \quad x_3 = 3

    For right rectangles, the sample points are the right endpoints of each interval: 0+1=10+1=1, 0+2=20+2=2, 0+3=30+3=3.

  3. f(1)=1,f(2)=2,f(3)=3f(1) = 1, \quad f(2) = 2, \quad f(3) = 3

    Evaluate the function f(x)=xf(x) = x at each right endpoint.

  4. i=13f(xi)Δx=(1+2+3)1=6\sum_{i=1}^3 f(x_i) \Delta x = (1 + 2 + 3) \cdot 1 = 6

    Multiply each height by the width and sum: this is the Riemann sum formula in action.

Answer: 66

This problem uses a right Riemann sum with few rectangles to make arithmetic easy. With n=3n = 3, each rectangle has width 1, and we sample the function at the right edge of each interval.

2. Approximate a decreasing quadratic with left rectangles

Problem

Use a left Riemann sum with n=4n = 4 to approximate 02(4x2)dx\int_0^2 (4 - x^2) \, dx.
  1. Δx=ban=204=0.5\Delta x = \frac{b - a}{n} = \frac{2 - 0}{4} = 0.5

    Each of the 4 rectangles spans a width of 0.5 units.

  2. x0=0,x1=0.5,x2=1,x3=1.5x_0 = 0, \quad x_1 = 0.5, \quad x_2 = 1, \quad x_3 = 1.5

    For a left Riemann sum, sample at the left endpoint of each subinterval [0,0.5][0, 0.5], [0.5,1][0.5, 1], [1,1.5][1, 1.5], and [1.5,2][1.5, 2].

  3. f(0)=402=4,f(0.5)=40.25=3.75,f(1)=41=3,f(1.5)=42.25=1.75f(0) = 4 - 0^2 = 4, \quad f(0.5) = 4 - 0.25 = 3.75, \quad f(1) = 4 - 1 = 3, \quad f(1.5) = 4 - 2.25 = 1.75

    Compute 4x24 - x^2 at each left endpoint: 402=44-0^2=4, 40.25=3.754-0.25=3.75, 41=34-1=3, 42.25=1.754-2.25=1.75.

  4. (4+3.75+3+1.75)0.5=12.50.5=6.25(4 + 3.75 + 3 + 1.75) \cdot 0.5 = 12.5 \cdot 0.5 = 6.25

    Sum the heights, then multiply by the width Δx=0.5\Delta x = 0.5.

Answer: 6.256.25

This example introduces fractions and a quadratic that decreases over the interval. The left endpoints give an overestimate of the true area because the function is decreasing.

3. Estimate game points using midpoint rectangles

Problem

A video game awards points based on your level: at level xx, you earn x2x^2 points per second. If you play from level 1 to level 5, use n=4n = 4 midpoint rectangles to estimate your total points earned.
  1. Δx=514=1\Delta x = \frac{5 - 1}{4} = 1

    The interval [1,5][1, 5] is divided into 4 subintervals, each of width 1.

  2. x1=1.5,x2=2.5,x3=3.5,x4=4.5x_1^* = 1.5, \quad x_2^* = 2.5, \quad x_3^* = 3.5, \quad x_4^* = 4.5

    For midpoint rectangles, use the center of each subinterval [1,2][1,2], [2,3][2,3], [3,4][3,4], [4,5][4,5].

  3. f(1.5)=(1.5)2=2.25,f(2.5)=(2.5)2=6.25,f(3.5)=(3.5)2=12.25,f(4.5)=(4.5)2=20.25f(1.5) = (1.5)^2 = 2.25, \quad f(2.5) = (2.5)^2 = 6.25, \quad f(3.5) = (3.5)^2 = 12.25, \quad f(4.5) = (4.5)^2 = 20.25

    Compute x2x^2 at each midpoint: (1.5)2=2.25(1.5)^2 = 2.25, (2.5)2=6.25(2.5)^2 = 6.25, (3.5)2=12.25(3.5)^2 = 12.25, (4.5)2=20.25(4.5)^2 = 20.25.

  4. (2.25+6.25+12.25+20.25)1=41(2.25 + 6.25 + 12.25 + 20.25) \cdot 1 = 41

    Add up all the rates (heights) and multiply by the time width (1 second per level) to get total points.

Answer: 4141

This midpoint Riemann sum approximates the video game's total points by sampling the earning rate at the middle of each level range. Midpoint sums often balance overestimation and underestimation better than left or right endpoints.

Common mistakes

Where Riemann Sum usually goes wrong
Answer came out wrong
Writing i=1nf(i)1\sum_{i=1}^n f(i) \cdot 1 when asked to approximate 03xdx\int_0^3 x \, dx with Δx=1\Delta x = 1
The sample points are xi=a+iΔxx_i = a + i \cdot \Delta x, so plug those into ff, not the index: i=1nf(xi)Δx\sum_{i=1}^n f(x_i) \Delta x.
Computing i=1nf(xi)\sum_{i=1}^n f(x_i^*) and forgetting the Δx\Delta x factor
Always multiply the sum of heights by the width: the full formula is i=1nf(xi)Δx\sum_{i=1}^n f(x_i^*) \cdot \Delta x.
Thinking that a single Riemann sum with n=5n = 5 gives the exact value of the integral
A Riemann sum gives only an approximation; as nn increases, it gets closer to the true integral, but never exact unless you actually take the limit.
The mistakeWhy it is wrongThe fix
Writing i=1nf(i)1\sum_{i=1}^n f(i) \cdot 1 when asked to approximate 03xdx\int_0^3 x \, dx with Δx=1\Delta x = 1Students treat the index ii as an x-value instead of using the actual sample point xix_i. This gives completely wrong values if ff is not f(x)=xf(x) = x.The sample points are xi=a+iΔxx_i = a + i \cdot \Delta x, so plug those into ff, not the index: i=1nf(xi)Δx\sum_{i=1}^n f(x_i) \Delta x.
Computing i=1nf(xi)\sum_{i=1}^n f(x_i^*) and forgetting the Δx\Delta x factorWithout the width factor, you get a sum of heights, not areas; the resulting number has wrong units and no meaning as an approximation to an integral.Always multiply the sum of heights by the width: the full formula is i=1nf(xi)Δx\sum_{i=1}^n f(x_i^*) \cdot \Delta x.
Thinking that a single Riemann sum with n=5n = 5 gives the exact value of the integralThe integral is the limit as nn \to \infty; for finite nn, you only have an estimate. Stopping after one value of nn means you have not taken the limit.A Riemann sum gives only an approximation; as nn increases, it gets closer to the true integral, but never exact unless you actually take the limit.

Tips and when to use something else

  • The more rectangles (larger nn), the better the approximation, but any finite nn leaves error.
  • Left, right, and midpoint methods all converge to the same limit; for fixed nn, use midpoint for the most balanced estimate.
  • When the curve is increasing, a left sum underestimates and a right sum overestimates; when the curve is decreasing, the opposite is true.
  • Once you know the Fundamental Theorem of Calculus, you can compute the exact integral; Riemann Sums are mainly useful for understanding the concept or approximating when no formula exists.

Frequently asked questions

Why do we need Riemann Sums if the Fundamental Theorem of Calculus is faster?
Riemann Sums explain WHY the integral equals area and how approximation connects to the limit process. They also work when you have no antiderivative—for example, if you only know data values from an experiment, not a formula, you can still approximate the integral using a Riemann sum.
Does it matter which method (left, right, midpoint) I use?
For a fixed nn, different methods give different approximations. Midpoint rectangles are usually most accurate because they tend to balance overestimation and underestimation. However, all three converge to the same true integral as nn \to \infty.
What does the limit notation mean in the Riemann sum formula?
It means that as you divide the interval into more and more rectangles, your approximation gets closer and closer to the exact value of the integral. The symbol lim\lim reminds you that the integral is the ultimate target, not any single finite sum.
Can I use a Riemann sum for functions with negative values?
Yes. When f(x)f(x) is negative, the rectangles extend downward, and f(xi)Δxf(x_i^*) \Delta x becomes a negative contribution to the sum. This represents area below the x-axis, and the Riemann sum correctly accounts for signed area.

Need a different method?

The full solver is not scoped to one formula — type any problem and it will pick the method.

Open the math solver

Reviewed 2026-09-18