Rectangles for area

Riemann sum calculator

Educational tool; results are estimates for learning, verify with your textbook or instructor.

Handwritten area notes and a scientific calculator on a desk.
Handwritten area notes and a calculator for a Riemann sum.

This tool approximates $\int_a^b f(x)\,dx$ with equal width rectangles. You type a simple expression, the endpoints $a$ and $b$, a count $n$ of subintervals, and a rule: left endpoints, midpoints, or right endpoints.

The sum is meaningful when $f$ is integrable on $[a,b]$ (or on $[b,a]$ if you reverse the ends) and when $n$ is large enough that the rectangles track the graph. Midpoint sums are often more accurate than left or right sums on a smooth monotone piece, but every rule here is still a rectangular estimate.

This is not symbolic integration. It does not find an antiderivative, it does not invoke the Fundamental Theorem, and it does not prove integrability. A Riemann sum is the definition’s finite picture, not a closed form.

How to use the rectangles

Enter $f(x)$ with the same constrained language as the other calculus tools. Set $a$ and $b$. Set $n$ (the default $100$ is a reasonable classroom size). Choose a rule and press Approximate integral.

The default $x^2$ on $[0,1]$ has exact integral $1/3$. A midpoint run with $n=100$ should land close to $0.333\ldots$. If it does not, check the expression before you trust a stranger function.

How to read the output

The large number is $\sum f(x_i^\ast)\Delta x$ with $\Delta x=(b-a)/n$ and $x_i^\ast$ the left, mid, or right sample in each subinterval. If $b<a$, $\Delta x$ is negative and the sum flips sign, which matches the usual definite integral convention.

Raise $n$ and watch the value settle. Settlement is evidence that the partition is fine enough for this $f$, not a proof that you have the exact integral. Compare left and right on a monotone graph: one overshoots, one undershoots, and the true integral sits between them.

Common pitfalls

A discontinuity or a blow up inside $[a,b]$ can make a sample non finite, and the tool will stop. That is a domain problem, not a rounding quirk. Split the interval or change the model.

Huge $n$ is slower and not automatically wiser. Past a point you pay in rounding and in time. For a smooth $f$, a few thousand midpoints usually already tell the story this page is meant to tell.

Expression rules are constrained on purpose. The parser is not general code. Rapid oscillation can need a picture, not only a larger $n$.

Related reading

Language: definite integral, integral, and derivative. The slope side of the Fundamental Theorem is what a derivative actually measures. Limits that justify the finer partition sit in epsilon delta intuition.

The map is calculus foundations. A path is the AP Calculus AB bridge. Nearby tools: numerical derivative calculator and numerical limit estimator.

Disclaimer. Educational estimate only. This page is not a computer algebra system and not a proof. See the site disclaimer and the FAQ on calculators versus understanding.

Common questions

Is the output an exact integral?

No. It is a rectangular Riemann sum. An exact value needs an antiderivative and the Fundamental Theorem, or another theorem. Use the sum to see area accumulate, then do the algebra your course asked for.

Which rule should I pick?

Midpoint is a good default on a smooth graph. Left and right are the pictures most courses draw first, and they make overestimate versus underestimate visible on a monotone function. Try all three on x squared.

What if b is less than a?

The page still runs. Delta x becomes negative, so the sum changes sign. That matches the usual convention for a definite integral with reversed limits.

What if the function blows up on the interval?

A non finite sample stops the sum. Improper integrals need a limit argument, not a blind rectangle pile. Change the interval or study the singularity first.

Want a tool that matches a new explainer, or a check that a page and a calculator disagree? Write a short note.

Suggest a topic or tool