For this indefinite integral:
$$\int \frac{\csc(x)\cot(x)}{1+\csc^2(x)} \, dx $$
I first used $u$-substitution and set $u =\csc(x)$. Using this I got the integration to be:
$$ -\arctan(\csc(x))+C $$
This answer appears to be correct, however on the solutions it appears to be,
$$ \arctan(\sin(x))+C $$
I searched online and found that the second solution was found using trigonometric substitution. If anyone could explain to me how the second solution was worked out it would be greatly appreciated.
We get $\dfrac {\dfrac {\cos x}{\sin^2x}}{\dfrac {\sin^2x+1}{\sin^2x}}=\dfrac {\cos x}{1+\sin^2x} $ for the integrand, and the result follows.