Last modified: December 22, 2024
This article is written in: 🇺🇸
Central Difference Method
- The central difference method is a finite difference method used for approximating derivatives. It utilizes the forward difference, backward difference, and the principles of Taylor series expansion to derive a more accurate approximation of derivatives.
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
- The central difference method is more accurate than the forward or backward difference methods, because it takes into account information from both sides of the point.
- It is easy to implement and understand.
- It can be used when the function is difficult to evaluate or when only discrete data is available.
Limitations
- The central difference method is still an approximation and introduces some amount of error. This error decreases as the step size $h$ gets smaller, but making $h$ too small can lead to numerical instability due to the limitations of floating-point arithmetic.
- The method requires the function values at the points $x - h$ and $x + h$, so it cannot be used directly at the endpoints of a domain unless the function is defined and continuous at points outside the domain.