ODE
\[ y(x) \left (p (p+1)-k^2 \csc ^2(x)\right )+y''(x)+\cot (x) y'(x)=0 \] ODE Classification
[[_2nd_order, _with_linear_symmetries]]
Book solution method
TO DO
Mathematica ✓
cpu = 0.558687 (sec), leaf count = 22
\[\left \{\left \{y(x)\to c_1 P_p^k(\cos (x))+c_2 Q_p^k(\cos (x))\right \}\right \}\]
Maple ✓
cpu = 0.236 (sec), leaf count = 19
\[ \left \{ y \left ( x \right ) ={\it \_C1}\,{\it LegendreP} \left ( p,k,\cos \left ( x \right ) \right ) +{\it \_C2}\,{\it LegendreQ} \left ( p,k,\cos \left ( x \right ) \right ) \right \} \] Mathematica raw input
DSolve[(p*(1 + p) - k^2*Csc[x]^2)*y[x] + Cot[x]*y'[x] + y''[x] == 0,y[x],x]
Mathematica raw output
{{y[x] -> C[1]*LegendreP[p, k, Cos[x]] + C[2]*LegendreQ[p, k, Cos[x]]}}
Maple raw input
dsolve(diff(diff(y(x),x),x)+cot(x)*diff(y(x),x)+(p*(p+1)-k^2*csc(x)^2)*y(x) = 0, y(x),'implicit')
Maple raw output
y(x) = _C1*LegendreP(p,k,cos(x))+_C2*LegendreQ(p,k,cos(x))