5
$\begingroup$

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?

$\endgroup$

2 Answers 2

4
$\begingroup$

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.

$\endgroup$
21
  • $\begingroup$ is this a complete solution? thanks for your post btw! I had an extra x on the ax in my question $\endgroup$
    – fr14
    Commented Nov 8, 2018 at 20:08
  • 1
    $\begingroup$ @fr14 I've just read the statement to be proved above. Daniel Moraes has completed his solution quicker than I do, so there's no point to duplicate the effort. $\endgroup$ Commented Nov 8, 2018 at 20:18
  • $\begingroup$ okay and his looks right in your opinion? $\endgroup$
    – fr14
    Commented Nov 8, 2018 at 20:23
  • $\begingroup$ @fr14 I agree with his solution except the last equality $$O(h^2) = 0.$$ $\endgroup$ Commented Nov 8, 2018 at 20:29
  • $\begingroup$ could you complete your solution? $\endgroup$
    – fr14
    Commented Nov 8, 2018 at 20:31
3
$\begingroup$

This is the centered finite difference approximation method, basically you need to apply it to the general polynomial:
$f′(x)=\dfrac{f(x+h)−f(x−h)}{2h}+O(h^2)$ is what you already got

$P_{2}'(x)=\dfrac{(a+b(x+h)+c(x+h)^2) -(a+b(x-h)+c(x-h)^2)}{2h} +O(h^2)$

$P_{2}'(x)=\dfrac{a(1-1)+b(x+h-x+h)+c(x^2+2hx+h^2-x^2+2xh-h^2)}{2h} +O(h^2)$

$P_{2}'(x)=\dfrac{b(2xh)+c(4xh)}{2h} +O(h^2)$

$P_{2}'(x)=b+2cx +O(h^2)$
Hence :
$P_{2}'(x) - (b+2cx) = b+2cx - b-2cx = 0 = O(h^{2})$, here we stating that the error goes to 0, it is also possible to see that $P_{2}''(x+h)-P_{2}''(x+h)=0$ and the higher order derivatives are $0$, so this statement is equivalent

$\endgroup$
15
  • $\begingroup$ sorry yes I edited the question, could you show me how this is done? $\endgroup$
    – fr14
    Commented Nov 8, 2018 at 20:04
  • $\begingroup$ ok, will open a lit bit more $\endgroup$ Commented Nov 8, 2018 at 20:04
  • $\begingroup$ if you could include all the details I can accept it! sorry for the typo $\endgroup$
    – fr14
    Commented Nov 8, 2018 at 20:05
  • $\begingroup$ i rewrited it, if you don't get a step i can exaplin it further $\endgroup$ Commented Nov 8, 2018 at 20:14
  • 1
    $\begingroup$ i see no need, but i added it $\endgroup$ Commented Nov 8, 2018 at 20:44

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .