Finite Difference Method for Numerical Differentiation: A Step-by-Step Guide

Finite Difference Method for Numerical Differentiation: A Step-by-Step Guide

The Finite Difference Method for Numerical Differentiation provides a method to approximate derivatives when finding an exact derivative is difficult, impractical, or impossible. In calculus, we typically learn to differentiate functions using algebraic methods and rules such as the power rule, product rule, and chain rule. However, many real-world problems involve only numerical data. In these situations, numerical differentiation lets us estimate derivatives directly from function values.

There are three fundamental finite difference formulas for approximating a first derivative: the forward difference, backward difference, and central difference formulas. Although all three methods are based on the same underlying idea, they have different levels of accuracy and are useful in different situations.

In this guide, we will develop each method from the definition of the derivative and Taylor series. You will see not only how to use the formulas, but also why they work and how to calculate the error. We will also work through several examples involving forward, backward, and central differences and examine situations in which finite difference methods succeed, and situations in which they can produce poor or misleading results.

By the end of this guide, you will be able to choose an appropriate finite difference formula, approximate derivatives, calculate the error, and understand the limitations of numerical differentiation.

What Is the Finite Difference Method?

The finite difference method is a numerical technique for approximating derivatives using function values at nearby points. Rather than finding an exact derivative symbolically, we use the values of a function at a finite number of points. This makes finite differences especially useful when only numerical data is available.

To understand why this works, it helps to review the definition of a derivative. In my article How to Differentiate a Function Step by Step: A Beginner’s Guide, I explained that the derivative measures a function’s instantaneous rate of change. Geometrically, it represents the slope of the tangent line to a function at a particular point, as I discussed in the article Secant and Tangent Lines in Calculus: A Complete Beginner’s Guide.

The derivative is defined as

$$f'(x) = \lim_{h \to 0}\frac{f(x + h) – f(x)}{h}.$$

The expression

$$\frac{f(x + h) – f(x)}{h}$$

is the slope of a secant line between two points on the graph of \( f(x) \). As \( h \) approaches zero, the second point approaches the first, and the secant line approaches the tangent line. The limit therefore gives us the exact derivative.

This connects finite difference methods directly to the concept of limits. In How to Calculate Limits in Calculus: Everything You Need to Know, we explored how limits describe what happens to a function or expression as its input approaches a particular value. Here, the same idea helps us understand numerical differentiation. Instead of taking the limit as \( h \) approaches zero, we choose a small but nonzero value of \( h \) and use the resulting difference quotient as an approximation.

For example, suppose we want to approximate \( f'(x) \). Choosing a small positive value of \( h \) gives

$$f'(x) \approx \frac{f(x + h) – f(x)}{h}.$$

The word finite in finite difference refers to the fact that \( h \) is not infinitesimally small. We are calculating the difference between function values at two distinct points. This is different from the exact derivative, which is obtained by taking the limit as the distance between those points approaches zero.

The Basic Idea

Consider two points on the graph of a function:

$$(x, f(x))$$

and

$$(x+h, f(x + h)).$$

The slope between these points is

$$\frac{f(x + h) – f(x)}{(x + h) – x} = \frac{f(x + h) – f(x)}{h}.$$

This is a finite difference approximation to the derivative at \( x \).

The approximation improves as the two points get closer together, provided the function is sufficiently smooth. This distinction is important: choosing a smaller \( h \) generally reduces one source of error, but making \( h \) extremely small can introduce another. We will examine this tradeoff in detail later in the article.

The finite difference method therefore turns the conceptual definition of the derivative into a practical computational procedure. Instead of asking what happens in the limiting process as \( h \to 0 \), we choose an appropriate finite value of \( h \), evaluate the function at nearby points, and use those values to estimate the derivative.

What Is a Finite Difference?

A finite difference is the difference between function values at two or more distinct points. For example, the forward difference is written as

$$\Delta f(x) = f(x + h) – f(x).$$

Dividing this difference by the spacing \( h \) gives the forward difference approximation to the first derivative:

$$f'(x) \approx \frac{f(x + h) – f(x)}{h}.$$

There are several ways to choose the points used in this calculation. The three most important for first derivatives are the forward difference, backward difference, and central difference methods.

The forward difference uses the point to the right of \( x \):

$$f'(x) \approx \frac{f(x + h) – f(x)}{h}.$$

The backward difference uses the point to the left:

$$f'(x) \approx \frac{f(x) – f(x – h)}{h}.$$

The central difference uses points on both sides of \( x \):

$$f'(x) \approx \frac{f(x + h) – f(x – h)}{2h}.$$

Although these formulas look similar, they are not equally accurate. The central difference formula generally provides a more accurate approximation for a given step size because its error terms behave differently. However, it also requires function values on both sides of the point being investigated, which can make it unsuitable at the boundary of a data set.

In the sections that follow, we will examine the forward, backward, and central difference formulas in detail. More importantly, we will derive these formulas and investigate why they work, how accurate they are, how to calculate their errors, and when they can fail.

The Three Finite Difference Formulas

There are three fundamental formulas for approximating a first derivative using finite differences: the forward difference, backward difference, and central difference formulas. All three formulas approximate \( f'(x) \), but they use function values at different locations around the point of interest.

The choice of formula depends largely on what information is available. If we have function values to the right of \( x \), we can use a forward difference. If the available values are to the left, a backward difference is appropriate. If we have values on both sides of \( x \), the central difference is usually preferred because it provides a higher-order approximation.

Forward Difference Formula

The forward difference formula estimates the derivative at \( x \) using the function value at \( x \) and a second function value at \( x + h \):

$$f'(x) \approx \frac{f(x + h) – f(x)}{h}.$$

The name forward difference comes from moving forward from \( x \) to \( x + h \).

This formula follows directly from the definition of the derivative:

$$f'(x) = \lim_{h \to 0} \frac{f(x + h) – f(x)}{h}.$$

Instead of taking the limit as \( h \) approaches zero, we choose a small, nonzero value of \( h \). The resulting difference quotient approximates the derivative.

The forward difference formula has first-order accuracy, meaning its truncation error is \( O(h) \):

$$f'(x) = \frac{f(x+h)-f(x)}{h} + O(h).$$

Backward Difference Formula

The backward difference formula estimates the derivative at \( x \) using the function value at \( x \) and a second function value at \( x – h \):

$$f'(x) \approx \frac{f(x) – f(x – h)}{h}.$$

The name backward difference comes from the fact that we move backward from \( x \) to \( x – h \).

The formula can be derived from the derivative definition by considering a point to the left of \( x \). A Taylor expansion of \( f(x – h) \) gives

$$f(x – h) = f(x) – hf'(x) + \frac{h^2}{2}f”(x) + \cdots.$$

Rearranging and dividing by \( h \) leads to

$$f'(x) \approx \frac{f(x) – f(x – h)}{h}.$$

Like the forward difference formula, the backward difference formula has first-order accuracy:

$$f'(x) = \frac{f(x) – f(x – h)}{h} + O(h).$$

Central Difference Formula

The central difference formula estimates the derivative at \( x \) using function values on both sides of \( x \):

$$f'(x) \approx \frac{f(x + h) – f(x – h)}{2h}.$$

Unlike the forward and backward difference formulas, the central difference formula is symmetric around \( x \). It uses the points \( x – h \) and \( x + h \), which are equally spaced from the point where the derivative is being approximated.

The central difference formula is particularly important because it has second-order accuracy:

$$f'(x) = \frac{f(x + h) – f(x – h)}{2h} + O(h^2).$$

Why Does the Finite Difference Method Work?

At first glance, finite difference methods might seem like a shortcut. The derivative is defined using a limit, yet finite difference formulas use a small, finite value of \( h \). Why should replacing a limit with a finite difference produce a reasonable approximation?

The answer comes from how smooth functions behave near a point. When a function is sufficiently smooth, its values near a point can be described very accurately using a Taylor series. The finite difference formulas work because the Taylor series allows us to express nearby function values in terms of the derivatives we are trying to approximate.

The Derivative as a Limit

Recall that the derivative of \( f(x) \) at \( x \) is defined by

$$f'(x) = \lim_{h \to 0}\frac{f(x + h) – f(x)}{h}.$$

For any nonzero value of \( h \), the quantity

$$\frac{f(x + h) – f(x)}{h}$$

is the slope of a secant line rather than the slope of the tangent line. As \( h \) becomes smaller, however, the secant line approaches the tangent line, assuming the function is differentiable at \( x \).

This is the fundamental reason finite differences work. We are using a finite value of \( h \) to approximate a limiting process.

The important question is therefore not whether the finite difference is exactly equal to the derivative. It generally is not. Instead, the question is how close the approximation is to the true derivative and how that accuracy changes as \( h \) changes.

For a sufficiently smooth function, the answer can be determined using Taylor’s theorem.

Using Taylor Series to Understand Finite Differences

Suppose \( f \) has sufficiently many derivatives near \( x \). Taylor’s theorem allows us to write \( f(x + h) \) as an expansion around \( x \):

$$f(x + h) = f(x) + hf'(x) + \frac{h^2}{2!}f”(x) + \cdots.$$

Now subtract \( f(x) \) from both sides:

$$f(x + h) – f(x) = hf'(x) + \frac{h^2}{2!}f”(x) + \cdots.$$

Dividing by \( h \) gives

$$\frac{f(x + h) – f(x)}{h} = f'(x) + \frac{h}{2!}f”(x) + \cdots.$$

The first term on the right-hand side is

$$f'(x).$$

The remaining terms represent the error introduced by using a finite value of \( h \).

Therefore,

$$\frac{f(x + h) – f(x)}{h} = f'(x) + O(h).$$

Equivalently, we can write

$$f'(x) = \frac{f(x + h) – f(x)}{h} + O(h).$$

This explains why the forward difference formula works and also tells us something important about its accuracy. Its error is proportional to \( h \). If \( h \) is reduced by a factor of 10, the leading truncation error is approximately reduced by a factor of 10 as well, assuming other sources of error remain negligible.

Why the Forward Difference Formula Works

The forward difference formula is

$$f'(x) \approx \frac{f(x + h) – f(x)}{h}.$$

From the Taylor expansion above, we know that

$$\frac{f(x + h) – f(x)}{h} = f'(x) + \frac{h}{2}f”(x) + O(h^2).$$

The additional terms become smaller as \( h \) approaches zero. Consequently
,
$$\frac{f(x + h) – f(x)}{h} \to f'(x) \text{as } h \to 0.$$

Why the Backward Difference Formula Works

The same reasoning can be applied to a point to the left of \( x \).

Expand \( f(x – h) \) using a Taylor series:

$$f(x – h) = f(x) – hf'(x) + \frac{h^2}{2!}f”(x) + \cdots.$$

Rearranging gives

$$f(x) – f(x – h) = hf'(x) – \frac{h^2}{2!}f”(x) – \cdots.$$

Dividing by \( h \),

$$\frac{f(x) – f(x – h)}{h} = f'(x) – \frac{h}{2}f”(x) – \cdots.$$

Thus,

$$\frac{f(x) – f(x – h)}{h} = f'(x) + O(h).$$

The backward difference method also has first-order accuracy. Its leading error has the opposite sign from the forward difference method, but the same order of magnitude.

Why the Central Difference Formula Works

The central difference formula uses points on both sides of \( x \):

$$f'(x) \approx \frac{f(x + h) – f(x – h)}{2h}.$$

To understand why this formula is more accurate, we need to expand both \( f(x + h) \) and \( f(x – h ) \) around \( x \).

We have

$$f(x + h) = f(x) + hf'(x) + \frac{h^2}{2}f”(x) + \cdots$$

and

$$f(x – h) = f(x) – hf'(x) + \frac{h^2}{2}f”(x) – \cdots.$$

Subtract the second equation from the first:

$$f(x + h) – f(x – h) = 2hf'(x) + \frac{2h^3}{6}f”'(x) + \cdots.$$

Dividing by \( 2h \) gives

$$\frac{f(x + h) – f(x – h)}{2h} = f'(x) + \frac{h^2}{6}f”'(x) + \cdots.$$

Therefore,

$$\frac{f(x + h) – f(x – h)}{2h} = f'(x) + O(h^2).$$

This is the main advantage of the central difference formula. Its leading truncation error is proportional to \( h^2 \), rather than \( h \).

When Does the Finite Difference Method Succeed?

The finite difference method can be effective when it is applied under the right conditions. Although the formulas themselves are relatively simple, their accuracy depends on several factors, including the smoothness of the function, the spacing between data points, the accuracy of the function values, and the choice of step size.

The Function Is Smooth

Finite difference methods work particularly well when the function being differentiated is smooth near the point of interest.

The Taylor-series derivations from earlier in this article rely on the function having enough derivatives in a neighborhood of \( x \). For example, the forward difference approximation

$$f'(x) \approx \frac{f(x + h) – f(x)}{h}$$

works well when the higher-order terms in the Taylor expansion remain small.

Similarly, the central difference approximation

$$f'(x) \approx \frac{f(x + h) – f(x – h)}{2h}$$

benefits from the function’s smooth behavior because its improved accuracy depends on the cancellation of terms in the Taylor expansions.

Functions that change smoothly near the point of interest are therefore generally good candidates for numerical differentiation.

For a review of smooth functions, please refer to the articles Newton’s Method Explained for Beginners, The Ultimate Resource for Understanding the Secant Method, and Interpolation Using Lagrange Polynomials in Numerical Analysis: A Complete Tutorial.

The Step Size Is Appropriate

Choosing an appropriate step size \( h \) is one of the most important factors in obtaining a reliable approximation.

If \( h \) is too large, the nearby function values may not be close enough to represent the local behavior of the function accurately.

On the other hand, if \( h \) is too small, round-off error can become significant.

Ideally, we want a value of \( h \) that balances these competing sources of error.

Accurate Function Values Are Available

Finite difference methods depend directly on the values of the function being evaluated. Any error in these values affects the resulting derivative approximation.

This becomes especially important when the function values come from measurements rather than a mathematical formula.

The Data Points Are Appropriately Spaced

Finite difference formulas are particularly convenient when data points are evenly spaced.

The standard forward, backward, and central difference formulas can then be applied directly.

There Is Sufficient Information Around the Point

The location of the point where we want the derivative also matters.

At an interior point, we generally have data on both sides: This allows us to use the central difference formula:

At a boundary, however, information exists only on one side. In this situation, a forward or backward difference is more natural:

The Function Does Not Have a Discontinuity Nearby

Finite differences work best when the function behaves predictably in the neighborhood being examined.

If the function has a discontinuity, a finite difference approximation may not accurately represent the derivative.

For a review of continuous functions, please refer to the articles A Complete Introduction to the Bisection Method with Worked Examples and Solutions and How to Solve Equations Using Fixed Point Iteration: A Step-by-Step Guide.

The Function Values Can Be Evaluated Reliably

Another important requirement is that we can actually evaluate the function accurately at the points required by the formula.

If evaluating a necessary function value is unstable, expensive, or subject to substantial numerical error, the resulting derivative approximation may also be unreliable.

When Does the Finite Difference Method Fail?

The finite difference method is a valuable tool for numerical differentiation, but it is not guaranteed to produce an accurate result in every situation. A formula can be mathematically correct and still produce a poor numerical approximation if the function is not smooth, the data contains noise, or the step size is poorly chosen.

Understanding when finite differences fail is therefore just as important as understanding when they succeed. In practice, the goal is not simply to apply a formula, but to recognize when the assumptions behind that formula are no longer reliable.

The Step Size Is Too Large

One of the most common reasons a finite difference approximation fails is choosing a step size \( h \) that is too large.

The Step Size Is Too Small

It might seem that the solution to a large \( h \) is simply to choose a small \( h \). Unfortunately, this can also cause finite differences to fail. If you subtract two nearly identical numbers, you can lose significant digits.

The Data Contains Too Much Noise

Finite differences can be particularly problematic when the function values come from experimental or observational data.

For noisy data, methods such as interpolation may be more appropriate than directly applying a finite-difference formula to raw measurements.

The Function Is Not Differentiable

Finite difference formulas approximate derivatives. Therefore, if the underlying function does not have a derivative at the point of interest, there may be no meaningful derivative for the numerical method to approximate.

There Is a Discontinuity Near the Point of Interest

A finite difference approximation can also fail when a discontinuity is located near the point where the derivative is being estimated.

Even if the function is differentiable at \( x \), a discontinuity close to the data points can interfere with the approximation.

The Data Points Are Not Appropriately Spaced

The standard finite difference formulas assume equally spaced points.

There Are Not Enough Data Points

Each finite difference formula requires specific information. If the necessary function values are unavailable, you cannot apply the corresponding formula.

Error Computation in Numerical Differentiation

A finite difference is an approximation, so it is important to know how accurate that approximation is. Simply calculating a derivative using a forward, backward, or central difference formula does not tell us how close the result is to the true derivative.

Error computation gives us a way to measure that difference.

In numerical differentiation, several different types of error are useful to consider. The most important are absolute error, relative error, truncation error, and round-off error.

Absolute Error

The simplest way to measure the error in numerical differentiation is the absolute error.

Suppose the exact derivative is \( f'(x) \), while our numerical approximation is

$$f’_{\mathrm{approx}}(x).$$

The absolute error is

$$\epsilon = |f'(x) – f’_{\mathrm{approx}}(x)|.$$

Absolute error is useful because it tells us how far the approximation is from the exact answer.

Relative Error

To account for the size of the exact answer, we can use the relative error:

$$\epsilon = \frac{|f'(x) – f’_{\mathrm{approx}}(x)|}{|f'(x)|}.$$

Relative error is often more informative than absolute error because it measures the error relative to the magnitude of the true derivative.

Truncation Error

One of the most important sources of error in finite difference methods is truncation error.

Truncation error occurs because we replace an infinite mathematical expression with a finite approximation.

The truncation error for the forward and backward difference formulas is

$$\epsilon = O(h),$$

whereas for the central difference formula it is

$$\epsilon = O(h^2).$$

This explains why the central difference formula is generally more accurate than the forward and backward difference formulas for the same \( h \).

Round-Off Error

Reducing \( h \) does not always improve the numerical approximation.

Computers use finite-precision arithmetic, meaning that most real numbers can only be represented approximately. Each function evaluation can therefore contain a small amount of rounding error.

Step-by-Step Procedure for Numerical Differentiation

The finite difference formulas are straightforward once we understand what each one does. However, solving a numerical differentiation problem correctly involves more than simply substituting values into a formula.

A reliable solution requires identifying the point where the derivative is needed, determining what data is available, selecting an appropriate finite difference formula, choosing a suitable step size, performing the calculation carefully, and evaluating the result’s accuracy.

The following procedure provides a general framework for forward, backward, and central difference approximations.

Step 1: Identify the Function and Point of Differentiation

First, identify the function \( f(x) \) and the point \( x = a \) where the derivative is needed.

Step 2: Determine What Information Is Available

Next, examine the function values or data points surrounding \( x = a \).

Ask:

  • Is there a point to the right of \( a \)?
  • Is there a point to the left of \( a \)?
  • Are there points on both sides?
  • Are the points equally spaced?

The answers to these questions help determine which finite difference formula is appropriate.

For example, if we have

$$f(a), f(a + h)$$

but no information to the left of \( a \), a forward difference is a natural choice.

If we have

$$f(a – h), f(a)$$

but no information to the right, a backward difference is appropriate.

If we have

$$f(a – h), f(a), f(a + h),$$

a central difference can be used.

Step 3: Determine the Step Size

The next step is to determine \( h \), the distance between the points used in the finite difference formula.

The value of \( h \) is important because it affects both the accuracy of the approximation and the amount of numerical error.

Step 4: Substitute the Function Values

Substitute the appropriate function values and simplify the expression.

Step 5: Estimate or Calculate the Error

If the exact derivative is known, calculate the error.

In the worked examples that follow, we will apply this procedure to forward, backward, and central differences and see how the three methods compare in practice.

Worked Out Examples

The first example shows how to use the forward difference formula.

Example 1: Use the forward difference formula to approximate the derivative of \( f(x) = x^3 + 2x \) at \( x = 1 \) with a step size of \( h = 0.1 \). Find the absolute error.

Solution: \( x + h \) is given by

$$x + h = 1 + 0.1.$$

Adding we obtain

$$x + h = 1.1.$$

Consider the function

$$f(x) = x^3 + 2x.$$

Evaluating the function at \( x = 1 \) we obtain

$$f(1) = 1^3 + 2(1).$$

Cubing we find

$$f(1) = 1 + 2(1).$$

Multiplying we get

$$f(1) = 1 + 2.$$

Adding gives

$$f(1) = 3.$$

Evaluating the function at \( x + h = 1.1 \) we obtain

$$f(1.1) = 1.1^3 + 2(1.1).$$

Cubing we find

$$f(1.1) = 1.331 + 2(1.1).$$

Multiplying we get

$$f(1.1) = 1.331 + 2.2.$$

Adding gives

$$f(1.1) = 3.531.$$

Substituting into the forward difference formula gives

$$f'(1) = \frac{3.531 – 3}{0.1}.$$

Subtracting gives

$$f'(1) = \frac{0.531}{0.1}.$$

Dividing we get

$$f'(1) = 5.31.$$

The derivative is given by

$$f'(x) = (x^3 + 2x)’.$$

By the sum rule, this is

$$f'(x) = (x^3)’ + (2x)’.$$

Using the power rule gives

$$f'(x) = 3x^2 + 2.$$

Evaluating the derivative at \( x = 1 \) we obtain

$$f'(1) = 3(1)^2 + 2.$$

Squaring we find

$$f'(1) = 3(1) + 2.$$

Multiplying we get

$$f'(1) = 3 + 2.$$

Adding gives

$$f'(1) = 5.$$

The absolute error is then

$$\epsilon = |5 – 5.31|.$$

Subtracting gives

$$\epsilon = |-0.31|.$$

Taking the absolute value, we arrive at a final answer of

$$\epsilon = 0.31.$$

The next example shows how to use the backward difference formula.

Example 2: Use the backward difference formula to approximate the derivative of \( f(x) = x^3 + 2x \) at \( x = 1 \) with a step size of \( h = 0.1 \). Find the absolute error.

Solution: \( x – h \) is given by

$$x – h = 1 – 0.1.$$

Subtracting we obtain

$$x – h = 0.9.$$

Consider the function

$$f(x) = x^3 + 2x.$$

Evaluating the function at \( x = 1 \) we obtain

$$f(1) = 1^3 + 2(1).$$

Cubing we find

$$f(1) = 1 + 2(1).$$

Multiplying we get

$$f(1) = 1 + 2.$$

Adding gives

$$f(1) = 3.$$

Evaluating the function at \( x – h = 0.9 \) we obtain

$$f(0.9) = 0.9^3 + 2(0.9).$$

Cubing we find

$$f(0.9) = 0.729 + 2(0.9).$$

Multiplying we get

$$f(0.9) = 0.729 + 1.8.$$

Adding gives

$$f(0.9) = 2.529.$$

Substituting into the backward difference formula gives

$$f'(1) = \frac{3 – 2.529}{0.1}.$$

Subtracting gives

$$f'(1) = \frac{0.471}{0.1}.$$

Dividing we get

$$f'(1) = 4.71.$$

The derivative is given by

$$f'(x) = (x^3 + 2x)’.$$

By the sum rule, this is

$$f'(x) = (x^3)’ + (2x)’.$$

Using the power rule gives

$$f'(x) = 3x^2 + 2.$$

Evaluating the derivative at \( x = 1 \) we obtain

$$f'(1) = 3(1)^2 + 2.$$

Squaring we find

$$f'(1) = 3(1) + 2.$$

Multiplying we get

$$f'(1) = 3 + 2.$$

Adding gives

$$f'(1) = 5.$$

The absolute error is then

$$\epsilon = |5 – 4.71|.$$

Subtracting gives

$$\epsilon = |0.29|.$$

Taking the absolute value, we arrive at a final answer of

$$\epsilon = 0.29.$$

The final example shows how to use the central difference formula.

Example 3: Use the central difference formula to approximate the derivative of \( f(x) = x^3 + 2x \) at \( x = 1 \) with a step size of \( h = 0.1 \). Find the absolute error.

Solution: \( x – h \) is given by

$$x – h = 1 – 0.1.$$

Subtracting we obtain

$$x – h = 0.9.$$

\( x + h \) is given by

$$x + h = 1 + 0.1.$$

Adding we obtain

$$x + h = 1.1.$$

Consider the function

$$f(x) = x^3 + 2x.$$

Evaluating the function at \( x – h = 0.9 \) we obtain

$$f(0.9) = 0.9^3 + 2(0.9).$$

Cubing we find

$$f(0.9) = 0.729 + 2(0.9).$$

Multiplying we get

$$f(0.9) = 0.729 + 1.8.$$

Adding gives

$$f(0.9) = 2.529.$$

Evaluating the function at \( x + h = 1.1 \) we obtain

$$f(1.1) = 1.1^3 + 2(1.1).$$

Cubing we find

$$f(1.1) = 1.331 + 2(1.1).$$

Multiplying we get

$$f(1.1) = 1.331 + 2.2.$$

Adding gives

$$f(1.1) = 3.531.$$

Substituting into the central difference formula gives

$$f'(1) = \frac{3.531 – 2.529}{2(0.1)}.$$

Subtracting gives

$$f'(1) = \frac{1.002}{2(0.1)}.$$

Multiplying, this is

$$f'(1) = \frac{1.002}{0.2}.$$

Dividing we get

$$f'(1) = 5.01.$$

The derivative is given by

$$f'(x) = (x^3 + 2x)’.$$

By the sum rule, this is

$$f'(x) = (x^3)’ + (2x)’.$$

Using the power rule gives

$$f'(x) = 3x^2 + 2.$$

Evaluating the derivative at \( x = 1 \) we obtain

$$f'(1) = 3(1)^2 + 2.$$

Squaring we find

$$f'(1) = 3(1) + 2.$$

Multiplying we get

$$f'(1) = 3 + 2.$$

Adding gives

$$f'(1) = 5.$$

The absolute error is then

$$\epsilon = |5 – 5.01|.$$

Subtracting gives

$$\epsilon = |-0.01|.$$

Taking the absolute value, we arrive at a final answer of

$$\epsilon = 0.01.$$

These three examples demonstrate the fundamental differences between the three basic finite difference formulas.

The forward difference estimates the derivative using information to the right, the backward difference estimates the derivative using information to the left, and the central difference uses information on both sides:

For the same step size, the central difference is generally more accurate.

Conclusion

The Finite Difference Method for Numerical Differentiation provides a practical way to approximate derivatives when an exact derivative is difficult to calculate or when we are working with numerical data rather than an actual function.

In this guide, we explored the three fundamental finite difference formulas: the forward difference, backward difference, and central difference.

We also saw why these methods work and their associated truncation errors. The forward and backward difference formulas have first-order accuracy, whereas the central difference formula has second-order accuracy,

The worked examples demonstrated how to apply forward, backward, and central differences step by step. They also showed that the appropriate method depends on the situation. Forward and backward differences are particularly useful near the boundaries of a data set, while central differences are often preferable at interior points where information is available on both sides.

Further Reading

Basic Integration Problems for Beginners  – Now that you understand numerical differentiation, I recommend reviewing integration, as the techniques used for numerical differentiation are similar to those used for numerical integration.

Frequently Asked Questions

Yes. One of the major advantages of numerical differentiation is that the derivative can be approximated from tabulated function values without knowing an explicit formula for the function. The appropriate finite difference formula depends on the location of the point and which neighboring data points are available.