Error of derivative approximation I have a task to approximate the value of $f'(x_0)$ with error of $O(h^2)$, knowing the values of $f$ in points: $x_0,\ x_1=x_0+h,\ x_2=x_0+2h$. I used Taylor equation with Peano Remainder for $x_1,\ x_2$ and I've got:
$$
f(x_2)-4f(x_1)=-3f(x_0)-2hf'(x_0)+O(4h^2)-4O(h^2)\\ f'(x_0)= \frac{1}{2h}(4f(x_1)-f(x_2)-3f(x_0))+? 
$$
this question mark (?) is the error - my question: how to prove that it is $O(h^2)$?
 A: Assume first $f\in C^3$ such that we can compute the second order Taylor approximation of $f(x)$ around $x_0$ with Lagrange remainder. 
First scenario.
Assume $x_1 = x_0 + h$ and $x_2 = x_0 + 2h$. We approximate $f$ as its Taylor approximation around $x_0$ at $x_1$
$$
f(x_0 + h) = f(x_0) + hf'(x_0) + \frac{h^2}{2} f''(x_0) + \frac{h^3}{6} f'''(c_1) \tag{1} \label{1}
$$
where $c_1\in [x_0, x_0 + h]$, and at $x_2$
$$
f(x_0 + 2h) = f(x_0) + 2hf'(x_0) + 4\frac{h^2}{2} f''(x_0) + 8\frac{h^3}{6} f'''(c_2) \tag{2} \label{2}
$$
where $c_2 \in [x_0, x_0 + 2h]$. Now subtract \eqref{2} from \eqref{1} multiplied by the weights $1$ and $4$ such that 
$$
f(x_0+2h) - 4f(x_0+h) = f(x_0) - 4f(x_0) + 2hf'(x_0) - 4hf'(x_0) + 4\frac{h^2}{2}f''(x_0) - 4\frac{h^2}{2}f''(x_0) + 8\frac{h^3}{6} f'''(c_2) - \frac{h^3}{6} f'''(c_1)
$$
Observe that the second order terms cancel and we remove these. We also rewrite the third order terms to big-O notation as
$$
f(x_0+2h) - 4f(x_0+h) = -3 f(x_0) - 2hf'(x_0) + O(h^3)
$$
which we can move around to show that
$$
f'(x_0) = \frac{1}{2} \left[4f(x_0 + h) - 3f(x_0) - f(x_0 + 2h)\right] + O(h^2).
$$
Second scenario.
We can also investigate the (somewhat weird) scenario in which we have $x_1 = x_0 + h$ (as before) and $x_2 = x_0 - 2h$. Then the Taylor approximation around $x_0$ evaluated at $x_2$ is given by
$$
f(x_0 - 2h) = f(x_0) - 2hf'(x_0) + 4\frac{h^2}{2}f''(x_0) - 8\frac{h^3}{6}f'''(c_3) \tag{3} \label{3}
$$
with $c_3 \in [x_0 - 2h, x_0]$. We subtract \eqref{3} and \eqref{1} multiplied with $1$ and $4$ and arrive at
$$
f(x_0 - 2h) - 4 f(x_0 + h) = f(x_0) - 4f(x_0) -2hf'(x_0) - 4hf'(x_0) + 4\frac{h^2}{2}f''(x_0) - 4\frac{h^2}{2}f''(x_0) - 8 \frac{h^3}{6}f'''(c_3) - 4\frac{h^3}{6}f'''(c_1)
$$
As before we notice that the second order terms cancel and we replace the third order terms using big-O notation. This simplifies to
$$
f(x_0 - 2h) - 4 f(x_0 + h) = f(x_0) - 4f(x_0) -6hf'(x_0) + O(h^3)
$$
which we can flip around
$$
f'(x_0) = \frac{1}{6h}\left[4f(x_0 + h) - 3f(x_0) - f(x_0 - 2h)\right] + O(h^2)
$$
