# Trapezoid Rule derivation using Taylor series

On our numerical analysis we had numerical integration, first we had rectangle rule, and we used Taylor series:

$f(x)=f(y_i)+\sum_{p=1}^{\infty}\frac{(x-y_i)^p}{p!}f^{(p)}(y_i)$

then we integrated it and we got:

$\int\limits_{x_i}^{x_{i+1}}f(x)=\underbrace{f(y_i)h_i}_{R}+\underbrace{\frac{1}{24}h_i^3f''(y_i)}_E +\underbrace{\frac{1}{1920}h_i^5f^4(y_i)+...}_F$

until this everything is clear to me.

After this we had trapezoid rule, and I have something like this:

$f(x_i)=f(y_i)-\frac{1}{2}h_i-\frac{1}{8}h_i^2-...$

and

$f(x_{i+1})=f(y_i)+\frac{1}{2}h_i+\frac{1}{8}h_i^2-...$

then

$\int\limits_{x_i}^{x_{i+1}}f(x)=\frac{x_{i+1}-x_i}{2}[f(x_i)+f(x_{i+1})]-\frac{h_i^3}{12}f''(y_i)-\frac{h_i^5}{480}f^{(4)}(y_i)$

now I am lost, I don't know what to do to get the last result and the trapezoid rule. If I add $f(x_i)$ to $f(x_{i+1})$ I get $f(y_i)=\frac{1}{2}(f(x_i)+f(x_{i+1}))$ and I can use it to substitute but from where the error terms come from? I can't figure it out. I saw the proof that used Lagrange polynomials but it was tedious, and also on our lectures we used this way to show those rules, using Taylor series.

EDIT: to clarify, we have an interval $[x_i,x_{i+1}]$ where we want to calculate the integral, $h_i=x_{i+1}-x_{i}$ and $y_i=\frac{1}{2}(x_i+x_{i+1})$

-
Unfortunately you haven't said anything about what $h$ is, or where the $y_i$ come from, since you seem to be dealing with $x_i$... – J. M. May 1 '12 at 22:25
I changed the first post, so it is clear what is what now, I hppe. – Andna May 1 '12 at 22:39