MathsCalculus

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.

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:

∫abf(x)dx\displaystyle \int_a^b f(x)\,dx=F(b)−F(a),\displaystyle {}= F(b) - F(a),F′(x)\displaystyle F'(x)=f(x)\displaystyle {}= f(x)
  • 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 13x+1\tfrac{1}{3x + 1}. 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:

Rulef(x)F(x), add + C
Powerx4x^{4}x55\frac{x^{5}}{5}
Root as a power(x\sqrt{\mathstrut x}2x323\frac{2x^{\frac{3}{2}}}{3}
Reciprocal1x\frac{1}{x}ln⁡|x|\ln\left|x\right|
Exponentiale2xe^{2x}e2x2\frac{e^{2x}}{2}
Sine, inner slope 3sin⁡(3x)\sin\left(3x\right)−cos⁡(3x)3-\frac{\cos\left(3x\right)}{3}
Natural logln⁡(x)\ln\left(x\right)xln⁡(x)−xx\,\ln\left(x\right) - x
Arctangent11+x2\frac{1}{1 + x^{2}}arctan⁡(x)\arctan\left(x\right)

The integral counts area below the axis as negative. The total area, the size of the shaded region, counts every part as positive:

Total area\displaystyle \text{Total area}=∫ab|f(x)|dx\displaystyle {}= \int_a^b \left|f(x)\right|dx

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 h=b−anh = \tfrac{b - a}{n}. The trapezoidal rule joins the points on the curve with straight lines:

T\displaystyle T=h[f(a)+f(b)2+∑i=1n−1f(xi)]\displaystyle {}= h\left[\frac{f(a) + f(b)}{2} + \sum_{i=1}^{n-1} f(x_i)\right]

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:

S\displaystyle S=h3[f(a)+f(b)+4O+2E]\displaystyle {}= \frac{h}{3}\left[f(a) + f(b) + 4O + 2E\right]

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:

∫14(x2−x−6)dx\displaystyle \int_1^4 \left(x^{2} - x - 6\right)dx=F(4)−F(1)\displaystyle {}= F(4) - F(1)=−92\displaystyle {}= -\frac{9}{2}=−4.5\displaystyle {}= −4.5

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 223\tfrac{22}{3} ≈ 7.3333 m, and after it moves forward 176\tfrac{17}{6} ≈ 2.8333 m. The distance traveled is the total area, 616\tfrac{61}{6} ≈ 10.17 m. Stewart’s Calculus works the same velocity in section 5.4 and gets the same two answers.

Open this example in the tool

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:

∫01e−x22(2πdx\displaystyle \int_0^1 \frac{e^{-\frac{x^{2}}{2}}}{\sqrt{\mathstrut 2\pi }}\,dx≈0.3413\displaystyle {}\approx 0.3413

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.

Open this example in the tool

A fraction that turns into π

Leo’s homework asks for the exact area under 11+x2\tfrac{1}{1 + x^2} from 0 to 1. The table gives F(x) = arctan⁡(x)\arctan\left(x\right), so

∫0111+x2dx\displaystyle \int_0^1 \frac{1}{1 + x^{2}}\,dx=arctan⁡1−arctan⁡0\displaystyle {}= \arctan 1 - \arctan 0=π4\displaystyle {}= \frac{\pi}{4}≈0.7854\displaystyle {}\approx 0.7854

The answer key wants π4\tfrac{\pi}{4}, 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.

Open this example in the tool

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 −92-\tfrac{9}{2} or π4\tfrac{\pi}{4}, 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: ∫baf(x)dx=−∫abf(x)dx\int_b^a f(x)\,dx = -\int_a^b f(x)\,dx. 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 = sin⁡(2x)2\frac{\sin\left(2x\right)}{2}, not sin(2x). Differentiate your answer: the chain rule brings the 2 back.
  • Using the power rule on 1x\tfrac{1}{x}. Adding 1 to the power −1 gives x00\tfrac{x^0}{0}, which means nothing. The antiderivative of 1x\tfrac{1}{x} 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 1x2\tfrac{1}{x^2} 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

Click a limit box and type pi, which turns into π, or e. Type / to start a stacked fraction, so π/4 is pi, then /, then 4, and sqrt turns into √. The limit is turned into a number before integrating, but the answer still shows it the way you typed it.

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)