approximating second derivative from Taylor's theorem

16.7k Views Asked by At

I have been having trouble coming up with an approximation formula for numerical differentiation (2nd derivative) of a function based on the truncation of its Taylor Series. I am not sure if the error is an algebraic one or otherwise.

I start of with the truncated Taylor series expanded about an arbitrary point a, which is derived from Taylor's theorem:

$f(a+h) = f(a) + h \cdot f'(a) + \frac { h^2 \cdot f''(a)}{2}$

The unknown is $f''(a)$, so let's switch the equation around:

$\frac{ h^2 \cdot f''(a) }{2} + h \cdot f'(a) + f(a) = f(a+h)$

Substracting $h \cdot f'(a) + f(a)$ from both sides, I get:

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

Since h is small, I then substitute $f'(a)$ by the secant $\frac{( f(a+h) - f(a) )}{h}$ :

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

$ \frac { h^2 \cdot f'(a)}{2}$ = $f(a+h) - f(a)$ $-$ $f(a+h) + f(a)$ = 0

I thus end up with the confusing result that f''(a) = 0 for arbitrary values of a. Can anybody tell me what went wrong?

3

There are 3 best solutions below

0
On

Your substitution of $f'(a)$ by the approximation $(f(a+h) - f(a) )/h$ is exact when when $f'(x)$ is constant for all $x \in [a,a+h]$, i.e. when $f''(x)=0$ on that interval. So it is unsuitable when trying to approximate $f''(a)$

Instead you could take your

$$\frac12 h^2 f''(a)\approx f(a+h) - f(a) - hf'(a)$$ and rewrite it to say $$f''(a)\approx \frac{2}{h^2}( f(a+h) - f(a) - hf'(a))$$

0
On

I assume you want to use only evaluations of $f$ itself to find an estimate for $f''(a)$. In that case, combine $$ f(a+h)\approx f(a)+hf'(a)+\frac 12h^2f''(a)$$ $$ f(a-h)\approx f(a)-hf'(a)+\frac 12h^2f''(a)$$ into $$ h^2f''(a)\approx f(a+h)+f(a-h)-2f(a)$$ (and beware of numerical errors caused by the subtraction)

0
On

You could perhaps take a finite difference approach. Consider the second derivative as a difference quotient in terms of the first derivative:

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

Substitute $f'(x+h) = \frac{f(x+2h)-f(x+h)}{h}$ and $f'(x)=\frac{f(x+h)-f(x)}{h}$ to acquire:

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

Also, as a tip, using MathJax when typing mathematics will make your questions and responses easier to read!