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