Quadrature Using Legendre Polynomials

I am working on studying for my last Qualifying Exam and ran across a problem that has stumped me. I have seen someone else's work for this, but I am pretty it is wrong. Anyway...

Quote:

Let $\displaystyle f(x)$ be a smooth function and consider the integral

$\displaystyle I=\int_{-1}^1\! f(x) \, dx$

and consider $\displaystyle p_{n-1}$ that interpolates $\displaystyle f$ at the roots of the Legendre polynomial of degree n.

Use $\displaystyle p_{n-1}$ to derive a quadrature method for the integral $\displaystyle I$

The solution I have seen is as follows

Quote:

Let $\displaystyle \left\{x_i\right\}_{i=1}^n$ be the $\displaystyle n$ distinct roots of $\displaystyle \widetilde{p}_n(x)$ (the Legendre Polynomial of degree $\displaystyle n$)

Define

$\displaystyle w_i = \int_{-1}^1\! \prod_{\stackrel{j=1}{j\ne i}}^n \frac{x-x_j}{x_i-x_j}\, dx \Rightarrow Q(f) = \sum_{i=1}^n w_i f(x_i)$

So my issue is that he didn't really use Legendre polynomials. Instead he bipassed the Legendre polynomials in favor of a Lagrange polynomial that interpolates at the Legendre roots. Maybe I am missing something or just confused. Could someone help me either understand the work above or help me with the problem? Thanks in advanced.