Here we compile the standard finite difference schemes of various orders on uniform grids.
Consider the derivative d u / d x du/dx d u / d x of a function u ( x ) u(x) u ( x ) , where x x x can be any independent variable (e.g., time, space, etc.). Finite-difference approximations are used to represent the continuous function u ( x ) u(x) u ( x ) by a set of discrete points u n u^n u n at evenly spaced intervals, where n n n is the index of the point in the grid. The spacing between these points is denoted as Δ x \Delta x Δ x .
Figure 1: Example of a one-dimensional grid with uniform spacing Δ x \Delta x Δ x .
The notation O ( ⋅ ) \mathcal{O}(\cdot) O ( ⋅ ) , known as Big O \mathcal{O} O notation, describes the truncation error of the approximation. It provides insight into how quickly the error shrinks as you decrease the step size, Δ x \Delta x Δ x .
Feature First-Order Error (O ( Δ x ) \mathcal{O}(\Delta x) O ( Δ x ) ) Second-Order Error (O ( Δ x 2 ) \mathcal{O}(\Delta x^2) O ( Δ x 2 ) ) Proportionality Error is proportional to the step size, Δ x \Delta x Δ x . Error is proportional to the square of the step size, Δ x 2 \Delta x^2 Δ x 2 . Convergence Rate Linear Quadratic Effect of Halving Δ x \Delta x Δ x Error is reduced by a factor of 2 (halved). Error is reduced by a factor of 4 (quartered ). Accuracy Lower Higher
Forward Difference ¶ First Derivative ( ∂ u ∂ x ) (\frac{\partial u}{\partial x}) ( ∂ x ∂ u ) ¶ O ( Δ x ) \mathcal{O}(\Delta x) O ( Δ x ) O ( Δ x 2 ) \mathcal{O}(\Delta x^2) O ( Δ x 2 ) u n + 1 − u n Δ x \frac{u^{n+1} - u^n}{\Delta x} Δ x u n + 1 − u n − u n + 2 + 4 u n + 1 − 3 u n 2 Δ x \frac{-u^{n+2} + 4u^{n+1} - 3u^n}{2\Delta x} 2Δ x − u n + 2 + 4 u n + 1 − 3 u n
Second Derivative ( ∂ 2 u ∂ x 2 ) (\frac{\partial^2 u}{\partial x^2}) ( ∂ x 2 ∂ 2 u ) ¶ O ( Δ x ) \mathcal{O}(\Delta x) O ( Δ x ) O ( Δ x 2 ) \mathcal{O}(\Delta x^2) O ( Δ x 2 ) u n + 2 − 2 u n + 1 + u n Δ x 2 \frac{u^{n+2} - 2u^{n+1} + u^n}{\Delta x^2} Δ x 2 u n + 2 − 2 u n + 1 + u n − u n + 3 + 4 u n + 2 − 5 u n + 1 + 2 u n Δ x 2 \frac{-u^{n+3} + 4u^{n+2} - 5u^{n+1} + 2u^n}{\Delta x^2} Δ x 2 − u n + 3 + 4 u n + 2 − 5 u n + 1 + 2 u n
Third Derivative ( ∂ 3 u ∂ x 3 ) (\frac{\partial^3 u}{\partial x^3}) ( ∂ x 3 ∂ 3 u ) ¶ O ( Δ x ) \mathcal{O}(\Delta x) O ( Δ x ) O ( Δ x 2 ) \mathcal{O}(\Delta x^2) O ( Δ x 2 ) u n + 3 − 3 u n + 2 + 3 u n + 1 − u n Δ x 3 \frac{u^{n+3} - 3u^{n+2} + 3u^{n+1} - u^n}{\Delta x^3} Δ x 3 u n + 3 − 3 u n + 2 + 3 u n + 1 − u n − 3 u n + 4 + 14 u n + 3 − 24 u n + 2 + 18 u n + 1 − 5 u n 2 Δ x 3 \frac{-3u^{n+4} + 14u^{n+3} - 24u^{n+2} + 18u^{n+1} - 5u^n}{2\Delta x^3} 2Δ x 3 − 3 u n + 4 + 14 u n + 3 − 24 u n + 2 + 18 u n + 1 − 5 u n
Fourth Derivative ( ∂ 4 u ∂ x 4 ) (\frac{\partial^4 u}{\partial x^4}) ( ∂ x 4 ∂ 4 u ) ¶ O ( Δ x ) \mathcal{O}(\Delta x) O ( Δ x ) O ( Δ x 2 ) \mathcal{O}(\Delta x^2) O ( Δ x 2 ) u n + 4 − 4 u n + 3 + 6 u n + 2 − 4 u n + 1 + u n Δ x 4 \frac{u^{n+4} - 4u^{n+3} + 6u^{n+2} - 4u^{n+1} + u^n}{\Delta x^4} Δ x 4 u n + 4 − 4 u n + 3 + 6 u n + 2 − 4 u n + 1 + u n − 2 u n + 5 + 11 u n + 4 − 24 u n + 3 + 26 u n + 2 − 14 u n + 1 + 3 u n Δ x 4 \frac{-2u^{n+5} + 11u^{n+4} - 24u^{n+3} + 26u^{n+2} - 14u^{n+1} + 3u^n}{\Delta x^4} Δ x 4 − 2 u n + 5 + 11 u n + 4 − 24 u n + 3 + 26 u n + 2 − 14 u n + 1 + 3 u n
Backward Difference ¶ First Derivative ( ∂ u ∂ x ) (\frac{\partial u}{\partial x}) ( ∂ x ∂ u ) ¶ O ( Δ x ) \mathcal{O}(\Delta x) O ( Δ x ) O ( Δ x 2 ) \mathcal{O}(\Delta x^2) O ( Δ x 2 ) u n − u n − 1 Δ x \frac{u^n - u^{n-1}}{\Delta x} Δ x u n − u n − 1 3 u n − 4 u n − 1 + u n − 2 2 Δ x \frac{3u^n - 4u^{n-1} + u^{n-2}}{2\Delta x} 2Δ x 3 u n − 4 u n − 1 + u n − 2
Second Derivative ( ∂ 2 u ∂ x 2 ) (\frac{\partial^2 u}{\partial x^2}) ( ∂ x 2 ∂ 2 u ) ¶ O ( Δ x ) \mathcal{O}(\Delta x) O ( Δ x ) O ( Δ x 2 ) \mathcal{O}(\Delta x^2) O ( Δ x 2 ) u n − 2 u n − 1 + u n − 2 Δ x 2 \frac{u^n - 2u^{n-1} + u^{n-2}}{\Delta x^2} Δ x 2 u n − 2 u n − 1 + u n − 2 2 u n − 5 u n − 1 + 4 u n − 2 − u n − 3 Δ x 2 \frac{2u^n - 5u^{n-1} + 4u^{n-2} - u^{n-3}}{\Delta x^2} Δ x 2 2 u n − 5 u n − 1 + 4 u n − 2 − u n − 3
Third Derivative ( ∂ 3 u ∂ x 3 ) (\frac{\partial^3 u}{\partial x^3}) ( ∂ x 3 ∂ 3 u ) ¶ O ( Δ x ) \mathcal{O}(\Delta x) O ( Δ x ) O ( Δ x 2 ) \mathcal{O}(\Delta x^2) O ( Δ x 2 ) u n − 3 u n − 1 + 3 u n − 2 − u n − 3 Δ x 3 \frac{u^n - 3u^{n-1} + 3u^{n-2} - u^{n-3}}{\Delta x^3} Δ x 3 u n − 3 u n − 1 + 3 u n − 2 − u n − 3 5 u n − 18 u n − 1 + 24 u n − 2 − 14 u n − 3 + 3 u n − 4 2 Δ x 3 \frac{5u^n - 18u^{n-1} + 24u^{n-2} - 14u^{n-3} + 3u^{n-4}}{2\Delta x^3} 2Δ x 3 5 u n − 18 u n − 1 + 24 u n − 2 − 14 u n − 3 + 3 u n − 4
Fourth Derivative ( ∂ 4 u ∂ x 4 ) (\frac{\partial^4 u}{\partial x^4}) ( ∂ x 4 ∂ 4 u ) ¶ O ( Δ x ) \mathcal{O}(\Delta x) O ( Δ x ) O ( Δ x 2 ) \mathcal{O}(\Delta x^2) O ( Δ x 2 ) u n − 4 u n − 1 + 6 u n − 2 − 4 u n − 3 + u n − 4 Δ x 4 \frac{u^n - 4u^{n-1} + 6u^{n-2} - 4u^{n-3} + u^{n-4}}{\Delta x^4} Δ x 4 u n − 4 u n − 1 + 6 u n − 2 − 4 u n − 3 + u n − 4 3 u n − 14 u n − 1 + 26 u n − 2 − 24 u n − 3 + 11 u n − 4 − 2 u n − 5 Δ x 4 \frac{3u^n - 14u^{n-1} + 26u^{n-2} - 24u^{n-3} + 11u^{n-4} - 2u^{n-5}}{\Delta x^4} Δ x 4 3 u n − 14 u n − 1 + 26 u n − 2 − 24 u n − 3 + 11 u n − 4 − 2 u n − 5
Central Difference ¶ First Derivative ( ∂ u ∂ x ) (\frac{\partial u}{\partial x}) ( ∂ x ∂ u ) ¶ O ( Δ x 2 ) \mathcal{O}(\Delta x^2) O ( Δ x 2 ) O ( Δ x 4 ) \mathcal{O}(\Delta x^4) O ( Δ x 4 ) u n + 1 − u n − 1 2 Δ x \frac{u^{n+1} - u^{n-1}}{2\Delta x} 2Δ x u n + 1 − u n − 1 − u n + 2 + 8 u n + 1 − 8 u n − 1 + u n − 2 12 Δ x \frac{-u^{n+2} + 8u^{n+1} - 8u^{n-1} + u^{n-2}}{12\Delta x} 12Δ x − u n + 2 + 8 u n + 1 − 8 u n − 1 + u n − 2
Second Derivative ( ∂ 2 u ∂ x 2 ) (\frac{\partial^2 u}{\partial x^2}) ( ∂ x 2 ∂ 2 u ) ¶ O ( Δ x 2 ) \mathcal{O}(\Delta x^2) O ( Δ x 2 ) O ( Δ x 4 ) \mathcal{O}(\Delta x^4) O ( Δ x 4 ) u n + 1 − 2 u n + u n − 1 Δ x 2 \frac{u^{n+1} - 2u^n + u^{n-1}}{\Delta x^2} Δ x 2 u n + 1 − 2 u n + u n − 1 − u n + 2 + 16 u n + 1 − 30 u n + 16 u n − 1 − u n − 2 12 Δ x 2 \frac{-u^{n+2} + 16u^{n+1} - 30u^n + 16u^{n-1} - u^{n-2}}{12\Delta x^2} 12Δ x 2 − u n + 2 + 16 u n + 1 − 30 u n + 16 u n − 1 − u n − 2
Third Derivative ( ∂ 3 u ∂ x 3 ) (\frac{\partial^3 u}{\partial x^3}) ( ∂ x 3 ∂ 3 u ) ¶ O ( Δ x 2 ) \mathcal{O}(\Delta x^2) O ( Δ x 2 ) O ( Δ x 4 ) \mathcal{O}(\Delta x^4) O ( Δ x 4 ) u n + 2 + 2 u n + 1 − 2 u n − 1 − u n − 2 2 Δ x 3 \frac{u^{n+2} + 2u^{n+1} - 2u^{n-1} - u^{n-2}}{2\Delta x^3} 2Δ x 3 u n + 2 + 2 u n + 1 − 2 u n − 1 − u n − 2 − u n + 3 + 8 u n + 2 − 13 u n + 1 + 13 u n − 1 − 8 u n − 2 + u n − 3 8 Δ x 3 \frac{-u^{n+3} + 8u^{n+2} - 13u^{n+1} + 13u^{n-1} - 8u^{n-2} + u^{n-3}}{8\Delta x^3} 8Δ x 3 − u n + 3 + 8 u n + 2 − 13 u n + 1 + 13 u n − 1 − 8 u n − 2 + u n − 3
Fourth Derivative ( ∂ 4 u ∂ x 4 ) (\frac{\partial^4 u}{\partial x^4}) ( ∂ x 4 ∂ 4 u ) ¶ O ( Δ x 2 ) \mathcal{O}(\Delta x^2) O ( Δ x 2 ) O ( Δ x 4 ) \mathcal{O}(\Delta x^4) O ( Δ x 4 ) u n + 2 − 4 u n + 1 + 6 u n − 4 u n − 1 + u n − 2 Δ x 4 \frac{u^{n+2} - 4u^{n+1} + 6u^n - 4u^{n-1} + u^{n-2}}{\Delta x^4} Δ x 4 u n + 2 − 4 u n + 1 + 6 u n − 4 u n − 1 + u n − 2 − u n + 3 + 12 u n + 2 − 39 u n + 1 + 56 u n − 39 u n − 1 + 12 u n − 2 − u n − 3 6 Δ x 4 \frac{-u^{n+3} + 12u^{n+2} - 39u^{n+1} + 56u^n - 39u^{n-1} + 12u^{n-2} - u^{n-3}}{6\Delta x^4} 6Δ x 4 − u n + 3 + 12 u n + 2 − 39 u n + 1 + 56 u n − 39 u n − 1 + 12 u n − 2 − u n − 3