Lemma (exact on Pn iff interpolating formula)

Consider a linear functional $λ: C^{n+1}[a,b]\to\R$ and an approximation $λ(f) \approx \sum_{i=0}^{N} a_if(x_i)$.

If $N=n$, the formula is exact on $\mathcal{P}_n$ iff it is the interpolating formula $$ \begin{align*} a_i = λ(l_i) \end{align*} $$ where $l_0, \ldots, l_n$ are the fundamental Lagrange polynomials.

Proof