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