Numerical differentiation: Difference formulas for the first derivative
Simple difference formulas
For a 'neat' function and a certain step size , we have according to Taylor's theorem about
The formula also means that if the function values for and are known, the derivative can be approximated with the forward difference quotient and the truncation error is given by for some between and . You often read this result as the following formula of forward difference.
Formula of forward difference
The figure below illustrates the idea of forward difference as an approximation of a derivative.
In a similar way you can define backward difference and arrive at the formula below.
Formula of backward difference
The accuracy of the backward difference quotient is comparable to that of the forward difference quotient.
We consider and . We know the first and second derivative: . So we can compare numerical approximations of the derivative via the forward and backward difference quotient with the exact value . With the forward difference quotient for between and we find that
The table below shows for the different step sizes the approximation of with the forward difference quotient, the absolute value of the truncation error, and its upper estimate.
With the backward difference quotient for between and we find that
We then get the table below.