How to Calculate a Riemann Sum

Find Δx, list the subinterval endpoints, pick sample points and add the areas. Step-by-step left, right and midpoint sums worked out by hand, then checked.

How to Calculate a Riemann Sum Step by Step

You have a function, an interval, and a number of rectangles n. Your exam expects you to produce a number, and here is how to calculate a Riemann sum by hand, with the arithmetic laid out so you do not lose a term.

The formula is Σ_{i=1}^{n} f(x_i*) · Δx, where Δx = (b - a)/n and x_i* is a sample point inside the i-th subinterval. The process is built on four steps, each a simple check on your scratch paper.

Step 1: Find Δx = (b - a)/n

This is the width of every rectangle. For a uniform partition, it is a single number. For the interval [0,2] with n = 4, Δx = (2-0)/4 = 0.5. For [0,π] with n = 4, Δx = (π - 0)/4 ≈ 0.7854. Write it down before you do anything else. If you miscompute Δx, every subsequent term is wrong.

The failure case: on an exam, a student writes Δx = (b - a) without dividing by n. This single error multiplies every rectangle height by n, giving a sum that is off by a factor of 4 or 6 or 10. Check your denominator.

Step 2: List the Partition Points x₀, x₁, …, xₙ

Start at x₀ = a. Add Δx repeatedly until you reach xₙ = b. For [0,2] with Δx = 0.5, the list is 0, 0.5, 1.0, 1.5, 2.0. There are n + 1 points: five points for n = 4. The most common indexing mistake is using n points instead of n + 1, which drops the last endpoint and shifts every subinterval.

Write the list vertically down the margin of your scratch paper. You will refer to it for every sample point decision.

Step 3: Choose Sample Points, Left, Right, or Midpoint

The type of Riemann sum determines which x_i* you use from each subinterval [x_{i-1}, x_i].

Left Riemann Sum

Use x_i* = x_{i-1} (the left endpoint). For n = 4, you use x₀, x₁, x₂, x₃, four points, skipping xₙ. For an increasing function, a left Riemann sum underestimates the area; for a decreasing function, it overestimates.

Right Riemann Sum

Use x_i* = x_i (the right endpoint). You use x₁, x₂, x₃, x₄, again four points, skipping x₀. For an increasing function, a right Riemann sum overestimates the area; for a decreasing function, it underestimates.

Midpoint Riemann Sum

Use the midpoint of each subinterval: (x_{i-1} + x_i)/2. You evaluate the function at four different points, none of which are the original partition points. The midpoint rule is often more accurate than the left or right rule for the same n, but its over/underestimate behavior depends on concavity, not monotonicity.

Step 4: Evaluate f at Each Sample Point, Multiply by Δx, and Sum

For each sample point, compute f(x_i*). Multiply each by Δx. Add them all. That single number is your Riemann sum.

Set it up as a table so you can see every term. A common hand-computation error is to sum the function values and then multiply by Δx only once, that gives you n times the correct answer if you multiply at the end, or no factor at all if you forget entirely. Every individual term is f(x_i*) · Δx. Write each product in its own column.

Example: Left and Right Sums of f(x) = x² on [0,2] with n = 4

OpenStax Calculus Volume 1, section 5.1, shows this exact function to introduce left, right, and midpoint approximations.

Given: f(x) = x², [a,b] = [0,2], n = 4. Δx = 0.5. Partition points: 0, 0.5, 1.0, 1.5, 2.0.

Left Riemann Sum

Sample points: 0, 0.5, 1.0, 1.5. Function values: f(0) = 0, f(0.5) = 0.25, f(1) = 1, f(1.5) = 2.25. Multiply each by Δx = 0.5: 0, 0.125, 0.5, 1.125. Sum = 1.75. The exact integral is 8/3 ≈ 2.667, so the left sum is an underestimate. Because f is increasing on [0,2], the left Riemann sum underestimates the area.

Right Riemann Sum

Sample points: 0.5, 1.0, 1.5, 2.0. Function values: f(0.5) = 0.25, f(1) = 1, f(1.5) = 2.25, f(2) = 4. Multiply by Δx = 0.5: 0.125, 0.5, 1.125, 2.0. Sum = 3.75. This is an overestimate. For an increasing function, the right Riemann sum always overestimates the area.

The table format keeps the arithmetic clean. Write each subinterval as a row: i, [x_{i-1}, x_i], x_i*, f(x_i*), product. The AP Calculus AB released free-response questions use this layout in their scoring guidelines, setup points are awarded before any arithmetic.

Example: Midpoint Sum of f(x) = sin(x) on [0,π] with n = 4

This example tests trigonometric evaluation and midpoint selection. Δx = (π - 0)/4 = π/4 ≈ 0.7854. Partition points: 0, π/4, π/2, 3π/4, π.

Midpoints: x₁* = π/8 ≈ 0.3927, x₂* = 3π/8 ≈ 1.1781, x₃* = 5π/8 ≈ 1.9635, x₄* = 7π/8 ≈ 2.7489. Function values: sin(0.3927) ≈ 0.3827, sin(1.1781) ≈ 0.9239, sin(1.9635) ≈ 0.9239, sin(2.7489) ≈ 0.3827. Multiply each by Δx ≈ 0.7854: 0.3006, 0.7256, 0.7256, 0.3006. Sum ≈ 2.052.

The exact integral of sin(x) from 0 to π is 2.052. Compare that to the left sum (error about 0.667) or right sum (error about 1.333) for the same n. The midpoint rule is substantially more accurate for smooth functions. Because sin(x) on [0,π] is concave down on (0,π/2) and concave up on (π/2,π), the midpoint rule does not guarantee a simple over/underestimate, check the concavity of your function before making a justification.

Use a scientific calculator in radian mode. The most frequent failure in trig Riemann sums is degrees-versus-radians: if your calculator is in degrees, sin(0.3927) is about 0.007, not 0.3827, and the sum collapses to near zero.

Setting Up a Table So You Don't Lose Terms

Draw a table with columns: i (from 1 to n), subinterval [x_{i-1}, x_i], sample point x_i*, f(x_i*), and product f(x_i*)·Δx. This forces you to write every term explicitly. The table also catches indexing errors: for a left sum, the sample point column should never contain xₙ; for a right sum, it should never contain x₀.

On an AP exam, the scoring rubric for a table-based Riemann sum awards points for the correct identification of each subinterval's endpoints and the correct sample point selection, even if the arithmetic is wrong. The table proves you know the setup.

Common Mistakes

n vs. n + 1 points: A partition has n + 1 endpoints. For a left sum, you use the first n endpoints. For a right sum, you use the last n endpoints. Using n points when you need n + 1 (or vice versa) shifts every subinterval.

Wrong endpoints: Using x_i when the problem asks for left endpoints, or x_{i-1} when it asks for right endpoints. This is the most heavily penalized error on free-response questions, it is a concept error, not an arithmetic slip.

Forgetting the Δx factor: Summing function values without multiplying by Δx. The result has the wrong dimension and is off by a factor equal to the subinterval width. A student who writes "sum = 3.5" without multiplying by 0.5 would report 3.5 instead of 1.75 for the left sum of x² on [0,2].

Sign errors: A Riemann sum computes signed area. If f(x) is negative on any subinterval, the product f(x_i*)·Δx is negative. The total sum can be smaller than the positive area or even negative. The definite integral is not always the area under the curve, it is the net signed area.

Radians vs. degrees: For any trigonometric function, set your calculator to radian mode. Using degrees changes every function value and produces a meaningless approximation.

Over/underestimate justification by monotonicity, not concavity: For left and right sums, the over/underestimate behavior depends on whether the function is increasing or decreasing on the entire interval. For midpoint sums, it depends on concavity. The AP Calculus CED Topic 6.2 specifies: "If f is increasing on [a,b], then left Riemann sum is an underestimate and right Riemann sum is an overestimate." Do not mention concavity unless the problem asks about the midpoint or trapezoidal rule.

Check Your Answer With a Calculator

After you finish by hand, verify your result with a Riemann sum calculator. Enter the function, the interval, the number of subintervals, and the rule (left, right, or midpoint). The calculator returns the sum instantly. If your hand-computed sum differs by more than 0.01 (for n = 4), you have an arithmetic error or a misidentified sample point. Recheck each row of your table.

Common Questions

What is the formula for a Riemann sum?

The formula is Σ_{i=1}^{n} f(x_i*) · Δx, where Δx = (b - a)/n and x_i* is the sample point in the i-th subinterval.

How do I know whether a left Riemann sum overestimates or underestimates the area?

For an increasing function on the interval, a left Riemann sum is an underestimate. For a decreasing function, it is an overestimate. This is a standard justification in AP Calculus free-response questions.

What is the difference between a left Riemann sum and a right Riemann sum?

A left Riemann sum uses the left endpoint of each subinterval as the sample point. A right Riemann sum uses the right endpoint. For n subintervals, a left sum uses n points starting at x₀, and a right sum uses n points ending at xₙ.

How do I handle a Riemann sum when the function is negative on part of the interval?

The Riemann sum calculates signed area. For subintervals where f(x) is negative, the product f(x_i*)·Δx is negative. Add these negative terms to the positive ones. The total is the net signed area, not the absolute area.

What is a midpoint Riemann sum?

A midpoint Riemann sum uses the midpoint of each subinterval as the sample point. It is often more accurate than the left or right sum for the same number of subintervals, but its over/underestimate behavior depends on the concavity of the function.

Why does my Riemann sum calculation not match the calculator?

The most common causes are an incorrect Δx, using the wrong sample points (left vs. right), forgetting to multiply by Δx, or having your calculator in degree mode for trigonometric functions. Recheck each row of your table against the calculator's output.

What does the College Board require for justifying over/underestimate on an AP exam?

The scoring guidelines require you to state that the function is increasing or decreasing on the interval. For an increasing function, the left sum is an underestimate and the right sum is an overestimate. For a decreasing function, the opposite holds. Concavity is not part of the left/right justification.