I am trying to evaluate $$\int \frac{2(\sin(x)\cos(x)-1)}{1-\cos(x)-\sin(x)+\sin(x)\cos(x)}dx$$
There were some methods I could think of (none of them seemed to work).
First is obviously using tangent half-angle formulas, and turns out WolframAlpha evaluates the integral by this method too. But I really couldn't factor things the way W|A did.
The second thing I thought of was using the substitution
$\sin x+\cos x=u$,$x+\pi/4-n\pi=\arcsin\frac{u}{\sqrt{2}}$ or, $dx=\frac{1}{\sqrt{2-u^2}}du$
The integral transforms to $$\int \frac{u^2-3}{(1-2u+u^2)(\sqrt{2-u^2})}du$$ This substitution seems to have failed miserably.
Another way I thought about the problem was to factor the denominator in the original integral. i.e.
$$\int \frac{2(\sin(x)\cos(x)-1)}{(1-\cos(x))(1-\sin(x))}dx$$ I'm not sure on how to solve with this method either. May I ask for help on how to proceed?