I tried to solve the equation $$\frac{dy}{dx}=\frac{k}{\sin{x}\sqrt{\sin^2{x}-k^2}}$$
and was suggested the substitution $$ \tan{u}=\frac{dy}{dx}\sin{x} $$
after some algebra (I'll add it if necessary) I get
$$ \frac{dy}{du} = \frac{\sin{u}}{\sqrt{\sin^2{u}-k^2}} $$
which is not hard to integrate using $ s = \cos{u} $ and $du = -\csc{u}dt $
and then I get : $$ -\tan^{-1}\left(\frac{\cos{u}}{\sqrt{sin^2{u}-k^2}}\right) $$
but the answer should be with $x$ instead of $u$.
What should I do from here? Why can I make this substitution?