# Deriving the approximation formula

$f'(x) \thickapprox$ $\frac{1}{2h} [ 4f(x+h) - 3 f(x) + f(x + 2h)]$

I need to derive the approximation formula for the function above. And I need to show that it's error term is of the form $\frac{1}{3}h^2 f'''(\xi)$

How do I go around doing this? I've been suggested to use the Central Difference Formula or Forward or Backward Approximation

-
You'll have a tough time, since the formula is wrong, or not well written. Let $f(x)=x$. We get nowhere near $1$. But for example if you interchange $4$ and $3$, you get something more plausible. – André Nicolas Jan 31 '12 at 3:52
I double checked, I have the correct formula – user906153 Jan 31 '12 at 3:54
Do you mean (on top) $4f(x+h)-(3f(x)+f(x+2h))$? Please note the parentheses. – André Nicolas Jan 31 '12 at 3:59
The way I wrote it in the question is how I it is written in the book that I have. It is apparently poorly written then – user906153 Jan 31 '12 at 4:17

Let $f(x)=x$. Then $$4f(x+h)-3f(x)+f(x+2h)=4(x+h)-3x+(x+2h)=2x-2h.$$ When you divide by $2h$, you get $\dfrac{x}{h}-1$. This is nowhere near the derivative. Actually, there is also terrible behaviour for the function $f(x)=1$!

How to modify so that things look roughly like the given expression? There are lots of possibilities. For sure the coefficients need to have sum $0$. My two guesses as to what might have been meant have error behaviour worse than the one asked for.

Probably the most popular approximation formula that in general behaves better than the ordinary $(f(x+h)-f(x))/h$ is $(f(x+h)-f(x-h))/2h$. It has error behaviour of the kind you want, with I think $1/6$ instead of $1/3$.

There are many others, involving more complicated combinations of differences.

Remark: Suppose that a numerical differentiation procedure has error behaviour of the type that you are looking for. Then since the third derivative of $1$, $x$, and $x^2$ is identically $0$, the procedure must be exact for $f(x)=1$, $f(x)=x$, and $f(x)=x^2$.

-
In general, symmetric differences have better numerical properties than unsymmetric differences. Also, they are much more suited to further processing like Richardson extrapolation than their unsymmetric counterparts. – J. M. Jan 31 '12 at 4:31

Following André Nicolas' remark one may search for all formulas of the type $$f'(x)\doteq {1\over 2h}\bigl( a f(x)+ b f(x+h)+ c f(x+2h)\bigr)\qquad (|h|\ll 1)$$ that are exact for $f(x)=x^k$ $\ (k=0,1,2)$. There is just one such formula, namely $$f'(x)={1\over2h}\bigl(4 f(x+h)-f(x+2h)-3 f(x)\bigr)\ .$$ To obtain an error estimate fix $x$ and consider the auxiliary function $$g(h):=4f(x+h)-f(x+2h)-3f(x)-2h f'(x)\ .$$ Then $$g'(h)=4f'(x+h)-2f'(x+2h)-2f'(x), \quad g''(h)=4f''(x+h)-4f''(x+2h)\ .$$ It follows that $g(0)=g'(0)=g''(0)=0$; furthermore $|g''(h)|\leq 4 M |h|$ where $M:=\sup|f'''(t)|$ in the $t$-interval with endpoints $x$ and $x+2h$. From this we conclude that $$|g'(h)|\leq 2 M h^2$$ and then $$|g(h|\leq {2\over3} M |h|^3\ .$$ It follows that $$\left|{1\over 2h}\bigl(4f(x+h)-f(x+2h)-3f(x)\bigr)-f'(x)\right|={|g(h)|\over 2|h|}\leq {1\over 3} h^2\,M\ ,$$ as stated by the OP (albeit without the $\xi \thinspace$).

-