# If and only if for Gaussian quadrature.

Consider a quadrature rule of the form $$Q(f) = \sum_{i=0}^{n} A_{i}f(x_{i})$$ to approximate the integral $$\int_{a}^{b}w(x)f(x)dx,$$ where $w:[a,b] \to \mathbb{R}$ is a positive function. Prove that $Q(f)$ is exact for all polynomials $f$ of degree less than or equal to $n$ if and only if $$A_{i}=\int_{a}^{b}w(x)\prod_{\substack{j =0\\j \neq i}}^{n}\frac{x-x_{j}}{x_{i}-x_{j}}dx.$$

I can prove the backward implication, that if $A_{i}$ is as stated, then $Q(f)$ is exact for all polynomials $f$ of degree less than or equal to $n$, but I am not sure how to prove that if $Q(f)$ is exact, then $A_{i}$ must be as stated.

## 1 Answer

The polynomial

$$p(x) := \prod_{\substack{j =1}}^{n}\frac{x-x_{j}}{x_{0}-x_{j}}\,.$$

has degree $n$ and satisfies $p(x_0) = 1$ and $p(x_i) = 0$ for $1\leq i \leq n\,.$

If the quadrature is exact for $p$, it means that

$$\int_{a}^{b}w(x)p(x)dx = \sum_{i=0}^{n} A_{i}p(x_{i}) = A_0\,.$$

Thus

$$A_0 = \int_{a}^{b}w(x)p(x)dx = \int_{a}^{b}w(x)\prod_{\substack{j =1}}^{n}\frac{x-x_{j}}{x_{0}-x_{j}} dx\,.$$

For $A_i$, $1\leq i\leq n$, you proceed in the very same way by picking an adequate polynomial.