Correct use of the Substitution Rule (or Integration by Substitution) When using the Substitution Rule (or Integration by Substitution), Stewart (Calculus: Early Transcendentals, 8e, 2016, p. 413) writes $$\int\sqrt{1+x^2}2x\,dx\overset{1}{=}\int\sqrt{u}\,du.$$
But strictly speaking, is $\overset{1}{=}$ correct?
I thought $u$ was just a dummy variable that can be replaced by any other letter, e.g. $x$. In which case, $$\int\sqrt{u}\,du=\int\sqrt{x}\,dx=\frac{2}{3}x^{3/2}+C,$$ which is clearly not equal to $\int\sqrt{1+x^2}2x\,dx$.
And if $\overset{1}{=}$ is wrong, then what is the correct way to use the Substitution Rule?
 A: The thing about variables in places like this is you need to be careful to keep track of the scope of their definitions. 
In a definite integral the scope of the variable of integration is strictly confined to the integrand. For example, in
$$ \int_0^\pi x^2 \sin(x)\, dx $$
the variable $x$ that occurs in the $dx$ is the same $x$ that is found in $x^2\sin(x),$ but a completely distinct variable from any other occurrence of the letter $x$ anywhere. You can even replace $\pi$ with $x$ at the upper limit of the integral and it (technically) is unrelated to the $x$ in the $dx.$
In an equation such as
$$ \int x^2 \, dx = \frac13 x^3 + C, \tag1$$
however, while the $x$ is a dummy variable in the sense that you could just as well write
$$ \int y^2 \, dy = \frac13 y^3 + C \tag2$$
without changing the fundamental meaning of the equation,
the scope of $x$ is not strictly limited to the integrand. 
It is closely related to (if not exactly the same as) the $x$ in $\frac13 x^3.$
After all, writing
$$ \int y^2 \, dy = \frac13 x^3 + C \tag3$$
(replacing $x$ with $y$ inside the integral but not elsewhere)
would not preserve the meaning of Equations $(1)$ and $(2)$;
in order to say the same thing as those equations do, you could give Equation $(3)$ and the stipulation that $y = x,$ but Equation $(3)$ by itself is not enough.
In short, when you use a dummy variable such as $x$ in writing an equation for the indefinite integral of a function, the scope of $x$ is not just the integrand within the integral; it's the entire equation. Hence
$$\int\sqrt{u}\,du = \int\sqrt{x}\,dx = \frac23 x^{3/2}+C $$
makes sense only if you stipulate that $u = x$; if you have in mind that $u = 1 + x^2$ then the first equality sign is not correct at all.
On the other hand, in a context where you have declared that $u = 1 + x^2,$ you can very well say that
$$\int\sqrt{u}\,du = \frac23 u^{3/2}+C,$$
and then, remembering that $u = 1 + x^2,$ you can substitute $1+x^2$ for the $u$ on the right-hand side.
You cannot just substitute $x$ for $u$ anywhere in that context, because then you would be mixing inconsistent relationships between $u$ and $x$:
implicitly saying that $u = 1 + x^2$ and $u = x$ at the same time.

For completness, I'll attempt to derive the substitution rule from the chain rule while taking proper care about notation.
The chain rule says that if $F(x) = G(u(x)),$ then
$$  F'(x) = \frac{d}{dx} G(u(x)) = G'(u(x))\, u'(x). $$
(You might see $G'(u(x))$ written $\frac{dG}{du}$ and $u'(x)$ written 
$\frac{du}{dx},$ that is, in Leibniz notation, since that notation has some strong mnemonic properties in this usage.)
Therefore, given that $F(x) = G(u(x)),$
if we define a function $g = G',$
we have that $F(x)$ is an antiderivative of 
\begin{align}
\int g(u(x))\, u'(x) \, dx 
&= \int G'(u(x))\, u'(x) \, dx \\
&= \int F'(x)\, dx \\
&= F(x) + C \\
&= G(u(x)) + C.
\end{align}
The substitution rule is really just an application of this formula.
In order to find $\int f(x)\,dx,$
we first guess functions $g$ and $u$ such that
$f(x) = g(u(x))\,u'(x)$ and such that $g$ has a known antiderivative $G.$
Then we can define $F(x) = G(u(x))$ and apply the equations above to show that
$$ \int f(x)\,dx = G(u(x)) + C. $$
In writing out the substitution rule, however, one often uses a convenient notation in which we write $u$ instead of $u(x)$ and $du$ instead of $u'(x) \, dx.$
In that form the rule is much easier to remember:
$$ \int f(x)\,dx = \int g(u)\,du = G(u) + C = F(x) + C. $$
(There is a way to make the substitution of $du$ for $u'(x) \, dx$ more than just a notational gimmick, but that would take a lot more development and for our purposes here I think the notational gimmick is enough.)
The important thing here is that we did not just rename the dummy variable $x$;
we introduced a function of $x$ named $u.$
Because of the chain rule, we are able to integrate $g(u(x))\, u'(x)$
(with respect to the original variable $x$)
using a known formula for the antiderivative of $g,$
obtaining a compound function $G(u(x)),$ which we can then write in a form
that more clearly shows it as a function of $x.$
Keeping a consistent relationship between our uses of the symbols
$u$ and $x$ is essential to this process.

Instead of (or in addition to) this attempt to prove the substitution rule, one could also look at the answers to Proof of the substitution rule for integrals for the indefinite case
A: $x$ is not a dummy variable, as that is an indefinite integral. You are likely thinking of definite integrals, in which case rewriting the integral using the same variable is fairly common, as it would indeed be a dummy variable:
$$\int_0^12x\sqrt{x^2+1}~\mathrm dx=\int_1^2\sqrt x~\mathrm dx$$
since the variables vanish after performing the integration. The same is not true for indefinite integrals, where the variable remains after integration:
$$\int2x\sqrt{x^2+1}~\mathrm dx=\frac23(x^2+1)^{3/2}+C_1=\frac23u^{3/2}+C_1=\int\sqrt u~\mathrm du\ne\int\sqrt x~\mathrm dx=\frac23x^{3/2}+C_2$$
where $u=x^2+1$.
A: You are violating the transitive relation by:
$$\underbrace{\int\sqrt{1+x^2}2x\,dx}_{I_1}\overset{1}{=}\underbrace{\int\sqrt{u}\,du}_{I_2}=\underbrace{\int\sqrt{x}\,dx}_{I_3}.$$
If $I_1=I_2$ and $I_2=I_3$, then $I_1=I_3$, however, the last relation is obviously incorrect, consequently you can not claim $I_2=I_3$, because $u=1+x^2\ne x$.
In the Wikipedia article Integration by substitution, Example 3, it is stated:

An antiderivative for the substituted function can hopefully be determined; the original substitution between u and x is then undone.

So, you need to determine the antidervative of substituted function and then undo (i.e. return to $x$) the substitution between the $u$ and $x$.  
