# Trapezoidal Rule Calculator for a Function

The calculator will approximate the integral using the trapezoidal rule, with steps shown.

Related calculator: Trapezoidal Rule Calculator for a Table

If the calculator did not compute something or you have identified an error, or you have a suggestion/feedback, please write it in the comments below.

Approximate the integral $\int\limits_{0}^{1} \sqrt{\sin^{3}{\left(x \right)} + 1}\, dx$ with $n = 5$ using the trapezoidal rule.

## Solution

The trapezoidal rule uses trapezoids to approximate the area:

$\int\limits_{a}^{b} f{\left(x \right)}\, dx\approx \frac{\Delta x}{2} \left(f{\left(x_{0} \right)} + 2 f{\left(x_{1} \right)} + 2 f{\left(x_{2} \right)} + 2 f{\left(x_{3} \right)}+\dots+2 f{\left(x_{n-2} \right)} + 2 f{\left(x_{n-1} \right)} + f{\left(x_{n} \right)}\right)$

where $\Delta x = \frac{b - a}{n}$.

We have that $a = 0$, $b = 1$, $n = 5$.

Therefore, $\Delta x = \frac{1 - 0}{5} = \frac{1}{5}$.

Divide the interval $\left[0, 1\right]$ into $n = 5$ subintervals of the length $\Delta x = \frac{1}{5}$ with the following endpoints: $a = 0$, $\frac{1}{5}$, $\frac{2}{5}$, $\frac{3}{5}$, $\frac{4}{5}$, $1 = b$.

Now, just evaluate the function at these endpoints.

$f{\left(x_{0} \right)} = f{\left(0 \right)} = 1$

$2 f{\left(x_{1} \right)} = 2 f{\left(\frac{1}{5} \right)} = 2 \sqrt{\sin^{3}{\left(\frac{1}{5} \right)} + 1}\approx 2.007826067912793$

$2 f{\left(x_{2} \right)} = 2 f{\left(\frac{2}{5} \right)} = 2 \sqrt{\sin^{3}{\left(\frac{2}{5} \right)} + 1}\approx 2.058206972332648$

$2 f{\left(x_{3} \right)} = 2 f{\left(\frac{3}{5} \right)} = 2 \sqrt{\sin^{3}{\left(\frac{3}{5} \right)} + 1}\approx 2.17257446116512$

$2 f{\left(x_{4} \right)} = 2 f{\left(\frac{4}{5} \right)} = 2 \sqrt{\sin^{3}{\left(\frac{4}{5} \right)} + 1}\approx 2.340214753424868$

$f{\left(x_{5} \right)} = f{\left(1 \right)} = \sqrt{\sin^{3}{\left(1 \right)} + 1}\approx 1.263258974474734$

Finally, just sum up the above values and multiply by $\frac{\Delta x}{2} = \frac{1}{10}$: $\frac{1}{10} \left(1 + 2.007826067912793 + 2.058206972332648 + 2.17257446116512 + 2.340214753424868 + 1.263258974474734\right) = 1.084208122931016.$

$\int\limits_{0}^{1} \sqrt{\sin^{3}{\left(x \right)} + 1}\, dx\approx 1.084208122931016$A