# approximating second order derivative using two stepsizes $h_1$ and $h_2$

Given stepsizes $h_1$ and $h_2$, develop a numerical scheme to approximate $f^{\prime\prime}(x_0)$ with function values $f(x_0)$, $f(x_0 + h_1)$ and $f(x_0 + h_2)$. Under what conditions will your method not work?

This is a practice problem, and I am not sure how to approach it. I am thinking about using the second derivative midpoint formula and plug in $f(x_0)$, $f(x_0 + h_1)$ and $f(x_0 + h_2)$, but I am not sure if it is the right approach. Any hints and suggestions would be helpful!

Thanks!

If $h_1= -h_2$, you can use second derivative midpoint formula $$f^{''}(x_0)=\frac{1}{h^2}[f(x_0-h)-2f(x_0)+f(x_0+h)]+o(h^3)$$ If $h_1\neq -h_2$, you can do like this: $$f(x_0+h_1)=f(x_0)+h_1f'(x_0)+\frac{h_1^2}{2}f^{''}(x_0)+o(h_1^3)$$ $$f(x_0+h_2)=f(x_0)+h_2f'(x_0)+\frac{h_2^2}{2}f^{''}(x_0)+o(h_2^3)$$ Minus the two equations $$f(x_0+h_2)-f(x_0+h_1)=(h_2-h_1)f'(x_0)+\frac{h_2^2-h_1^2}{2}f^{''}(x_0)+o(h_2^3-h_1^3)$$ and $$f'(x_0)=\frac{f(x_0+h_2)-f(x_0+h_1)}{h_2-h_1}+o(h_2^2-h_1^2)$$

But, considering the accuracy, in general, we pick $h_1= -h_2$, which cancels out the $f'(x_0)$ that has a low accuracy in a certain sense.

EDIT1: An alternative way to find $f^{''}(x_0)$ using only $f(x_0)$, $f(x_0+h_1)$ and $f(x_0+h_2)$ and not involving $f'(x_0)$ is that you should express $f'(x_0)$ with $f(x_0)$, $f(x_0+h_1)$ and $f(x_0+h_2)$, so a potential formula is $$f(x_0+h_1)=f(x_0)+\frac{h_1}{h_1+h_2}[f(x_0+h_1)+f(x_0+h_2)-2f(x_0)-(\frac{h_2^2-h_1^2}{2}f^{''}(x_0))]+\frac{h_1^2}{2}f^{''}(x_0)$$

• You do not need to eliminate $f(x_0)$, its value is given. You need to eliminate $f'(x_0)$ to get an approximation of $f''(x_0)$. Mar 21 '17 at 8:59
• Yes, you are right. Mar 21 '17 at 10:25

By Taylor,

$$f_1\approx f_0+h_1f'_0+\frac{h_1^2}2f''_0,$$

$$f_2\approx f_0+h_2f'_0+\frac{h_2^2}2f''_0.$$

Then by elimination of $f'_0$, you get

$$h_2(f_1-f_0)-h_1(f_2-f_0)=\frac{h_1h_2(h_1-h_2)}2f''_0.$$