# Using Taylor Polynomial To Derive Centered Difference

This is the question:

a) Expand $y(x_i + h)$ and $y(x_i - h)$ in a second-degree Taylor polynomial about $x_i$, assuming that $y$ is three times continuously differentiable.

b) Using the expansion from part (a), show that the centered difference given by $$y'(x_i) = \frac{1}{2h}[y(x_i +h)-y(x_i - h)]-\frac{h^2}{6}y'''(\epsilon_i)***$$ for some $\epsilon_i \in (x_i -h, x_i + h)$

My attempt:

a) $$y(x_i + h) = y(x_i) + hy'(x_i) + \frac{h^2}{2}y''(x_i) + \frac{h^3}{6}y'''(x_i) + O(h^3)$$ and $$y(x_i - h) = y(x_i) - hy'(x_i) + \frac{h^2}{2}y''(x_i) + \frac{h^3}{6}y'''(x_i) + O(h^3)$$

b) subtracting the two I get: $$y'(x) = \frac{y(x_i + h) - y(x_i - h)}{2h} + O(h^3)**$$

My problem:

I don't understand how $***$ becomes $**$

Not an assignment: trying to understand class exercises...

-
You have a mistake, the $y'''$ term in $y(x_i-h)$ is negative, so it doesn't cancel out. –  gt6989b Mar 18 '13 at 19:35
Also, in (a), you only need to add $O(h^4)$ not $O(h^3)$ as you have. –  gt6989b Mar 18 '13 at 19:37
@gt6989b Thanks! –  Siyanda Mar 18 '13 at 19:40