Maths

Newton-Cotes Formula

A derivation of Newton-Cotes quadrature formulas from Lagrange interpolation, including the weight system, degree of exactness, and the first three standard cases.

Newton-Cotes formula is a general class of formulas that estimate the integral of a function with the integral of a Lagrange interpolation polynomial of the function.

Say we want to estimate abf(x)dx\int_{a}^{b}f(x)\,\mathrm{d}x.
Let h=ban,xi=a+ih,fi=f(xi),i=0,1,2,,nh=\frac{b-a}{n}, x_i=a+ih, f_i=f(x_i),\quad i=0,1,2,\cdots,n.
The result polynomial of Lagrange interpolation will be

g(x)=i=0nfili(x), li(x)=j=0,jinxxjxixj.g(x)=\sum_{i=0}^{n}{f_i\cdot l_i(x)},\ l_i(x)=\prod_{j=0,j\neq i}^{n}{\frac{x-x_j}{x_i-x_j}}.

We estimate the integral of ff with that of gg:

abf(x)dxabg(x)dx=i=0n(fiabli(x)dx).\int_{a}^{b}{f(x)\,\mathrm{d}x}\approx \int_{a}^{b}{g(x)\,\mathrm{d}x}= \sum_{i=0}^{n}({f_i\cdot \int_{a}^{b}{l_i(x)\,\mathrm{d}x}}).

Now the problem boils down to the integral of lil_i.
By transformation we can show that abli(x)dx=(ba)01li(x)dx\int_{a}^{b}{l_i(x)\,\mathrm{d}x}=(b-a)\int_{0}^{1}{l_i(x)\,\mathrm{d}x}. (Note: the lil_is are based on different interpolation nodes.)

Let αi=01li(x)dx\alpha_{i}=\int_{0}^{1}{l_i(x)\,\mathrm{d}x} and ti=in,i=0,1,2,,nt_i=\frac{i}{n},\quad i=0,1,2,\cdots,n. Then

01xkdx=i=0nαitik=1k+1,k=0,1,2,,n.\int_{0}^{1}{x^k\,\mathrm{d}x} = \sum_{i=0}^{n}{\alpha_{i}\cdot {t_i}^k}=\frac{1}{k+1},\quad k=0,1,2,\cdots,n.

Namely

[1111t0t1t2tnt02t12t22tn2t0nt1nt2ntnn][α0α1α2αn]=[1112131n+1].\begin{bmatrix} 1 & 1 & 1 & \cdots & 1 \\ t_0 & t_1 & t_2 & \cdots & t_n \\ t_0^2 & t_1^2 & t_2^2 & \cdots & t_n^2 \\ \vdots & \vdots & \vdots & \ddots & \vdots \\ t_0^n & t_1^n & t_2^n & \cdots & t_n^n \end{bmatrix} \begin{bmatrix} \alpha_0 \\[2pt] \alpha_1 \\[2pt] \alpha_2 \\[2pt] \vdots \\[2pt] \alpha_n \end{bmatrix} = \begin{bmatrix} \frac{1}{1} \\[4pt] \frac{1}{2} \\[4pt] \frac{1}{3} \\[4pt] \vdots \\[4pt] \frac{1}{n+1} \end{bmatrix}.

Solving this system gives αi\alpha_{i}. Newton-Cotes formula is then

abf(x)dx(ba)i=0nαifi.\int_{a}^{b}{f(x)\,\mathrm{d}x}\approx (b-a)\sum_{i=0}^{n}{\alpha_{i}f_{i}}.

Appendix I. For Newton-Cotes formulas, the degree of exactness is:

exactness={n+1,if n is even,n,if n is odd.\text{exactness} = \begin{cases} n+1, & \text{if $n$ is even}, \\ n, & \text{if $n$ is odd}. \end{cases}

Appendix II. Newton-Cotes formulas for n=1,2,3n=1,2,3.

abf(x)dxba2[f0+f1]\int_a^b f(x)\,\mathrm{d}x \approx \frac{b-a}{2} \,[f_0 + f_1] abf(x)dxba6[f0+4f1+f2]\int_a^b f(x)\,\mathrm{d}x \approx \frac{b-a}{6} \,[f_0 + 4f_1 + f_2] abf(x)dxba8[f0+3f1+3f2+f3]\int_a^b f(x)\,\mathrm{d}x \approx \frac{b-a}{8} \,[f_0 + 3f_1 + 3f_2 + f_3]