Using Taylor’s theorem to determine an approximation of the highest possible order

numerical methodstaylor expansion

If, where $f$ is a function and $a,b,c$ are constants, $af(-2h)+bf(0) + cf(h)$ is an approximation for $f’(0)$, I have to find the values of $a,b,c$ such that the approximation is of the highest order possible, using Taylor’s theorem.

From Taylor’s theorem, I have that:

$f(x+h) = f(x) + hf’(x)+\frac{1}{2}h^2f’’(x)+\frac{1}{6}h^3f’’’(\xi)$

and therefore, with $x=0$:

$f(-2h)=f(0)-2hf’(0)+2h^2f’’(0)-\frac{4}{3}h^3f’’’(\xi)$ and

$f(h)=f(0)+hf’(0)+\frac{1}{2}h^2f’’(0)+\frac{1}{6}h^3f’’’(\xi’)$

So what I believe I would do to maximise the order of $af(-2h)+bf(0)+cf(h)$ when approximating $f’(0)$ is to have $a,b,c$ such that $f(0)$ and $f’’(0)$ vanish.

If I had $a+b+c=0$ and $2a+\frac{1}{2}c=0$ this would do it.

What confuses me is that the question I am doing asks me to find $the$ values $a,b,c$ and since there are infinite solutions to the above equations I don’t know which values would be better.

The other problem I have is that if I used, say, $a=1,b=1,c=-2$ then I would get $af(-2h) +bf(0)+cf(h)=-4hf’(0)-\frac{8}{3}f’’’(\xi’’)$ and I don’t get how this is is an approximation for $f’(0)$ due to the $h$. In fact, no values of $a,b,c$ could get rid of the $h$. So I’m slightly confused about how $af(-2h)+bf(0) + cf(h)$ is an approximation in the first place.

Thank you.

Best Answer

There are in fact three equations and three unknowns. Moreover, a division with $h$ is required. You have $$f(-2h) = f(0) - 2f'(h) + 2f''(0)h^2 + O(h^3).$$ and $$f(h) = f(0) + f'(0)h + \frac{1}{2}f''(0)h^2 + O(h^3)$$ It follows that $$af(-2h) + b f(0) + c f(h) = (a+b+c)f(0) + (-2a+c)f'(0)h + \left(2a+\frac{1}{2}c\right)f''(0)h^2+O(h^3).$$ As you have reasoned, you must have $$a+b+c=0$$ and $$2a+\frac{1}{2}c = 0.$$ However, there is also a third equation which must not be neglected. Specifically, $$-2a+c = 1.$$ When these equations are solved you have $$\frac{af(-2h) + b f(0) + c f(h)}{h} = f'(0) + O(h^2).$$ Notice that I have explicitly divided with $h$. It is straight forward to determine the values of $a$, $b$ and $c$. You should also extend the Taylor expansion to fourth order and verify that in general we can not expect third order accuracy from this approximation of the derivative.