<s>[INST] How to integrate $\int\frac{\sqrt{1-x}}{\sqrt{x}}\ \mathrm dx$ I'm having a bit of trouble solving this integral:  $$\int\frac{\sqrt{1-x}}{\sqrt{x}}dx$$
Here is my attempt at a solution:
I multiplied the numerator and the denominator of $\frac{\sqrt{1-x}}{\sqrt{x}}$ by $\sqrt{x}$, yielding $$\int\frac{\sqrt{x-x^2}}{x}dx.$$
Further simplification resulted in $$\int\frac{\sqrt{\frac{1}{4}-\left(x-\frac{1}{2}\right)^2}}{x}dx.$$
Using trigonometric substitution, I set $$x-\frac{1}{2}=\frac{1}{2}\sin\theta$$ and solving for the differential $dx$ got $$dx=\frac{1}{2}\cos\theta.$$ Substituting this all back into $\int\frac{\sqrt{\frac{1}{4}-(x-\frac{1}{2})^2}}{x}dx$ (and some simplification later) yielded $$\frac{1}{2}\int{\frac{\cos^2\theta}{\sin\theta+1}}d\theta.$$ By substituting $1-\sin^2\theta$ for $\cos^2\theta$ I obtained $$\frac{1}{2}\int{\frac{1}{\sin\theta+1}-\frac{\sin^2\theta}{\sin\theta+1}d\theta}.$$ The issue I'm having is trying to solve this resultant integral. If there is an easier method to solve the problem, that would be graciously accepted.
 [/INST] Let $$u=\frac{\sqrt{1-x}}{\sqrt{x}}$$
Then $u^2=\frac{1-x}{x}=\frac{1}{x}-1$. Hence
$$x=\frac{1}{u^2+1}$$
$$dx=-\frac{2u}{(u^2+1)^2}$$
Your integral becomes
$$-2 \int \frac{u^2}{(u^2+1)^2}du=-2 \int \frac{u^2+1}{(u^2+1)^2}du+2 \int \frac{1}{(u^2+1)^2}du$$
which can be calculated integrating by parts $\frac{1}{u^2+1}$ or via a standard trig substitution.
</s>