Evaluating $\int\sqrt{1-\sin x}\ dx$ One of the method to find the integral $$\int\sqrt{1-\sin x}\ dx$$ is by multiplying by $\dfrac{1+\sin x}{1+\sin x}$ inside the root. Then, by using the identity $\sin^2x+\cos^2x=1$ , we get $$\int\dfrac{\sqrt{\cos^2x}}{\sqrt{1+\sin x}}\ dx$$
The next step is we remove the square with the root and using the substitution $u=\sin x$. My question is why ? Why don't we put an absolute value of $\cos x$? So, we have two answers. Is this situation always true in any similar situation in indefinite integrals? 
Sorry, if my question is trivial. Thanks
 A: As Simply Beautiful Art says, you are right. The indefinite integral obtained by using $\sqrt{\cos(x)^2} = \cos x$ is only valid between $\pm \frac{\pi}{2}$ (and at $2\pi$ intervals).
The actual value of the integral (praise Wolfram with your whole heart) is $$\frac{2 \sqrt{1-\sin (x)} \left(\sin \left(\frac{x}{2}\right)+\cos
   \left(\frac{x}{2}\right)\right)}{\cos \left(\frac{x}{2}\right)-\sin
   \left(\frac{x}{2}\right)}$$
WolframAlpha's "show steps" functionality makes the same mistake that you pointed out, and then cops out by saying at the end "This is equivalent, for restricted values of $x$, to the actual answer". Of course, Mathematica's Integrate function gets it right because it uses voodoo.
A: Here is another way:
$$\int \sqrt{1-\sin(x)}~dx=\int \sqrt{1-\cos\left(\frac{\pi}{2}-x\right)}~dx$$
We know that:
$$1-\cos(\theta)\equiv 2\sin^2\left(\frac{\theta}{2}\right)$$
Hence:
$$\int \sqrt{1-\sin(x)}~dx=\int \sqrt{2\sin^2\left(\frac{\pi}{4}-x\right)}~dx=\sqrt{2}\cdot \int \sin\left(\frac{\pi}{4}-x\right)dx=\sqrt{2}\cos\left(\frac{\pi}{4}-x\right)+c$$ 
A: Another way:
\begin{align}
\int\sqrt{1-\sin x}\ dx&=\int\sqrt{1-2\sin \dfrac x2 \cos \dfrac x2}\ dx\\
&=\int\sqrt{\left(\sin^2 \dfrac x2+\cos^2 \dfrac x2\right)-2\sin \dfrac x2 \cos \dfrac x2}\ dx\\
&=\int\sqrt{\left(\sin \dfrac x2-\cos \dfrac x2\right)^2}\ dx\\
&=\int \left(\sin \dfrac x2-\cos \dfrac x2\right)\ dx\\
&=2\left(-\cos\dfrac x2-\sin\dfrac x2\right)+\text{const.}
\end{align}
A: I would like to suggest another solution, using the substitution $\sin(x) = \sin^2(u)$. Then $x = \arcsin(\sin^2(u))$ (note that $\arcsin(t) = \sin^{-1}(t)$, $\arcsin(t)$ is the inverse function of $\sin(t)$).
Hence, $dx = d \biggl( \arcsin(\sin^{2}(u))\biggr) \Rightarrow dx = \frac{d\biggl(\sin^{2}(u) \biggr)}{\sqrt{1-\bigl(\sin^{2}(u)\bigr)^{2}}}$
$$\int \sqrt{1-\sin(x)}dx = \int \sqrt{1 - \sin^{2}(u)}\frac{d\biggl(\sin^{2}(u) \biggr)}{\sqrt{1-\bigl(\sin^{2}(u)\bigr)^{2}}}$$
$$\sqrt{1-\bigl(\sin^{2}(u)\bigr)^2} = \sqrt{(1 - \sin^{2}(u))(1 + \sin^{2}(u))}$$
$$\int \frac{d\biggl(\sin^{2}(u) \biggr)}{\sqrt{1+\sin^{2}(u)}} = \int \frac{d\biggl(1 + \sin^{2}(u) \biggr)}{\sqrt{1+ \sin^{2}(u) }}$$

Using the formula: $\int \frac{du}{\sqrt u} = 2u^{1/2} + C$ we get:
$$2\biggl(1 + \sin^{2}(u)\biggr)^{1/2} + C$$
and the final result is:
$$\int \sqrt{1-\sin(x)}dx = 2\biggl(1 + \sin^{2}(u)\biggr)^{1/2} + C = 2\biggl(1 + \sin(x)\biggr)^{1/2} + C$$
