From a practice problem
Problem Statement
Let the interval $[a,b]$ be divided into $n$ subintervals by $n+1$ points $x_0 = a , x_1 = a+h$, $x_2 = a+2h , \dots ,x_n = a+nh =b$. Derive the quadrature rule of the form
$$
\int_{-1}^1 f(x) \mathrm{d} x \approx w_0 f(\alpha) + w_1 f'(\beta) ,\quad -1 \le \alpha < \beta \le 1 \tag{1}
,$$
that is exact for polynomials of as high degree as possible.
Attempt at solution
Let $p(x)$ be the lagrange interpolation polynomial interoplating the points $(x_0, f(x_0) ), \dots , (x_n , f(x_n))$. Then
$$
p(x) = \sum_{i=0}^n l_i(x) f(x_i) \qquad \text{for} , \ l_i (x) = \prod_{j=0, j\neq i}^n \left( \frac{x-x_j}{x_i – x_j} \right)
$$
it follows that
$$
\int_{-1}^1 f(x) \mathrm{d} x \approx \int_{-1}^1 p(x) \mathrm{d} x
$$
where
\begin{align}
\int_{-1}^1 p(x) \mathrm{d} x &= \int_{-1}^1 \sum_{i=0}^n l_i(x) f(x_i) \mathrm{d} x \\
&= \sum_{i=0}^n \left( \int_{-1}^1 l_i(x) \mathrm{d} x \right) f(x_i) \mathrm{d} x \\
&:= \sum_{i=0}^n w_i f(x_i)
\end{align}
We conclude
$$
\therefore \int_{-1}^1 f(x) \mathrm{d} x = \sum_{i=0}^n w_i f(x_i)
$$
Questions
From here I am stuck. In $(1)$ we have a function derivative $f'(\beta)$, but in the formula derived above, there's no such thing. Moreover, I don't know how many terms in this sum to take as well. Does anyone know how I can complete this derivation?
Best Answer
The reference to the sub-intervals is useless... We just want to determine the quadrature nodes ($\alpha, \beta)$ and weights ($\omega_0, \omega_1$) that make the rule exact for polynomial of degree as high as possible. So, forcing the rule to be exact for $f(x)=1, f(x) = x, f(x)=x^2, \cdots$, you get a system of equations that allows the calculation of $\alpha, \beta, \omega_0, \omega_1$:
$$ \omega_0 \cdot 1 + \omega_1 \cdot 0 = 2 \Leftrightarrow \omega_0=2 $$
$$ \omega_0 \cdot \alpha + \omega_1 \cdot 1 = 0\Leftrightarrow 2 \alpha+\omega_1=0 $$
$$ \omega_0 \alpha^2 + \omega_1 \cdot 2 \beta = \frac 23 $$
$$ \vdots $$