APMA 0160 (A. Yew) Spring 2011
Numerical differentiation: finite differences
The derivative of a function f at the point x is defined as the limit of a difference quotient:
f(x + h) − f(x) f 0(x) = lim h→0 h f(x + h) − f(x) In other words, the difference quotient is an approximation of the derivative f 0(x), and h this approximation gets better as h gets smaller. How does the error of the approximation depend on h? Taylor’s theorem with remainder gives the Taylor series expansion
f 00(ξ) f(x + h) = f(x) + hf 0(x) + h2 where ξ is some number between x and x + h. 2! Rearranging gives f(x + h) − f(x) f 00(ξ) − f 0(x) = h , h 2 f(x + h) − f(x) which tells us that the error is proportional to h to the power 1, so is said to be a h “first-order” approximation. If h > 0, say h = ∆x where ∆x is a finite (as opposed to infinitesimal) positive number, then
f(x + ∆x) − f(x) ∆x is called the first-order or O(∆x) forward difference approximation of f 0(x). If h < 0, say h = −∆x where ∆x > 0, then
f(x + h) − f(x) f(x) − f(x − ∆x) = h ∆x is called the first-order or O(∆x) backward difference approximation of f 0(x). By combining different Taylor series expansions, we can obtain approximations of f 0(x) of various orders. For instance, subtracting the two expansions
f 00(x) f 000(ξ ) f(x + ∆x) = f(x) + ∆x f 0(x) + ∆x2 + ∆x3 1 , ξ ∈ (x, x + ∆x) 2! 3! 1 f 00(x) f 000(ξ ) f(x − ∆x) = f(x) − ∆x f 0(x) + ∆x2 − ∆x3 2 , ξ ∈ (x − ∆x, x) 2! 3! 2