How to Calculate a Riemann Sum: Step-by-Step Guide

Calculating a Riemann sum by hand is a great way to understand how numerical integration works. Whether you're preparing for a calculus exam or just want to see how the area under a curve is approximated, this step-by-step guide will walk you through the process. For a broader overview, check out our page on What is a Riemann Sum?.

You'll Need

  • The function f(x) you want to integrate.
  • The interval [a, b] (lower bound a and upper bound b).
  • The number of subintervals n (more subintervals give a better approximation).
  • Choose a method: left, right, midpoint, or trapezoidal.
  • Pen/pencil and paper (or a spreadsheet).
  • A scientific calculator for evaluating functions.

Step-by-Step Process

Every Riemann sum follows the same basic formula: Σi=1n f(xi*) · Δx, where Δx = (b-a)/n and xi* is a sample point in the ith subinterval. The formula is explained in detail on our Riemann Sum Formula page.

  1. Find Δx: Divide the interval length by the number of subintervals: Δx = (ba) / n.
  2. Identify subinterval endpoints: Starting at a, add Δx repeatedly to get the endpoints: x0 = a, x1 = a + Δx, x2 = a + 2Δx, …, xn = b.
  3. Choose the sample points: For a left Riemann sum, use the left endpoint of each subinterval: xi* = xi-1. For a right Riemann sum, use the right endpoint: xi* = xi. For a midpoint Riemann sum, use the midpoint: (xi-1 + xi) / 2. For the trapezoidal rule, you average the left and right values (or use the formula directly).
  4. Evaluate the function at each sample point: Compute f(xi*) for i = 1 to n.
  5. Multiply by Δx and sum: Multiply each function value by Δx and add them all up: Σ f(xi*) · Δx.
  6. (Optional) If you're notching for trapezoids: The trapezoidal sum is (Δx/2) · [f(x0) + 2f(x1) + … + 2f(xn-1) + f(xn)].

Example 1: Left Riemann Sum for f(x) = x² on [0,2] with n = 4

Step 1: Δx = (2 – 0) / 4 = 0.5.

Step 2: Subinterval endpoints: x0 = 0, x1 = 0.5, x2 = 1.0, x3 = 1.5, x4 = 2.0.

Step 3: Left endpoints: 0, 0.5, 1.0, 1.5.

Step 4: Evaluate: f(0) = 0² = 0, f(0.5) = 0.25, f(1) = 1, f(1.5) = 2.25.

Step 5: Sum = (0 + 0.25 + 1 + 2.25) × 0.5 = 3.5 × 0.5 = 1.75.

The actual integral of x² from 0 to 2 is 8/3 ≈ 2.667, so the left sum underestimates. Using more subintervals improves accuracy.

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

Step 1: Δx = (π – 0) / 4 = π/4 ≈ 0.7854.

Step 2: Endpoints: 0, π/4, π/2, 3π/4, π.

Step 3: Midpoints: π/8, 3π/8, 5π/8, 7π/8. (Approx. 0.3927, 1.1781, 1.9635, 2.7489)

Step 4: Evaluate sin at each midpoint: sin(0.3927) ≈ 0.3827, sin(1.1781) ≈ 0.9239, sin(1.9635) ≈ 0.9239, sin(2.7489) ≈ 0.3827.

Step 5: Sum = (0.3827 + 0.9239 + 0.9239 + 0.3827) × 0.7854 = 2.6132 × 0.7854 ≈ 2.052.

The exact integral of sin(x) from 0 to π is 2, so the midpoint sum is quite close even with only 4 subintervals.

Common Pitfalls

  • Wrong sample points: Using right endpoints when you intend left will shift the approximation.
  • Forgetting the Δx factor: Each rectangle's area is f(xi*) × Δx, not just the sum of function values.
  • Sign errors: If the function dips below the x-axis, the area contributed is negative. Riemann sums sum signed areas.
  • Radians vs. degrees: For trigonometric functions like sin, always use radians unless stated otherwise.
  • Missing the trapezoidal formula: The trapezoidal rule uses a different weighting; don't treat it like left/right.

For more tips and to see what different Riemann sum values tell you, visit our guide on Interpreting Riemann Sum Results. If you have further questions, check the Riemann Sums FAQ. Now you're ready to tackle Riemann sums by hand — or use our Riemann Sum Calculator to check your work!

Try the free Riemann Sum Calculator ⬆

Get your Riemann sum: a method for approximating the definite integral of a function using rectangular or trapezoidal subdivisions. result instantly — no signup, no clutter.

Open the Riemann Sum Calculator

Contact Us