Deriving Trapezoid Rule via Newton-Cotes formula

integrationnumerical methodsnumerical-calculus

Newton-Cotes is given by

$$
\int_{a}^{b} f(x) d x \approx \sum_{i=0}^{n} f\left(x_{i}\right) A_{i}, \: A_{i}=\int_{a}^{b} \ell_{i}(x) d x, \quad i=0,1, \ldots, n
$$

For $n=1$, $a=x_0$ and $b=x_1$ I get:

$$
\int_{a}^{b} f(x) d x = \int_{x_0}^{x_1} f(x) d x \approx \sum_{i=0}^{1} f\left(x_{i}\right) A_{i} = f(x_0)A_0+f(x_1)A_1
$$

So my problem is that I do not know how to integrate the indicator functions $\ell_0(x)$ and $\ell_1(x)$ over $[a,b]$ ?

Best Answer

For $n=1$, we have that $l_0$ and $l_1$ are linear functions. Moreover, $l_0(a) = l_1(b) = 1$ and $l_0(b) = l_1(a) = 0$. It follows that $$A_i = \int_a^b l_i(x) dx = \frac{1}{2}(b-a)$$ for $i=1,2$.

Related Question