In order to integrate
$$\int \sqrt{\frac{x}{x+1}}dx$$
I did
$$x = \tan^2\theta $$
$$\int \sqrt{\frac{x}{x+1}}dx = \int\sqrt{\frac{\tan^2(\theta)}{\tan^2(\theta)+1}} \ 2\tan(\theta)\sec^2(\theta)d\theta \\= \int \frac{|\tan(\theta)|}{|\sec^2(\theta)|}2\tan(\theta)\sec^2(\theta)d\theta = \int \tan^3\theta d\theta = \int\frac{\sin^3 \theta}{\cos^3 \theta}d\theta$$
$$p = \cos\theta \implies dp = -\sin\theta d\theta$$
$$\int\frac{\sin^3 \theta}{\cos^3 \theta}d\theta = -\int\frac{(1-p^2)(-\sin\theta)}{p^3 }d\theta \\= -\int \frac{1-p^2}{p^3}dp = -\int \frac{1}{p^3}dp +\int \frac{1}{p}dp \\= -\frac{p^{-2}}{-2}+\ln|p| = -\frac{(\cos\theta)^{-2}}{-2}+\ln|\cos\theta|$$
$$x = \tan^2\theta \implies \tan\theta= \sqrt{x}\implies \theta = \arctan\sqrt{x}$$
$$= -\frac{(\cos\arctan\sqrt{x})^{-2}}{-2}+\ln|\cos\arctan\sqrt{x}|$$
But the result seems a little bit different from wolfram alpha.
I Know there may be easier ways to solve this integral. But my question is about this method I choose specifically.
Is the answer correct? Also, if it is, is there a way to reduce $\cos\arctan()$ to something simpler?
For the last question, you have a triangle with side lengths $1,x,\sqrt{x^2+1}$ to have tangent $x$. That triangle has cosine $\frac{1}{x^2+1}$. Hence $$\cos \arctan x=\frac{1}{\sqrt{x^2+1}}$$