← MathScape

Computing Riemann Sums

MATH161
Reference: Stewart 4.2  •  Chapter: 4  •  Section: 2

Navigation: Wiki Home > Skills > Computing Riemann Sums

Computing Riemann Sums

From Rectangles to Areas

How do you find the area of a region with curved boundaries? You can't use a simple formula like length times width. The brilliant idea behind calculus is to approximate the curved region with rectangles, then make the approximation better and better.

A Riemann sum is exactly this: the total area of rectangles that approximate the region under a curve. By increasing the number of rectangles, the approximation improves. In the limit, as we use infinitely many infinitely thin rectangles, we get the exact area.

The key insight: A Riemann sum isn't just a numerical approximation—it's a fundamental way of thinking about accumulation. Every integral you'll ever compute is, at its heart, a limit of Riemann sums.

Prerequisite Map

This skill
Riemann Sums

Quick Reference

Property Value
Concept Integration
Course MATH161
Section Stewart 4.2
Difficulty Intermediate
Time ~20 minutes

Key Concepts

Setting Up a Riemann Sum

To approximate $\int_a^b f(x)\,dx$ using $n$ rectangles:

Step 1: Divide the interval $[a,b]$ into $n$ equal subintervals.

The width of each subinterval is: $$\Delta x = \frac{b - a}{n}$$

The endpoints are: $$x_0 = a, \quad x_1 = a + \Delta x, \quad x_2 = a + 2\Delta x, \quad \ldots, \quad x_n = b$$

In general: $x_i = a + i \cdot \Delta x$

Step 2: Choose sample points in each subinterval $[x_{i-1}, x_i]$.

Step 3: Form the sum of rectangle areas: $$\sum_{i=1}^{n} f(x_i^*) \cdot \Delta x$$

where $x_i^*$ is the sample point in the $i$th subinterval.

Types of Riemann Sums

Type Sample Point Formula for $x_i^*$
Right Riemann Sum ($R_n$) Right endpoint $x_i^* = x_i = a + i\Delta x$
Left Riemann Sum ($L_n$) Left endpoint $x_i^* = x_{i-1} = a + (i-1)\Delta x$
Midpoint Sum ($M_n$) Midpoint $x_i^* = \bar{x}_i = \frac{x_{i-1} + x_i}{2}$

Visualizing Riemann Sums

For $f(x) = x^2$ on $[0, 2]$ with $n = 4$ (right endpoints):

    y
    |
  4 +                    ■
    |                ■■■■■
  3 +                ■
    |            ■■■■■
  2 +            ■
    |        ■■■■■
  1 +    ■■■■■
    |■■■■■
  0 +----+----+----+----+→ x
    0   0.5   1   1.5   2

Each rectangle has width $\Delta x = 0.5$ and height $f(x_i)$ where $x_i$ is the right endpoint.

The Riemann Sum Formula

$$R_n = \sum_{i=1}^{n} f(x_i) \Delta x = \sum_{i=1}^{n} f\left(a + i \cdot \frac{b-a}{n}\right) \cdot \frac{b-a}{n}$$

Important observation: For an increasing function:

For a decreasing function, the opposite is true.

Physical Interpretation

Riemann sums model accumulated quantities:

Practice Problems

Level 1 Identifying Components

For the Riemann sum used to approximate $\int_1^5 (2x+3)\,dx$ with $n = 8$ subintervals:

  1. What is $\Delta x$?
  2. What are the values $x_0, x_1, x_2$?
  3. If using right endpoints, what is $x_3^*$?
Thought Process

Use the formulas:

  • $\Delta x = \frac{b-a}{n}$
  • $x_i = a + i \cdot \Delta x$
  • For right endpoints, $x_i^* = x_i$
Show Answer

(a) $\Delta x = \frac{5 - 1}{8} = \frac{4}{8} = \frac{1}{2}$

(b)

  • $x_0 = 1$
  • $x_1 = 1 + \frac{1}{2} = \frac{3}{2}$
  • $x_2 = 1 + 2 \cdot \frac{1}{2} = 2$

(c) For right endpoints: $x_3^* = x_3 = 1 + 3 \cdot \frac{1}{2} = \frac{5}{2}$

Level 2 Computing a Right Riemann Sum

Compute the right Riemann sum $R_4$ for $f(x) = x^2 - 1$ on $[0, 2]$ using $n = 4$ subintervals.

Thought Process
  1. Find $\Delta x = \frac{2-0}{4} = \frac{1}{2}$
  2. List the right endpoints: $x_1 = 0.5, x_2 = 1, x_3 = 1.5, x_4 = 2$
  3. Evaluate $f$ at each right endpoint
  4. Multiply each by $\Delta x$ and add
Show Answer

$\Delta x = \frac{2-0}{4} = 0.5$

Right endpoints: $x_1 = 0.5, x_2 = 1, x_3 = 1.5, x_4 = 2$

Evaluate $f(x) = x^2 - 1$:

  • $f(0.5) = 0.25 - 1 = -0.75$
  • $f(1) = 1 - 1 = 0$
  • $f(1.5) = 2.25 - 1 = 1.25$
  • $f(2) = 4 - 1 = 3$

$$R_4 = \Delta x \cdot [f(0.5) + f(1) + f(1.5) + f(2)]$$ $$= 0.5 \cdot [-0.75 + 0 + 1.25 + 3]$$ $$= 0.5 \cdot 3.5 = 1.75$$

Level 3 Comparing Left and Right Sums

For $f(x) = \sqrt{x}$ on $[1, 9]$ with $n = 4$:

  1. Compute the left Riemann sum $L_4$
  2. Compute the right Riemann sum $R_4$
  3. Which is an overestimate and which is an underestimate? Explain why.
Thought Process

First find $\Delta x = \frac{9-1}{4} = 2$.

For $L_4$, use left endpoints: $1, 3, 5, 7$ For $R_4$, use right endpoints: $3, 5, 7, 9$

Since $f(x) = \sqrt{x}$ is an increasing function, think about whether rectangles fit inside or extend beyond the curve.

Show Answer

$\Delta x = \frac{9-1}{4} = 2$

(a) Left Riemann Sum:

Left endpoints: $1, 3, 5, 7$

$$L_4 = 2[f(1) + f(3) + f(5) + f(7)]$$ $$= 2[\sqrt{1} + \sqrt{3} + \sqrt{5} + \sqrt{7}]$$ $$= 2[1 + 1.732 + 2.236 + 2.646]$$ $$\approx 2(7.614) \approx 15.23$$

(b) Right Riemann Sum:

Right endpoints: $3, 5, 7, 9$

$$R_4 = 2[f(3) + f(5) + f(7) + f(9)]$$ $$= 2[\sqrt{3} + \sqrt{5} + \sqrt{7} + \sqrt{9}]$$ $$= 2[1.732 + 2.236 + 2.646 + 3]$$ $$\approx 2(9.614) \approx 19.23$$

(c) Since $f(x) = \sqrt{x}$ is increasing on $[1, 9]$:

  • $L_4 \approx 15.23$ is an underestimate (left endpoints give shorter rectangles)
  • $R_4 \approx 19.23$ is an overestimate (right endpoints give taller rectangles)

The true value $\int_1^9 \sqrt{x}\,dx$ lies between them.

Level 4 Net Area Interpretation

The function $g(x) = x - 2$ changes sign on the interval $[0, 4]$.

  1. Compute $R_4$ (right Riemann sum with $n = 4$)
  2. Sketch the rectangles. Which have positive area? Negative area?
  3. Explain what your answer represents in terms of regions above and below the $x$-axis.
Thought Process

When a function takes negative values, $f(x_i^*) < 0$, the corresponding rectangle contributes a negative term to the sum. The Riemann sum computes net area: area above minus area below.

Find where $g(x) = 0$ to identify which rectangles are above/below the axis.

Show Answer

(a) $\Delta x = \frac{4-0}{4} = 1$

Right endpoints: $1, 2, 3, 4$

$$R_4 = 1 \cdot [g(1) + g(2) + g(3) + g(4)]$$ $$= (1-2) + (2-2) + (3-2) + (4-2)$$ $$= -1 + 0 + 1 + 2 = 2$$

(b) $g(x) = 0$ when $x = 2$

  • Rectangle over $[0,1]$: height $g(1) = -1$ (negative, below axis)
  • Rectangle over $[1,2]$: height $g(2) = 0$ (zero contribution)
  • Rectangle over $[2,3]$: height $g(3) = 1$ (positive, above axis)
  • Rectangle over $[3,4]$: height $g(4) = 2$ (positive, above axis)

(c) The answer $R_4 = 2$ represents the net area:

$$\text{Net Area} = \text{(Area above } x\text{-axis)} - \text{(Area below } x\text{-axis)}$$

The region below the axis (on $[0,2]$) has area 2, and the region above (on $[2,4]$) has area 4, giving net area $4 - 2 = 2$.

Level 5 Writing a Riemann Sum in Sigma Notation
  1. Write the right Riemann sum for $\int_2^6 (x^3 + 1)\,dx$ using $n$ subintervals in sigma notation.
  2. Express this sum fully in terms of $n$ and $i$ (no $\Delta x$ or $x_i$).
  3. Use the summation formulas $\sum_{i=1}^n 1 = n$, $\sum_{i=1}^n i = \frac{n(n+1)}{2}$, $\sum_{i=1}^n i^2 = \frac{n(n+1)(2n+1)}{6}$, and $\sum_{i=1}^n i^3 = \left[\frac{n(n+1)}{2}\right]^2$ to write a closed-form expression for $R_n$.
Thought Process

For part (a): Set up $\sum_{i=1}^n f(x_i) \Delta x$ where $x_i = 2 + i \cdot \Delta x$ and $\Delta x = \frac{4}{n}$.

For part (b): Substitute the expressions for $x_i$ and expand.

For part (c): Expand $(x_i)^3$ using the binomial theorem, then apply the summation formulas. Factor out constants from each sum.

Show Answer

(a) With $a = 2$, $b = 6$, we have:

  • $\Delta x = \frac{6-2}{n} = \frac{4}{n}$
  • $x_i = 2 + i \cdot \frac{4}{n} = 2 + \frac{4i}{n}$

$$R_n = \sum_{i=1}^{n} f(x_i) \Delta x = \sum_{i=1}^{n} \left[\left(2 + \frac{4i}{n}\right)^3 + 1\right] \cdot \frac{4}{n}$$

(b) Let $u = 2 + \frac{4i}{n}$. Expanding using $(a+b)^3 = a^3 + 3a^2b + 3ab^2 + b^3$:

$$u^3 = 2^3 + 3(2)^2\left(\frac{4i}{n}\right) + 3(2)\left(\frac{4i}{n}\right)^2 + \left(\frac{4i}{n}\right)^3$$

$$= 8 + \frac{48i}{n} + \frac{96i^2}{n^2} + \frac{64i^3}{n^3}$$

So: $$R_n = \frac{4}{n}\sum_{i=1}^{n}\left[9 + \frac{48i}{n} + \frac{96i^2}{n^2} + \frac{64i^3}{n^3}\right]$$

(c) Distributing the sum:

$$R_n = \frac{4}{n}\left[9n + \frac{48}{n}\cdot\frac{n(n+1)}{2} + \frac{96}{n^2}\cdot\frac{n(n+1)(2n+1)}{6} + \frac{64}{n^3}\cdot\frac{n^2(n+1)^2}{4}\right]$$

Simplifying each term: $$= 36 + \frac{96(n+1)}{n} + \frac{64(n+1)(2n+1)}{n^2} + \frac{64(n+1)^2}{n^2}$$

As $n \to \infty$, this approaches $36 + 96 + 128 + 64 = 324$.

(Verification: $\int_2^6 (x^3+1)\,dx = \left[\frac{x^4}{4} + x\right]_2^6 = (324 + 6) - (4 + 2) = 324$ ✓)

Mastery Checklist

Mental Model

The Staircase Approximation: Imagine building a staircase that follows a curved hill. Each step (rectangle) has a fixed width but varies in height based on the hill at some point in that interval. A few wide steps give a rough approximation; many narrow steps follow the curve more closely. The Riemann sum is the total vertical material in your staircase. As steps get narrower and more numerous, your staircase becomes indistinguishable from the smooth hill.


Connections

Looking back:

Looking ahead:


Previous Up Next
Sigma Notation Skills Index Definite Integral Definition

Last updated: 2026-01-22