Q: Integrate the function $\sqrt{\frac{1-\sqrt{x}}{1+\sqrt{x}}}$.
Let $I=\sqrt{\frac{1-\sqrt{x}}{1+\sqrt{x}}}$
Let $x=\cos ^2 \theta \Longrightarrow d x=-2 \sin \theta \cos \theta d \theta$
And $\sqrt{x}=\cos \theta \Longrightarrow \theta=\cos ^{-1} \sqrt{x}$
Using the above substitution we can write the integral as
$I=\int \sqrt{\frac{1-\sqrt{\cos ^2 \theta}}{1+\sqrt{\cos ^2 \theta}}}(-2 \sin \theta \cos \theta) d \theta$
$=-\int \sqrt{\frac{1-\cos \theta}{1+\cos \theta}}(2 \sin \theta \cos \theta) d \theta$
$=-\int \sqrt{\tan ^2 \frac{\theta}{2}}(2 \sin \theta \cos \theta) d \theta$
$=-\int \sqrt{\tan ^2 \frac{\theta}{2}}\left(2.2 \sin \frac{\theta}{2} \cos \frac{\theta}{2} \cos \theta\right) d \theta$
$=-4 \int \sin ^2 \frac{\theta}{2} \cos \theta d \theta$
$=-4 \int \sin ^2 \frac{\theta}{2}\left(2 \cos ^2 \frac{\theta}{2}-1\right) d \theta$
$=\int-4 \cdot\left\{\left[2 \cdot \sin ^2\left(\frac{\theta}{2}\right) \cos ^2\left(\frac{\theta}{2}\right)\right]-\sin ^2\left(\frac{\theta}{2}\right)\right\} \mathrm{d} \theta$
$=\int-2 \cdot\left(2 \sin \frac{\theta}{2} \cos \frac{\theta}{2}\right)^2 \mathrm{~d} \theta+4 \int \sin ^2\left(\frac{\theta}{2}\right) \mathrm{d} \theta$
$=-2 \cdot \int \sin ^2 \theta \mathrm{~d} \theta+4 \int \sin ^2\left(\frac{\theta}{2}\right) \mathrm{d} \theta$
$=\int-2 \cdot\left(2 \sin \frac{\theta}{2} \cos \frac{\theta}{2}\right)^2 \mathrm{~d} \theta+4 \int \sin ^2\left(\frac{\theta}{2}\right) \mathrm{d} \theta$
$=-2 \cdot \int \sin ^2 \theta \mathrm{~d} \theta+4 \int \sin ^2\left(\frac{\theta}{2}\right) \mathrm{d} \theta$
$=-2 \cdot \int \frac{1-\cos 2 \theta}{2} \mathrm{~d} \theta+4 \int \frac{1-\cos \theta}{2} \mathrm{~d} \theta$
$=-2 \cdot \int \sin ^2 \theta \mathrm{~d} \theta+4 \int \sin ^2\left(\frac{\theta}{2}\right) \mathrm{d} \theta$
$=-2 \cdot \int \frac{1-\cos 2 \theta}{2} \mathrm{~d} \theta+4 \int \frac{1-\cos \theta}{2} \mathrm{~d} \theta$
$=-2\left[\frac{\theta}{2}-\frac{\sin 2 \theta}{4}\right]+4\left[\frac{\theta}{2}-\frac{\sin \theta}{2}\right]+C$
$=-\theta+\frac{\sin 2 \theta}{2}+2 \theta-2 \sin \theta+C$
$=\theta+\frac{2 \cdot \sin \theta \cdot \cos \theta}{2}-2 \sin \theta+C$
$=\theta+\frac{2 \cdot \sqrt{1-\cos ^2 \theta} \cdot \cos \theta}{2}-2 \sqrt{1-\cos ^2 \theta}+C$
$=\cos ^{-1} \sqrt{x}+\sqrt{1-x} \cdot \sqrt{x}-2 \sqrt{1-x}+C$
$\Rightarrow I=\cos ^{-1} \sqrt{x}+\sqrt{x-x^2}-2 \sqrt{1-x}+C$