# Newton-Cotes formula problem

By the method of undetermined coefficients I found $a=c=1/6$ and $b=2/3$ and $\alpha=\gamma=2/3$ and $\beta=-1/3$. Also that both are exact for polynomials of degree $\leq 3$. But I cannot figure out which one is better.

Thank you.

• I believe you are expected to find the error for a fourth degree polynomial. The multiplier is different for the two cases. The "better" one is the one with a lower multiplier. This is not a blanket recommendation-you can find functions where each one is more accurate than the other. Mar 17 '15 at 23:30
• Please see this tutorial on how to format mathematics on this site. Mar 17 '15 at 23:35

Considering function $f(x)$ to be integrated between $a$ and $b$, let me set $f_i=f(x_i)$ where $x_i=a+(b-a)\frac in$ where $n$ is the degree. We shall consider $n=3$ which is your problem.

Closed Newton-Cotes formula is $$\int_a^b f(x)\,dx\approx \frac{b-a}{6}\,(f_0+4f_1+f_2)$$ and the error is $-\frac{(b-a)^5}{2880}f^{(4)}(\xi)$.

Open Newton-Cotes formula is $$\int_a^b f(x)\,dx\approx \frac{b-a}{3}\,(2f_1-f_2+2f_3)$$ and the error is $\frac{7(b-a)^5}{23040}f^{(4)}(\xi)$.

As you can see, assuming similar $\xi$'s, the errors are in a ratio of $7:8$ slightly favouring the open form (just as Rory Daulton answered).

• You are welcome ! Mar 19 '15 at 4:29
• Nice answer. Could you provide a reference for those error formulae? Mar 19 '15 at 13:01
• @ Rory Daulton. I had that from Abramowitz and Stegun handbook but have a look at en.wikipedia.org/wiki/Newton%E2%80%93Cotes_formulas. Cheers :-) Mar 19 '15 at 13:46

"Better" is vague here. I tested both approximations using $f(x)=x^4$, and the approximation errors I got were:

• about $0.00833$ for the first (out of $0.2$),
• about $0.00729$ for the second (out of $0.2$).

So, for this example, the second was slightly "better" in terms of error. However, other examples may give different results.

Another way the second is better is that it can handle improper integrals, where the values of $f(x)$ are not defined at the endpoints $x=0$ and $x=1$. For example, the second could approximate

$$\int_0^1 \frac 1{\sqrt x}\,dx$$

to an error of about $0.36827$ (out of $2$), whereas the first could not give any approximation at all.

I therefore conclude that the second approximation formula is "better."