[Math] Derive an $O(h^4)$ five point formula to approximate $f'(x_0)$ that uses $f(x_0 – h), f(x_0), f(x_0 + h), f(x_0 + 2h), f(x_0 + 3h)$

derivativesnumerical methods

This is a Numerical Analysis textbook question on Numerical Differentiation (like https://en.wikipedia.org/wiki/Numerical_differentiation):

Official Textbook Question

Q: Derive an $O(h^4)$ five point formula to approximate $f'(x_0)$ that uses $f(x_0 – h), f(x_0), f(x_0 + h), f(x_0 + 2h), f(x_0 + 3h)$

Hint: Consider the expression $A f(x_0 – h) + B f(x_0 + h) + C f(x_0 + 2h) + D f(x_0 + 3h)$. Expand in fourth Taylor polynomials, and choose $A, B, C, D$ appropriately.

My Work

I can follow the full textbook derivation of the "Three Point" Formulas, the Three Point Endpoint Formula:

\begin{align*}
f'(x_0) &= \frac{1}{2h} \left[ -3 f(x_0) + 4 f(x_0 + h) – f(x_0 + 2h) \right] + \frac{h^2}{3} f^{(3)}(\xi_0) \\
\end{align*}

where $\xi_0$ is between $x_0$ and $x_0 + 2h$

and the Three-Point Midpoint Formula:

\begin{align*}
f'(x_0) &= \frac{1}{2h} \left[ f(x_0 + h) – f(x_0 – h) \right] – \frac{h^2}{6} f^{(3)}(\xi_1) \\
\end{align*}

where $\xi_1$ is between $x_0 – h$ and $x_0 + h$

These derivations involve calculating the Lagrange interpolating polynomial of three evenly spaced points, calculating the derivative, and solving for the derivative at each point. Using either the first or last point gives you the three point endpoint formula and using the midpoint gives you the three point midpoint formula.

Obviously, the same technique would work for five points, but the equations get very tedious and hard to work with, and the problem hint obviously doesn't want us to solve the problem that way.

I don't quite understand how the hint wants me to proceed. Is a fourth Taylor polynomial something like this:

\begin{align*}
f(x) &= f(x_0) + \frac{f'(x_0)}{1!} (x – x_0) + \frac{f^{(2)}(x_0)}{2!} (x – x_0)^2 + \frac{f^{(3)}(x_0)}{3!} (x – x_0)^3
\end{align*}

I don't see how that would help solve this problem. Thanks!

Best Answer

Consider that your formula must give the correct values for $f (x) = 1$, $f (x) = x$, $f (x) = x^2$, $f (x) = x^3$ and $f (x) = x^4$. The hint is weird, since it assumes that you are not using f (x).

So you get the equations:

$A + B + C + D + E = 0$, $A(x-h) + B(x) + C(x+h) + D(x + 2h) + E(x + 3h) = 1$, $A(x-h)^2 + B(x)^2 + C(x+h)^2 + D(x + 2h)^2 + E(x + 3h)^2 = 2x$, $A(x-h)^3 + B(x)^3 + C(x+h)^3 + D(x + 2h)^3 + E(x + 3h)^3 = 3x^2$, $A(x-h)^4 + B(x)^4 + C(x+h)^4 + D(x + 2h)^4 + E(x + 3h)^4 = 4x^3$.

Consider that your formula must give the correct values for $f (x) = 1$, $f (x) = x$, $f (x) = x^2$, $f (x) = x^3$ and $f (x) = x^4$. The hint is weird, since it assumes that you are not using f (x).

These equations look a bit difficult. So we use different polynomials:

$f (x) = 1$, $f (x) = (x-x_0)/h$, $f (x) = ((x-x_0)/h)^2$, $f (x) = ((x-x_0)/h)^3$ and $f (x) = ((x-x_0)/h)^4$.

(1) $A + B + C + D + E = 0$

(2) $-A + C + 2D + 3E = 1/h$

(3) $A + C + 4D + 9E = 2/h^2$

(4) $-A + C + 8D + 27E = 3/h^3$

(5) $A + C + 16D + 81E = 4/h^4$.

This is easy enough to solve for A, B, C, D and E by subtracting (4) - (2) and (5) - (3), calculating E and D, subtracting (3) - (2) and substituting D, E to get C, adding (2) + (3) and substituting D, E to get A, and substituting all in (1) to get B. To follow the original "hint" set B = 0 instead.