# How do you Use the trapezoidal rule with #n=8# to approximate the integral #int_0^pix^2*sin(x)dx#?

##### 1 Answer

The "trap rule" approximates the area by creating n trapezoids with their bases on the x-axis, top corners along the curve y = f(x), and then adding their areas together.

Here we evaluate the function f(x) = x^2 sin(x) at 9 points along the interval from 0 to π, to make 8 intervals of

Now use the trapezoid area formula:

In our case

and when you add all n of these together you get

because the middle terms appear twice, the right side of one trapezoid being the left side of the next. For our example,

You get to evaluate each term to as much accuracy as you need to get your answer to the specified tolerance. Happy calculator plugging!

\another fine answer from dansmath/