TITLE: Find $\int_{0}^{2\pi} \sqrt{2+2\sin x}dx$
QUESTION [6 upvotes]: I'm trying to find the result of the integral in the title. I know the result is 8 (according to my calculator and also wolframalpha), but I integrated it multiplying it by 
$$
\frac{\sqrt{1-\sin(x)}}{\sqrt{1-\sin(x)}} 
$$
after putting de $\sqrt{2}$ out. After that, substitution $u = 1-\sin(x)$, but my surprise is that it turns out to be 0 when I evaluate the new limits. ¿Can somebody point out my mistake?
I found that in some forum, someone integrated something alike, a bit different, but the result is the same that I got:
http://mathforum.org/library/drmath/view/53659.html
and as you can see, if you convert your integration limits, you get that if $x = 0$, $u = 1 $ and if $ x = 2\pi$, then $u = 1$, so of course, you'll get  $ 0$.
Thank you in advanced.

REPLY [3 votes]: The general idea is right, and a fix will be straightforward. Calculate as you began. We get 
$$\frac{\sqrt{1-\sin^2 x}}{\sqrt{1-\sin x}}.$$
Now comes the source of error. You likely automatically simplified the top to $\cos x$. This is not correct. When $x$ is (strictly) between $\pi/2$ and $3\pi/2$, $\sqrt{1-\sin^2 x}$ is positive, but $\cos x$ is negative. 
Thus, for $\pi/2\lt x\lt 3\pi/2$, your function is actually $\dfrac{-\cos x}{\sqrt{1-\sin x}}$.
So one should split the integral into $3$ parts. Or else graph your function, and see that the areas from $0$ to $\pi/2$, and $\pi/2$ to $\pi$, and so on are all the same.
There is a  technical issue, in that in principle the singularity at $\pi/2$ should be dealt with carefully. But naive integration will give the right answer.