$ \int {1\over1-\sin 2x}dx = \int {1\over \sin^2 x-2\sin x\cos x+\cos^2x}dx = \int {1\over (\sin x-\cos x)^2}dx $
From here I get two different answers, depending on whether I factor out $\sin x$ or $\cos x$. Factoring out $\sin x$, this one is correct according to WolframAlpha:
$=\int {1\over [\sin x(1-{\cos x\over \sin x})]^2}dx=\int {1\over \sin^2x(1-{\cos x\over \sin x})^2}dx = \int {1\over(1-\cot x)^2}d(1-\cot x)$ $={1\over \cot x-1}+C$
But when I factor out $\cos x$:
$=\int {1\over [\cos x({\sin x\over \cos x}-1)]^2}dx=\int {1\over \cos^2x({\sin x\over \cos x}-1)^2}dx = \int {1\over(\tan x-1)^2}d(\tan x-1)$ $={1\over 1-\tan x}+C$
I bet it's just some stupid typo that I'm missing, I can't figure it out.
Thanks.