Let $n \in \mathbb{N}$. We consider $n+1$ distinct points in $I$, denoted $x_0 < x_1 < \cdots < x_n$, and the Lagrange basis $(L_0, \ldots, L_n)$ associated with these points. Suppose that, for all $k \in \mathbb{N}$, the map $x \mapsto x^k w(x)$ is integrable on $I$. Show that the quadrature formula $I_n(f) = \sum_{j=0}^n \lambda_j f(x_j)$ is exact on $\mathbb{R}_n[X]$ if and only if $$\forall j \in \llbracket 0, n \rrbracket, \quad \lambda_j = \int_I L_j(x) w(x)\,\mathrm{d}x.$$
We consider the case $I = [0,1]$ and $\forall x \in I, w(x) = 1$. Determine the Lagrange basis associated with the points $(0, 1/2, 1)$ and thus recover the coefficients of the quadrature formula $I_2(f)$ from question 3.