Skip to content

Integral Calculator (with steps)

Type a function to get its antiderivative (+ C) or a definite integral between two bounds, with every step: substitution, integration by parts, partial fractions and more. Works to ∞ too, with the area under the curve drawn for you.

Variable, Riemann sums, average value, other letters

Type x^2 for x², sqrt(x) for √x, e^x, ln(x), sin(x). You can leave out × (2x, x cos x). log(x) is base 10.

Try:
Type of integral

Bounds can be fractions, π, e or ∞ (type inf).

Decimal places
ResultUpdates as you type—Value—As a decimal—Antiderivative—Total area (all counted as positive)—Average value of f on [a, b]f(x)Area above the axisArea below (counts negative)F(x) with C = 0Step by step

How your integral is worked out

Your numbers, step by step: read the function, pick a method, find the antiderivative, then use the bounds.

  1. 1

    Read the function

    f(x) = x·cos(x)from 0 to π/2

  2. 2

    Integration by parts

    ∫u dv = u·v − ∫v duu = x, dv = cos(x) dx∫cos(x) = sin(x)

  3. 3

    Antiderivative

    F(x) = x·sin(x)+ cos(x)+ C

  4. 4

    Plug in the bounds

    F(π/2) − F(0)= π/2 − 1≈ 0.5708

Read more: the formula, a worked example, the methods and numeric integration

Integration is the reverse of differentiation. The indefinite integral ∫f(x) dx is a function F(x) whose derivative is f(x), plus a constant C. The definite integral from a to b is a number, F(b) − F(a): the area between the curve and the x-axis, with parts below the axis counted as negative. The calculator tries the textbook methods one by one and writes down each step. If none fits, it asks a full computer algebra system and checks its answer by differentiating it back.

The formula

indefinite: ∫f(x) dx = F(x) + C, where F′(x) = f(x)
definite (fundamental theorem): ∫ from a to b of f(x) dx = F(b) − F(a)
power rule: ∫xⁿ dx = xⁿ⁺¹ ÷ (n + 1) + C (n ≠ −1), and ∫1/x dx = ln|x| + C
by parts: ∫u dv = u·v − ∫v du
substitution: ∫f(g(x))·g′(x) dx = ∫f(u) du with u = g(x)
average value on [a, b] = (1 ÷ (b − a)) × ∫ from a to b of f(x) dx

Worked example

Find the integral of x·cos(x) from 0 to π/2. It is a product of a power of x and a trig function, so use integration by parts with u = x and dv = cos(x) dx. Then du = dx and v = sin(x). So ∫x·cos(x) dx = x·sin(x) − ∫sin(x) dx = x·sin(x) + cos(x) + C. Check: the derivative of x·sin(x) + cos(x) is sin(x) + x·cos(x) − sin(x) = x·cos(x). Now the bounds: F(π/2) = (π/2) × 1 + 0 = π/2, and F(0) = 0 × 0 + 1 = 1. So the integral is π/2 − 1 ≈ 0.570796. The curve stays above the x-axis between 0 and π/2, so the total area is also 0.570796, and the average value of x·cos(x) on [0, π/2] is (π/2 − 1) ÷ (π/2) = 1 − 2/π ≈ 0.363380.

Which method when

Looks likeMethodExample
xⁿ, eˣ, sin, cos, 1/xStandard rules∫x³ dx = x⁴/4 + C
f(ax + b)Linear substitution∫cos(3x + 1) dx = sin(3x + 1)/3 + C
f(g(x))·g′(x)u-substitution∫x·cos(x²) dx = sin(x²)/2 + C
(power of x) × (eˣ, sin, cos, ln)Integration by parts∫x·eˣ dx = x·eˣ − eˣ + C
sin²(x), cos²(x), tan²(x)Trig identity first∫sin²(x) dx = x/2 − sin(2x)/4 + C
Fraction, bottom of degree 2Complete the square or partial fractions∫1/(x² + 4x + 5) dx = atan(x + 2) + C
Top degree ≥ bottom degreeDivide first∫x²/(x + 1) dx = x²/2 − x + ln|x + 1| + C
e^(−x²), sin(x²), sin(x)/xNo elementary formula: numeric∫ from 0 to 1 of sin(x²) dx ≈ 0.310268

Numeric integration

When there is no formula, or to check one, the calculator uses adaptive Simpson’s rule: it fits little parabolas through the curve and keeps splitting the interval where the fit is poor until the answer settles to about 10 decimal places. For infinite bounds, or a function that shoots off at an end (like 1/√x at 0), it uses the tanh-sinh rule, which squeezes the points towards the ends. In Advanced you can compare left, right and midpoint Riemann sums, the trapezoid rule and Simpson’s rule with your own number of strips n and see how far each is from the true value.

Improper integrals

If a bound is ∞ or the function blows up inside [a, b], the integral is a limit. The calculator finds where the function blows up, splits the interval there, and checks whether each piece settles. ∫ from 1 to ∞ of 1/x² dx = 1, ∫ from −∞ to ∞ of e^(−x²) dx = √π ≈ 1.772454, but ∫ from 1 to ∞ of 1/x dx and ∫ from −1 to 1 of 1/x² dx both diverge.

x is in radians for trig functions. The CAS fallback is the open-source nerdamer library (MIT licence); its answers are only shown after they differentiate back to your function.

Common questions

What is the difference between a definite and an indefinite integral?

An indefinite integral is a function: the antiderivative F(x) plus a constant C, because any constant disappears when you differentiate. A definite integral has bounds a and b and is a number: F(b) − F(a). It measures the signed area between the curve and the x-axis from a to b, where area below the axis counts as negative.

Why do you add + C?

Many functions have the same derivative. x² + 1, x² and x² − 7 all differentiate to 2x, so the integral of 2x is x² + C, where C can be any constant. For a definite integral the C cancels out in F(b) − F(a), so it is left off.

How does integration by parts work?

For a product, pick u (the part that gets simpler when differentiated: logs, then inverse trig, then powers of x, then trig, then exponentials) and dv (the rest). Then ∫u dv = u·v − ∫v du. For ∫x·cos(x) dx, u = x and dv = cos(x) dx give du = dx and v = sin(x), so the answer is x·sin(x) − ∫sin(x) dx = x·sin(x) + cos(x) + C.

What if an integral has no formula?

Some functions, like e^(−x²) or sin(x²), have no antiderivative made of ordinary functions. A definite integral still has a value, so the calculator works it out numerically with adaptive Simpson’s rule (or the tanh-sinh rule for infinite bounds) and labels it as a numeric answer. For example, the integral of sin(x²) from 0 to 1 is about 0.310268.

What is an improper integral?

An integral is improper when a bound is infinite or the function shoots off to infinity inside the interval. It is found as a limit. The integral of 1/x² from 1 to ∞ is 1, because −1/x goes to 0. But the integral of 1/x from 1 to ∞ diverges, because ln(x) keeps growing, and so does 1/x² from −1 to 1.

Related calculators

Derivative calculatorFirst, second or nth derivatives and partial derivatives with every rule shown, the slope at a point, the tangent line and a graph of f and f′.Limit calculatorLimits as x → a, ∞ or from one side, with L’Hôpital steps, a table of values from both sides, a graph and whether the limit exists.Area calculatorArea and perimeter of 15 shapes, from rectangles and triangles to sectors and polygons, in mixed units with a scale drawing and steps.Graphing calculatorPlot up to 6 graphs with pan and zoom, trace, roots, turning points and intersections, plus parametric, polar, inequalities, sliders and a table.

Made by Zulu Calculator, part of AlphaZulu LLC. Formulas are shown in full and rule figures are checked against official sources; see how we build calculators.

Embed this calculator on your site

Free to use on your website or blog. Paste this code where you want the calculator to appear. Please keep the credit link.

Integral calculator by Zulu Calculator ↗