We Define 3 grid points $x_{-1}$, $x_0$, $x_1$ with $x_{-1}=x_0-h$ and $x_{1} = x_0 + h$ with $h$ > 0.
Given a smooth function f, show that the approximation to $f'(x_0)$ given by the centered differences:
$$f[x_{-1}, x_1] = \frac { f({ x }_{ 1 })-f({ x }_{ -1 }) }{ { x }_{ 1 }-{ x }_{ -1 } } $$
has discretization error $O(h^2)$
I know that performing a Taylor expansion of $f(x_1)$ and $f(x_{-1})$ at $x_0$ would be a good start here but I do not proceed with that.
Could anyone show me how to solve this problem?
Almost all of these sort of analyses start with a Taylor expansion. I have a preference for the integral expansion.
The basic idea of the central difference is that the even powers of $h$ in the Taylor expansion cancel each other.
We have $f(x+h) = f(x) + f'(x)h + {1 \over 2} f''(x) h^2 + \int_0^1 f'''(x+th) {(1-t)^2 \over 2!}h^3 dt$.
Hence $f(x+h)-f(x-h) = f'(x) 2h + \int_0^1 f'''(x+th) {(1-t)^2 \over 2!}h^3 dt + \int_0^1 f'''(x-th) {(1-t)^2 \over 2!}h^3 dt$, which gives ${ f(x+h)-f(x-h) \over 2h} -f'(x) = {h^2 \over 2} \left[ \int_0^1 f'''(x+th) {(1-t)^2 \over 2!}dt +\int_0^1 f'''(x-th) {(1-t)^2 \over 2!}dt\right]$.
If $h \mapsto f'''(x+h)$ is bounded by $M$ in a neighbourhood of $0$, we have
$\left| { f(x+h)-f(x-h) \over 2h} -f'(x) \right| \le {M \over 6} h^2$.
In terms of the questions symbols: $\left| f[x_0-h,x_0+h] -f'(x_0) \right| \le {M \over 6} h^2$, which is $O(h^2)$.