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.
2 Answers
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$.
- 43,591
-
Thanks, I almost forgot I had asked this question… – Benjamin_Gal Mar 31 '22 at 05:55
-
But I would like to ask how to derive the property shown in the third equation – Benjamin_Gal Mar 31 '22 at 05:57
-
@Benjamin_Gal: Edited to include that. – metamorphy Mar 31 '22 at 06:20
The part of the accepted answer addressing the author's question is unclear and most of it is addressing a different topic than the author's question so I am adding this answer clearly showing only how to derive the weight equation.
The Gauss-Legendre quadrature weight for node $x_i$ can be expressed in terms of $x_i$ and the derivative of the $n$th Legendre polynomial $P_n(x)$: $$ w_i = \frac{2}{(1- x_i^2)\left[ P_n'(x_i)\right]^2}. \tag{1}\label{weight_equation} $$ Equation \eqref{weight_equation} can be derived by computing the definite integral over $[-1,1]$ of $$ f(x) = P_n'(x) \frac{P_n(x)}{x-x_i} \tag{2}\label{f_for_weight_eqn} $$ in two different ways: Gaussian quadrature and integration by parts. The function $f$ is a polynomial with degree $2n-2$ since $P_n'$ has degree $n-1$ and the ratio $P_n(x)/(x-x_i)$ also has degree $n-1.$ The Legendre polynomial $P_n$ is divisible by $x-x_i$ since $x_i$ is a root of $P_n.$ So the $n$ point Gaussian quadrature rule will compute the integral of $f$ exactly.
The integral of $f$ computed exactly using Gaussian quadrature is $$ \int_{-1}^1 f(x) \, dx = \sum_{j=0}^{n-1} w_j P_n'(x_j) \frac{P_n(x_j)}{x_j - x_i}. \tag{3}\label{gq_sum1} $$ Every term in the sum \eqref{gq_sum1} except for term $j=i$ is zero since $P_n(x_j)=0$ and $x_j - x_i \neq 0$ for $j\neq i.$ For $j=i,$ L'Hôpital's rule can be used to compute $P_n(x_i) / (x_i - x_i)$ as a limit: $$ \frac{P_n(x_i)}{x_i - x_i} = \lim_{x\rightarrow x_i} \frac{P_n(x)}{x - x_i} = P_n'(x_i). $$ So the integral computed using Gaussian quadrature is $$ \int_{-1}^1 f(x) \, dx = w_i \left[ P_n'(x_i) \right]^2. \tag{4}\label{gq_sum} $$
We can compute the definite integral of $f$ using integration by parts if we let $u(x)=P_n(x)$ and $v(x) = P_n(x)/(x - x_i).$ Then $f(x) = u'(x)v(x)$ and the desired integral is $$ \begin{align} \int_{-1}^1 u'(x) v(x) \, dx &= \left.u(x) v(x)\right|_{-1}^1 - \int_{-1}^1 u(x)v'(x)\, dx \nonumber\\ &= \left.\frac{\left[ P_n(x) \right]^2}{x - x_i} \right|_{-1}^1 \nonumber\\ &= \frac{1}{1 - x_i} + \frac{1}{1 + x_i} \nonumber\\ &= \frac{2}{1 - x_i^2}. \tag{5}\label{integration_by_parts} \end{align} $$ The integral of $uv'$ in \eqref{integration_by_parts} vanishes since $v'$ is a polynomial of degree $n-2,$ which is orthogonal to $u = P_n,$ because all polynomials of degree less than $n$ are orthogonal to $P_n.$ We are also using the Legendre polynomial scaling $P_n(1) = P_n(-1) = 1$ here. Equating equations \eqref{integration_by_parts} and \eqref{gq_sum} yields equation \eqref{weight_equation}.
- 1,950