Connection between u-substitution change of limit and Riemann sum I worked with integration by $u$ substitution for a bit now, but I still have a hard time rationalizing why we change the limits of the integral when doing $u$ substitution (I know we don't have to change the limits, there is another way, but I'm not interested in that in this question).
I always think of the integral as the sum of infinite many rectangles under a curve (as an intuition.) Let's say we have the following more formal definition of a definite integral:
$$\int_{{\,a}}^{{\,b}}{{f\left( x \right)\,dx}} = \mathop {\lim }\limits_{n \to \infty } \sum\limits_{i = 1}^n {f\left( {x_i^*} \right)\Delta x} 
$$
I tried to bring this together with $u$ substitution, because I want to actually understand why we need to change the limits of the integral. Say we have:
$$\int_{{\,a}}^{{\,b}}{{f(g(x))g'(x)\,dx}}$$
Let $u = g(x)$, then I think we have:
$$\int_{{\,g(a)}}^{{\,g(b)}}{{f(u)\,du}} = \mathop {\lim }\limits_{n \to \infty } \sum\limits_{i = 1}^n {f\left( {u_i^*} \right)\Delta u}$$
But what I don't understand is: what is the proper justification to change the limits of the integral that we change $\int_{{a}}^{{b}}$ to $\int_{{g(a)}}^{{g(b)}}$, and what effect does this have on the sum, the actual definition of the integral? Is there any connection to the Riemann sum?
 A: The change-of-variables theorem can be proved under very weak assumptions about $f$ and $g$. However, a standard proof assumes that $g$ is continuously differentiable and uses the fundamental theorem of calculus.  The theorem holds even if $g$ is not monotone (increasing or decreasing). We can even have $g(a) = g(b)$.
A proof along the lines of what you are suggesting requires an assumption that $g$ is monotone.  We begin with a partition $a = x_0 < x_1 < \ldots < x_n = b$ and form the sum 
$$\tag{*}S(P,fg')= \sum_{j=1}^n f(g(\xi_j))g'(\xi_j)(x_j - x_{j-1})$$
where we use intermediate points $\xi_j \in [x_{j-1},x_j]$ and which will converge with refinement to $$\int_a^bf(g(x)) g'(x) \, dx$$
If $g$ is increasing then a partition $P'$ of $[g(a),g(b)]$ is naturally induced by 
$$g(a) = g(x_0) < g(x_1) < \ldots < g(x_n) = g(b),$$
and using the intermediate points $g(\xi_j)$, we have a Riemann sum for the integral of $f$ over $[g(a),g(b)]$ taking the form
$$S(P',f) = \sum_{j=1}^n f(g(\xi_j))(\,g(x_j) - g(x_{j-1})\,)$$
We need the monotonicity of $g$ to ensure that $g(\xi_j) \in [g(x_{j-1}), g(x_j)]$.
Applying the mean value theorem, there exist points $\eta_j \in (x_{j-1},x_j))$ such that 
$$\tag{**}S(P',f) = \sum_{j=1}^n f(g(\xi_j))g'(\eta_j)(x_j - x_{j-1})$$
Notice the similarity between the sums in (*) and (**).  Aside from the distinction between $\eta_j$ and $\xi_j$, they are identical. Using the continuity (and uniform continuity) of $g'$ we can show that as the partition is refined and both $\|P\|, \|P'\| \to 0$ we have   
$$\lim_{\|P|| \to 0}|S(P,fg') - S(P',f)|  = 0$$
Therefore, $S(P',f)$ converges to both integrals and we have 
$$\lim_{\|P'\| \to 0}S(P',f) = \int_{g(a)}^{g(b)} f(u) \, du = \int_a^b f(g(x)) g'(x) \, dx$$
Again, there are a number of ways to prove the change-of-variables theorem --  without the assumption that $g$ is monotone -- that avoid this association with Riemann sums. In the most general form only integrability and not continuity of $f$ and $g'$ is assumed.
