Indefinite integral. Where is the mistake?

The problem was to compute $I=\int x^2\sin^{-1}(x)\ dx$

(where $\sin^{-1}(x)$ is the inverse function of $\sin(x)$).

The answer of my students: firstly, we put $u=\sin^{-1}(x)$, so $x=\sin(u)$ and $dx=\cos(u)\ du$. Thus, the given integral is $$I=\int u\cos(u)\sin^2(u)\ du$$

Now, we do the substitution $v=\pi-u$, so $dv=-du$ and $$I=-\int (\pi-v)\cos(\pi-v)\sin^2(\pi-v)\ dv$$ Since $\cos(\pi-v)=-\cos(v)$ and $\sin(\pi-v)=\sin(v)$, it follows that $$I=\int (\pi-v)\cos(v)\sin^2(v)\ dv$$

As a consequence, $$I=\int\pi\cos(v)\sin^2(v)\ dv-I=\frac{\pi\sin^3(v)}{3}-I=\frac{\pi x^3}{3}-I$$.

Finally, $$I=\frac{\pi x^3}{6}+C$$

This result is obviously false but where is the mistake? My only guess is that $u\in(-\frac{\pi}{2},\frac{\pi}{2})$ and $u\in(\frac{\pi}{2},\frac{3\pi}{2})$, so $\int v\cos(v)\sin^2(v)\ dv$ is not equal to $I$ but I am not totally convinced.


This is a fantastic error. Basically the problem is that $$\int v \cos(v) \sin^2(v)\,dv \neq \int u\cos(u)\sin^2(u)\,du.$$ The reason is because you have two indefinite integrals in different variables. Here is a simpler example: we do not have $$\int x\,dx= \int v\,dv,$$ as $$\int x\,dx=\frac{x^2}{2}+C_1$$ and $$\int v\,dv=\frac{v^2}{2}+C_2$$ for these integrals to be equal, we would need $x^2 = v^2 +C_3$, and that is not necessarily true. In fact, in this example, the only possible choice is $v=x$, and $C_1=C_2$. Imagine $v=x^2$—then it is clearly false!


Let me explain it in a simpler way using a ridiculous example. Consider we want to compute the integrate for an even function $f(x)=f(-x)$. We write $$I(x)=\int f(x)dx\tag{1}$$ Substitute $y=-x$ into (1) $$I(y)=\int f(-y)d(-y)=-\int f(y)dy\tag{2}$$ Then the ridiculous conclusion isdrawn $$I(y)=-I(y)\Longrightarrow I(y)=0$$ So the problem is, instead of $\int f(x)dx=\int f(y)dy$, but on the confusion of value $x$ and variable $x$. The correct version should be $$I(x)=I(y)|_{y=-x}\neq I(-x)\\ I(y)=-I(\xi)|_{\xi=y}\neq-I(y)\tag{*}$$ One more clearer example, take $f(x)=x^2$. One will see $$I(x)=^{(1)}\frac13x^3=I(y)|_{y=-x}=^{(2)}-\frac13y^3|_{y=-x}\neq I(-x)=^{(1)}-\frac13x^3\\ I(y)=^{(2)}-\frac13y^3=-I(\xi)|_{\xi=y}=^{(1)}-\frac13\xi^3|_{\xi=y}\neq-I(y)=^{(2)}\frac13y^3$$