Deriving formula for approximating the derivatives Derive the following formula for approximating derivates and show that it is O(h^4) by establishing its error:
$$
f'(x) \approx \frac{1}{12h} [-f(x+2h)+8f(x+h)-8f(x-h)+f(x-2h)]
$$
I've tried writing everything out with their taylor expansions. Then I get
$$
f'(x) \approx \frac{1}{12h} \left( 12hf'(x) \right)
$$
But I am not sure if im doing the right thing. Any ideas or hints?
 A: Write the Taylor expansion of your terms up to fourth order
For example:
$$ f(x+h)= f(x) + hf'(x) + h^2/2 f"(x) + h^3/6 f'''(x) + O(h^4)$$
$$ f(x-h)= f(x) - hf'(x) + h^2/2 f"(x) - h^3/6 f'''(x) + O(h^4)$$
$$  f(x+2h)= f(x) +2hf'(x) + (2h)^2/2 f"(x) + (2h)^3/6 f'''(x) + O(h^4)$$
$$f(x-2h)= f(x) -2hf'(x) + (2h)^2/2 f"(x) - (2h)^3/6 f'''(x) + O(h^4)$$
Plug in the RHS and solve for f'(x) to get the LHS.
A: It's best to go to a high enough order we can see how close the approximation is. Using$$\begin{align}f(x+ch)&\in f(x)+cf^\prime(x)h\\&+\tfrac{c^2}{2}f^{\prime\prime}(x)h^2+\tfrac{c^3}{3!}f^{(3)}(x)h^3+\tfrac{c^4}{4!}f^{(4)}(x)h^4+\tfrac{c^5}{5!}f^{(5)}(x)h^5+o(h^5),\end{align}$$you can show the right-hand side is $f^\prime(x)-\tfrac{1}{30}f^{(5)}(x)h^4+o(h^4)$. (To save you work beside computing the $h^4$ coefficient, note the $f^{(2n)}$ terms will always cancel because $f(x+ch)-f(x-ch)$ is odd in $c$, while the $f^{(3)}$ term cancels because $8f(x+h)+f(x-2h)$ has no $h^3$ term.) The error is $O(h^4)$, making the approximation excellent for small $h$.
