# Evaluating $\displaystyle \int_{0}^{\frac{\pi}{2}}\frac{\sqrt{\sin x}}{\sqrt{\sin x}+\sqrt{\cos x}}dx$

I have to evaluate:

$$\displaystyle \int_{0}^{\frac{\pi}{2}}\frac{\sqrt{\sin x}}{\sqrt{\sin x}+\sqrt{\cos x}}dx$$ I can't get the right answer! So please help me out!

-
I can't say why, but the result, according to Mathematica is $\pi/4$. – Siminore Jul 6 '12 at 8:18
It seems the indefinite integral here is an elliptic integral. – GEdgar Jul 6 '12 at 20:41

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}{\sin^a x + \sin^a x } dx = \frac{\pi }{4}$ for $a>0$ (same trick.)

-
Is the $f$-continuous condition actually necessary? It seems like the equation you state should be true for any integrable function... – Ben Millwood Jul 6 '12 at 10:16

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}.$$

-