What is actually happening during $u$-substitution while calculating integrals Whenever we want to substitute,we say $u=g(x)$ so $u$ is a dependent variable of the independent variable of $x$. But, the integral $$\int_{a}^{b} f(u)du $$ is actually interpreting $u$ as an independent variable,because it is the variable of integration
To be more specific, when we substitute and afterwards change the boundaries of the integration to fit out new variable we use the equation $u=g(x)$,which is the value of $g$ for a value of $x$.
So, what is in the end the variable $u$?
 A: The substitution rule is the antiderivative version of the chain rule. You have
$$
f(g(x))'=f'(g(x))\,g'(x). 
$$
So 
$$\tag1
f(g(b))-f(g(a))=\int_a^b f'(g(x))\,g'(x)\,dx.
$$
If you rename $f'$ as $f$ and write its antiderivative as $F$, you have 
$$\tag2
F(g(b))-F(g(a))=\int_a^b f'(g(x))\,g'(x)\,dx.
$$
We also have from the Fundamental Theorem of Calculus that 
$$\tag3
F(g(b))-F(g(a))=\int_{g(a)}^{g(b)} f(x)\,dx.
$$
Comparing $(2)$ and $(3)$ you get the Substitution Rule: 
$$\tag5
\int_{g(a)}^{g(b)} f(x)\,dx=\int_a^b f(g(x))\,g'(x)\,dx.
$$
This allows you to write 
$$
\int_\alpha^\beta f(u)\,du=\int_{u^{-1}(\alpha)}^{u^{-1}(\beta)}f(u(x))\,u'(x)\,dx
$$
A: I want to point out that calculus cannot be taught without lots of implicit assumptions. These assumptions -- for instance, change of variables works for "nicely behaved" functions -- are not taught in calculus courses since the mathematics behind them is kinda complicated and can be considered unnecessary for many engineering fields. Nonetheless, the mathematics is really fascinating, and I suggest taking a course if you're curious to learn the hidden gears that power calculus, and how they can produce some very powerful tools.
To use the change of variables technique, you need an integral that can be put in the form $\int_a^b f(\phi(x))\phi'(x)dx$, where $f$ and $\phi'$ are integrable functions, and $\phi$ is strictly increasing on $[a,b]$. There are a few more prerequisites, but I will skip them for good reasons: the list of prerequisites for theorems in real analysis tend to be very long, however nicely behaved functions tend to meet those prerequisites.
As an example, $\int_0^2x \sin(x^2)dx$ can be of this form by setting $f(x)=\frac{1}{2}\sin(x)$ and $\phi(x)=x^2$. The change of variables theorem states 
$\int_a^b f(\phi(x))\phi'(x)dx=\int_{\phi(a)}^{\phi(b)}f(x)dx$, yet a calculus student may write $...=\int_{\phi(a)}^{\phi(b)}f(u)du$. Writing $u$ or $x$ does not matter, switching the variable simply helps you keep track!
It follows $\int_0^2x \sin(x^2)dx=\int_0^4\frac{1}{2}\sin(u)du$. 
Why is this theorem true? I can't prove it to you, since you might not know enough analysis but I can give an outline. Take the integral $\int_0^2x \sin(x^2)dx$. This integral is essentially a bunch of rectangles whose summed area is the integral (as the number of rectangles approaches $\infty$). What change of variables does is it distorts the bases and heights of these rectangles, yet keeps their summed area constant. It also keeps the number of rectangles constant.
Let $P=[x_0=0,x_1,x_2,...,x_n=2]$ be a partition of $[0,2]$, where $x_0<x_1<x_2<...<x_n$. Remember $\int_0^2x \sin(x^2)dx$ basically means splitting $x \sin(x^2)$ into $n$ (approaching $\infty$) rectangles whose area converges to the integral. In other words $\int_0^2x \sin(x^2)dx \approx \sum_{k=1}^n \max_{x \in [x_{k-1},x_k]}(x \sin(x^2)) \cdot \Delta x_k$, where $\Delta x_k=x_{k}-x_{k-1}$. Change of variables distorts the height and base of these rectangles, yet keeps their summed area the same.
So I will create a new set of rectangles, and the summed area will be the same as my last set.
Let $P_\phi=[\phi(x_0)=\phi(0)=0,\phi(x_1),\phi(x_2),...,\phi(x_n)=\phi(2)=4]=[u_0,u_1,u_2,...,u_n]$ be the image of the partition $P$, which itself is a partition of $[0,4]$. So the number of rectangles is constant. Let's define the height of the rectangles in this new set as $\max_{u \in [u_{k-1},u_k]}\left(\frac{1}{2}\sin(u)\right)$ for the $k$th rectangle, and their width as $\Delta u_k= u_{k}-u_{k-1}$. As it turns out, the summed area of these new rectangles equals the summed area of the last set. In other words, $\int_0^2x \sin(x^2)dx \approx \sum_{k=1}^n \max_{x \in [x_{k-1},x_k]}\left(x \sin(x^2) \right) \Delta x_k = \sum_{k=1}^n \max_{u \in [u_{k-1},u_k]}\left(\frac{1}{2}\sin(u)\right) \Delta u_k \approx \int_0^4\frac{1}{2}\sin(u)du$.
A: In order for $u$-substitution to work with the formula $u = g(x)$, the correspondence between $u$ and $x$ needs to be one-to-one.  In other words, you need to be able to reverse things and think of $x$ as the dependent variable and $u$ is the independent variable.  This is sometimes possible: e.g. $u = x^3$ you can reverse to $x = \sqrt[3]{u}$, but sometimes not, e.g. $u = x^2$ on the interval $x \in(-2,2)$ you cannot reverse it.
There is a precise theorem that tells you exactly what is going on:
$$\int_{g(a)}^{g(b)} f(x) dx = \int_a^b f(g(x))dx$$
whenever $g(x)$ is one-one-one on the interval $(a,b)$.  and the only dependent variable in both cases is $x$.
