Connect via MCP →

Enter Calculation

Formula

Advertisement

Results

Definite Integral
2.666667
signed area over the interval
Method Composite Simpson rule
Subintervals (n) 100
Step size (h) 0.02

What the Definite Integral Calculator does

This tool computes the definite integral \(\int_a^b f(x)\,dx\) — the signed area between a curve and the x-axis over an interval. Because not every function has a tidy closed-form antiderivative, this calculator uses a robust numerical method (composite Simpson rule) that gives highly accurate results for smooth functions. Choose a built-in function, set your lower and upper limits, pick how many subintervals to use, and read off the area.

Shaded signed area under a curve f(x) between x=a and x=b
The definite integral is the signed area between f(x) and the x-axis over [a, b].

How to use it

Pick a function \(f(x)\) from the list. Enter the lower limit \(a\) and the upper limit \(b\). Set the number of subintervals \(n\) (more subintervals = more accuracy; the tool automatically rounds \(n\) up to the nearest even number, as Simpson rule requires). Submit to get the approximate value of the integral plus the step size used.

The formula

Simpson composite rule splits \([a,b]\) into \(n\) equal pieces of width \(h=\tfrac{b-a}{n}\) and weights the sample points 1, 4, 2, 4, …, 4, 1:

$$\int_a^b f(x)\,dx \approx \frac{h}{3}\left[f(x_0)+4\sum_{\text{odd }i}f(x_i)+2\sum_{\text{even }i}f(x_i)+f(x_n)\right]$$

where \(x_i = a + i\,h\), \(h=\frac{b-a}{n}\), and \(n\) is even.

Advertisement
Simpson rule approximating a curve with parabolic segments over even subintervals
Simpson's rule fits parabolas over pairs of subintervals to approximate the area.

Worked example

Compute \(\int_0^2 x^2\,dx\) with \(n=2\). Here \(h=\frac{2-0}{2}=1\), sample points \(x_0=0,\,x_1=1,\,x_2=2\):

$$\frac{1}{3}\left[0^2 + 4(1^2) + 2^2\right] = \frac{1}{3}\left[0 + 4 + 4\right] = \frac{8}{3} \approx 2.6667$$

This matches the exact answer \(\tfrac{8}{3}\) — Simpson rule is exact for polynomials up to degree 3.

Exact Integrals of the Supported Functions

The calculator approximates each integral numerically, but every supported function has a known closed-form antiderivative \(F(x)\) satisfying \(F'(x)=f(x)\). By the Fundamental Theorem of Calculus the exact value is \(\int_a^b f(x)\,dx = F(b)-F(a)\). Use the table below to check the numerical answer or to understand where a function is undefined.

Menu value \(f(x)\) Antiderivative \(F(x)\) Domain restriction
x2 \(x^2\) \(\dfrac{x^3}{3}\) All real \(x\)
x3 \(x^3\) \(\dfrac{x^4}{4}\) All real \(x\)
inv \(\dfrac{1}{x}\) \(\ln|x|\) \(x\neq 0\); interval must not cross or touch 0
sqrt \(\sqrt{x}\) \(\dfrac{2}{3}x^{3/2}\) \(x\ge 0\)
exp \(e^{x}\) \(e^{x}\) All real \(x\)
ln \(\ln x\) \(x\ln x - x\) \(x>0\)
sin \(\sin x\) \(-\cos x\) All real \(x\) (radians)
cos \(\cos x\) \(\sin x\) All real \(x\) (radians)

As a worked check, \(\int_0^1 x^2\,dx = \dfrac{1^3}{3}-\dfrac{0^3}{3} = \) 0.3333. Because \(x^2\) is a polynomial of degree 2, Simpson's rule returns this value exactly even at the smallest \(n=2\).

Advertisement

Key Terms

  • Definite integral — the quantity \(\int_a^b f(x)\,dx\), a single number giving the net (signed) accumulation of \(f\) between the limits \(a\) and \(b\).
  • Signed area — the integral's value counts area above the \(x\)-axis as positive and area below it as negative, so regions can cancel; the result is not necessarily the total geometric area.
  • Subinterval — one of the \(n\) equal pieces into which \([a,b]\) is divided; Simpson's rule fits a parabola across each consecutive pair of subintervals.
  • Step size \(h\) — the common width of each subinterval, \(h=\dfrac{b-a}{n}\); smaller \(h\) generally gives a more accurate approximation.
  • Sample points \(x_i\) — the \(n+1\) evenly spaced nodes \(x_i = a + i\,h\) for \(i = 0,1,\ldots,n\), where the function is evaluated.
  • Even \(n\) requirement — Simpson's rule pairs subintervals into parabolic arcs, so the number of subintervals \(n\) must be even; the weighting pattern is \(1,4,2,4,2,\ldots,4,1\).
  • Antiderivative — a function \(F(x)\) with \(F'(x)=f(x)\); when one is known, the exact integral is \(F(b)-F(a)\), which the numerical estimate approximates.

FAQ

Which functions are supported? A curated set: \(x^2\), \(x^3\), \(1/x\), \(\sqrt{x}\), \(e^x\), \(\ln x\), \(\sin x\), and \(\cos x\). Trig functions use radians.

Why must \(n\) be even? Simpson rule pairs subintervals into parabolic arcs, so it needs an even count. The tool rounds odd inputs up by one.

Is the result exact? For polynomials up to cubic it is essentially exact; for other functions it is a very close numerical approximation that improves as \(n\) grows.

Last updated: