Evaluating : $\int \frac{\sec x-\tan x}{\sqrt{\sin^2x-\sin x}} \mathrm{d}x$ As a part of a bigger question, I was asked to evaluate the integral : 

$$\int \frac{\sec x-\tan x}{\sqrt{\sin^2x-\sin x}} \mathrm{d}x$$

Here's what I tried:
(Please bear with me, it gets quite lengthy)
$$\int \frac{\sec x-\tan x}{\sqrt{\sin^2x-\sin x}} \mathrm{d}x$$
$$=\int \frac{1-\sin x}{\cos x \sqrt{\sin^2x-\sin x}}\mathrm{d}x$$
$$=\int \frac{(1-\sin x) \cos x }{\sqrt{\sin^2 x-\sin x}(1-\sin^2 x)}\mathrm{d}x$$
$$=\int \frac{\cos x}{(\sqrt{\sin^2x -\sin x}(1+\sin x)}\mathrm{d}x$$
Substituting $\sin x= t$, we're left with a comparatively good-looking integral:
$$\int \frac {\mathrm{d}t}{(1+t)\sqrt{t^2-t}}$$
Well, this integral looks simple and maybe is, but I'm having real trouble evaluating it :
$$\frac12\int \frac{t+1-(t-1)}{(1+t)\sqrt{t^2-t}}\mathrm{d}t$$
$$=\frac12\left[\int \frac{\mathrm{d}t}{\sqrt{t^2-t}}-\int \frac{t-1}{\sqrt{t^2-t}}\mathrm{d}t\right]$$
Now this is getting longer than I expected it to. Can anyone help me find a shorter and quicker solution to this problem?
Thanks in advance.
 A: Starting from
$$I=\int \frac {\mathrm{d}t}{(1+t)\sqrt{t^2-t}},$$
substitute
$$\dfrac 1 {t+1}=u \implies t=\dfrac 1u-1, ~  dt=-\dfrac {du}{u^2}.$$
The integral becomes
$$I=-\int \dfrac {du}{\sqrt {2u^2-3u+1}}.$$
Then since
$$\int\frac{dx}{\sqrt{ax^2+bx+c}}=\frac{1}{\sqrt{a}}\ln\left|2\sqrt{a}\sqrt{ax^2+bx+c}+2ax+b\right|+c_1,$$
we have
$$I=-\frac{1}{\sqrt{2}}\ln\left|2\sqrt{2}\sqrt{2u^2-3u+1}+4u-3\right|+c_1.$$
As $u=\dfrac{1}{t+1}$,
$$I=-\frac{1}{\sqrt{2}}\ln\left|2\sqrt{2}\sqrt{\frac{t(t-1)}{(t+1)^2}}+\frac{4}{t+1}-3\right|+c_1.$$
And the original substitution $\sin x=t$ forms
$$I=-\frac{1}{\sqrt{2}}\ln\left|2\sqrt{2}\sqrt{\frac{\sin x(\sin x-1)}{(\sin x+1)^2}}+\frac{4}{\sin x+1}-3\right|+c_1.$$
A: Substitute $u=\frac 1t \implies dt =\frac{-1}{u^2} du$ to get
$$-\int \frac{du}{(u+1)\sqrt{1-u}}$$
Now, substitute $w=\sqrt{1-u} \implies dw=\frac{-1}{2\sqrt{1-u}} du$
$$=2\int\frac{dw}{2-w^2}= \frac{1}{\sqrt 2} \log \left( \frac{w+\sqrt 2}{w-\sqrt 2} \right) + C$$
Reverting back to $x$, $$=\frac{1}{\sqrt 2}\log \left( \frac{\sqrt{\sin x +1} + \sqrt{2\sin x}}{\sqrt{\sin x-1} - \sqrt{2\sin x}} \right) + C$$
A: The valid domain requires that $\sin x \in (-1, 0)$, or,
$\csc x<-1$, which allows the integral to be rewritten as
\begin{align}
I=\int \frac{\sec x-\tan x}{\sqrt{\sin^2x-\sin x}} dx
=&\int \sec x\sqrt{1-\csc x}\ dx\\
\end{align}
Then, substitute $t= \sqrt{1-\csc x}>\sqrt2$ to integrate
$$ I=\int\frac2{t^2-2}dt=-\sqrt2\coth^{-1}\frac t{\sqrt2}
=- \sqrt2 \coth^{-1}\sqrt{\frac {1-\csc x}2}
$$
A: Letting $\sin x=\sec^2 \theta$, we have
$$
\begin{aligned}I&=\int \frac{2 \sec ^2 \theta \tan \theta d \theta}{\left(1+\sec ^2 \theta\right) \sec \theta \tan \theta}\\&= 2 \int \frac{d(\sin \theta)}{2-\sin ^2 \theta}\\&= \frac{1}{\sqrt{2}} \ln \left|\frac{\sqrt{2}+\sin \theta}{\sqrt{2}-\sin \theta}\right|+C\\&= \frac 1{\sqrt{2}} \ln \left|\frac{\sqrt{2 \sin x}+\sqrt{\sin x+1}}{\sqrt{2 \sin x}-\sqrt{\sin x+1}}\right| +C \end{aligned}
$$
