I have to evaluate:

$$\int\_{0}^{\pi/2}\frac{\sqrt{\sin x}}{\sqrt{\sin x}+\sqrt{\cos x}}\, \mathrm{d}x. $$
I can't get the right answer! So please help me out!
['https://math.stackexchange.com/questions/167409', 'https://math.stackexchange.com', 'https://math.stackexchange.com/users/27579/']
Let $I$ denote the integral and consider the substitution $u= \frac{\pi }{2} - x.$ Then $I = \displaystyle\int\_0^{\frac{\pi }{2}} \frac{\sqrt{\cos u}}{\sqrt{\cos u } + \sqrt{\sin u }} du$ and $2I = \displaystyle\int\_0^{\frac{\pi }{2}} \frac{\sqrt{\cos u} + \sqrt{\sin u }}{\sqrt{\cos u } + \sqrt{\sin u }} du = \frac{\pi }{2}.$ Hence $I = \frac{\pi }{4}.$

In general, $ \displaystyle\int\_0^a f(x) dx = \displaystyle\int\_0^a f(a-x) $ $dx$ whenever $f$ is integrable, and $\displaystyle\int\_0^{\frac{\pi }{2}} \frac{\cos^a x}{\cos^a x + \sin^a x } dx = \displaystyle\int\_0^{\frac{\pi }{2}} \frac{\sin^a x}{\cos^a x + \sin^a x } dx = \frac{\pi }{4}$ for $a>0$ (same trick.)
Note that $\sin(\pi/2-x)=\cos x$ and $\cos(\pi/2-x)=\sin x$. The answer will exploit the symmetry. 

Break up the original integral into two parts, (i) from $0$ to $\pi/4$ and (ii) from $\pi/4$ to $\pi/2$.
So our first integral is
$$\int\_{x=0}^{\pi/4} \frac{\sqrt{\sin x}}{\sqrt{\sin x}+\sqrt{\cos x}}\,dx.\tag{$1$} $$

For the second integral, make the change of variable $u=\pi/2-x$. Using the fact that $\sin x=\sin(\pi/2-u)=\cos u$ and $\cos x=\cos(\pi/2-u)=\sin u$, and the fact that $dx=-du$, we get after not much work
$$\int\_{u=\pi/4}^{0} -\frac{\sqrt{\cos u}}{\sqrt{\cos u}+\sqrt{\sin u}}\,du$$
Change the dummy variable of integration variable to the **name** $x$. Also, do the integration in the "right" order, $0$ to $\pi/4$. That changes the sign, so our second integral is equal to 
$$\int\_{x=0}^{\pi/4} \frac{\sqrt{\cos x}}{\sqrt{\cos x}+\sqrt{\sin x}}\,dx.\tag{$2$}$$
Our original integral is the **sum** of the integrals $(1)$ and $(2)$. Add, and note the beautiful cancellation $\frac{\sqrt{\sin x}}{\sqrt{\sin x}+\sqrt{\cos x}}+ \frac{\sqrt{\cos x}}{\sqrt{\cos x}+\sqrt{\sin x}}=1$. Thus our original integral is equal to 
$$\int\_0^{\pi/4}1\,dx.$$
This is trivial to compute: the answer is $\pi/4$.

**Remark:** Let $f(x)$ and $g(x)$ be any reasonably nice functions such that $g(x)=f(a-x)$. Exactly the same argument shows that
$$\int\_0^a\frac{f(x)}{f(x)+g(x)}\,dx=\frac{a}{2}.$$