## Numerical Differentiation: Basic Numerical Differentiation Formulas

### Basic Numerical Differentiation Formulas

The numerical differentiation formulas presented in the Taylor Series section will be repeated here.

#### Forward Finite Difference

Let be differentiable and let ,then, using Taylor theorem:

where . In that case, the forward finite-difference can be used to approximate as follows:

(1)

where indicates that the error term is directly proportional to the chosen step size .

#### Backward Finite Difference

Let be differentiable and let , then, using Taylor theorem:

where . In this case, the backward finite-difference can be used to approximate as follows:

(2)

where indicates that the error term is directly proportional to the chosen step size .

#### Centred Finite Difference

The centred finite difference can provide a better estimate for the derivative of a function at a particular point. If the values of a function are known at the points and , then, we can use the Taylor series to find a good approximation for the derivative as follows:

subtracting the above two equations and dividing by gives the following:

where indicates that the error term is directly proportional to the square of the chosen step size . I.e., the centred finite difference provides a better estimate for the derivative when the step size is reduced compared to the forward and backward finite differences. Notice that when , the centred finite difference is the average of the forward and backward finite difference!

The following tool illustrates the difference between forward, backward, and centred finite difference when calculating the numerical derivative of the function at a point wit ha step size . Click on the picture to activate the tool and move the slider to vary the value of and to see the effect on the calculated deriative. The centred finite difference in most cases provides a closer estimate to the true value of the derivative.

<div=””></div=””>

### Basic Numerical Differentiation Formulas for Higher Derivatives

The formulas presented in the previous section can be extended naturally to higher-order derivatives as follows.

#### Forward Finite Difference

Let be differentiable and let , with , then, using the basic forward finite difference formula for the second derivative, we have:

(3)

Notice that in order to calculate the second derivative at a point using forward finite difference, the values of the function at two additional points and are needed.
Similarly, for the third derivative, the value of the function at another point with is required (with the same spacing ). Then, the third derivative can be calculated as follows:

Similarly, for the fourth derivative, the value of the function at another point with is required (with the same spacing ). Then, the fourth derivative can be calculated as follows:

#### Backward Finite Difference

Let be differentiable and let , with , then, using the basic backward finite difference formula for the second derivative, we have:

(4)

Notice that in order to calculate the second derivative at a point using backward finite difference, the values of the function at two additional points and are needed.
Similarly, for the third derivative the value of the function at another point with is required (with the same spacing ). Then, the third derivative can be calculated as follows:

Similarly, for the fourth derivative, the value of the function at another point with is required (with the same spacing ). Then, the fourth derivative can be calculated as follows:

#### Centred Finite Difference

Let be differentiable and let , with a constant spacing , then, we can use the Taylor theorem for and as follows:

Adding the above two equations and dividing by gives the following:

(5)

which provides a better approximation for the second derivative than that provided by the forward or backward finite difference as the error is directly proportional to the square of the step size.
For the third derivative, the value of the function is required at the points and . Assuming all the points to be equidistant with a spacing , then, the third derivative can be calculated using Equation 5 as follows:

Replacing the first derivatives with the centred finite difference value for those:

(6)

For the fourth derivative, the value of the function at the points and is required. Assuming all the points to be equidistant with a spacing , then, the fourth derivative can be calculated using Equation 5 as follows:

Using the centred finite difference for the second derivatives (Equation 5) yields:

### Lecture Video

1. John says:

It looks like you wrote this in Latex. I’m just getting started with Latex. Would you be willing to share a sample file with me?