Weighting for Gauss-Legendre Quadrature The textbook I am reading shows that the weighting of Gauss-Legendre Quadrature is
\begin{align*}
w(x_i) = \frac{1}{P_n'(x_i)}\int_{-1}^1 \frac{P_n(x)}{x-x_i} dx
\end{align*}
which is evaluated without proof to be
\begin{align*}
w(x_i) = \frac{2}{(1-x_i^2)|P_n'(x_i)|^2}
\end{align*}
where $x_i$ is the $i$-th zero of the $n$-th order Legendre Polynomial $P_n(x)$. I am stuck when trying to compute the integral in the first equation. I am not sure what properties of Legendre Polynomial to use. Its form resembles some sort of pole integration but I don't know how to proceed. Any help will be appreciated.
 A: Denoting the nodes by $x_{n,i}$ (to emphasize the dependence on $n$) and the weights by $w_{n,i}$, $$\int_{-1}^1 P(x)\,dx=\sum_{i=1}^n w_{n,i}P(x_{n,i})$$ holds for any polynomial $P$ of degree $<2n$. Let's recall how to show this property. Set $$P_{n,j}(x):=\frac1{P_n'(x_{n,j})}\frac{P_n(x)}{x-x_{n,j}};\qquad P_{n,j}(x_{n,i})=\begin{cases}0,&i\neq j\\1,&i=j\end{cases}.$$ Now $R(x):=P(x)-\sum_{j=1}^n P(x_{n,j})P_{n,j}(x)$ vanishes at $x=x_{n,i}$ for each $i$. Hence $R(x)$ is a multiple of $P_n(x)$, that is $R(x)=P_n(x)Q(x)$ with a polynomial $Q(x)$ of degree $<n$. Thus, if we put $w_{n,j}=\int_{-1}^1 P_{n,j}(x)\,dx$ by definition (this is the first formula in the question), we get $$\int_{-1}^1 P(x)\,dx=\sum_{j=1}^n w_{n,j}P(x_{n,j})+\int_{-1}^1 P_n(x)Q(x)\,dx,$$ and the last term is $0$ by orthogonality.
Now put $P(x)=P_n'(x)P_{n,j}(x)$ which has degree $2n-2$, and get $$P_n'(x_{n,j})w_{n,j}=\int_{-1}^1 P_n'(x)P_{n,j}(x)\,dx=P_n(x)P_{n,j}(x)\Bigg|_{-1}^1-\int_{-1}^1 P_n(x)P_{n,j}'(x)\,dx.$$ The last term is $0$ (again), and the evaluation follows by $P_n^2(\pm 1)=1$.
