# Midpoint Rule Calculator for a Function

## Approximate an integral (given by a function) using the midpoint rule step by step

An online calculator for approximating the definite integral using the midpoint (mid-ordinate) rule, with steps shown.

Related calculator: Midpoint 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_{1}^{3} \sqrt{\sin^{4}{\left(x \right)} + 7}\, dx$ with $n = 4$ using the midpoint rule.

### Solution

The midpoint rule (also known as the midpoint approximation) uses the midpoint of a subinterval for computing the height of the approximating rectangle:

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

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

We have that $f{\left(x \right)} = \sqrt{\sin^{4}{\left(x \right)} + 7}$, $a = 1$, $b = 3$, and $n = 4$.

Therefore, $\Delta x = \frac{3 - 1}{4} = \frac{1}{2}$.

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

Now, just evaluate the function at the midpoints of the subintervals.

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

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

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

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

Finally, just sum up the above values and multiply by $\Delta x = \frac{1}{2}$: $\frac{1}{2} \left(2.794821922941848 + 2.817350905627184 + 2.714130913751178 + 2.649758163512828\right) = 5.488030952916519.$

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