Finite Difference Approximations to Derivatives
Rajen Kumar Sinha
Department of Mathematics
IIT Guwahati
Rajen Kumar Sinha MA573
Consider the two-dimensional second-order linear PDE:
∂2U ∂2U ∂2U ∂U ∂U
a 2
+ b + c 2
+d +e + fU + g = 0, (1)
∂x ∂x∂y ∂y ∂x ∂y
where a, b, c, d, e, f , and g may be functions of the independent variables
x and y . U = U(x, y ) is the dependent variable.
Classifications: The PDE (1) is said to be
• Elliptic when b 2 − 4ac < 0.
• Parabolic when b 2 − 4ac = 0.
• Hyperbolic when b 2 − 4ac > 0.
Elliptic equations: These problems are generally associated with
equilibrium or steady-state problems. For example,
∂2U ∂2U
• + = 0 (Laplace’s equation)
∂x 2 ∂y 2
The velocity potential V for the steady flow of incompressible
non-viscous fluid satisfies Laplace’s equation.
Rajen Kumar Sinha MA573
∂2U ∂2U
• + = f (x, y ) (Poisson’s equation)
∂x 2 ∂y 2
The electric potential V associated with a two-dimensional electron
distribution of charge density ρ satisfies Poisson’s equation with
f = −ρ/, where is a dielectric constant.
Parabolic equations: The heat equation
∂U ∂2U
=κ 2
∂t ∂x
is the simplest example of parabolic equation, where U represents the
temperature in a rod at a distance x unit of length after t seconds of
heat conduction.
Hyperbolic equations: These equations generally originate from vibration
problems, or from problems where the discontinuities can persist in time.
The simplest hyperbolic equation is one-dimensional wave equation:
∂2U 2
2∂ U
= c .
∂t 2 ∂x 2
Rajen Kumar Sinha MA573
Finte Difference Approximations to Derivatives
Functions of one-variable: Let U : [a, b] → R be sufficinetly
differentiable function. Let
a = x0 < x1 < x2 < · · · < xn = b
be a partition of [a, b] such that xn = x0 + nh, where h = (xn − x0 )/n is
the discretization parameter. Set xi = x0 + ih, i = 0, 1, . . . , n and
Ui = U(xi ).
By Taylor’s theorem
h2 00 h3 000
U(x + h) = u(x) + hU 0 (x) + U (x) + U (x) + · · · . (2)
2 6
h2 h3 000
U(x − h) = u(x) − hU 0 (x) + U 00 (x) − U (x) + · · · . (3)
2 6
Rajen Kumar Sinha MA573
dU U(xi + h) − U(xi )
= + O(h) (From (2))
dx x=xi h
Ui+1 − Ui
≈ , (Forward difference formula)
h
U(xi ) − U(xi − h)
= + O(h) (From (3))
h
Ui − Ui−1
≈ (Backward difference formula)
h
U(xi + h) − U(xi − h)
= + O(h2 ) (From (2)-(3))
2h
Ui+1 − Ui−1
≈ (Central difference formula)
2h
d 2U U(xi + h) − 2U(xi ) + U(xi − h)
= + O(h2 )
dx 2 x=xi h2
Ui+1 − 2Ui + Ui−1
≈ .
h2
Rajen Kumar Sinha MA573
Functions of two-variables: Let U : [0, a] × [0, b] → R be a differentiable
function of x and t. Introduce the mesh parameters h and k in the
directions of x and t, respectively. Denote
xi = ih, i = 0, 1, 2, . . . , N with x0 = 0, xN = a.
tj = jk, j = 0, 1, 2, . . . , J with t0 = 0, tJ = b.
Notation: Set
Ui,j = U(xi , tj ) = U(ih, jk), Ui+1,j = U(xi + h, tj ) = U((i + 1)h, jk),
Ui−1,j = U(xi − h, tj ) = U((i − 1)h, jk),
Ui,j+1 = U(xi , tj + k) = U(ih, (j + 1)k),
Ui,j−1 = U(xi , tj − k) = U(ih, (j − 1)k).
Rajen Kumar Sinha MA573
(Discretization of the domain)
Rajen Kumar Sinha MA573
∂U Ui+1,j − Ui,j
= + O(h)
∂x (xi ,tj ) h
Ui,j − Ui−1,j
= + O(h)
h
Ui+1,j − Ui−1,j
= + O(h2 )
2h
∂U Ui,j+1 − Ui,j
= + O(k)
∂t (xi ,tj ) k
Ui,j − Ui,j−1
= + O(k)
k
Ui,j+1 − Ui,j−1
= + O(k 2 )
2k
∂2U Ui+1,j − 2Ui,j + Ui−1,j
= + O(h2 )
∂x 2 (xi ,tj ) h2
∂2U Ui,j+1 − 2Ui,j + Ui,j−1
= + O(k 2 )
∂t 2 (xi ,tj ) k2
*** Ends ***
Rajen Kumar Sinha MA573