How to integrate $\int \frac{1}{1+{\sqrt{\frac{1}{1+x}}}}dx$? I am trying this integral by substituting $x=\tan^{2}\theta$. Therefore $dx=2(\tan\theta)(\sec^{2}\theta)d\theta$.
Now $\sqrt{\frac{1}{1+x}}=|\cos\theta|$. Now if I take $|\cos\theta|=\cos\theta$, then the result of the above integral will be $\int{(\sec^{2}\frac{\theta}{2})}(\tan\theta)(\sec^{2}\theta)d\theta$.
And for $|\cos\theta|=-\cos\theta$, the result of the above integral will be $\int (\csc^{2}\frac{\theta}{2})(\tan\theta)(\sec^{2}\theta)d\theta$. Thus two different integrals are occurring.
Therefore I thought of taking $|\cos\theta|=(\cos\theta)\text{sgn}(\cos\theta)$. Therefore the above integral will be $\int \frac{1}{1+(\cos\theta)(\text{sgn}(\cos\theta))}d\theta$.
But I can't simplify further. Also I can't understand the case when $|\cos\theta|=0$. Because, when $\cos\theta=0$, then $\tan\theta=\infty$. Therefore, I am in very much doubt with this integral. Please help me out with this integral.
The integral is equivalent to: $$\int \frac{\sqrt{1+x}}{1+\sqrt{1+x}}\mathrm dx=\int \frac{\sqrt u}{1+\sqrt u}\mathrm du $$ Now let $1+\sqrt u=t$, $\mathrm du=2\sqrt u\,\mathrm dt$ and the integral becomes: $$\int \frac{\sqrt u}{1+\sqrt u}\mathrm du=2\int\frac{(t-1)^2}{t}\mathrm dt $$ Can you take it from here?