# Use Taylor expansion to determine the leading error term in a quadrature

I'm working on the last problem in an assignment, and need some guidance on what to actually start by doing. The question is asking me to use taylor expansion to determine the leading error term (which means..?) for the following:

$$\int_a^bf(x) \approx \frac{h}{2}\sum\limits_{j=0}^n[f(x_{j,0}) + f(x_{j,1})]$$

I think I'm still a little bit fuzzy on how exactly to go about using taylor expansions to prove anything, so any guidance at all would be much appreciated!

If you want a Taylor expansion around $c=\frac {a+b}2$ (the center of your interval) it is $f(x)\approx f(c)+f'(c)(x-c)+\frac 1{2!}f''(c)(x-c)^2+\frac 1{3!}f'''(c)(x-c)^3+\ldots$. If you plug this into the integral, each term is a polynomial and easy to integrate. You can just consider the value of $f(c)$ and all the derivatives to be constants. Then you can plug $x_{j,0}$ and $x_{j,1}$ into the Taylor series and evaluate the right side. They will agree for the first few terms, then start to disagree. The error term is the first (lowest power of (x-c)) place they disagree.

Added: If we have $a=-1, b=1$ the two point Gaussian Quadrature rule is that $\int_{-1}^1 f(x)dx \approx f(\frac {-\sqrt 3}3)+f(\frac {\sqrt 3}3)$ and the above $c=0$. It is a little easier to see and type over this range, so I will stick to that. The basic idea is that you substitute in the Taylor series for $f$ on the left and evaluate it as shown on the right. The first few terms will agree perfectly. In this case, it is the terms up to $x^3$. This means the error is of order $x^4$.

Here we go: $$\int_{-1}^1 f(x)dx \approx \int_{-1}^1 \left(f(0)+f'(0)x+\frac 1{2!}f''(0)x^2+\frac 1{3!}f'''(0)x^3+\frac 1{4!}f''''(0)x^4\right)dx\\=\left.\left(f(0)x+\frac 1{2!}f'(0)x^2+\frac 1{3!}f''(0)x^3+\frac 1{4!}f'''(0)x^4+\frac 1{5!}f''''(0)x^5 \right)\right|_{-1}^1\\=2f(0)+\frac 2{3!}f''(0)+\frac 2{5!}f''''(0)$$

$$f(\frac {-\sqrt 3}3)\approx f(0)+\frac {-\sqrt 3}3f'(0)+\left(\frac {-\sqrt 3}3\right)^2f''(0)+\left(\frac {-\sqrt 3}3\right)^3f'''(0)+\left(\frac {-\sqrt 3}3\right)^4f''''(0)\\f(\frac {-\sqrt 3}3)+f(\frac {\sqrt 3}3)\approx f(\frac {-\sqrt 3}3)\approx 2f(0)+\left(\frac {2}3\right)f''(0)+\left(\frac {2}9\right)^4f''''(0)$$ So the integral and the Gaussian formula agree up to terms of order $f''''(0)$

• It seems like I'm supposed to do the formula in general, I guess in that case I can just assume, like you said, that f(x) and its derivatives are constant? Also could you clarify what you mean by agree/disagree? – Stephen Young Apr 12 '13 at 4:46
• thanks so much for the help, really clarified it a lot for me - was helpful to be able to work through and see how my calculations compared. I think I'm finally understanding this stuff :) – Stephen Young Apr 13 '13 at 5:56