# Approximating Integral Question

I am stuck on this question:

Consider the following method for approximating $\int_{a}^{b}f(x)dx$. Partition the interval $[a,b]$ into $n$ equal subintervals. On each subinterval approximate the function $f$ by a quadratic polynomial that agrees with $f$ at both endpoints and at the midpoint of the subinterval.

(a) Explain why the integral of $f$ on the subinterval $[x_{i-1},x_{i}]$ is approximately equal to the expression:

$$\frac{x_{i}-x_{i-1}}{3}\left [ \frac{f(x_{i-1})}{2}+2f\left(\frac{x_{i-1}+x_{i}}{2}\right)+\frac{f(x_{i})}{2} \right ].$$

(b) Show that if we add up these approximations, we get Simpson's rule:

$$\int_{a}^{b}f(x)dx \approx \frac{2}{3}\text{MID}(n)+\frac{1}{3}\text{TRAP}(n)$$

Where MID and TRAP represent the mid-point and trapezoidal methods of integral approximation.

-

Write $h = (x_{i} - x_{i-1})/2$, consider a quadratic polynomial $p(x) = ax^2 + bx + c$. Since we only care about the integral, we may translate the problem to the interval $[-h,h]$. I would suggest that you first calculate the integral $$\int_{-h}^{h} p(x),$$ as this is going to simplify things later. Moving on to the conditions on $p(x)$, we see that \begin{align*} f(x_{i-1}) &= p(-h) = a(-h)^2 + b(-h) + c = ah^2 - bh + c \\ f\left( \frac{x_{i-1} + x_i}{2} \right) &= p(0) = a \cdot 0 + b \cdot 0 + c = c \\ f(x_i) &= p(h) = ah^2 + bh + c \end{align*} Now solve for whatever constants you need, and insert them into the expression you found for the integral of $p(x)$. This will give you the correct expression for the approximation to the integral of $f$. Problem (b) should be easy.

-

Not too hard. I presume you know how to determine an interpolating polynomial?

The idea is to find the parabola $ax^2+bx+c$ passing through $x_{i-1}$, $\dfrac{x_{i-1}+x_i}{2}$, and $x_i$, and then integrate that over $[x_{i-1},x_i]$. You could, for instance, set up the (Vandermonde) system of linear equations

$$\begin{pmatrix}1&x_{i-1}&x_{i-1}^2\\1&\frac{x_{i-1}+x_i}{2}&\left(\frac{x_{i-1}+x_i}{2}\right)^2\\1&x_i&x_i^2\end{pmatrix}\begin{pmatrix}c\\b\\a\end{pmatrix}=\begin{pmatrix}f(x_{i-1})\\f\left(\frac{x_{i-1}+x_i}{2}\right)\\f(x_i)\end{pmatrix}$$

since you know the three points where the parabola to be integrated passes through. You should be getting something like

$\displaystyle p(x)=\frac{2\left(f\left(x_{i-1}\right)-2f\left(\frac{x_{i-1}+x_i}{2}\right)+f\left(x_i\right)\right)}{\left(x_i-x_{i-1}\right)^2}\left(x-\frac{x_{i-1}+x_i}{2}\right)^2+\frac{f\left(x_i\right)-f\left(x_{i-1}\right)}{x_i-x_{i-1}}\left(x-\frac{x_{i-1}+x_i}{2}\right)+f\left(\frac{x_{i-1}+x_i}{2}\right)$

and evaluating $\int_{x_{i-1}}^{x_i}p(u)\;\mathrm du$ in the usual way should yield Simpson's rule.

To show that a linear combination of the trapezoidal and midpoint rules give Simpson's rule, consider the trapezoidal and midpoint approximations

\begin{align*} \text{trap}&=\int_{x_{i-1}}^{x_i}\left(f\left(x_{i-1}\right)+\frac{f\left(x_i\right)-f\left(x_{i-1}\right)}{x_i-x_{i-1}}\left(u-x_{i-1}\right)\right)\;\mathrm du\\ &=\frac{x_i-x_{i-1}}{2}\left(f(x_{i-1})+f(x_i)\right)\\ \text{mid}&=\int_{x_{i-1}}^{x_i}f\left(\frac{x_{i-1}+x_i}{2}\right)\;\mathrm du\\ &=(x_i-x_{i-1})f\left(\frac{x_{i-1}+x_i}{2}\right) \end{align*}

and figure out appropriate values of $p$ and $q$ such that

$$\frac{x_i-x_{i-1}}{3}\left(\frac{f(x_{i-1})}{2}+2f\left(\frac{x_{i-1}+x_i}{2}\right)+\frac{f(x_i)}{2}\right)=p\;\text{trap}+q\;\text{mid}$$

-
I'm afraid I am not familiar with interpolating polynomials. This is for a first year calculus course that assumes no knowledge of linear algebra. We have not been exposed to anything like the Vandermonde matrix. –  J.Borges Feb 9 '12 at 11:15
But you do know how to solve $n$ linear equations in $n$ unknowns, don't you? That skill very much applies here. –  Guess who it is. Feb 9 '12 at 11:18
I think I left out something important. The question which preceded this one involved the following: Suppose that $a<b$. The purpose of this problem is to show that if $f$ is a quadratic polynomial, then we have $$\int_{a}^{b}f(x)dx=\frac{b-a}{3}\left [ \frac{f(a)}{2}+2f(\frac{a+b}{2})+\frac{f(b)}{2} \right ].$$ I was then asked to show that the equation holds for $f(x)=1$, $f(x)=x$, $f(x)=x^{2}$, and any general quadratic polynomial $f(x)=Ax^2 + Bx + C$ –  J.Borges Feb 9 '12 at 11:23
That's odd, since that formula is precisely Simpson's rule! If you've proven that, it's a simple matter to let $a=x_{i-1}$ and $b=x_i$... –  Guess who it is. Feb 9 '12 at 11:36