Substituting $x$ with $\sin\theta$ during integration

indefinite-integralsintegrationtrigonometry

$\int x^2 \sqrt{1-x^2}dx =?$

I know how to solve this math but am facing a conceptual confusion.

If we substitute $x$ with $\sin\theta$ we can simply solve this problem but my confusion lies in the part $\sqrt{1-x^2}$. Putting $x=\sin\theta$ we can show this equals $\cos\theta$. But why is it $\cos\theta$ instead of $\pm\cos\theta$?. Why are we only considering the principal values of $\theta$? Why are we just simply pulling of any substituent of $x$ and restricting their values? How is it not violating any identity?

Pardon me for asking such type of question in this forum.

Edit:
Using second approach as shown by sir Jose Carlos Santos I solved the integral in the following way.

$x=\sin\theta => dx=\cos\theta d\theta$

Now,
$\int{x^2\sqrt{1-x^2} dx} $
$=\int{\sin^2\theta (-\cos\theta) \cos\theta d\theta} $
$= -\frac1 8 \int{(1-\cos4\theta) d\theta}$
$=-\frac1 8 [1-4\sin\theta\cos\theta(1-2\sin^2\theta)]+c $
$= -\frac 1 8 [\arcsin(x)+x\sqrt{1-x^2}(1-2x^2)]+c $

Where did I do wrong? There shouldn't have been a negative sign before $\arcsin(x)$

Best Answer

Since $x\in[-1,1]$, then, in order to be able to apply the substitution $x=\sin(\theta)$, you must fix some interval $[a,b]$ such that the restriction of $\sin$ to $[a,b]$ is a bijection from $[a,b]$ onto $[-1,1]$. If, say $[a,b]=\left[-\frac\pi2,\frac\pi2\right]$, then$$\cos\theta\geqslant0\implies\sqrt{1-\sin^2\theta}=\cos\theta.$$And if, say, $[a,b]=\left[\frac\pi2,\frac{3\pi}2\right]$, then$$\cos\theta\leqslant0\implies\sqrt{1-\sin^2\theta}=-\cos\theta.$$And both approaches will lead you to the same answer.

In fact, if you do it according to the first approach, what you get is\begin{align}\int\sin^2(\theta)\cos^2(\theta)\,\mathrm d\theta&=\frac14\int\sin^2(2\theta)\,\mathrm d\theta\\&=\frac14\int\frac{1-\cos(4\theta)}2\,\mathrm d\theta\\&=\frac18\int1-\cos(4\theta)\,\mathrm d\theta\\&=\frac\theta8-\frac1{32}\sin(4\theta)\\&=\frac\theta8-\frac1{16}\sin(2\theta)\cos(2\theta)\\&=\frac\theta8-\frac18\left(\sin(\theta)\cos(\theta)\left(1-2\sin^2(\theta)\right)\right)\\&=\frac18\left(\arcsin(x)+x\sqrt{1-x^2}(2x^2-1)\right),\end{align}since $\cos(\theta)=\sqrt{1-\sin^2(\theta)}=\sqrt{1-x^2}$.

What changes now if we use the second approach? In the first place, what we have to compute now is $\displaystyle-\int\sin^2(\theta)\cos^2(\theta)\,\mathrm d\theta$. But now, since $\theta\in\left[\frac\pi2,\frac{3\pi}2\right]$, from $x=\sin(\theta)$, what we get is that $\theta=\pi-\arcsin(x)$ and that $\cos(\theta)=-\sqrt{1-\sin^2(\theta)}=-\sqrt{1-x^2}$. So, in this case we get\begin{align}-\int\sin^2(\theta)\cos^2(\theta)\,\mathrm d\theta&=-\frac18\left(\frac\pi2-\arcsin(x)-x\sqrt{1-x^2}(2x^2-1)\right)\\&=\frac18\left(\arcsin(x)-\frac\pi2+x\sqrt{1-x^2}(2x^2-1)\right),\end{align}which differs from the previous answer by a constant. Therefore, it is in fact the same answer.