[Math] centered finite difference approximation

calculuslinear algebranumerical methods

Show that the centered finite difference approximation for the first derivative of a function on a uniform mesh yields the exact derivative for any quadratic polynomial $P_2(x) = a+bx+cx^2$

Using the taylor series:

\begin{align}
f(x+h) &= f(x) +f'(x)h + f''(x) \frac{h^2}{2}+f'''(x)\frac{h^3}{6}+ \dots \\
f(x-h) &= f(x) -f'(x)h + f''(x) \frac{h^2}{2}-f'''(x)\frac{h^3}{6}+ \dots
\end{align}

From the first equation, we get the forward difference approximation:
$$f'(x) = \frac{f(x+h)-f(x)}{h}+O(h).$$

From the second equation, we get the backward difference approximation
$$f'(x) = \frac{f(x)-f(x-h)}{h}+O(h),$$

and if we subtract the second equation from the first equation we get
$$f'(x) = \frac{f(x+h)-f(x-h)}{2h}+O(h^2),$$

which is the central difference formula.

But how do I use this to solve my problem? Is this formula the same as the centered finite difference approximation mentioned in the question?

Best Answer

You've well applied Taylor's expansion.

\begin{align} f(x+h) &= f(x) +f'(x)h + f''(x) \frac{h^2}{2}+f'''(x)\frac{h^3}{6}+ o(h^3) \tag1 \label1 \\ f(x-h) &= f(x) -f'(x)h + f''(x) \frac{h^2}{2}-f'''(x)\frac{h^3}{6}+ o(h^3) \tag2 \label2 \end{align}

$$\frac{\eqref{1} - \eqref{2}}{2} : \frac{f(x+h)-f(x-h)}{2} = f'(x)h + f'''(x)\frac{h^3}{6} + o(h^3) \tag{3}\label{3}$$

When the above equality is applied to a quadratic polynomial, we have $f^{(n)} \equiv 0$ for $n \ge 3$, so only the first derivative remains. This should give you the desired result

$$f'(x) = \frac{f(x+h)-f(x-h)}{2h}. \tag{4}\label{4}$$


(Edit in response to OP's request)

Apply given formula $$f'(x) = \frac{f(x+h)-f(x-h)}{2h}+O(h^2) \tag5\label5$$ to $P_2(x)$.

$$\begin{aligned} P_2'(x) &= \frac{P_2(x+h)-P_2(x-h)}{2h}+O(h^2) \\ &= \frac{(a-a)+b[(x+h)-(x-h)] + c[(x+h)^2-(x-h)^2]}{2h}+O(h^2) \\ &= \frac{b(2h) + c[(x+h)+(x-h)][(x+h)-(x-h)]}{2h}+O(h^2) \\ &= \frac{2bh + c(2x)(2h)}{2h}+O(h^2) \\ &= b+2cx + O(h^2) \end{aligned} \tag6\label6$$

Since \eqref{5} actually comes from dividing \eqref{3} by $2h$, and the third and higher derivatives in \eqref{3} vanishes when $f = P_2$, therefore, we can discard $O(h^2)$ in \eqref{6} and conclude that the central finite difference approximation for the first derivative is exact when $f = P_2$.


  • When $O(h)$ is used to describe a particular function, it's used as an object. In symbols: $f = O(h)$.
  • When $O(h)$ is used as a subject, it describes a class of functions bounded by $Mh$ for a certain constant $M>0$.

When $P_{2}'(x) = b+2cx +O(h^2)$, $$P_{2}'(x) - (b+2cx) = (b+2cx +O(h^2)) - (b+2cx) = O(h^{2}).$$ We won't say $O(h^2) = 0$ in general. Instead, we need to make use of the given conditions to conclude further.