4.25.23 \(y''(x)=y(x) \left (a^2+(p-1) p \csc ^2(x)+(q-1) q \sec ^2(x)\right )\)

ODE
\[ y''(x)=y(x) \left (a^2+(p-1) p \csc ^2(x)+(q-1) q \sec ^2(x)\right ) \] ODE Classification

[[_2nd_order, _with_linear_symmetries]]

Book solution method
TO DO

Mathematica
cpu = 0.890018 (sec), leaf count = 146

\[\left \{\left \{y(x)\to \frac {(-1)^{-q} \left (-\sin ^2(x)\right )^{p/2} \cos ^2(x)^{-\frac {q}{2}-\frac {1}{4}} \left (c_1 (-1)^q \cos ^2(x)^{q+\frac {1}{2}} \, _2F_1\left (\frac {1}{2} (-i a+p+q),\frac {1}{2} (i a+p+q);q+\frac {1}{2};\cos ^2(x)\right )+i c_2 \cos ^2(x) \, _2F_1\left (\frac {1}{2} (-i a+p-q+1),\frac {1}{2} (i a+p-q+1);\frac {3}{2}-q;\cos ^2(x)\right )\right )}{\sqrt {\cos (x)}}\right \}\right \}\]

Maple
cpu = 0.348 (sec), leaf count = 94

\[ \left \{ y \left ( x \right ) = \left ( \sin \left ( x \right ) \right ) ^{p} \left ( \left ( \cos \left ( x \right ) \right ) ^{-q+1}{\mbox {$_2$F$_1$}({\frac {p}{2}}-{\frac {q}{2}}+{\frac {i}{2}}a+{\frac {1}{2}},{\frac {p}{2}}-{\frac {q}{2}}-{\frac {i}{2}}a+{\frac {1}{2}};\,{\frac {3}{2}}-q;\, \left ( \cos \left ( x \right ) \right ) ^{2})}{\it \_C2}+ \left ( \cos \left ( x \right ) \right ) ^{q}{\mbox {$_2$F$_1$}({\frac {p}{2}}+{\frac {q}{2}}+{\frac {i}{2}}a,{\frac {p}{2}}+{\frac {q}{2}}-{\frac {i}{2}}a;\,{\frac {1}{2}}+q;\, \left ( \cos \left ( x \right ) \right ) ^{2})}{\it \_C1} \right ) \right \} \] Mathematica raw input

DSolve[y''[x] == (a^2 + (-1 + p)*p*Csc[x]^2 + (-1 + q)*q*Sec[x]^2)*y[x],y[x],x]

Mathematica raw output

{{y[x] -> ((Cos[x]^2)^(-1/4 - q/2)*(I*C[2]*Cos[x]^2*Hypergeometric2F1[(1 - I*a +
 p - q)/2, (1 + I*a + p - q)/2, 3/2 - q, Cos[x]^2] + (-1)^q*C[1]*(Cos[x]^2)^(1/2
 + q)*Hypergeometric2F1[((-I)*a + p + q)/2, (I*a + p + q)/2, 1/2 + q, Cos[x]^2])
*(-Sin[x]^2)^(p/2))/((-1)^q*Sqrt[Cos[x]])}}

Maple raw input

dsolve(diff(diff(y(x),x),x) = (a^2+p*(p-1)*csc(x)^2+q*(q-1)*sec(x)^2)*y(x), y(x),'implicit')

Maple raw output

y(x) = sin(x)^p*(cos(x)^(-q+1)*hypergeom([1/2*p-1/2*q+1/2*I*a+1/2, 1/2*p-1/2*q-1
/2*I*a+1/2],[3/2-q],cos(x)^2)*_C2+cos(x)^q*hypergeom([1/2*p+1/2*q+1/2*I*a, 1/2*p
+1/2*q-1/2*I*a],[1/2+q],cos(x)^2)*_C1)