Derivation: finite differences from Taylor

How the truncated Taylor expansion yields the forward, backward and central finite differences of the first derivative.

Forward, backward and central

  1. Take Taylor with a=xia=x_i and x=xi+1x=x_{i+1}, keeping first order. Solving for the derivative gives the forward difference:

    f(xi+1)=f(xi)+f(xi)(xi+1xi)+R1  f(xi)f(xi+1)f(xi)xi+1xif(x_{i+1})=f(x_i)+f'(x_i)(x_{i+1}-x_i)+R_1\ \Longrightarrow\ f'(x_i)\approx\frac{f(x_{i+1})-f(x_i)}{x_{i+1}-x_i}
  2. With a=xi1a=x_{i-1} and x=xix=x_i (looking backward) we get the backward difference:

    f(xi)f(xi)f(xi1)xixi1f'(x_i)\approx\frac{f(x_i)-f(x_{i-1})}{x_i-x_{i-1}}
  3. Subtracting the forward minus the backward expansion cancels the even term and yields the central difference, more accurate. With equally spaced nodes (step h), x_{i+1}−x_{i−1}=2h:

    f(xi)f(xi+1)f(xi1)xi+1xi1=f(xi+1)f(xi1)2hf'(x_i)\approx\frac{f(x_{i+1})-f(x_{i-1})}{x_{i+1}-x_{i-1}}=\frac{f(x_{i+1})-f(x_{i-1})}{2h}