Visual Tools
Calculators
Tables
Mathematical Keyboard
Converters
Other Tools


Riemann Sum


Quadraticf(x) =
×
880 × 460
Riemann sumS = Δx · Σ f(xᵢ*) · Δx = 0.375 · rule: left
Approximation S
7.3828
with n = 8 (left)
True integral
9
closed form
Error
-1.6172
undershoots
Applieda=0b=3n=8rule=leftn drives accuracy · rule drives error sign





Key Terms



Key Terms

Riemann sum — an approximation of the definite integral abf(x)dx\int_a^b f(x)\, dx formed by partitioning [a,b][a, b] into nn equal strips and summing the areas of simple shapes built on each strip.

Partition — the division of [a,b][a, b] into nn subintervals of equal width Δx=(ba)/n\Delta x = (b - a)/n.

Sample point — the value of xx on each strip where the function's height is evaluated. Determined by the rule: left endpoint, right endpoint, midpoint, or both endpoints (for trapezoid).

Left Riemann sum — sample at the left endpoint of each strip; uses rectangles.

Right Riemann sum — sample at the right endpoint of each strip; uses rectangles.

Midpoint rule — sample at the center of each strip; uses rectangles.

Trapezoid rule — average the function values at the two endpoints of each strip; uses trapezoids.

Convergence order — the rate at which the error shrinks as nn grows. Left and right are O(1/n)O(1/n); midpoint and trapezoid are O(1/n2)O(1/n^2).

Getting Started

The page opens with the Quadratic family f(x)=x2f(x) = x^2 loaded, integrating from a=0a = 0 to b=3b = 3 with n=8n = 8 partitions using the Left rule. You see:

• The deep-blue curve of ff across the integration window.

• Eight light-blue rectangles, each with its left edge touching the curve.

• Dashed gray vertical lines at aa and bb marking the bounds.

Below the graph, the result card shows three numbers side by side: the approximation SnS_n, the true integral, and the error. A small tag below the error labels the result as *overshoots*, *undershoots*, or *exact*.

To explore, switch between Left, Right, Midpoint, and Trapezoid in the Method section, drag the partitions n slider, or pick a different function family in the left panel.

The Four Methods

The Method section in the left panel offers four ways to build the approximation. Each samples the function at a different point on each strip:

Left — sample at the left endpoint. On an increasing function every rectangle sits *below* the curve; on a decreasing function every rectangle sits *above*. Convergence order O(1/n)O(1/n).

Right — sample at the right endpoint. Mirror image of left: overshoots on increasing, undershoots on decreasing. Same O(1/n)O(1/n) order.

Midpoint — sample at the center. The flat top punches *above* the curve on one half of each strip and *below* on the other, so over- and under-shoots within each strip mostly cancel. Convergence order O(1/n2)O(1/n^2).

Trapezoid — connect the left and right endpoint heights with a straight line. Errors also mostly cancel, opposite in sign to midpoint. Same O(1/n2)O(1/n^2) order.

Switching methods changes the picture immediately.

The Function Families

Eight families are organized into three groups in the left panel.

Polynomial (closed-form antiderivative):

Identity f(x)=xf(x) = x — integrates to x2/2x^2 / 2.

Quadratic f(x)=x2f(x) = x^2 — integrates to x3/3x^3 / 3.

Cubic f(x)=x3f(x) = x^3 — integrates to x4/4x^4 / 4.

Transcendental (closed-form):

Sine f(x)=sinxf(x) = \sin x — antiderivative cosx-\cos x.

Cosine f(x)=cosxf(x) = \cos x — antiderivative sinx\sin x.

Exponential f(x)=exf(x) = e^x — antiderivative exe^x.

Numerical only (no elementary antiderivative):

Gaussian bump f(x)=ex2/2f(x) = e^{-x^2/2} — the kernel of the normal distribution.

Sinc f(x)=sin(x)/xf(x) = \sin(x)/x — appears in signal processing.

For the third group the "true" integral is computed numerically with a 40004000-strip trapezoid.

The a, b, and n Sliders

Three sliders in the Parameters section control the integration setup:

lower bound a and upper bound b — the endpoints of the integration interval. The dashed gray lines at aa and bb on the graph follow the sliders. Setting b<ab < a flips the sign of the integral; everything else still works.

partitions n — the number of subintervals (and rectangles or trapezoids). Ranges from 11 to 8080. As nn grows, the rectangles get thinner, fill the area under the curve more tightly, and the error shrinks.

The most instructive experiment: fix a method, then slide nn from low to high. Watch the error tag in the result card. With the left or right rule, doubling nn roughly halves the error. With midpoint or trapezoid, doubling nn shrinks the error by about a factor of four.

The Reset button next to Parameters restores the family defaults.

Reading the Result Card

The boxed card below the graph displays the three numerical results:

Approximation Sₙ — the value of the Riemann sum at the current nn and method.

True integral — the exact value of abf(x)dx\int_a^b f(x)\, dx. For polynomial and transcendental families this comes from a closed-form antiderivative. For numerical-only families it comes from a high-resolution trapezoid sum and is labeled accordingly.

Error — the signed difference SnIS_n - I. Positive means the Riemann sum is too high (overshoots); negative means too low (undershoots); near zero means the approximation has converged.

The header line above shows the method&apos;s formula symbolically, the current value of Δx\Delta x, and which rule is active. Use the three numbers together: the approximation is what you computed, the true integral is what you wanted, and the error is the gap to close.

The Error Tag

Below the error number is a colored tag with one of three values:

overshoots (red) — the Riemann sum is larger than the true integral. The error is positive. Common for the left rule on a decreasing function, or the right rule on an increasing function.

undershoots — the Riemann sum is smaller than the true integral. The error is negative. Common for the left rule on an increasing function, or the right rule on a decreasing function.

exact (green) — the absolute error is below the display threshold. Either you found a closed match (the trapezoid rule on a linear function is exact, for example) or nn is large enough that the approximation has fully converged.

The endpoint rules (left, right) have predictable signs based on monotonicity. Midpoint and trapezoid usually err in opposite directions, which is why averaging them gives Simpson&apos;s rule — a more advanced technique.

What Is a Riemann Sum

A Riemann sum approximates the area under a curve using simple geometric shapes. The procedure is:

• Split the interval [a,b][a, b] into nn subintervals of equal width Δx=(ba)/n\Delta x = (b - a)/n.

• On each subinterval, pick a sample point xix_i^* and use the function&apos;s value there as a height.

• Sum the areas of the resulting rectangles (or trapezoids):

Sn=i=1nf(xi)ΔxS_n = \sum_{i=1}^{n} f(x_i^*) \cdot \Delta x


The four classical rules differ only in where on each subinterval the sample point sits. As nn \to \infty, the Riemann sum converges to the exact definite integral:

limnSn=abf(x)dx\lim_{n \to \infty} S_n = \int_a^b f(x)\, dx


This limit is in fact the definition of the integral. The Fundamental Theorem of Calculus then provides the shortcut: evaluate an antiderivative at the endpoints instead of summing rectangles.

For full theoretical coverage, see the Riemann integral page.

Convergence and Error

The four rules differ not just in how they sample the curve, but in *how fast* the error shrinks as nn grows.

Endpoint rules (Left and Right): error is $O(1/n)$.

Each rectangle&apos;s flat top mismatches the curve&apos;s slope. Doubling nn halves the strip width and roughly halves the error. To reduce the error by a factor of 100100, you need nn to grow by a factor of 100100.

Midpoint and Trapezoid: error is $O(1/n^2)$.

Both rules sample more representatively. Midpoint takes the height at the center of each strip; trapezoid uses the linear interpolant between endpoint heights. In either case the over- and undershoots within a single strip largely cancel, so the leading-order error is in 1/n21/n^2 instead of 1/n1/n. Doubling nn shrinks the error by a factor of *four*. To reduce the error by 100100, nn only needs to grow by 1010.

The practical lesson: choose the rule before you crank up nn.

Signed Area

When the integrand dips below the x-axis, the function values become negative and the corresponding rectangles count as negative area. The tool draws them on the appropriate side of the axis and the Riemann sum subtracts them naturally.

This matches the standard convention for definite integrals: abf(x)dx\int_a^b f(x)\, dx is the *signed* area between the curve and the x-axis, counting area above the axis positively and area below negatively. A function that&apos;s symmetric about the x-axis (like sinx\sin x over [π,π][-\pi, \pi]) has integral zero — positive and negative areas cancel.

Two other sign conventions are also handled correctly:

• If you set b<ab < a, the strip width Δx=(ba)/n\Delta x = (b - a)/n goes negative, every term in the sum flips sign, and the result becomes baf(x)dx-\int_b^a f(x)\, dx. This is the standard ab=ba\int_a^b = -\int_b^a identity.

• If a=ba = b, every strip has zero width and the sum collapses to zero.

Related Concepts

Definite integrals — the limit of Riemann sums as nn \to \infty. The exact area the approximations are converging to.

Fundamental Theorem of Calculus — the shortcut for computing definite integrals: find an antiderivative, evaluate at the endpoints, subtract. See the FTC visualizer.

Simpson&apos;s rule — a higher-order rule that fits parabolas through groups of three points instead of rectangles or straight-line trapezoids. Convergence order O(1/n4)O(1/n^4).

Gaussian quadrature — an even higher-order family of numerical integration methods using carefully chosen sample points and weights. Used in production numerical libraries.

Improper integrals — integrals over unbounded intervals or with unbounded integrands. Defined as limits of ordinary integrals.

Average value of a function — equal to 1baabf(x)dx\frac{1}{b-a} \int_a^b f(x)\, dx. The mean of ff over the interval.

Visual tools for calculus — limits, continuity, derivatives, FTC, MVT, optimization.