Prove that the following is a fourth order accurate approximation of the second derivative of a function $f$: $$f''(x_0) = \frac{-f(x_0+2h)+16f(x_0+h)-30f(x_0)+16(x_0-h)-f(x_0-2h)}{12h^2} + O(h^4)$$ Find the leading order error term.
Here are my workings below, 1. Are they correct? 2. How do I find the leading order error term? looking for some help with this
Using taylor expansion:
$$ f(x_0+h) = f(x_0) + h f'(x_0) + \frac{h^2}{2} f''(x_0) + \frac{h^3}{6} f'''(x_0) + O(h^4) $$
$$ f(x_0-h) = f(x_0) - h f'(x_0) + \frac{h^2}{2} f''(x_0) - \frac{h^3}{6} f'''(x_0) + O(h^4) $$
$$ f(x_0+2h) = f(x_0) + 2h f'(x_0) + 2 h^2 f''(x_0) + \frac{4 h^3}{3} f'''(x_0) + O(h^4) $$
$$ f(x_0-2h) = f(x_0) - 2h f'(x_0) + 2 h^2 f''(x_0) - \frac{4 h^3}{3} f'''(x_0) + O(h^4) $$
Calculate: $$ -f(x_0 + 2h) + 16f(x_0 + h) - 30f(x_0) + 16f(x_0 - h) - f(x_0 -2h) $$
Which is $$ \begin{aligned} & - \left[ f(x_0) + 2h f'(x_0) + 2 h^2 f''(x_0) + \frac{4 h^3}{3} f'''(x_0) \right] \\ & +16 \left[ f(x_0) + h f'(x_0) + \frac{h^2}{2} f''(x_0) + \frac{h^3}{6} f'''(x_0) \right] \\ & -30 f(x_0) \\ & +16 \left[ f(x_0) - h f'(x_0) + \frac{h^2}{2} f''(x_0) - \frac{h^3}{6} f'''(x_0) \right] \\ & - \left[ f(x_0) - 2h f'(x_0) + 2 h^2 f''(x_0) - \frac{4 h^3}{3} f'''(x_0) \right] \\ & + O(h^4) \end{aligned} $$
Which evaluates to $ 12 h^2 $ to give the required result.