Derivation: three-point forward O(h²)

How to combine two Taylor expansions to eliminate the second derivative and get an order-2 forward difference for the first derivative.

Combining two expansions

  1. Expand Taylor at xi+1x_{i+1} and xi+2x_{i+2} around xix_i:

    f(xi+1)=f(xi)+hf(xi)+h22f(xi)+R2f(xi+2)=f(xi)+2hf(xi)+2h2f(xi)+R2\begin{aligned} f(x_{i+1})&=f(x_i)+hf'(x_i)+\tfrac{h^2}{2}f''(x_i)+R_2\\ f(x_{i+2})&=f(x_i)+2hf'(x_i)+2h^2 f''(x_i)+R_2 \end{aligned}
  2. Compute (second)2(first)(\text{second})-2\cdot(\text{first}) to cancel ff'; solving for ff'' gives an O(h)\mathcal{O}(h) formula for the second derivative:

    f(xi)=fi+22fi+1+fih2+O(h)f''(x_i)=\frac{f_{i+2}-2f_{i+1}+f_i}{h^2}+\mathcal{O}(h)
  3. Substituting this ff'' into the first expansion and solving for ff' cancels the order-hh term and leaves:

    f(xi)=fi+2+4fi+13fi2h+O(h2)f'(x_i)=\frac{-f_{i+2}+4f_{i+1}-3f_i}{2h}+\mathcal{O}(h^2)