b2KIT

Integral Visualizer

Visualize definite integrals as area under curves. Compare Riemann sums (left, right, midpoint, trapezoidal) with n subdivisions.

Tested tool guide Tested browser tools Checked August 16, 2026

What Integral Visualizer does, with a checked example

Enter a function of x, choose lower and upper bounds, and set the number of subdivisions to see a definite integral alongside left, right, midpoint, and trapezoidal approximations. The diagram shows how each rule represents the curve over equal-width subintervals, while the numerical results make overestimates and underestimates easy to compare. The most common surprise is that a definite integral is signed: regions below the x-axis contribute negative values instead of being added as positive geometric area.

Worked example

A concrete input and expected output from the current implementation.

Input

f(x) = x, lower bound = 0, upper bound = 2, n = 2

Expected output

Definite integral = 2; left sum = 1; right sum = 3; midpoint sum = 2; trapezoidal sum = 2.

Each subinterval has width 1. The left heights are 0 and 1, the right heights are 1 and 2, and the midpoint heights are 0.5 and 1.5. The trapezoidal and midpoint rules both reproduce the integral of this linear function exactly.

How the result is produced

1

Equal-width partition

The interval from a to b is divided into n pieces, each with width (b - a) / n. Left and right sums use function values at their named endpoints. The midpoint sum samples halfway across each piece. Each sampled height is multiplied by the common width, and those signed contributions are added.

2

Trapezoidal comparison

The trapezoidal rule replaces each curved segment with a straight line joining its endpoint values. Its contribution over one subinterval is the width multiplied by the average of the two endpoint heights. Comparing its displayed shapes and value with the rectangle-based sums helps reveal how the chosen sampling rule responds to increasing, decreasing, or curved functions.

Good uses

  • Check left, right, midpoint, and trapezoidal calculations for a calculus exercise using the same interval and subdivision count.
  • Increase n to observe how the four estimates approach the definite integral for a continuous curve.
  • Explore a function that crosses the x-axis and distinguish signed accumulation from total geometric area.

Limits and checks

  • A negative displayed contribution is not an error. It represents a portion of the graph below the x-axis and reduces the definite integral.
  • Matching values from two methods do not prove that every method is exact. Midpoint and trapezoidal sums happen to be exact for linear functions, including the worked example.
  • A finite Riemann sum is generally an approximation. Functions with discontinuities, vertical asymptotes, or values outside their real domain require particular care when interpreting the drawing and result.

Common questions

Why do the left and right sums fall on opposite sides of the integral?

For an increasing function on each subinterval, the left endpoint gives the smaller height and the right endpoint gives the larger one, so the left sum tends to underestimate while the right sum tends to overestimate. For a decreasing function the relationship reverses. If the function changes direction, neither rule must stay entirely above or below the integral.

Does increasing the number of subdivisions make the displayed estimate exact?

No, not necessarily for any finite n. More subdivisions usually reduce the error for a well-behaved function because each approximating piece covers a narrower interval. Exact agreement can occur for special functions and rules, but it should not be assumed. Convergence also depends on the function being Riemann integrable over the selected interval.

References and verification

The example and behavioral notes were checked against the browser implementation. Standards and primary references below define the relevant format, formula, or platform behavior.

Related Tools