$$\int \cot x \,dx=\int \frac{\cos x\sin x}{\sin^2 x}\,dx. $$ Assume $t= \sin^2 x$. Then $dt= 2\sin x\cos x \,dx$. Using the identity: $$ \sin 2x =2\sin x\cos x$$
$$\int \cot x \,dx=\int \frac{1}{2t}\,dt=\frac{1}{2}\ln(\sin x)^2+c $$ Can you help me find out what I did wrong? Thanks a lot!
Note that
$$\frac12\ln(\sin(x))^2+c=\ln|\sin(x)|+c$$