Integral
calculator.
Type a function and two limits to get the exact value, the shaded area and every step, or switch to Indefinite for the antiderivative.
f crosses the x-axis at x = 0 and x = 2. The area above the axis (8) and the area below it (4) partly cancel, so the integral (4) is smaller in size than the total area (12).
Limits can be exact: type pi for π, e, or / for a fraction such as π/4.
Graph
Drag the brass handle along the curve, or click the graph to move the nearer limit there.
f(x) = x³ − 4x with the region from x = −1 to x = 3 shaded. The integral is 4: an area of 8 lies above the x-axis and 4 below it, and f crosses the axis at x = 0 and x = 2. The second line is the area so far, the integral from a to x, which reaches the answer at x = b.
Working
- 1Sum rule: integrate each term on its ownf(x) = x3 − 4x
- 2Power rule: add 1 to the power, then divide by the new power∫x3 dx = x44
- 3Power rule: add 1 to the power, then divide by the new power∫4x dx = 2x2
- 4Add the pieces, keeping each signF(x) = x44 − 2x2 + C
- 5Fundamental theorem of calculus: F(b) − F(a)F(3) − F(−1) = 2.25 − (−1.75) = 4
- 6Total area: split where f crosses the axis (x = 0 and x = 2) and add the sizes∫0−1f dx = 1.75, ∫20f dx = −4, ∫32f dx = 6.25; area = 1.75 + 4 + 6.25 = 12
- 7Check with a method that never uses F: adaptive Gauss–Kronrod quadrature≈ 4, which agrees with F(b) − F(a)
- 8Answer∫3−1(x3 − 4x) dx = 4
Area so far, from a to each x
| f(x) | ||
|---|---|---|
| −1 | 3 | 0 |
| −0.6 | 2.184 | 1.0624 |
| −0.2 | 0.792 | 1.6704 |
| 0.2 | −0.792 | 1.6704 |
| 0.6 | −2.184 | 1.0624 |
| 1 | −3 | 0 |
| 1.4 | −2.856 | −1.2096 |
| 1.8 | −1.368 | −2.1056 |
| 2.2 | 1.848 | −2.0736 |
| 2.6 | 7.176 | −0.3456 |
| 3 | 15 | 4 |
Each row is the integral from a = −1 up to that x. With f as a rate (meters per second, liters per minute), it is the total so far. It rises where f is positive and falls where f is negative.
Methods side by side
| Method | Value | Difference |
|---|---|---|
| Answer, from F(b) − F(a) | 4 | – |
| Adaptive Gauss–Kronrod | 4 | −1.1 × 10⁻¹⁴ |
| Simpson’s rule, n = 10 | 4 | 1.8 × 10⁻¹⁵ |
| Trapezoidal rule, n = 10 | 4.32 | 0.32 |
For a smooth f, doubling n cuts the trapezoidal rule’s error about 4 times and Simpson’s about 16 times. The answer itself does not depend on n.
Keyboard shortcuts
- In the function and limit boxes, type sqrt, pi or ^ and they turn into √, π and a power. / starts a stacked fraction.
- Tab to the brass handle on the graph, then use ← and → to move the chosen limit (hold Shift for bigger steps). In Indefinite mode ↑ and ↓ move the point too.
- ← and → switch between Definite and Indefinite, between Move a and Move b, and between decimal places.
- ↑ and ↓ in the subintervals box change n by 2.
- Ctrl or ⌘ with the mouse wheel, or + and − on the focused graph, zoom it. Reset view brings it back.
How it’s worked out
A definite integral adds up f(x) across an interval, so it measures the signed area between the curve and the x-axis from x = a to x = b. You rarely add up the strips yourself. The fundamental theorem of calculus turns the job into one subtraction:
- f(x) is the integrand, the function you type in the box.
- a and b are the lower and upper limits, where the region starts and stops.
- F(x) is an antiderivative: any function whose derivative is f. Adding a constant C to F does not change F(b) − F(a), because C cancels.
- dx marks x as the variable you add up along.
To find F, the tool splits your function into terms and looks each one up in a table of standard integrals. It handles constant multiples, sums and inner functions of the form ax + b, such as cos(2x) or . Then it differentiates F at seven test points and keeps it only if F′ matches f at all of them. These are the tool’s own results for some common rules:
| Rule | f(x) | F(x), add + C |
|---|---|---|
| Power | ||
| Root as a power | ||
| Reciprocal | ||
| Exponential | ||
| Sine, inner slope 3 | ||
| Natural log | ||
| Arctangent |
The integral counts area below the axis as negative. The total area, the size of the shaded region, counts every part as positive:
The tool finds every point between the limits where f changes sign, integrates each stretch on its own and adds the sizes. Those crossing points are marked on the graph.
Some functions have no antiderivative made of ordinary functions, e−x² being the best known. For those the value comes from adaptive Gauss–Kronrod quadrature. It samples f at 15 weighted points in each panel and keeps splitting the panel with the largest error estimate until the total estimated error is about 10−12 of the answer. Even when F exists, quadrature runs as the check, because it never uses F.
The check table also shows two rules from the textbook. Both cut the interval into n strips of width . The trapezoidal rule joins the points on the curve with straight lines:
Simpson’s rule fits parabolas instead, so n must be even. With O the sum of f at the odd-numbered inner points (x₁, x₃ and so on) and E the sum at the even-numbered ones:
When F(b) − F(a) matches a simple closed form to about 12 significant digits, the answer shows that form too. The forms it tries are a fraction, a multiple of π, e, a square root or a log, or a fraction plus one of those. A value found by quadrature never gets an exact form, and angles in sin, cos and tan are in radians.
Worked examples
Displacement and distance from a velocity
In a physics lab, Priya’s motion sensor records a cart moving at v(t) = t² − t − 6 meters per second between t = 1 and t = 4 seconds. Type it with x in place of t. The integral of velocity is the change in position:
So the cart ends 4.5 m behind where it was at t = 1. That is not how far it traveled. The velocity crosses zero at t = 3. Before then the cart moves backward ≈ 7.3333 m, and after it moves forward ≈ 2.8333 m. The distance traveled is the total area, ≈ 10.17 m. Stewart’s Calculus works the same velocity in section 5.4 and gets the same two answers.
The middle of a bell curve
Sam is checking the 68–95–99.7 rule for test scores. The share of a normal population between the mean and one standard deviation above it is the area under the standard normal curve from 0 to 1:
This function has no antiderivative in the table, or in any table of ordinary functions, so the tool says so and uses quadrature: 0.341345, or 34.13%. Double it and you get the familiar 68% within one standard deviation. A standard normal table gives Φ(1) − 0.5 = 0.3413, the same value. As a check, Simpson’s rule with 10 subintervals gives 0.341345 and the trapezoidal rule 0.341143.
A fraction that turns into π
Leo’s homework asks for the exact area under from 0 to 1. The table gives F(x) = , so
The answer key wants , and that is what the answer panel shows next to the decimal. A decimal of 0.7854 on its own would usually lose the mark.
Reading your result
The value is a signed area. Its units are the units of f times the units of x: a velocity in meters per second over seconds gives meters, and a flow in liters per minute over minutes gives liters. A negative value means more of the region lies below the axis than above it.
The exact form, such as or , appears when the value came from F(b) − F(a) and matches a simple form. An equals sign before the decimal means it is the whole value. An approximately sign means it is rounded to the places you chose.
Total area, above and below. The tiles split the region at the crossings. For the starting example, f(x) = x³ − 4x from −1 to 3, the area above the axis is 8 and below it is 4. The integral is the difference, 4, and the total area is the sum, 12.
The average value of f is the integral divided by b − a. It is the height of a rectangle on the same base with the same signed area. For x³ − 4x from −1 to 3 that height is 1.
Reversed limits flip the sign: . The areas in the tiles stay positive, because they describe the shape, not the direction.
Antiderivatives are only fixed up to a constant. The Indefinite mode shows F(x) + C. Give it a point the curve must pass through, as in “find f if f′(x) = 3x² and f(1) = 5”, and it works out C for you. Drag the point on the graph and watch the whole curve shift up or down.
Common mistakes
- Forgetting to divide by the inner slope. The tool gives ∫ cos(2x) dx = , not sin(2x). Differentiate your answer: the chain rule brings the 2 back.
- Using the power rule on . Adding 1 to the power −1 gives , which means nothing. The antiderivative of is ln|x|, with the absolute value, so it also works for negative x.
- Calling the integral the area. When the curve dips below the axis they differ. For sin x from 0 to 2π the integral is 0, but the shaded area is 4.
- Integrating across a vertical asymptote. For from −1 to 1, F(b) − F(a) gives −2, a negative answer for a function that is never negative. The integral actually diverges. The tool refuses limits like these and points you to the improper integral calculator.
- Subtracting the wrong way round. It is F(b) − F(a), upper limit first. Swapping them flips the sign of the answer.
- Working in degrees. The rule that sin x integrates to −cos x only holds in radians, and the tool treats x as radians. Type π for a half turn, not 180: ∫ from 0 to 180 of sin x is worked out over 180 radians and gives 1.5985 instead of 2.
- Mixing up + C. An indefinite integral needs + C. A definite integral never has one, because it cancels in F(b) − F(a).
Questions people ask
Sources
- Stewart, Calculus: Early Transcendentals, 8th ed., sections 5.3 and 5.4 (the fundamental theorem and indefinite integrals) and 7.7 (approximate integration)
- Piessens, de Doncker-Kapenga, Ueberhuber and Kahaner, QUADPACK: A Subroutine Package for Automatic Integration, Springer, 1983 (Gauss–Kronrod rules)
- NIST Digital Library of Mathematical Functions, section 7.2 (error function)