Elio Saade
Note

Central Difference

Topics: Numerical Methods

Definition

Central Difference is a second-order, finite difference method to numerically approximate the derivative of a function or a dataset. It estimates the derivative using the previous point and the next point as
dfdt≈f(t+Δt)−f(t−Δt)2Δt\frac{df}{dt} \approx \frac{f(t+\Delta t) - f(t-\Delta t)}{2\Delta t}

Derivation

Starting from the Taylor series expansion of f(t+Δt)f(t+\Delta t) and f(t−Δt)f(t-\Delta t):
f(t+Δt)=f(t)+Δt  df(t)dt+Δt22!  d2f(t)dt2+Δt33!  d3f(t)dt3+O(Δt4)f(t+\Delta t) = f(t) + \Delta t \; \frac{df(t)}{dt} + \frac{\Delta t ^2}{2!} \; \frac{d^2f(t)}{dt^2} + \frac{\Delta t ^3}{3!} \; \frac{d^3 f(t)}{dt^3} + \mathcal{O}(\Delta t ^4)
f(t−Δt)=f(t)−Δt  df(t)dt+Δt22!  d2f(t)dt2−Δt33!  d3f(t)dt3+O(Δt4)f(t-\Delta t) = f(t) - \Delta t \; \frac{df(t)}{dt} + \frac{\Delta t ^2}{2!} \; \frac{d^2f(t)}{dt^2} - \frac{\Delta t ^3}{3!} \; \frac{d^3 f(t)}{dt^3} + \mathcal{O}(\Delta t ^4)
Subtracting f(t−Δt)f(t-\Delta t) from f(t+Δt)f(t+\Delta t) and dividing by 2Δt2 \Delta t gives:
f(t+Δt)−f(t−Δt)2Δt=dfdt+Δt23!  d3f(t)dt3+O(Δt3)\frac{f(t+\Delta t) - f(t-\Delta t)}{2\Delta t} = \frac{df}{dt} + \frac{\Delta t ^2}{3!} \; \frac{d^3 f(t)}{dt^3} + \mathcal{O}(\Delta t ^3)
The terms after df(t)dt\frac{df(t)}{dt} form the error of the Central Difference method. This error is O(Δt2)\mathcal{O}(\Delta t^2), i.e., it is proportional to Δt2\Delta t^2. This is why it is a second-order method.

References

  1. https://www.youtube.com/watch?v=9fGaTU1-f-0&pp=ygUgc3RldmUgYnJ1bnRvbiBmb3J3YXJkIGRpZmZlcmVuY2U%3D

Connections

Direct relationships to this note.