Integral and Derivative Calculator

Type a function f(x) to find its derivative at a point and its definite integral between two limits, computed numerically.

Derivative at a point

Use x as the variable. Trig functions use radians. Examples: x^2 + 3x, sin(x)/x, e^(-x^2), sqrt(1-x^2)

Definite integral

Use x as the variable. Trig functions use radians. Examples: x^2 + 3x, sin(x)/x, e^(-x^2), sqrt(1-x^2)

Limits can be numbers, pi or e. Use inf or -inf for infinity.

How to use

  • Enter f(x) with x as the variable, for example x^2 + 3x - sin(x)/2. Results update as you type.
  • Derivative: enter a point x₀ to see the function value f(x₀), the first derivative f′(x₀) and the second derivative f″(x₀).
  • Definite integral: enter the lower limit a and the upper limit b. Limits can be numbers or constant expressions such as pi/2; use inf, -inf or ∞ for an infinite limit.
  • The integral comes with an estimated error (±). If a is greater than b, the sign of the result flips, and if a = b the result is 0.
  • Results are numerical approximations shown to up to 12 significant digits. The calculator does not output formulas such as a derivative function or an antiderivative.

How the derivative is calculated

The derivative is the slope of the tangent line, defined as f′(x₀) = lim(h→0) (f(x₀ + h) − f(x₀))/h. A computer cannot shrink h all the way to 0, so the calculator uses the central difference (f(x₀ + h) − f(x₀ − h))/(2h), which averages the slopes on both sides and is far more accurate than a one-sided difference.

The second derivative uses (f(x₀ + h) − 2f(x₀) + f(x₀ − h))/h². Both formulas are evaluated for a series of shrinking step sizes h and combined by Richardson extrapolation (Ridders’ method), which cancels the leading error terms; the estimate with the smallest error wins. Digits below that error are dropped, so noise such as 1e-14 shows as 0.

First, the slopes from the left and right are compared. At a sharp corner, such as |x| at x = 0, or where the function exists on one side only, such as sqrt(x) at x = 0, the derivative is shown as “Can’t be computed”.

How the definite integral is calculated

The definite integral ∫ₐᵇ f(x) dx is the signed area between the graph and the x-axis from a to b: area above the axis counts as positive and area below it as negative.

The calculator uses adaptive Gauss–Kronrod quadrature. On each subinterval it evaluates f(x) at 15 carefully chosen points and compares a 7-point Gauss rule with the 15-point Kronrod rule; the difference serves as the error estimate. It keeps splitting the subinterval with the largest error in half until the total error is about 10⁻¹² of the result (or the rounding limit), using at most 1000 subintervals.

Infinite limits are handled by a change of variable, such as x = a + t/(1 − t), that maps the infinite range onto a finite one. The endpoints themselves are never evaluated, so a function that blows up only at an endpoint, like 1/√x from 0 to 1, can still be integrated.

Step-by-step worked example

Here are the examples the page opens with, worked out by hand.

  • Derivative of x³ at x₀ = 1, step 1: with h = 0.1 the central difference is (1.1³ − 0.9³)/0.2 = (1.331 − 0.729)/0.2 = 3.01.
  • Step 2: with h = 0.05 it is (1.157625 − 0.857375)/0.1 = 3.0025. Because the error shrinks like h², combining the two as (4 × 3.0025 − 3.01)/3 gives exactly 3. That is the idea behind Richardson extrapolation, and indeed f′(x) = 3x², so f′(1) = 3.
  • Step 3, second derivative: (1.331 − 2 × 1 + 0.729)/0.1² = 0.06/0.01 = 6, which matches f″(x) = 6x at x = 1. The calculator shows f(1) = 1, f′(1) = 3 and f″(1) = 6.
  • Integral of x² from 0 to 3: the antiderivative is x³/3, so the exact value is 3³/3 − 0 = 9. The calculator shows 9 along with a tiny estimated error.
  • Numerical integration also works when there is no elementary antiderivative: ∫₀¹ e^(−x²) dx ≈ 0.746824132812, and the integral of e^(−x²) from −∞ to ∞ is √π ≈ 1.77245385091.

Input rules and common mistakes

  • Trig functions use radians, so sin(30) is about −0.988, not 0.5. For degrees, multiply by pi/180: sin(30pi/180) = 0.5.
  • Functions need parentheses: write sin(x), not sin x. sin^2(x) means (sin x)², and for the inverse sine use asin(x), because sin^-1(x) is not accepted.
  • e always means Euler’s number (2.718…), so 1e-6 is read as 1·e − 6 ≈ −3.28. Write 10^-6 for 0.000001.
  • −x^2 means −(x²), 2^3^2 = 2^9 = 512, and 1/2x means (1/2)·x. To divide by 2x, write 1/(2x).
  • Multiplication signs can be left out, as in 2x, 2(x+1) and x sin(x). ln is the natural log and log is base 10. Available functions: sin, cos, tan, cot, sec, csc, asin, acos, atan, sinh, cosh, tanh, asinh, acosh, atanh, ln, log, log10, log2, sqrt, cbrt, abs or |x|, exp

Frequently asked questions

Does this calculator show the antiderivative or the derivative formula?

No, it gives numbers only. It computes the derivative at a point and the definite integral between two limits numerically, without producing a formula such as 3x² or x³/3.

How accurate are the results?

They are usually correct to 10 or more significant digits and are displayed with up to 12. The integral also shows an estimated error (±), and accuracy can drop for functions that are not smooth.

Can it calculate improper integrals with infinite limits?

Yes, type inf, -inf or ∞ as a limit. For example, the integral of 1/x² from 1 to inf is 1, and the integral of e^(−x²) from -inf to inf is √π ≈ 1.77245385091.

Why does it say the integral may diverge or did not converge?

The area does not settle to a finite value, or f(x) becomes infinite or undefined inside the interval. For example, ∫₀¹ 1/x dx and the integral of sin(x) from 0 to inf do not converge, while ∫₀¹ 1/√x dx = 2 does.

Why does the derivative show “Can’t be computed”?

Because the derivative does not exist at that point. This happens at a sharp corner, such as |x| at x = 0, or where the function is defined on one side only, such as sqrt(x) at x = 0; without a first derivative there is no second derivative either.

Can I enter angles in degrees?

No, trig functions always use radians. Multiply degrees by pi/180, for example cos(60pi/180) = 0.5.

How do I type scientific notation like 1e-6?

Write 10^-6 or 0.000001 instead. The letter e always means Euler’s number here, so 1e-6 is read as 1·e − 6 ≈ −3.28.