Seeing Finite Difference Approximations of the Derivatives

Consider function f that has first and second derivatives at each point.

There are two finite difference approximations to its derivatives at a particular point x:

[1] \frac{d}{dx}f(x) \approx \frac{ f(x+\frac{h}{2})-f(x-\frac{h}{2})}{h}

Fig. 1

Intuitively (see Fig. 1),

\frac{d}{dx} f(x) \approx \frac{ f(x+\frac{h}{2})-f(x-\frac{h}{2})}{h}\quad\quad\quad(1)

[2] \frac{d^2}{dx}f(x) \approx \frac{f(x+h)-2f(x)+f(x-h)}{h^2}

Let

g(x) = \frac{d}{dx}f(x) \overset{(1)}{\approx} \frac{f(x+\frac{h}{2})-f(x-\frac{h}{2})}{h}\quad\quad\quad(2)

so that

\frac{d^2}{dx}f(x) = \frac{d}{dx}(\frac{d}{dx}f(x))=\frac{d}{dx}(g(x)) \overset{(1)}{\approx} \frac{g(x+\frac{h}{2})-g(x-\frac{h}{2})}{h}.\quad\quad\quad(3)

Substituting

g(x+\frac{h}{2}) \overset{(2)}{=} \frac{f((x+\frac{h}{2})+\frac{h}{2})-f((x+\frac{h}{2})-\frac{h}{2})}{h}=\frac{f(x+h)-f(x)}{h}

and

g(x-\frac{h}{2}) \overset{(2)}{=} \frac{f((x-\frac{h}{2})+\frac{h}{2})-f((x-\frac{h}{2})-\frac{h}{2})}{h}=\frac{f(x)-f(x-h)}{h}

into (3) gives

\frac{d^2}{dx}f(x) \approx \frac{\frac{f(x+h)-f(x)}{h}-\frac{f(x)-f(x-h)}{h}}{h}=\frac{f(x+h)-f(x)-f(x)+f(x-h)}{h^2}=\frac{f(x+h)-2f(x)+f(x-h)}{h^2}.

i.e.,

\frac{d^2}{dx}f(x) \approx \frac{f(x+h)-2f(x)+f(x-h)}{h^2}.

See also “Deriving Finite Difference Approximations of the Derivatives“.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s