Mathwords logoMathwords

Finite Difference — Definition, Formula & Examples

A finite difference is the difference between function values at two nearby points, used to approximate a derivative without calculus. It replaces the infinitesimal dxdx in a derivative with a small but measurable step size hh.

Given a function ff and a step size h>0h > 0, the forward finite difference operator is defined as Δf(x)=f(x+h)f(x)\Delta f(x) = f(x+h) - f(x). The backward difference is f(x)=f(x)f(xh)\nabla f(x) = f(x) - f(x-h), and the central difference is δf(x)=f(x+h/2)f(xh/2)\delta f(x) = f(x + h/2) - f(x - h/2). As h0h \to 0, the ratio Δf(x)/h\Delta f(x)/h converges to f(x)f'(x) for differentiable functions.

Key Formula

Δf(x)=f(x+h)f(x)\Delta f(x) = f(x + h) - f(x)
Where:
  • f(x)f(x) = Value of the function at point x
  • hh = Step size (a small positive number)
  • Δf(x)\Delta f(x) = Forward finite difference of f at x

How It Works

You pick a small step size hh and evaluate your function at discrete points separated by hh. To approximate the first derivative at xx, compute f(x+h)f(x)h\frac{f(x+h) - f(x)}{h} (forward difference) or f(x+h)f(xh)2h\frac{f(x+h) - f(x-h)}{2h} (central difference). The central difference is generally more accurate because its error is O(h2)O(h^2) compared to O(h)O(h) for forward and backward differences. Higher-order derivatives can be approximated by applying the difference operator repeatedly; for instance, the second derivative approximation is f(x+h)2f(x)+f(xh)h2\frac{f(x+h) - 2f(x) + f(x-h)}{h^2}.

Worked Example

Problem: Approximate the derivative of f(x) = x³ at x = 2 using a forward finite difference with h = 0.1.
Step 1: Evaluate f at x and x + h.
f(2)=8,f(2.1)=9.261f(2) = 8, \quad f(2.1) = 9.261
Step 2: Compute the forward difference quotient.
f(2.1)f(2)0.1=9.26180.1=12.61\frac{f(2.1) - f(2)}{0.1} = \frac{9.261 - 8}{0.1} = 12.61
Step 3: Compare with the exact derivative f'(x) = 3x², so f'(2) = 12.
Error=12.6112=0.61\text{Error} = |12.61 - 12| = 0.61
Answer: The forward finite difference approximation gives f'(2) ≈ 12.61, compared to the exact value of 12. The small error of 0.61 shrinks as h decreases.

Why It Matters

Finite differences are the backbone of numerical methods for solving differential equations, appearing in techniques like the finite difference method for PDEs. Engineers use them in computational fluid dynamics and structural analysis when exact solutions are unavailable. They also underpin numerical differentiation routines in scientific computing libraries.

Common Mistakes

Mistake: Choosing h too small, expecting better accuracy.
Correction: Very small h causes round-off error to dominate because you subtract nearly equal floating-point numbers. There is an optimal h that balances truncation error and round-off error, typically around h ≈ √ε for forward differences, where ε is machine epsilon.