Skip to main content

First and second order finite difference schemes

Short answer

First-order schemes (forward/backward differences) have truncation error O(Δx) causing numerical diffusion; the chord slope is offset from the tangent. Second-order schemes (central difference) have error O(Δx^2) causing numerical dispersion; the central chord nearly matches the tangent, giving higher accuracy.

With appropriate expressions and graphs, explain first and second order accurate schemes of finite differences of partial differential equations.

A finite difference scheme is of order pp if its truncation error (the terms dropped from the Taylor series) is proportional to Δxp\Delta x^p (or Δtp\Delta t^p). Higher order means the error falls faster when the grid is refined.

First-order accurate schemes

From Taylor's series,

fi+1−fiΔx=fi′+Δx2fi′′+… ⇒ fi′=fi+1−fiΔx+O(Δx)\frac{f_{i+1}-f_i}{\Delta x}=f'_i+\frac{\Delta x}{2}f''_i+\dots\ \Rightarrow\ f'_i=\frac{f_{i+1}-f_i}{\Delta x}+O(\Delta x)

The forward difference (fi+1−fi)/Δx(f_{i+1}-f_i)/\Delta x and the backward difference (fi−fi−1)/Δx(f_i-f_{i-1})/\Delta x are first-order accurate. Applied to ∂Q/∂t+c ∂Q/∂x=0\partial Q/\partial t+c\,\partial Q/\partial x=0 with forward time and backward space:

Qin+1−QinΔt+cQin−Qi−1nΔx=0,error O(Δt,Δx)\frac{Q_i^{n+1}-Q_i^n}{\Delta t}+c\frac{Q_i^n-Q_{i-1}^n}{\Delta x}=0,\qquad \text{error } O(\Delta t,\Delta x)

Second-order accurate schemes

Subtract the two Taylor series for fi+1f_{i+1} and fi−1f_{i-1}; the f′′f'' terms cancel:

fi+1−fi−12Δx=fi′+Δx26fi(3)+… ⇒ fi′=fi+1−fi−12Δx+O(Δx2)\frac{f_{i+1}-f_{i-1}}{2\Delta x}=f'_i+\frac{\Delta x^2}{6}f_i^{(3)}+\dots\ \Rightarrow\ f'_i=\frac{f_{i+1}-f_{i-1}}{2\Delta x}+O(\Delta x^2)

This central difference is second-order accurate. Likewise fi′′=fi+1−2fi+fi−1Δx2+O(Δx2)f''_i=\dfrac{f_{i+1}-2f_i+f_{i-1}}{\Delta x^2}+O(\Delta x^2). A second-order scheme in both variables is the four-point (box) scheme centred at (i+12, n+12)(i+\tfrac12,\ n+\tfrac12):

Qin+1+Qi+1n+1−Qin−Qi+1n2Δt+c Qi+1n+1+Qi+1n−Qin+1−Qin2Δx=0\frac{Q_i^{n+1}+Q_{i+1}^{n+1}-Q_i^n-Q_{i+1}^n}{2\Delta t}+c\,\frac{Q_{i+1}^{n+1}+Q_{i+1}^n-Q_i^{n+1}-Q_i^n}{2\Delta x}=0

Graphical meaning

 f
 |                     . f(i+1)
 |                 . '
 |            f(i)
 |         .'
 |   f(i-1)
 +----|---------|---------|----> x
     i-1        i        i+1

 forward : chord i  -> i+1
 backward: chord i-1-> i
 central : chord i-1-> i+1 (closest to tangent at i)

The slope of the chord approximates the slope of the tangent at ii. The forward and backward chords are tilted either side of the tangent (error proportional to Δx\Delta x); the central chord is almost parallel to it (error proportional to Δx2\Delta x^2).

Grid view of the two PDE schemes

 t
 n+1 :   o--------o            o   o
         |        |              \ |
 n   :   o        x         x-----x-----x   
        (i-1)    (i)       (i-1)  (i)  (i+1)
   first order (forward t,      second order (central
   backward x): 2 known pts     in x): 3 known points

Comparison

First orderSecond order
Truncation errorO(Δx)O(\Delta x)O(Δx2)O(\Delta x^2)
Effect of halving Δx\Delta xerror halveserror falls to one quarter
Main numerical errornumerical diffusion (smearing)numerical dispersion (oscillations)
Cost per stepsmallslightly larger

✓ Answer checked by Claude Opus 5.5 (high effort)

All Computational Techniques in Civil Engineering chapter 5 questions →