Develop second-order method for approximating f'(x) I am stuck on the following question:
Develop a second-order method for approximating $f'(x)$ that uses the data $f(x-h), f(x)$, and $f(x+3h)$ only.
Any hints/tips?? Thanks!
 A: By Taylor, we have
\begin{align*}
  f(x-h) &= f(x) - hf'(x) + \frac 12 h^2 f''(x) + O(h^3)\\
  f(x+3h) &= f(x) + 3hf'(x) + \frac 92 h^2 f''(x) + O(h^3)
\end{align*}
So 
$$ \frac 1h \bigl(\alpha f(x-h) + \beta f(x) + \gamma f(x+3h)\bigr) 
  = \frac 1h (\alpha + \beta + \gamma)f(x) + (3\gamma - \alpha)f'(x) + \frac h2(\alpha + 9\gamma)f''(x) + O(h^2) $$ 
We must therefore have $\alpha+\beta+\gamma = 0$, $3\gamma - \alpha = 1$ and $\alpha + 9\gamma = 0$, the second and third equations give $12\gamma = 1$, so $\gamma = \frac 1{12}$, hence $\alpha = -\frac 34$, and $\beta = \frac 23$. That is
$$ f'(x) = \frac{-9f(x-h) + 8f(x) + f(x+3h)}{12 h} + O(h^2)$$
A: Expanding on  Mhenni Benghorbal's link:
$f(x+h) 
=f(x)+hf'(x)+h^2f''(x)/2+h^3f'''(x)/6+...
$,
and
$f(x-h) 
=f(x)-hf'(x)+h^2f''(x)/2-h^3f'''(x)/6+...
$,
so
$f(x+3h) 
=f(x)+3hf'(x)+9h^2f''(x)/2+27h^3f'''(x)/6+...
$.
To combine
$f(x), f(h-x)$,
and $f(x+3h)$
to get
$f'(x)$,
let
$g(x)
=af(x)+bf(x-h)+cf(x+3h)
$.
Then 
$g(x)
=(a+b+c)f(x)
+(-b+3c)hf'(x)
+(b+9c)h^2f''(x)/2
+(-b+27c)h^3f'''(x)/6
+...
$.
To make this
a second order approximation,
we need
$a+b+c=0$,
$-b+3c = 1$,
and
$b+9c=0$.
This will make
$g(x)
=hf'(x)+O(h^3)$,
so
$\frac{g(x)}{h}
= f'(x) + O(h^2)
$.
The solution to these
is
$c = 1/12$,
$b = -3/4$,
and
$a = 2/3$.
Since
$-b+27c
=-3/4+27/12
=-9/12+27/12
=18/12
=3/2
$,
this makes
$\begin{align}
\dfrac{\frac{2}{3}f(x)-\frac{3}{4}f(x-h)+\frac1{12}f(x+3h)}{h}
&=\dfrac{g(x)}{h}\\
&=f'(x)+h^2f''(x)(3/2)/6+O(h^3)\\
&=f'(x)+h^2f''(x)/4+O(h^3)\\
\end{align}
$.
