# Derive error term by using Taylor series expansions.

Using Taylor series expansions, derive the error term for the formula $$f''(x)\approx \frac{1}{h^{2}}\left [ f(x)-2f(x+h)+f(x+2h) \right ].$$

I've tried it on my own way. We see that \begin{align*} f(x+h)&=\sum_{k=0}^{3}\frac{h^{k}}{k!}f^{(k)}(x)+E_{n}(h)\\ &=f(x)+hf'(x)+\frac{h^{2}}{2}f''(x)+\frac{h^{3}}{6}f'''(x)+E_{3}(h) \end{align*} \begin{align*} f(x+2h)&=\sum_{k=0}^{3}\frac{(2h)^{k}}{k!}f^{(k)}(x)+E_{n}(2h)\\ &=f(x)+2hf'(x)+2h^{2}f''(x)+\frac{4h^{3}}{3}f'''(x)+E_{3}(2h) \end{align*} and $$f(x+2h)-2f(x+h)=-f(x)+h^{2}f''(x)+h^{3}f'''(x)+E_{3}(2h)-E_{3}(h)$$ then by isolating $f''(x)$ we get $$f''(x)=\frac{1}{h^{2}}\left [ f(x+2h)-2f(x+h)+f(x) \right ]-hf'''(x)-\frac{1}{h^{2}}\left [E_{3}(2h)-E_{3}(h) \right ]$$ which isn't the right way to do since the term of "$-hf'''(x)$" is added (that's not mentioned in this problem). The rest is the error term. How do I answer it correctly?

• Maybe it is a dumb question, but why don't you just stop at the $E_2$ terms? Commented Oct 14, 2013 at 0:24
• $-(1/h^2) (E_3(2h) - E_3(h))$ isn't explicitly mentioned in this problem either.
– user14972
Commented Oct 14, 2013 at 0:45
• @IanMateus Thanks for your answer. It works! Commented Oct 14, 2013 at 1:23
• @AjmalW: Right: but it's not the error term. The error term for the approximation you're proving $$-hf'''(x) - (1/h^2)(E_3(2h) - E_3(h))$$ (actually, I think your work is missing some factors of $2$, and that should probably be $2E_3(h)$)
– user14972
Commented Oct 14, 2013 at 2:16
• I suppose the confusion is over what the phrase "error term" means. In general, if we approximate $f$ with $g$, the error term to the approximation means $g - f$. $E_3(x,h)$, for example, is the error term when approximating $f(x)$ with its third order Taylor series. The error term for the approximation you're proving is not "the terms involving $E_3$", but instead "the difference between the two sides of the approximation".
– user14972
Commented Oct 14, 2013 at 2:22

With the purpose of not leaving this question unanswered, this answer contains what OP already knows: stopping at $E_2$ is the cleanest way to go, since we already know how to express the error term of a Taylor series in convenient ways (Lagrange form, integral form). Some algebra quickly yields the error $h^{-2}(E_2(2h)-2E_2(h))$.

As a central difference quotient for the position $$x+h$$, the Taylor expansion of the expression starts as $$\frac1{h^{2}}[f(x)-2f(x+h)+f(x+2h)]=f''(x+h)+\frac{h^2}{12}f^{(4)}(x+h)+O(h^4). \tag{*}\label{eq:1}$$

By Taylor expansion of the second derivative $$g(x)=f''(x)$$ one gets that the deviation from $$x$$ to $$x+h$$ expands as \begin{align} f''(x+h)=g(x+h)&=g(x)+g'(x)h+\frac{h^2}2g''(x)+O(h^3) \\ &=f''(x)+hf'''(x)+\frac{h^2}2f^{(4)}(x)+O(h^2). \tag{**}\label{eq:2} \end{align}

Inserting \eqref{eq:2} into \eqref{eq:1} gives in total $$\frac1{h^{2}}[f(x)-2f(x+h)+f(x+2h)]=f''(x)+hf'''(x)+\frac{7h^2}{12}f^{(4)}(x)+O(h^3),$$ so that the error term from the question should be $$-hf'''(x)-\frac{7h^2}{12}f^{(4)}(x)+O(h^3).$$ Obviously the linear error term is the dominant one. So up to the missing $$2$$ in front of $$E_3(h)=h^4R_3(h)$$ as mentioned in the comments, the calculation is correct.