Find $\int_{0}^{2\pi} \sqrt{2+2\sin x}dx$ 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:
Link
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.
 A: HINT:$$ 1+ \sin x = \left(\sin \frac{x}{2} + \cos \frac{x}{2}\right)^2$$
A: Using the half-angle formula:
$$\sqrt{\frac{1+\cos x}2} = \left|\cos (x/2)\right|$$
So $$\begin{align}\sqrt{2+2\sin x} &= 2\sqrt{\frac{1+\cos\left(\frac{\pi}{2}-x\right)}2}\\
&=2\left|\cos \left(\frac{\pi}4 - \frac{x}2\right)\right|\end{align}$$
That should be easier to integrate. You have to integrate separately across the intervals where $\cos$ might be negative.
A: $\displaystyle{\\\int_0^{2\pi}\sqrt{2 + 2\sin(x)}\,dx = \int_0^{2\pi}\sqrt{2 + 2\sin(x)}\frac{\sqrt{2 - 2\sin(x)}}{\sqrt{2 - 2\sin(x)}}\,dx = \int_0^{2\pi}\frac{2|\cos(x)|}{\sqrt{2 - 2\sin(x)}}\,dx = \int_0^{\pi/2}\frac{2\cos(x)}{\sqrt{2 - 2\sin(x)}}\,dx + \int_{3\pi/2}^{2\pi}\frac{2\cos(x)}{\sqrt{2 - 2\sin(x)}}\,dx + \int_{\pi/2}^{3\pi/2}\frac{-2\cos(x)}{\sqrt{2 - 2\sin(x)}}\,dx}$.
The integrals are improper, but converge and are simple to evaluate with the substitution $u=\sin x$.
A: I think your mistake was in not recognizing that an absolute value needed to be taken.  A simple substitution illustrates this.
Write $x=\pi/2-y$, the the integral is
$$\begin{align}\sqrt{2} \int_{-3 \pi/2}^{\pi/2} dy \: \sqrt{1+\cos{y}} &= 2 \int_{-3 \pi/2}^{\pi/2} dy \: |\cos{(y/2)}|\\ &= 2 \left [-\int_{-3 \pi/2}^{-\pi} dy\: \cos{(y/2)} + \int_{-\pi}^{\pi/2} dy\: \cos{(y/2)} \right ]\\ &= 4 \left [ \sin{(-3 \pi/4)} - \sin{(-\pi/2)} + \sin{(\pi/4)} - \sin{(-\pi/2)} \right ]\\ &= 4 \left [-\frac{1}{\sqrt{2}} + 1 + \frac{1}{\sqrt{2}} + 1 \right ] \\ &= 8\end{align}$$
A: 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. 
