##### 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 Classiﬁcation

[[_2nd_order, _with_linear_symmetries]]

Book solution method
TO DO

Mathematica
cpu = 1.19834 (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 = 1.177 (sec), leaf count = 97

$\left [y \left (x \right ) = \textit {\_C1} \left (\cos ^{q}\left (x \right )\right ) \left (\sin ^{p}\left (x \right )\right ) \hypergeom \left (\left [\frac {p}{2}+\frac {q}{2}+\frac {i a}{2}, \frac {p}{2}+\frac {q}{2}-\frac {i a}{2}\right ], \left [\frac {1}{2}+q \right ], \cos ^{2}\left (x \right )\right )+\textit {\_C2} \left (\cos ^{-q +1}\left (x \right )\right ) \left (\sin ^{p}\left (x \right )\right ) \hypergeom \left (\left [\frac {p}{2}-\frac {q}{2}+\frac {i a}{2}+\frac {1}{2}, \frac {p}{2}-\frac {q}{2}-\frac {i a}{2}+\frac {1}{2}\right ], \left [\frac {3}{2}-q \right ], \cos ^{2}\left (x \right )\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))

Maple raw output

[y(x) = _C1*cos(x)^q*sin(x)^p*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)+_C2*cos(x)^(-q+1)*sin(x)^p*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)]