Approximate numerical formulae can be derived using Taylor series.
For all the definitions below, h is a small positive number, and is called the step size.
First Order Derivative
Taylor series expansion of f(x0+h) around x0, truncated after 1st derivative.
f′(x0)=hf(x0+h)−f(x0)+2!hf(2)(ϵ)
Error is bounded by:
2M∣h∣
Forward difference formula
f′(x0)=hf(x0+h)−f(x0)+O(h)
Here M is a bound on f(2)(x) between x0 and x0+h.
Backward difference formula
f′(x0)≈hf(x0)−f(x0−h)+O(h)
Here M is a bound on f(2)(x) between x0 and x0−h.
Centered difference formula
Aka. three-point mid point formula. Truncated after 2nd derivative.
f′(x0)=2hf(x0+h)−f(x0−h)+O(h2)
Error is in order of O(h2) which is better than O(h).
Second Order Derivatives
Second forward difference formula
f(2)(x0)=h21[f(x0+2h)−2f(x0+h)+f(x0)]+O(h)
Second backward difference formula
f(2)(x0)=h21[f(x0)−2f(x0−h)+f(x0−2h)]+O(h)
Second centered difference formula
f(2)(x0)=h21[f(x0+h)−2f(x0)+f(x0−h)]+O(h2)
Higher Order Derivatives
For n-th derivative, Taylor series is truncated after nth derivative.
n-th forward difference formula
f(n)(x)=hn1i=0∑n(−1)n−i(in)f(x+ih)+O(h)
n-th backward difference formula
f(n)(x)=hn1i=0∑n(−1)i(in)f(x−ih)+O(h)
n-th centered difference formula
f(n)(x)=hn1i=0∑n(−1)i(in)f(x+(2n−i)h)+O(h2)
Accuracy
The accuracy of these divided difference formulas can be increased by including additional terms in the Taylor series. In each step the accuracy is improved by a power of h.