Ekuation

method

Midpoint Rule Calculator

Apply the midpoint rule to approximate definite integrals. Ideal when the function is undefined at endpoints.

Back to Integral Calculator

Enter a mathematical expression using x as the variable.

Number of subdivisions for the numerical calculation.

Number of rectangles shown in the visualization.

Integral Calculator Tips

Click to show tips

Try an Example

Pick a scenario to see how the calculator works, then adjust the values

Basic Polynomial

Integrate x^2 from 0 to 1 using Simpson's rule. Exact answer: 1/3.

Key values: x^2 · [0, 1] · Simpson's rule

Trigonometric Integral

Integrate sin(x) from 0 to pi. Exact answer: 2.

Key values: sin(x) · [0, pi] · Exact: 2

Area Under a Bell Curve

Approximate the Gaussian integral e^(-x^2) from -3 to 3.

Key values: e^(-x^2) · [-3, 3] · Gaussian

Documentation

The Midpoint Rule

The midpoint rule evaluates the function at the center of each subinterval rather than at the endpoints. This simple change gives it a natural advantage for functions with endpoint singularities.

abf(x)dxhi=0n1f ⁣(a+(i+12)h)\int_a^b f(x)\,dx \approx h\sum_{i=0}^{n-1} f\!\left(a + \left(i + \tfrac{1}{2}\right)h\right)

Error Bound

EM(ba)324n2maxx[a,b]f(x)|E_M| \leq \frac{(b-a)^3}{24n^2} \max_{x \in [a,b]} |f''(x)|

Same O(h2)O(h^2) convergence rate as the trapezoidal rule, but with half the error constant (denominator 24 vs. 12). For smooth functions, the midpoint rule is roughly twice as accurate as the trapezoidal rule for the same number of subdivisions.


Handling Endpoint Singularities

The midpoint rule's key advantage: it never evaluates f(x)f(x) at the endpoints aa or bb. This makes it naturally robust for integrals like:

011xdx=2\int_0^1 \frac{1}{\sqrt{x}}\,dx = 2

Here f(0)f(0) is undefined, so the trapezoidal and Simpson's rules fail without special handling. The midpoint rule works directly because it only evaluates at interior points like x=0.05,0.15,0.25,x = 0.05, 0.15, 0.25, \ldots

When to choose midpoint: Use it when the integrand has singularities at the integration bounds, or when you want a simple method that's more accurate than trapezoidal without the even-nn constraint of Simpson's.


Frequently Asked Questions

What is the midpoint rule for integration?

The midpoint rule approximates a definite integral by evaluating the function at the center of each subinterval rather than at the endpoints. The formula is f(midpointi)×Δx\sum f(\text{midpoint}_i) \times \Delta x summed over all subintervals.

Why is the midpoint rule better for functions with endpoint singularities?

The midpoint rule never evaluates f(x)f(x) at the integration bounds aa or bb. This makes it naturally robust for integrals like 011xdx\int_0^1 \frac{1}{\sqrt{x}}\,dx, where f(0)f(0) is undefined but the integral converges.

How accurate is the midpoint rule compared to the trapezoidal rule?

Both have O(h2)O(h^2) convergence, but the midpoint rule has half the error constant (denominator 24 vs. 12 in the error bound). For smooth functions, the midpoint rule is roughly twice as accurate as the trapezoidal rule for the same number of subdivisions.

Does the midpoint rule require an even number of subintervals?

No. Unlike Simpson's rule, the midpoint rule works with any number of subintervals, whether odd or even. This makes it the most flexible basic numerical integration method.

When should I choose the midpoint rule over Simpson's rule?

Choose the midpoint rule when the integrand has singularities at the bounds, when you need a simple method without parity constraints, or when you want a quick estimate that is more accurate than the trapezoidal rule.

Related method Variants

Explore more method options

More Math Calculators

Explore the category

Calculator Search

Search and find calculators