Derivation of fourth-order accurate formula for the second derivative I am trying to derive / prove the fourth order accurate formula for the second derivative:
$f''(x) = \frac{-f(x + 2h) + 16f(x + h) - 30f(x) + 16f(x - h) - f(x -2h)}{12h^2}$.
I know that in order to do this I need to take some linear combination for the Taylor expansions of $f(x + 2h)$, $f(x + h)$, $f(x - h)$, $f(x -2h)$. For example, when deriving the the centered-difference formula for the first derivative, the Taylor expansion of $f(x + h)$ minus $f(x-h)$ can be computed to give the desired result of $f'(x)$, in that case.
In what way would I have to combine these Taylor expansions above to obtain the required result?
 A: Exactly as Gammatester says, Taylor expand the terms upto order $4$ and verify.
\begin{eqnarray*}
-f(x+2h) &=& -f(x) &-& 2h f'(x)  &-& 2h^2 f''(x) &-& \frac{4}{3} h^3 f'''(x) &-& \frac{2}{3} h^4 f''''(x) &+& O(h^5)  \\ 
16f(x+h) &=& 16  f(x)&+& 16h f'(x)  &+& 8h^2 f''(x) &+& \frac{8}{3} h^3 f'''(x) &+& \frac{2}{3} h^4 f''''(x) &+& O(h^5)  \\ 
-30f(x) &=& -30f(x) & &    & &    & &   & &  & &    \\ 
16f(x-h) &=& 16  f(x)&-& 16h f'(x)  &+& 8h^2 f''(x) &-& \frac{8}{3} h^3 f'''(x) &+& \frac{2}{3} h^4 f''''(x) &+& O(h^5)  \\ 
-f(x-2h) &=& -f(x) &+& 2h f'(x)  &-& 2h^2 f''(x) &+& \frac{4}{3} h^3 f'''(x) &-& \frac{2}{3} h^4 f''''(x) &+& O(h^5)  \\ 
\end{eqnarray*}
A: $$
f(x+h) = 
f(x) + h f'(x) + \frac{h^2}{2} f''(x) 
+ \frac{h^3}{6} f'''(x) 
+ O(h^4)
$$
$$
f(x-h) = 
f(x) - h f'(x) + \frac{h^2}{2} f''(x) 
- \frac{h^3}{6} f'''(x) 
+ O(h^4)
$$
$$
f(x+2h) = 
f(x) + 2h f'(x) + 2 h^2 f''(x) 
+ \frac{4 h^3}{3} f'''(x) + O(h^4)
$$
$$
f(x-2h) = 
f(x) - 2h f'(x) + 2 h^2 f''(x) 
- \frac{4 h^3}{3} f'''(x) 
+ O(h^4)
$$
Calculate:
$$
-f(x + 2h) + 16f(x + h) - 30f(x) + 16f(x - h) - f(x -2h)
$$
Which is
$$
\begin{aligned}
&
- \left[
f(x) + 2h f'(x) + 2 h^2 f''(x) 
+ \frac{4 h^3}{3} f'''(x) 
\right]
\\
&
+16
\left[
f(x) + h f'(x) + \frac{h^2}{2} f''(x) 
+ \frac{h^3}{6} f'''(x) 
\right]
\\
&
-30
f(x)
\\
&
+16
\left[
f(x) - h f'(x) + \frac{h^2}{2} f''(x) 
- \frac{h^3}{6} f'''(x) 
\right]
\\
&
-
\left[
f(x) - 2h f'(x) + 2 h^2 f''(x) 
- \frac{4 h^3}{3} f'''(x) 
\right]
\\
&
+ O(h^4)
\end{aligned}
$$
Which evaluates to 
$
12 h^2
$
to give the required result.
A: You can easily derive the formula, if you do not know it, as a derivative of the Lagrange polynomial
D[D[InterpolatingPolynomial[{(-2*h,y0),(-1*h,y1),(0*h,y2),(1*h,y3),(2*h,y4)},x],x],x] /. x=0

 Try at Wolfram Alpha

The other answers show how to prove the order of accuracy of an already-known formula.
