Numerical Differentiation: Forward, Backward, and Central Differences

When a function is only known at discrete points (from a table, an experiment, or a computer program), we cannot use differentiation rules directly. Instead we approximate the derivative using finite differences built from nearby function values.

Secant-line approximations to the tangent slope at x_0 using points at x_0-h, x_0, and x_0+h.

Secant-line approximations to the tangent slope at x0x_0 using points at x0−hx_0-h, x0x_0, and x0+hx_0+h.

Position of a Moving Object over Time

Position of a Moving Object over Time

The three basic formulas

  • Forward difference: f′(x0)≈f(x0+h)−f(x0)hf'(x_0) \approx \dfrac{f(x_0+h)-f(x_0)}{h}, error O(h)O(h)
  • Backward difference: f′(x0)≈f(x0)−f(x0−h)hf'(x_0) \approx \dfrac{f(x_0)-f(x_0-h)}{h}, error O(h)O(h)
  • Central difference: f′(x0)≈f(x0+h)−f(x0−h)2hf'(x_0) \approx \dfrac{f(x_0+h)-f(x_0-h)}{2h}, error O(h2)O(h^2)


For sufficiently smooth functions with equally spaced, sufficiently accurate values, the central difference is usually preferred when both neighbours are available and truncation error dominates noise and roundoff, because its truncation error is O(h2)O(h^2): in that regime halving hh roughly quarters the error, instead of only halving it.


The qualifications matter. Smoothness and equal spacing are what make the O(h2)O(h^2) term the right description; with noisy readings, or with hh driven very small in floating-point arithmetic, subtractive cancellation can swamp that term so that a larger hh does better.


And at one particular hh a one-sided formula can simply happen to be closer: for f(x)=x3f(x)=x^3 sampled at x0=−h/3x_0=-h/3, the forward difference is exact while the central difference is off by h2h^2.

Worked example

Let f(x)=x3f(x)=x^3, x0=2x_0=2, h=0.1h=0.1. Then f(2.1)=9.261f(2.1)=9.261, f(1.9)=6.859f(1.9)=6.859, and f(2)=8f(2)=8.


Central difference: 9.261−6.8590.2=12.01\dfrac{9.261-6.859}{0.2}=12.01, very close to the exact value f′(2)=12f'(2)=12. A forward difference gives 9.261−80.1=12.61\dfrac{9.261-8}{0.1}=12.61, noticeably less accurate for the same hh.



Which expression correctly gives the forward difference approximation of f′(x0)f'(x_0) using step size hh?

Choose an answer

Create a free account to get started

Unlock full course notes by signing up

  • Video lessons taught by top educators
  • Practice questions with guided solutions
  • Written review notes for reference
  • Expert answers anytime from course tutors

Using the data in the graph, estimate the velocity at t=1.0 st=1.0\text{ s} with the forward difference formula and h=0.5 sh=0.5\text{ s}, given s(1.0)=2.5 ms(1.0)=2.5\text{ m} and s(1.5)=4.1 ms(1.5)=4.1\text{ m}. Give your answer in m/s.

Secant-line approximations to the tangent slope at x_0 using points at x_0-h, x_0, and x_0+h.

Secant-line approximations to the tangent slope at x0x_0 using points at x0−hx_0-h, x0x_0, and x0+hx_0+h.

Position of a Moving Object over Time

Position of a Moving Object over Time

Create a free account to get started

Unlock full course notes by signing up

  • Video lessons taught by top educators
  • Practice questions with guided solutions
  • Written review notes for reference
  • Expert answers anytime from course tutors

Using the data shown in the graph, estimate the instantaneous velocity at t=1.5 st=1.5\text{ s} with the central difference formula and h=0.5 sh=0.5\text{ s}, using s(1.0)=2.5 ms(1.0)=2.5\text{ m} and s(2.0)=6.0 ms(2.0)=6.0\text{ m}.

Secant-line approximations to the tangent slope at x_0 using points at x_0-h, x_0, and x_0+h.

Secant-line approximations to the tangent slope at x0x_0 using points at x0−hx_0-h, x0x_0, and x0+hx_0+h.

Position of a Moving Object over Time

Position of a Moving Object over Time

Choose an answer

Create a free account to get started

Unlock full course notes by signing up

  • Video lessons taught by top educators
  • Practice questions with guided solutions
  • Written review notes for reference
  • Expert answers anytime from course tutors