# Deriving the first and second order Newton-Cotes formulas

#### MarkFL

Staff member
Much like Simpson's Rule, a.k.a. the prismoidal method, improves upon the trapezoidal method by fitting parabolic arcs across known discrete points on some function $f(x)$ rather than line segments, Newton-Cotes formulas of order 1 and 2 fit cubic and quartic curves across points on the curve.

Newton-Cotes formula order 1

First, we need to compute the definite integral:

$$\displaystyle \int_{-h}^h Ax^3+Bx^2+Cx+D\,dx$$

Applying the FTOC, we find:

$$\displaystyle \int_{-h}^h Ax^3+Bx^2+Cx+D\,dx=\left[\frac{Ax^4}{4}+\frac{Bx^3}{3}+\frac{Cx^2}{2}+Dx \right]_{-h}^h=$$

$$\displaystyle \left(\frac{Ah^4}{4}+\frac{Bh^3}{3}+\frac{Ch^2}{2}+Dh \right)-\left(\frac{A(-h)^4}{4}+\frac{B(-h)^3}{3}+\frac{C(-h)^2}{2}+D(-h) \right)=$$

$$\displaystyle \frac{2Bh^3}{3}+2Dh=\frac{2h}{3}\left(Bh^2+3D \right)$$

We will require that the cubic integrand pass through the points:

$$\displaystyle \left(-h,y_0 \right),\,\left(-\frac{h}{3},y_1 \right),\,\left(\frac{h}{3},y_2 \right),\,\left(h,y_3 \right)$$

From this, the following system of equations results:

$$\displaystyle y_0=-Ah^3+Bh^2-Ch+D$$

$$\displaystyle y_1=-\frac{Ah^3}{27}+\frac{Bh^2}{9}-\frac{Ch}{3}+D$$

$$\displaystyle y_2=\frac{Ah^3}{27}+\frac{Bh^2}{9}+\frac{Ch}{3}+D$$

$$\displaystyle y_3=Ah^3+Bh^2+Ch+D$$

From these equation, we find:

$$\displaystyle y_0-y_1-y_2+y_3=\frac{16}{9}Bh^2$$

$$\displaystyle Bh^2=\frac{9}{16}\left(y_0-y_1-y_2+y_3 \right)$$

We also find:

$$\displaystyle -y_0+9y_1+9y_2-y_3=16D$$

$$\displaystyle 3D=\frac{3}{16}\left(-y_0+9y_1+9y_2-y_3 \right)$$

Using these values, we find:

$$\displaystyle \int_{-h}^h Ax^3+Bx^2+Cx+D\,dx=\frac{2h}{3}\left(Bh^2+3D \right)=\frac{h}{4}\left(y_0+3y_1+3y_2+y_3 \right)$$

Now, suppose that some closed interval $[a,b]$, is partitioned into $n$ sub-intervals of equal width:

$$\displaystyle \Delta x=x_{k+1}-x_{k}=\frac{b-a}{n}$$

where $n$ is a multiple of 3.

Then on each sub-interval $\left[x_{k-3},x_k \right]$, where:

$$\displaystyle h=\frac{3\Delta x}{2}$$

the definite integral may be approximated by:

$$\displaystyle \int_{x_{k-3}}^{x_k} f(x)\,dx\approx\frac{3\Delta x}{8}\left(f\left(x_{k-3} \right)+3f\left(x_{k-2} \right)+3f\left(x_{k-1} \right)+f\left(x_{k} \right) \right)$$

Hence, we have found:

$$\displaystyle \int_a^b f(x)\,dx\approx\frac{3(b-a)}{8n}\left(f\left(x_{0} \right)+3f\left(x_{1} \right)+3f\left(x_{2} \right)+2f\left(x_{3} \right)+\cdots \right.$$

$$\displaystyle \;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\left.+2f\left(x_{n-3} \right)+3f\left(x_{n-2} \right)+3f\left(x_{n-1} \right)+f\left(x_{n} \right) \right)$$

This is also known as Simpson's 3/8 rule.

Newton-Cotes formula order 2

Now, let's proceed in a like manner to derive the second order Newton-Cotes formula. First we need to compute:

$$\displaystyle \int_{-h}^h Ax^4+Bx^3+Cx^2+Dx+E\,dx=\frac{2h}{15}\left(3Ah^4+5Ch^2+15E \right)$$

We will require that the quartic integrand pass through the points:

$$\displaystyle \left(-h,y_0 \right),\,\left(-\frac{h}{2},y_1 \right),\,\left(0,y_2 \right),\,\left(\frac{h}{2},y_3 \right),\,\left(h,y_4 \right)$$

From this, the following system of equations results:

$$\displaystyle y_0=Ah^4-Bh^3+Ch^2-Dh+E$$

$$\displaystyle y_1=\frac{Ah^4}{16}-\frac{Bh^3}{8}+\frac{Ch^2}{4}-\frac{Dh}{2}+E$$

$$\displaystyle y_2=E$$

$$\displaystyle y_3=\frac{Ah^4}{16}+\frac{Bh^3}{8}+\frac{Ch^2}{4}+\frac{Dh}{2}+E$$

$$\displaystyle y_4=Ah^4+Bh^3+Ch^2+Dh+E$$

From these equation, we find:

$$\displaystyle y_0-4y_1+6y_2-4y_3+y_4=\frac{3Ah^4}{2}$$

$$\displaystyle Ah^4=\frac{2}{3}\left(y_0-4y_1+6y_2-4y_3+y_4 \right)$$

We also find:

$$\displaystyle -y_0+16y_1-30y_2+16y_3-y_4=6Ch^2$$

$$\displaystyle Ch^2=\frac{1}{6}\left(-y_0+16y_1-30y_2+16y_3-y_4 \right)$$

Using these values, we find:

$$\displaystyle \int_{-h}^h Ax^4+Bx^3+Cx^2+Dx+E\,dx=\frac{2h}{15}\left(3Ah^4+5Ch^2+15E \right)=\frac{h}{45}\left(7y_0+32y_1+12y_2+32y_3+7y_4 \right)$$

And so, we ultimately find:

$$\displaystyle \int_a^b f(x)\,dx\approx\frac{2(b-a)}{45n}\left(7f\left(x_{0} \right)+32f\left(x_{1} \right)+12f\left(x_{2} \right)+32f\left(x_{3} \right)+14f\left(x_{4} \right)+\cdots\right.$$

$$\displaystyle \;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\left.+14f\left(x_{n-4} \right)+32f\left(x_{n-3} \right)+12f\left(x_{n-2} \right)+32f\left(x_{n-1} \right)+7f\left(x_{n} \right) \right)$$

This is also known as Boole's rule.

Comments and questions should be posted here:

Commentary for "Deriving the first and second order Newton-Cotes formulas"