determining the limits in $u$-substitution I have a fundamental question regarding $u$-substitution: Suppose that want to calculate the integral 
$$
\int_{a}^{b}f(x)\,dx
$$
and we wish to use a $u$-substitution of the form $x=g(u)$ (rather then $u=g(x)$) and suppose that we can express $f(x)\,dx$ using $u$ and $du$. How to choose the limits of the new integral? can we choose any $\alpha$ and $\beta$ such that $g(\alpha)=a$ and $g(\beta)=b$, or should we choose $\alpha$ and $\beta$ such that $g(x)$ is invertible in $[\alpha,\beta]$? for example, suppose we want to calculate 
$$
\int_{0}^{1/2}x^2\,dx
$$
by using the subsition $x=\sin u$. Here $x^2=\sin^2x$, so $2x\,dx=2\sin u\cos u\,du$, that is $x\,dx=\sin u\cos u\,du$. Since $x=\sin u$, it follows that $x^2\,dx=\sin^2u\cos u\,du$. Therefore, our integral is 
$$
\int_{?}^{?}\sin^2u\cos u\,du
$$
Now, in this example we can choose any limits $\alpha$ and $\beta$ such that $\sin\alpha=0$ and $\sin\beta=1/2$ (such as $\alpha=-\pi$ and $\beta=\pi/6$). Does that work in general? Note that I deliberately took a non invertible substitution. If it does not true I will be happy to see some example. Thanks a lot!


$$
\int_{a}^{b}f(x)\,\mathrm dx
$$ Suppose that we wish to use a substitution of the form $$x=g(u)$$ (rather then $u=g(x)$) and suppose that we can express $f(x)\,\mathrm dx$ using $u$ and $\mathrm du$. How to choose the limits $\alpha$ and $\beta$ of the new integral? Do we choose them such that $g(x)$ is invertible in $[\alpha,\beta]$?

Yes, exactly. When making the implicit substitution $x=g(u)$ (wherein the new variable $u$ is an implicit function of the starting variable $x$) during integration, we are invoking the theorem

*

*if $\phi'$ is integrable on $[a,b]$ and $h$ is integrable, and has an antiderivative, on $\phi[a,b],$ then, substituting $u=\phi(x)$ into the LHS, $$\int_a^bh\big(\phi(x)\big)\, \phi'(x)\,\mathrm{d}x=\int_{\phi(a)}^{\phi(b)}h(u)\,\mathrm{d}u,$$
with $$\phi=g^{-1},$$ that is, with an invertible $g.$ Thus, there is exactly one choice of $\alpha$ and $\beta.$
For example, if $x=g(x)=\sin u,$ then $g=\sin,$ so $\phi=g^{-1}=\arcsin,$ whose principal range is $[-\frac{\pi}2,\frac{\pi}2].$ So, the old integration limits $0$ & $\frac12$ correspond to the new integration limits $g^{-1}(0){=}0$ & $g^{-1}(\frac12){=}\frac{\pi}6,$ respectively.
In Does $u$-substitution require invertibility?, I explain that when the substitution has the form $$u=g(x)$$ instead, then its invertibility is not called for.
