Evaluate $\int_0^{\frac{\pi}{2}}\frac{\sqrt{\sin x}}{\sqrt{\sin x}+\sqrt{\cos x}} dx$

Evaluate
$$\int_0^{\frac{\pi}{2}}\frac{\sqrt{\sin x}}{\sqrt{\sin x}+\sqrt{\cos x}} dx.$$

Hint: First show that for any function $f(x)$ the following formula holds 
\[\int_{a}^{b}\frac{f(x)}{f(a+b-x)+f(x)}dx=\frac{b-a}{2}.\]

Answer

Let $u=a+b-x$. Then $du=-dx$ and 
\[I=\int_a^{b}\frac{f(x)}{f(a+b-x)+f(x)}dx\]
\[=\int_{b}^{a}\frac{f(a+b-u)}{f(u)+f(a+b-u)}(-du)\]
\[=\int_{a}^{b}\frac{f(a+b-u)}{f(u)+f(a+b-u)}du\]
\[=\int_{a}^{b}\frac{f(a+b-x)}{f(x)+f(a+b-x)}dx=I.\]
Hence
\[2I=\int_a^{b}\frac{f(x)}{f(a+b-x)+f(x)}dx+\int_{a}^{b}\frac{f(a+b-x)}{f(x)+f(a+b-x)}dx\]
\[=\int_a^{b}\frac{f(x)+f(a+b-x)}{f(a+b-x)+f(x)}dx=\int_a^{b}1dx=b-a.\]
So 
\[I=\int_a^{b}\frac{f(x)}{f(a+b-x)+f(x)}dx=\frac{b-a}{2}.\]
Now letting $f(x)=\sqrt{\sin x}$, $a=0, b=\frac{\pi}{2}$. We have
\[f(\frac{\pi}{2}+0-x)=\sqrt{\sin (\frac{\pi}{2}-x)}=\sqrt{\cos x}.\]
Hence
\[\int_0^{\frac{\pi}{2}}\frac{\sqrt{\sin x}}{\sqrt{\sin x}+\sqrt{\cos x}}dx=\int_0^{\frac{\pi}{2}}\frac{f(x)}{f(0+\frac{\pi}{2}-x)+f(x)}dx\]
\[\frac{\frac{\pi}{2}-0}{2}=\frac{\pi}{4}.\]

The answer is accepted.