# Riemann Sums: Left, Right and Midpoint Rules With Examples

> Learn Riemann sums step by step: left, right and midpoint rectangles, sigma notation, over and underestimates, and how the limit becomes the definite integral.

Source: https://practicecalculus.com/blog/riemann-sums
Updated: 2026-09-12

## Key takeaways

- A Riemann sum estimates the area under a curve by adding up the areas of rectangles: $\sum f(x_i^*)\,\Delta x$.
- With $n$ equal pieces on $[a, b]$, each rectangle has width $\Delta x = \frac{b - a}{n}$, and the height comes from a left endpoint, right endpoint or midpoint.
- For an increasing function the left sum underestimates and the right sum overestimates; for a decreasing function it is the reverse.
- As $n \to \infty$ the Riemann sums approach the definite integral $\int_a^b f(x)\,dx$.

Finding the area of a rectangle is easy. Finding the area under a curve like $y = x^2$ is not, because the top edge bends. **Riemann sums** solve this by filling the region with thin rectangles and adding them up, and they are the idea that the entire definite integral is built on.

## What is a Riemann sum?

A **Riemann sum** is an estimate of the area under $y = f(x)$ on an interval $[a, b]$ made of rectangles:

1. Split $[a, b]$ into $n$ equal pieces, each of width

$$\Delta x = \frac{b - a}{n}$$

2. In each piece, pick a sample point $x_i^*$ and use $f(x_i^*)$ as the rectangle's height.
3. Add up the areas, height times width:

$$\sum_{i=1}^{n} f(x_i^*)\,\Delta x$$

The only choice you make is **where** in each piece to take the height. That choice gives the three standard rules.

## Left, right and midpoint Riemann sums

With $x_0 = a$, $x_1 = a + \Delta x$, $x_2 = a + 2\Delta x$, and so on up to $x_n = b$:

| Rule          | Sample point in piece $i$                    | Sum                                                        |
| ------------- | -------------------------------------------- | ---------------------------------------------------------- |
| Left sum      | left end, $x_{i-1} = a + (i-1)\Delta x$      | $L_n = \Delta x\,[f(x_0) + f(x_1) + \cdots + f(x_{n-1})]$   |
| Right sum     | right end, $x_i = a + i\,\Delta x$           | $R_n = \Delta x\,[f(x_1) + f(x_2) + \cdots + f(x_n)]$       |
| Midpoint sum  | middle, $a + (i - \frac{1}{2})\Delta x$      | $M_n = \Delta x\,[f(m_1) + f(m_2) + \cdots + f(m_n)]$       |

Notice that the left sum uses every point **except the last**, and the right sum uses every point **except the first**.

## Worked example 1: area under y = x² from 0 to 2

Estimate $\int_0^2 x^2\,dx$ with $n = 4$ using left, right and midpoint sums.

**Step 1. Width.** $\Delta x = \frac{2 - 0}{4} = 0.5$. The division points are $0, 0.5, 1, 1.5, 2$.

```graph
title: 'Area under y = x² from 0 to 2 with right-endpoint heights for 4 rectangles'
caption: 'Each piece has width $0.5$. The dots mark the right-endpoint heights $0.25, 1, 2.25$ and $4$. The shaded exact area is $\frac{8}{3}$.'
x: [-0.5, 2.5]
y: [-0.5, 4.5]
functions:
  - expr: x^2
    label: y = x²
shade: {expr: x^2, from: 0, to: 2}
points:
  - [0.5, 0.25, '0.25']
  - [1, 1, '1']
  - [1.5, 2.25, '2.25']
  - [2, 4, '4']
vertical:
  - {x: 0.5}
  - {x: 1}
  - {x: 1.5}
  - {x: 2}
```

**Step 2. Left sum.** Heights at $0, 0.5, 1, 1.5$:

$$L_4 = 0.5\,[0 + 0.25 + 1 + 2.25] = 0.5(3.5) = 1.75$$

**Step 3. Right sum.** Heights at $0.5, 1, 1.5, 2$:

$$R_4 = 0.5\,[0.25 + 1 + 2.25 + 4] = 0.5(7.5) = 3.75$$

**Step 4. Midpoint sum.** Midpoints $0.25, 0.75, 1.25, 1.75$:

$$M_4 = 0.5\,[0.0625 + 0.5625 + 1.5625 + 3.0625] = 0.5(5.25) = 2.625$$

The exact area (which we will confirm below) is $\frac{8}{3} \approx 2.667$. The left sum is far too low, the right sum far too high, and the midpoint sum is off by only $0.04$.

## Overestimate or underestimate?

On an **increasing** function like $x^2$ on $[0, 2]$, the left end of each piece is the lowest point, so every left rectangle sits under the curve: **left sums underestimate**. The right end is the highest point, so **right sums overestimate**. For a decreasing function, swap the two.

The midpoint rule depends on **concavity** instead. On a concave up curve like $x^2$, the midpoint sum underestimates (just slightly), and on a concave down curve it overestimates.

| Function shape | Left sum | Right sum | Midpoint sum |
| -------------- | -------- | --------- | ------------ |
| Increasing     | Under    | Over      | (check concavity) |
| Decreasing     | Over     | Under     | (check concavity) |
| Concave up     |          |           | Under        |
| Concave down   |          |           | Over         |

Averaging the left and right sums gives the **trapezoid rule**: $\frac{1.75 + 3.75}{2} = 2.75$. On a concave up curve the trapezoid rule overestimates, so the true value sits between the midpoint and trapezoid estimates: $2.625 < \frac{8}{3} < 2.75$.

## Worked example 2: a decreasing function

Estimate $\int_1^3 \frac{1}{x}\,dx$ with $n = 4$ using all three rules.

**Step 1. Width.** $\Delta x = \frac{3 - 1}{4} = 0.5$. Division points: $1, 1.5, 2, 2.5, 3$.

**Step 2. Left sum.** Heights $f(1) = 1$, $f(1.5) \approx 0.6667$, $f(2) = 0.5$, $f(2.5) = 0.4$:

$$L_4 = 0.5\,[1 + 0.6667 + 0.5 + 0.4] \approx 1.2833$$

**Step 3. Right sum.** Heights at $1.5, 2, 2.5, 3$:

$$R_4 = 0.5\,[0.6667 + 0.5 + 0.4 + 0.3333] = 0.5(1.9) = 0.95$$

**Step 4. Midpoint sum.** Midpoints $1.25, 1.75, 2.25, 2.75$ give heights $0.8$, $0.5714$, $0.4444$, $0.3636$:

$$M_4 \approx 0.5(2.1795) \approx 1.0898$$

The exact value is $\ln 3 \approx 1.0986$. This time the function is **decreasing**, so the left sum is too big and the right sum is too small: the opposite of example 1. The curve is concave up, so the midpoint sum is again slightly low.

## Worked example 3: Riemann sums from a table

A car's velocity is recorded every second:

| $t$ (s)      | 0 | 1 | 2 | 3 | 4  |
| ------------ | - | - | - | - | -- |
| $v$ (m/s)    | 0 | 4 | 7 | 9 | 10 |

Estimate the distance traveled from $t = 0$ to $t = 4$.

Distance is the area under the velocity curve, and $\Delta t = 1$.

**Left sum:** $1 \cdot (0 + 4 + 7 + 9) = 20$ m.

**Right sum:** $1 \cdot (4 + 7 + 9 + 10) = 30$ m.

The velocity only increases in the table, so (assuming it increases between readings too) the true distance is between $20$ and $30$ meters. You cannot use a midpoint sum with $n = 4$ here, because the table has no readings at $t = 0.5, 1.5, \ldots$. With $n = 2$ you could: midpoints $t = 1$ and $t = 3$ give $2 \cdot (4 + 9) = 26$ m.

## Writing Riemann sums in sigma notation

For a right sum on $[a, b]$ with $n$ pieces, the sample points are $x_i = a + i\,\Delta x$, so

$$R_n = \sum_{i=1}^{n} f\!\left(a + i\,\frac{b - a}{n}\right)\frac{b - a}{n}$$

For left sums replace $i$ with $i - 1$; for midpoints replace it with $i - \frac{1}{2}$.

### Worked example 4: the exact area as a limit

Find $\int_0^2 x^2\,dx$ as the limit of right sums.

**Step 1. Set up.** $\Delta x = \frac{2}{n}$ and $x_i = \frac{2i}{n}$, so $f(x_i) = \frac{4i^2}{n^2}$.

**Step 2. Write the sum.**

$$R_n = \sum_{i=1}^{n} \frac{4i^2}{n^2} \cdot \frac{2}{n} = \frac{8}{n^3}\sum_{i=1}^{n} i^2$$

**Step 3. Use the sum of squares formula** $\sum_{i=1}^{n} i^2 = \frac{n(n+1)(2n+1)}{6}$:

$$R_n = \frac{8}{n^3}\cdot\frac{n(n+1)(2n+1)}{6} = \frac{4}{3}\left(1 + \frac{1}{n}\right)\left(2 + \frac{1}{n}\right)$$

**Step 4. Take the limit.** As $n \to \infty$, both $\frac{1}{n}$ terms go to $0$:

$$\lim_{n\to\infty} R_n = \frac{4}{3}(1)(2) = \frac{8}{3}$$

So the exact area is $\frac{8}{3}$. With $n = 4$ the formula gives $\frac{4}{3}(1.25)(2.25) = 3.75$, matching worked example 1.

## From Riemann sums to the definite integral

The calculation above is exactly how the **definite integral** is defined:

$$\int_a^b f(x)\,dx = \lim_{n\to\infty}\sum_{i=1}^{n} f(x_i^*)\,\Delta x$$

The notation even mirrors the sum: $\int$ is a stretched "S" for sum, $f(x)$ is the height, and $dx$ is the infinitely thin width. Where $f$ is negative, the rectangles have negative height, so the integral measures **signed** area: area above the axis counts as positive and area below as negative.

Computing a limit of sums every time would be painful. The [fundamental theorem of calculus](/blog/fundamental-theorem-of-calculus) shows that you can skip it: $\int_0^2 x^2\,dx = \left[\frac{x^3}{3}\right]_0^2 = \frac{8}{3}$, using [antiderivatives](/blog/antiderivatives). Riemann sums are still how you approximate integrals from data or from functions with no simple antiderivative.

## Common Riemann sum mistakes

1. **Using $n + 1$ heights.** With $n = 4$ there are 5 division points but only 4 rectangles. A left sum drops the last point; a right sum drops the first.
2. **Forgetting to multiply by $\Delta x$.** Adding the heights gives $7.5$ in example 1, not the area $3.75$.
3. **Wrong midpoints.** The midpoint of $[1, 1.5]$ is $1.25$. Compute $f(1.25)$, not the average of $f(1)$ and $f(1.5)$ (that is the trapezoid rule).
4. **Unequal widths from a table.** If the data are not evenly spaced, each rectangle needs its own width. Do not use a single $\Delta x$.
5. **Mixing up over and under.** Increasing or decreasing decides left and right sums; concavity decides the midpoint and trapezoid rules.

## Practice with rectangles

Riemann sums reward a steady routine: find $\Delta x$, list the sample points, evaluate, add, multiply. The interactive lesson below lets you build left, right and midpoint sums with instant feedback, so you can see exactly which height or width went wrong and fix it on the next try.

## Frequently asked questions

### What is a Riemann sum?

A Riemann sum approximates the area under a curve by cutting the interval into pieces, building a rectangle on each piece, and adding up the rectangle areas. More pieces give a better estimate, and in the limit you get the exact area, the definite integral.

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

They use different heights. A left Riemann sum takes each rectangle's height from the function at the left end of its piece, a right Riemann sum from the right end. On the same interval with the same $n$, they use all but one of the same heights.

### Is the midpoint rule more accurate than left and right sums?

Usually yes, by a lot. The midpoint rule takes heights from the middle of each piece, so the overshoot on one side of each rectangle roughly cancels the undershoot on the other. Its error is typically about half that of the trapezoid rule and much smaller than left or right sums.

### How do you know if a Riemann sum is an overestimate or underestimate?

For left and right sums, look at whether the function is increasing or decreasing. If $f$ is increasing, left sums are too small and right sums are too big. For the midpoint rule, look at concavity: concave up means the midpoint sum is too small.

### How do Riemann sums relate to integrals?

The definite integral is defined as the limit of Riemann sums: $\int_a^b f(x)\,dx = \lim_{n\to\infty}\sum_{i=1}^n f(x_i^*)\,\Delta x$. The fundamental theorem of calculus then gives a shortcut for computing that limit with antiderivatives.
