Approximating the second derivative with Taylor’s Series

The Taylor’s Series tells us:

$f(x+h)=\frac{h^0 f(x)}{0!}+\frac{h^1 f'(x)}{1!}+\frac{h^2 f''(x)}{2!}+\frac{h^3 f'''(x)}{3!}+...$

and
$f(x-h)=\frac{(-h)^0 f(x)}{0!}+\frac{(-h)^1 f'(x)}{1!}+\frac{(-h)^2 f''(x)}{2!}+\frac{(-h)^3 f'''(x)}{3!}+...$

adding the two together yields:

$f(x+h)+f(x-h) = \frac{h^0 f(x)}{0!}+\frac{(-h)^0 f(x)}{0!}+\frac{h^1 f'(x)}{1!}+\frac{(-h)^1 f'(x)}{1!}$

$+ \frac{h^2 f''(x)}{2!} + \frac{(-h)^2 f''(x)}{2!} +\frac{h^3 f'''(x)}{3!} +\frac{(-h)^3 f'''(x)}{3!} + ...$

Notice how odd terms cancel each other which leaves us with:

$f(x+h)+f(x-h) = \frac{h^0 f(x)}{0!}+\frac{(-h)^0 f(x)}{0!} + \frac{h^2 f''(x)}{2!} + \frac{(-h)^2 f''(x)}{2!} + ...$

Combining like terms and simplifying yields:

$f(x+h)+f(x-h) = 2f(x) + h^2 f''(x) + ...$

Now solve for the second derivative:

$f''(x)=\frac{f(x+h)+f(x-h)-2f(x)}{h^2}$

Truncating the series gives an error of $O(h^2)$.

Advertisements
This entry was posted in Math and tagged , . Bookmark the permalink.