<s>[INST] How do I solve $\int\frac{dx}{\sin x+\cos x-1}$? Please help me find the following indefinite integral:
$$\int\dfrac{dx}{\sin x+\cos x-1}$$
I have tried many different substitutions to no avail. Any help is appreciated.
 [/INST] Another way, using trigonometric identities 
$$\sin{2x} = 2 \cdot \sin{x} \cdot \cos{x}$$
$$1 - \cos{x} = 2 \cdot \sin^2\frac{x}{2}$$
is as follows:
$$\int\dfrac{dx}{\sin x+\cos x-1}$$
$$= \int\dfrac{dx}{\sin x-(1 - \cos x)}$$
$$= \int\dfrac{dx}{2 \cdot \sin\frac{x}{2} \cdot \cos\frac{x}{2}-(2\cdot sin^2\frac{x}{2})}$$
$$= \int\dfrac{dx}{2 \cdot \sin\frac{x}{2}\cdot \big(\cos\frac{x}{2}-sin\frac{x}{2}\big)}$$
$$= \frac{1}{2}\int\dfrac{cosec\frac{x}{2} \cdot dx}{\big(\cos\frac{x}{2}-sin\frac{x}{2}\big)}$$
$$= \frac{1}{2}\int\dfrac{cosec^2\frac{x}{2} \cdot dx}{\big(\cot\frac{x}{2}-1\big)}$$
$$= \int\dfrac{cosec^2\frac{x}{2} \cdot \frac{dx}{2}}{\big(\cot\frac{x}{2}-1\big)}$$
$$ = -ln\bigg(cot\bigg(\frac{x}{2}\bigg) - 1\bigg) + C$$
Hence
$$\int\dfrac{dx}{\sin x+\cos x-1}= \boxed{- ln\bigg(cot\bigg(\frac{x}{2}\bigg) - 1\bigg) + C}$$
</s>