Solving for the first derivative then yields the result:
Note that this approximation is second order accurate in dx. It uses one point to the right and one point
to the left of the point where the derivative is evaluated. Only two values of f are needed, as with the
forward and backward formulae. So, we can get better accuracy without using more data. Since the data used
are symmetrically placed relative to where the derivative is computed, this formula is called a centered
difference approximation. In practice, this formula is quite widely used. It is a workhorse of computational
physics.
As with the forward and backward formulae, we note that the centered difference formula would be exact if
the underlying function had a vanishing third derivative. This implies that the function would necessarily
have to be a quadratic function
Then, by inspecting these two expansions we easily see that the following combination will
result in the terms which have second derivatives cancelling out.
Solving for the first derivative we find
Thus we have constructed a second order accurate derivative approximation which is defined at the leftmost
end point of the defined data. The same method could be used to generate a second order derivative defined
at the rightmost end of the given data.