Last modified: December 22, 2024

This article is written in: 🇺🇸

Central Difference Method

Untitled

Mathematical Formulation and Derivation

The central difference approximation of the first derivative of a function $f$ at a point $x$ with step size $h$ is given by:

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

This formula is derived from the average of the forward and backward difference formulas:

The forward difference approximation:

$$f'(x_0)\approx \frac{f(x_0+h)-f(x_0)}{h}, \quad h>0$$

The backward difference approximation:

$$f'(x_0)\approx \frac{f(x_0) - f(x_0 - h)}{h}, \quad h>0$$

The Taylor series expansion is a representation of a function as an infinite sum of terms calculated from the function's derivatives at a single point. We use this expansion to improve our approximation of derivatives:

Expanding $f(x_0+h)$ and $f(x_0-h)$ in a Taylor series around $x_0$:

$$f(x_0+h) = f(x_0)+hf'(x_0)+\frac{h^2}{2}f''(x_0) + \mathcal{O}(h^3)$$

$$f(x_0-h) = f(x_0)-hf'(x_0)+\frac{h^2}{2}f''(x_0) + \mathcal{O}(h^3)$$

Subtracting the second equation from the first and rearranging for $f'(x_0)$:

$$f'(x_0)=\frac{f(x_0+h)-f(x_0-h)}{2h} + \mathcal{O}(h^2)$$

This formula represents the slope of the secant line passing through the points $(x - h, f(x - h))$ and $(x + h, f(x + h))$.

Error in Central Difference Method

The error in the central difference method is of the order $O(h^2)$, which implies that the error goes to zero at a quadratic rate as $h$ approaches zero. This makes the method more accurate than forward or backward difference methods.

Example

Suppose we have a function $f(x) = x^2$, and we want to approximate the derivative at the point $x = 2$ with a step size $h = 0.01$. Using the central difference method, we get:

$$f'(2) \approx \frac{f(2 + 0.01) - f(2 - 0.01)}{2*0.01} = \frac{4.0401 - 3.9601}{0.02} = 4.00$$

The exact derivative of $f(x) = x^2$ at the point $x = 2$ is $f'(2) = 2*2 = 4$, so the approximation is accurate.

Advantages

Limitations

Table of Contents

    Central Difference Method
    1. Mathematical Formulation and Derivation
    2. Error in Central Difference Method
    3. Example
    4. Advantages
    5. Limitations