Simplification of an infinite sum consisting of Legendre polynomials In an article about Legendre Polynomials, I encountered the following simplification.
\begin{align}
 (something)\dots&=\int_{-1}^{1} \int_{-1}^{1} \left[\sum_{i=n+1}^{\infty} \sum_{j=n+1}^{\infty} a_{ij}\, p_{i}(x) \,p_{j}(y) \right]^2\, dx\, dy \qquad (1)\\
&=\int_{-1}^{1} \int_{-1}^{1} \sum_{i=n+1}^{\infty} \sum_{j=n+1}^{\infty} \left[a_{ij}^2\, p_{i}^2(x) \,p_{j}^2(y) \right]\, dx\, dy \, \qquad (2)
\end{align}
where $p_i(x)$ and $p_j(y)$ are Legendre polynomials.
Could you please explain how we can simplify equation $(1)$ to equation $(2)$? As you know infinite sums do not have many properties that finite sums have. By the way, the article can be found here. The above equations are on page 88.
 A: The use of $$ \int_{-1}^{1} P_{n}(x) \, P_{m}(x) \, dx = \frac{2}{2 n + 1} \, \delta_{n,m}$$ will be made as follows:
\begin{align}
I &= \int_{-1}^{1} \int_{-1}^{1} \left[\sum_{i=n+1}^{\infty} \sum_{j=n+1}^{\infty} b_{i,j} \, P_{i}(x) \, P_{j}(y) \right]^2 \, dx\, dy  \\
&= \sum_{i} \sum_{j} \sum_{k} \sum_{m} b_{i,j} \, b_{k,m} \, \int_{-1}^{1} \int_{-1}^{1} P_{i}(x) \, P_{k}(x) \, P_{j}(y) \, P_{m}(y) \, dx \, dy \\
&= \sum_{i} \sum_{j} \sum_{k} \sum_{m} b_{i,j} \, b_{k,m} \, \int_{-1}^{1} P_{i}(x) \, P_{k}(x) \, dx \times \, \int_{-1}^{1} P_{j}(y) \, P_{m}(y) \, dy \\
&= \sum_{i} \sum_{j} \sum_{k} \sum_{m} \frac{4 \, b_{i,j} \, b_{k,m}}{(2 i+1)(2 j +1)} \, \delta_{i,k} \, \delta_{j,m} \\
&= \sum_{i} \sum_{j} \frac{4 \, b_{i,j}^{2}}{(2 i+1)(2 j+1)}
\end{align}
Now, since $$ \int_{-1}^{1} P_{n}^{2}(x) \, dx = \frac{2}{2 n + 1} $$ then
\begin{align} 
I &= \sum_{i} \sum_{j} \frac{4 \, b_{i,j}^{2}}{(2 i+1)(2 j+1)} \\
&= \sum_{i} \sum_{j} b_{i,j}^{2} \, \int_{-1}^{1} \int_{-1}^{1} P_{i}^{2}(x) \, P_{j}^{2}(x) \, dx \\
&= \int_{-1}^{1} \int_{-1}^{1} \sum_{i=n+1}^{\infty} \sum_{j=n+1}^{\infty} \left( b_{i,j}^2 \, P_{i}^2(x) \, P_{j}^2(y) \right) \, dx\, dy.
\end{align}
This gives $$ \int_{-1}^{1} \int_{-1}^{1} \left[\sum_{i=n+1}^{\infty} \sum_{j=n+1}^{\infty} b_{i,j} \, P_{i}(x) \, P_{j}(y) \right]^2 \, dx\, dy = \int_{-1}^{1} \int_{-1}^{1} \sum_{i=n+1}^{\infty} \sum_{j=n+1}^{\infty} \left( b_{i,j}^2 \, P_{i}^2(x) \, P_{j}^2(y) \right) \, dx\, dy $$
