DSolve[-(((-1 + n)*n + a*Sin[x]^2)*y[x]) + Sin[x]^2*Derivative[2][y][x] == 0,y[x],x]