How to compute Newton-Cotes quadrature coefficients?

I'm struggling with the below problem.

For the following approximation:

$f''(x) \approx Af(x)+Bf(x+h)+Cf(x+2h)$

Find the coefficients A, B, C so that the degree of exactness is maximal and compute the error.

I have supposed that this is a Newton-Cotes quadrature, but I don't really know how should I compute the coefficients and the error.

Is the degree of exactness supposed to be the highest degree polynomial for which the formula is exact ? How is that value computed ?

Thank you.

• This has nothing to do with Newton-Cotes quadrature. – Yves Daoust May 13 '15 at 19:49

By Taylor, $$f(x+h)\approx f(x)+hf'(x)+\frac12 h^2f''(x)+\frac16h^3f'''(x)+\cdots$$ $$f(x+2h)\approx f(x)+2hf'(x)+2h^2f''(x)+\frac43h^3f'''(x)+\cdots$$
\begin{align}f(x)&\to A+B+C=0\\f'(x)&\to hB+2hC=0\\f''(x)&\to\frac12h^2B+2h^2C=1,\end{align} and solve to yield $$A=\frac1{h^2},B=-\frac2{h^2},C=\frac1{h^2}.$$ $$\color{green}{f''(x)\approx\frac{f(x)-2f(x+h)+f(x+2h)}{h^2}}.$$
This is called the $2^{nd}$ order forward difference formula.
The next term in the development, a first estimate of the error, will be $$\frac1{h^2}(-\frac26h^3+\frac43h^3)f'''(x)=hf'''(x).$$