By Tim King · Updated
Definite Integral Calculator
Area Under a Curve Between Two Limits, Average Value and Simpson's Rule
OneTask is free, with no sign-up, and built by one person.
If this tool saved you time, a coffee helps keep new ones coming.
How the Definite Integral Calculator works
This definite integral calculator works out the integral of a function of x between two limits. It also gives the true area between the curve and the x-axis, which differs from the integral when part of the curve dips below the axis, plus the average value of the function over the interval and the Simpson's rule and trapezium rule estimates for comparison.
A definite integral adds up a function's values across an interval, weighted by width. On a graph it is the area under the curve, with any part below the x-axis counted as negative. That makes it the tool for turning a rate into a total: speed into distance, flow rate into volume.
How the definite integral calculator works
The formula for the integral of f from a to b is F(b) − F(a), where F is any antiderivative of f. Rather than hunt for F, the calculator splits the interval into strips and fits a parabola across each pair, which is Simpson's rule, and keeps halving the strips wherever the curve bends sharply until the answer stops changing. That gives about ten correct digits for smooth functions. The average value is the integral divided by (b − a).
First example. The integral of x² from 0 to 3 is 3³/3 − 0 = 9, and the average value over the interval is 9 ÷ 3 = 3.
Second example. The integral of sin(x) from 0 to 2π is 0, because the hump above the axis and the dip below it cancel. The area between the curve and the axis is 4.
How many strips does Simpson's rule need? For x² the answer is exact with just 2, because Simpson's rule fits parabolas. For curves that bend more, the adaptive method uses hundreds or thousands where they are needed.
Values of x^2 and the running integral from x = 0 to 3
| x | f(x) | Integral so far |
|---|---|---|
| 0 | 0 | 0 |
| 0.125 | 0.015625 | 0.0006510417 |
| 0.25 | 0.0625 | 0.0052083333 |
| 0.375 | 0.140625 | 0.017578125 |
| 0.5 | 0.25 | 0.0416666667 |
| 0.625 | 0.390625 | 0.0813802083 |
| 0.75 | 0.5625 | 0.140625 |
| 0.875 | 0.765625 | 0.2233072917 |
| 1 | 1 | 0.3333333333 |
| 1.125 | 1.265625 | 0.474609375 |
| 1.25 | 1.5625 | 0.6510416667 |
| 1.375 | 1.890625 | 0.8665364583 |
| 1.5 | 2.25 | 1.125 |
| 1.625 | 2.640625 | 1.430338542 |
| 1.75 | 3.0625 | 1.786458333 |
| 1.875 | 3.515625 | 2.197265625 |
| 2 | 4 | 2.666666667 |
| 2.125 | 4.515625 | 3.198567708 |
| 2.25 | 5.0625 | 3.796875 |
| 2.375 | 5.640625 | 4.465494792 |
| 2.5 | 6.25 | 5.208333333 |
| 2.625 | 6.890625 | 6.029296875 |
| 2.75 | 7.5625 | 6.932291667 |
| 2.875 | 8.265625 | 7.921223958 |
| 3 | 9 | 9 |
Tips
- Type the function as you would write it. 3x^2, x sin(x), e^(-x^2), sqrt(x) and 1/x all work.
- Swap the limits to flip the sign. The integral from b to a is minus the integral from a to b.
- Watch for gaps. 1/x from −1 to 1 crosses x = 0 where the function is undefined, so there is no single answer.
FAQ
What is the difference between the integral and the area?
The integral counts area below the x-axis as negative, so parts can cancel. The area treats every part as positive. For sin(x) from 0 to 2π the integral is 0 but the area is 4.
Can it find the indefinite integral?
No. It works out the number for a given pair of limits, not the antiderivative formula. The derivative calculator goes the other way and shows each rule it uses.
How accurate is the answer?
For smooth functions the answer is accurate to about ten significant figures. Functions with sharp spikes or vertical asymptotes near the limits may be less accurate, and if the function is undefined inside the interval, the calculator says so rather than giving a number.
What is the average value of a function?
The height of the rectangle with the same width and the same area as the region under the curve. It is the integral divided by the width, so x² on 0 to 3 averages 3.
See also: all Trigonometry and Calculus tools, Arithmetic, Number Theory, Algebra and Geometry, Statistics.
Related tools
Derivative Calculator
Derivatives with the rules shown, plus the tangent at a point.
Function Grapher
Graph up to three functions with roots and turning points marked.
Summation Calculator
Sigma notation sums with the terms written out.
Trig Calculator
All six trig functions and their inverses, with exact values.
Arithmetic Sequence Calculator
The nth term, the sum and the rule, with the working.