In working through various schools' qualifying exams in numerical analysis, I have come across a problem that appears several times in a variety of different flavors:
The Legendre polynomials \begin{align*} P_n(x) = \frac{1}{2^n n!} \ \frac{d^n}{dx^n} [(1-x^2)^n] \end{align*} are orthogonal with respect to the inner product $(f,g) = \int_{-1}^1 f(x)g(x) \ dx$. Consider the Gauss-Legendre integration formula \begin{align*} \int_{-1}^1 f(x) \ dx \approx \sum\limits_{i=1}^n w_i f(x_i) \end{align*} where \begin{align*} w_i = \int_{-1}^1 L_i(x) \end{align*} with $L_i$ being the $i$th Lagrange interpolating polynomial, and the $x_i$'s being the roots of $P_n$. Show that this method is exact for all polynomials of degree $\leq 2n - 1$ by writing any such polynomial $p(x) = q(x)P_n(x) + r(x)$ where the degrees of $q$ and $r$ are less than $n$.
I believe there are a few clever ways to go about solving this depending on the prompt of the question and the hint given (if any). I have a complete answer (below), but I am looking for feedback to improve. In particular, in my dealings with $q(x)$, is it necessary for me to show that it's a linear combination of lower degree Legendre polynomials to show that the integral evaluates to zero, or would it be appropriate to just state that, since $q(x)$ is a polynomial of degree $< n$ that orthogonality with respect to the inner product follows? In general, I often feel that my proofs are sometimes a little cumbersome.