Let us suppose $x_1,...,x_n$ be $n$ nodes and we interpolate the functions $f$ with lagrange polynomial
Then my book says $$\int_a^b f(x) dx=\sum A_i f(x_i), A_i=\int_a^b l_i(x)dx $$where $ l_i(x_j) = \delta_{ij}$
for all polynomial for degree at most n. Certainly this is true for polynomial of degree $n$, because there is unique polynomial of degree n passing through these points, but why it has to be true for polynomial of degree less than $n$?
If $f(x)$ is a polynomial with degree $\leq n$, it coincides with its interpolating polynomial over $n+1$ distinct nodes. So, is this case,
$$ \int_a^b f(x) dx = \int_a^b \mathop{\Large \Sigma}_{i=0}^n f(x_i)l_i(x) dx = \mathop{\Large \Sigma}_{i=0}^n f(x_i) \underbrace{\int_a^bl_i(x) dx}_{A_i} = \mathop{\Large \Sigma}_{i=0}^n A_i f(x_i). $$
If the degree is less than $n$, nothing changes.
Note: for some reason the \sum commando was not working... hence the strange sum symbols.