All Tools

Riemann Sum & Integration Explorer

Type a function, set an interval, and drag the slider to add rectangles. Watch how the Riemann sum converges toward the exact integral as you increase the number of subdivisions.

Graph

01xf(x)f(x) = x^2, n = 10

Parameters

Supports: x^n, sin, cos, tan, sqrt, abs, ln, e^x, pi, +, -, *, /

1100

Results

Left Riemann Sum
0.285
Exact Integral
0.333333
Absolute Error
0.0483333
Relative Error
14.5%
Number of Rectangles
10

Step-by-Step Calculation

1. Width of Each Rectangle

Δx=ban\Delta x = \frac{b - a}{n}
Δx=1010\Delta x = \frac{1 - 0}{10}
Δx=0.1\Delta x = 0.1

2. Sample Points (left endpoint)

xi=a+iΔxx_i = a + i \cdot \Delta x
i=0,1,2,,9i = 0, 1, 2, \ldots, 9
x0=0,  x1=0.1,  x_0 = 0, \; x_1 = 0.1, \; \ldots

3. Riemann Sum

Sn=i=0n1f(xi)ΔxS_n = \sum_{i=0}^{n-1} f(x_i^*) \cdot \Delta x
S10=i=09f(xi)0.1S_{10} = \sum_{i=0}^{9} f(x_i^*) \cdot 0.1
S10=0.285S_{10} = 0.285

4. Exact Integral

01f(x)dx\int_{0}^{1} f(x)\, dx
01(x2)dx\int_{0}^{1} (x^2)\, dx
=0.333333= 0.333333

5. Error

ExactApprox|\text{Exact} - \text{Approx}|
0.3333330.285|0.333333 - 0.285|
=0.0483333= 0.0483333

Reference Guide

Riemann Sums

A Riemann sum approximates the area under a curve by dividing the interval into n subintervals and summing the areas of rectangles.

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

As n increases, the sum gets closer to the true area. The limit as n goes to infinity is the definite integral.

Methods Compared

Left uses the left endpoint of each subinterval. Right uses the right endpoint. Midpoint uses the center of each subinterval and is generally more accurate.

Trapezoidal connects the two endpoints with a straight line, forming a trapezoid instead of a rectangle. It averages the left and right sums.

The Definite Integral

The definite integral is the exact area under the curve, defined as the limit of Riemann sums.

abf(x)dx=limni=0n1f(xi)Δx\int_a^b f(x)\, dx = \lim_{n \to \infty} \sum_{i=0}^{n-1} f(x_i^*) \Delta x

Error Estimates

For the midpoint and trapezoidal rules, the error decreases proportionally to 1/n21/n^2. Doubling the number of subintervals cuts the error roughly by a factor of four.

Left and right sums converge more slowly, with error proportional to 1/n1/n.