Why can we simplify $\sqrt{1 - \sin^2 u} = \sqrt {\cos^2 u}$ to $\cos u$ instead of $|\cos u|$ when making a trigonometric substitution? $\def\d{\mathrm{d}}$I'm trying to calculate a very typical integral:

$$ \int \frac{\d x}{\sqrt{1-x^{2}}}.$$

In the first step I make substitution: 
$$ x = \sin(u), \qquad \d x = \cos(u)\,\d u.$$
As a consequence,
$$ \int\frac{\cos(u)}{\sqrt{\smash[b]{1-\sin^{2}(u)}}} \,\d u = \int \frac{\cos(u)}{\sqrt{\smash[b]{\cos^{2}(u)}}}\,\d u.$$
In this point I have a problem. For example from this video: 
integral
the result of above integral is: 
 $$ \int \d u  =  u + C = \arcsin(x) + C.$$
I don't agree with that, because $ \sqrt{\cos^2{u}} = |\cos(u)| $, right?
Why is this answer correct?
I will be grateful for an explanation.
Best regards.
 A: First, note that the original integrand, $$\frac{1}{\sqrt{1 - x^2}} ,$$ is defined on the interval $(-1, 1)$.
Now, when we make the usual reverse substitution $x = \sin u$, there are many values $u$ that give a given value $\sin u$ so we must (usually implicitly) choose an interval for $u$ on which the function $u \mapsto \sin u$ is invertible and take on at least the values on which the original integrand is defined (per the above, in our case $\sin u$ must take on all of the values in $(-1, 1)$).
The usual (again, implicit) choice is $I := \left(-\frac{\pi}{2}, \frac{\pi}{2}\right)$. In fact, $\arcsin$ is defined to be the inverse function of the restriction $\sin\vert_{[-\frac{\pi}{2}, \frac{\pi}{2}]}$, so we can also make our choice of interval explicit by declaring $u = \arcsin x$. This choice of interval has the convenient property that for $u \in I$ we have $\cos u > 0$, so $\sqrt{\cos^2 u} = \cos u$ and hence
$$\int \frac{dx}{\sqrt{1 - x^2}} = \int du = u + C = \arcsin x + C$$
as usually claimed.
On the other hand, we could could have chosen another (less convenient) interval from which to take the values of our new variable, say, $\left(\frac{\pi}{2}, \frac{3 \pi}{2}\right)$, on which $\cos v < 0$, so that $\sqrt{\cos^2 v} = -\cos v$. In this case, the symmetry of the sine function gives that we can write this substitution as $v = \pi - \arcsin x$, and so
$$
\begin{align*}
\int\frac{dx}{\sqrt{1 - x^2}}
&= \int\frac{\cos v \,dv}{\sqrt{|\cos^2 v|}}\\
&= \int\frac{\cos v \,dv}{-\cos v}\\
&= -\int dv\\
&= - v + C'\\
&= -(\pi - \arcsin x) + C'\\
&= \arcsin x + (C' - \pi) .
\end{align*}
$$
By absorbing $-\pi$ in the constant, i.e., setting $C := C' - \pi$, we recover the answer we produced using the usual choice of interval.
A: Notice that $x\in[-1,1]$ then $u\in[-\frac\pi2,\frac\pi2]$ and for such $u$ we have that $\cos u\geq 0$ so $\sqrt{\cos^2 u}=\cos u$
A: We’re often a bit sloppy when doing substitutions. In this case the substitution is
$$
u=\arcsin x
$$
which is possible because $-1<x<1$.
Hence $-\pi/2\le u\le\pi/2$ by definition of arcsine and therefore $\cos u\ge0$.
In the particular case, since the domain for $x$ is $-1<x<1$, we have $-\pi/2<u<\pi/2$, so $\cos u>0$.
You have to remember that this kind of substitution needs to be bijective as we're trying to force in a derivative, so to be able to apply the chain rule.
In other situations this is not needed, precisely when the derivative we seek is already present; for instance
$$
\int\sin x\cos x\,dx=
\Bigl[\begin{aligned}u&=\sin x\\du&=\cos x\,dx\end{aligned}\Bigr]=
\int u\,du=\frac{1}{2}u^2+c=\frac{1}{2}\sin^2x+c
$$
Here we don't need the substitution to be bijective (and indeed it isn't in the domain of the function), because we're directly applying the chain rule.
