# Finite Difference Methods

## Learning Objectives

- Approximate derivatives using the Finite Difference Method

## Finite Difference Approximation

For a differentiable function \(f:\mathbb{R} \rightarrow \mathbb{R}\), the derivative is defined as

\[f'(x) = \lim_{h \rightarrow 0} \frac{f(x+h)-f(x)}{h} \]

Let’s consider the forward finite difference approximation to the first derivative as

\[f'(x) \approx \frac{f(x+h)-f(x)}{h} \]

where \(h\) is often called a “perturbation”, i.e., a “small” change to the variable \(x\) (small when compared to the magnitude of \(x\)). By the Taylor’s theorem, we can write

\[f(x+h) = f(x) + f'(x)\, h + f''(\xi)\, \frac{h^2}{2} \]

for some \(\xi \in [x,x+h]\). Rearranging the above we get

\[f'(x) = \frac{f(x+h)-f(x)}{h} - f''(\xi)\, \frac{h}{2} \]

Therefore, the truncation error of the finite difference approximation is bounded by \(M\,h/2\), where \(M\) is a bound on \(\vert f''(\xi) \vert\) for \(\xi\) near \(x\).

Using a similar approach, we can summarize the following finite difference approximations:

#### Forward Finite Difference Method

In addition to the computation of \(f(x)\), this method requires one function evaluation for a given perturbation, and has truncation order \(O(h) \).

\[f'(x) = \frac{f(x+h)-f(x)}{h}\]

#### Backward Finite Difference Method

In addition to the computation of \(f(x)\), this method requires one function evaluation for a given perturbation, and has truncation order \(O(h) \).

\[f'(x) = \frac{f(x)-f(x-h)}{h}\]

#### Central Finite Difference Method

This method requires two function evaluations for a given perturbation (\(f(x+h)\) and \(f(x-h)\) ), and has truncation order \(O(h^2) \).

\[f'(x) = \frac{f(x+h)-f(x-h)}{2h}\]

*Reference text: “Scientific Computing: an introductory survey” by Michael Heath*

## Review Questions

## ChangeLog