Consider the Integration
$\int_{-1}^{1}x^{2}P_{n+1}(x)P_{n-1}(x)dx$
where, $P_{n+1}(x) ,P_{n-1}(x)$ are Legendre Polynomials
Applying integration by parts,we get $x^{2}\int_{-1}^{+1}P_{n+1}(x)P_{n-1}(x)dx -\int_{-1}^{+1}2x\int_{-1}^{+1}P_{n+1}(x)P_{n-1}(x)dx$
(By taking $x^{2}$ as the first function)
Now, $\int_{-1}^{+1}P_{n+1}(x)P_{n-1}(x)dx = 0$
So,$\int_{-1}^{1}x^{2}P_{n+1}(x)P_{n-1}(x)dx = 0$
But the actual answer is not zero, am i doing it wrong somewhere ?
Partial integration is not the way to go. Use the relationship $$(2n+1)xP_n(x) = (n+1)P_{n+1}(x) + nP_{n-1}(x)$$ from which it follows that both $$(2n-1)xP_{n-1}(x) = nP_n(x) + (n-1)P_{n-2}(x)$$ and $$(2n+3)xP_{n+1}(x) = (n+2)P_{n+2}(x) + (n+1)P_n(x)$$ ,thus $$x^2P_{n+1}(x)P_{n-1}(x) = \frac{1}{(2n+3)(2n-1)}[(n+2)P_{n+2}(x) + (n+1)P_n(x)]\cdot[nP_n(x) + (n-1)P_{n-2}(x)]$$ and thus (remember orthogonality of different $P_n$ and $P_m$ ):
\begin{equation} \begin{split} \int_{-1}^1 x^2P_{n+1}(x)P_{n-1}(x)dx& = \frac{n(n+1)}{(2n+3)(2n-1)}\int_{-1}^1 P_n(x)^2dx \\ &= \frac{2n(n+1)}{(2n+3)(2n+1)(2n-1)} \end{split} \end{equation}