4.31.41 \(n (n+1) y(x)+\left (1-x^2\right ) y''(x)-2 x y'(x)=\frac {2 ((-n-1) x P_n(x)+(n+1) P_{n+1}(x))}{x^2-1}\)

ODE
\[ n (n+1) y(x)+\left (1-x^2\right ) y''(x)-2 x y'(x)=\frac {2 ((-n-1) x P_n(x)+(n+1) P_{n+1}(x))}{x^2-1} \] ODE Classification

[[_2nd_order, _linear, _nonhomogeneous]]

Book solution method
TO DO

Mathematica
cpu = 599.998 (sec), leaf count = 0 , timed out

$Aborted

Maple
cpu = 0.168 (sec), leaf count = 119

\[ \left \{ y \left ( x \right ) ={\it LegendreP} \left ( n,x \right ) {\it \_C2}+{\it LegendreQ} \left ( n,x \right ) {\it \_C1}-2\,\int \!{\frac {{\it LegendreQ} \left ( n,x \right ) \left ( -x{\it LegendreP} \left ( n,x \right ) +{\it LegendreP} \left ( n+1,x \right ) \right ) }{ \left ( {\it LegendreP} \left ( n+1,x \right ) {\it LegendreQ} \left ( n,x \right ) -{\it LegendreP} \left ( n,x \right ) {\it LegendreQ} \left ( n+1,x \right ) \right ) \left ( {x}^{2}-1 \right ) }}\,{\rm d}x{\it LegendreP} \left ( n,x \right ) +2\,\int \!{\frac { \left ( -x{\it LegendreP} \left ( n,x \right ) +{\it LegendreP} \left ( n+1,x \right ) \right ) {\it LegendreP} \left ( n,x \right ) }{ \left ( {\it LegendreP} \left ( n+1,x \right ) {\it LegendreQ} \left ( n,x \right ) -{\it LegendreP} \left ( n,x \right ) {\it LegendreQ} \left ( n+1,x \right ) \right ) \left ( {x}^{2}-1 \right ) }}\,{\rm d}x{\it LegendreQ} \left ( n,x \right ) \right \} \] Mathematica raw input

DSolve[n*(1 + n)*y[x] - 2*x*y'[x] + (1 - x^2)*y''[x] == (2*((-1 - n)*x*LegendreP[n, x] + (1 + n)*LegendreP[1 + n, x]))/(-1 + x^2),y[x],x]

Mathematica raw output

$Aborted

Maple raw input

dsolve((-x^2+1)*diff(diff(y(x),x),x)-2*x*diff(y(x),x)+n*(n+1)*y(x) = 2*((n+1)*LegendreP(n+1,x)-(n+1)*x*LegendreP(n,x))/(x^2-1), y(x),'implicit')

Maple raw output

y(x) = LegendreP(n,x)*_C2+LegendreQ(n,x)*_C1-2*Int(LegendreQ(n,x)*(-x*LegendreP(
n,x)+LegendreP(n+1,x))/(LegendreP(n+1,x)*LegendreQ(n,x)-LegendreP(n,x)*LegendreQ
(n+1,x))/(x^2-1),x)*LegendreP(n,x)+2*Int((-x*LegendreP(n,x)+LegendreP(n+1,x))*Le
gendreP(n,x)/(LegendreP(n+1,x)*LegendreQ(n,x)-LegendreP(n,x)*LegendreQ(n+1,x))/(
x^2-1),x)*LegendreQ(n,x)