Math Lab

Trapezoidal Rule on sin x

Integrals · Class XII

Approximate ∫₀^a sin x dx by stacking n trapezoids. Compare to the exact value 1 − cos a.

3.14
type a value
0.16.28
8
type a value
1100
Live values
  • Trapezoidal estimate1.9743
  • Exact2
  • Error-0.0257
xy
  • y = sin x

Formulas in this lab

  • Trapezoidal estimate
    TnT_n
  • Exact
    1cosa1 - \cos a
  • Error
    Tn(1cosa)T_n - (1-\cos a)
Tip: Error shrinks like 1/n² for smooth integrands.

Frequently asked questions

What is the trapezoidal rule?

It approximates $\int_a^b f(x)\,dx$ by stacking $n$ trapezoids: $T_n = h\left(\dfrac{f(x_0) + f(x_n)}{2} + \sum_{k=1}^{n-1} f(x_k)\right)$, where $h = (b-a)/n$. For smooth functions, the error shrinks like $1/n^2$.

How do I use the trapezoidal rule lab?

Slide the upper limit $a$ and the number of trapezoids $n$. The lab approximates $\int_0^a \sin x\,dx$ and compares to the exact value $1 - \cos a$. Try $a = \pi$, $n = 8$: estimate $\approx 1.97$, exact $2$, error $\approx -0.03$.

Why does the error shrink as $1/n^2$?

Because each trapezoid leaves a gap proportional to $h^3 f''(\xi)$, and there are $n = (b-a)/h$ trapezoids, giving a total error of order $h^2 = (b-a)^2/n^2$. Doubling $n$ quarters the error. Simpson's rule does even better at $1/n^4$ for smooth functions.

Where is numerical integration used in real life?

When closed-form integrals don't exist: drag-force integrals, drug-concentration AUC (area under curve), and area under blood-glucose curves all use trapezoidal estimates. Excel's =SUMPRODUCT for trapezoidal sums is in regular use across pharma and engineering teams.