Theorem (Gaussian quadrature)

Let a quadrature $\int_{a}^{b} f(x)ω(x) \d x \approx \sum_{i=0}^{n} a_i f(x_i)$ for numerical integration be exact on $\mathcal{P}_{n}$ (i.e. the interpolating formula).

Then it is exact on $\mathcal{P}_{2n+1}$ iff $x_0, \ldots, x_n$ are the $(n+1)$ distinct roots of an $n$-th orthogonal polynomial with respect to the inner product $\langle f,g\rangle = \int_{a}^{b} a(x)b(x)ω(x) \d x$.

Such a quadrature is called a Gaussian quadrature.

Proof