Dummy variables in integration: Is $\int x^2\,dx=\int y^2\,dy$? My understanding was that when writing out indefinite integrals, the variable we use (customarily $x$) is merely a dummy variable that can be replaced by any other letter.
So for example, we may write $$\int x^2 \,dx=\int y^2 \,dy=\int z^2 \,dz=\int u^2 \,du.$$
However, I posted this other question and was told that I am mistaken. Am I?
And if I am mistaken, then what precisely does the expression $\int x^2\,dx$ mean? How are we supposed to know when $\int x^2\,dx$ is not the same as $\int y^2\,dy$?
My understanding was that


*

*Given the mapping $x\mapsto x^2$, the expression $\int x^2\,dx$ refers to that mapping's antiderivative (or antiderivatives or set of antiderivatives).

*$x$ is merely a dummy variable.

*The choice of the letter $x$ is merely customary and we can replace $x$ with any other letter.


What (if anything) is wrong with my understanding?
 A: There are two aspects which need to be checked and which might help to clarify the situation.

*

*The first one is the term dummy variable and its usage


*The second addresses the  term substitution of variables
The following provides some thoughts regarding these two aspects.

Dummy variables: A synonym for a dummy variable is bound variable, where the attribute bound   indicates a specific scope of the variable. At first we look at an example related to definite integrals.
We consider the real-valued function
\begin{align*}
&f:\mathbb{R}\to\mathbb{R}\\
&f(x)=5x+\frac{1}{3}
\end{align*}
There are many more ways to write the function $f$ and two of them are
\begin{align*}
f(x)=5x+\frac{1}{3}&=5x+\int_{0}^1x^2\,dx\tag{1}\\
&=5x+\int_{0}^1y^2\,dy\tag{2}
\end{align*}


*

*We observe the right-hand side of (1)  has two different kind of variables and (by a slight abuse of notation) both of them are called $x$. The integration variable $x$ in $\int_{0}^1x^2\,dx$ is a dummy variable, i.e. a bound variable with scope between the integral sign $\int$ and $dx$. Note the name of the dummy variable is not essential, since after all the integral is just a number
\begin{align*}
\int_{0}^1x^2\,dx=\frac{1}{3}
\end{align*}
and another perfectly fine representation of $\frac{1}{3}$ is $\int_{0}^1y^2\,dy$ in (2) where $y$ is just another dummy variable. We can write without running into troubles
\begin{align*}
\int_{0}^1x^2\,dx=\int_{0}^1y^2\,dy
\end{align*}
which is just saying $\frac{1}{3}=\frac{1}{3}$.


*A completely different species is the variable $\color{blue}{x}$ in $f(\color{blue}{x})=5\color{blue}{x}+\int_{0}^1x^2\,dx$. This time the blue marked variable $\color{blue}{x}$ is a free variable and the argument $x$ in $f(x)$ addresses this variable and does not address the integration variable $x$ in (1) which is bounded by its restricted scope and sloppily formulated not visible by $f$.

Next we consider another function in conjunction with an indefinite integral
\begin{align*}
&g:\mathbb{R}\to\mathbb{R}\\
&g(x)=5x+\frac{1}{3}x^3=5x+\int x^2\,dx\tag{3}
\end{align*}

Here we take as integration constant zero and have a representation of $g(x)=5x+\frac{1}{3}x^3$ via an indefinite integral.
But there is a significant difference to (1), because here the scope of the integration variable $x$ is not limited to the integral. We say the integrand $x$ is a free variable and it is the same variable $x$ as the other occurrences of the symbol $x$ in (3).
Conclusion: $x$ in $\int x^2\,dx$ is not a dummy variable, but a free variable instead.

Substitution:  The statement
\begin{align*}
\int x^2 \,dx=\int y^2 \,dy
\end{align*}
is an identity, without providing any additional information is not correct, as we will shortly see.
What we can say in any case is:
Given the indefinite integral
\begin{align*}
\int x^2 \,dx=\frac{1}{3}x^3+C
\end{align*}
with $C$ an integration constant, it can be replaced by
\begin{align*}
\int y^2 \,dy=\frac{1}{3}y^3+C
\end{align*}
indicating that the name of the free variable of integration is not relevant.

But we don't say $\frac{1}{3}x^3=\frac{1}{3}y^3$ is an identity, since its rather an equation in two variables. Due to the same reason we don't say $\int x^2 \,dx=\int y^2 \,dy$.

But again, this changes when we add additional information in the context of a substitution, namely

*

*Substituting $x$ by $y$ we have: $\int x^2 \,dx=\int y^2 \,dy$.


*Now we have in fact a system of two equations, namely
\begin{align*}
x&=y\tag{4}\\
\int x^2 \,dx&=\int y^2 \,dy\tag{5}
\end{align*}
and given (4), the equation (5) can be regarded as identity.

Examples: The following examples of substituting $x$ with $2x$ in $f$ and $g$ indicate nicely the difference between the usage of a bound variable and a free variable.

\begin{align*}
&f(2x)=5(2x)+\frac{1}{3}=10x+\frac{1}{3}\\
&f(2x)=5(2x)+\int_{0}^1x^2\,dx=10x+\left.\frac{1}{3}x^3\right|_{0}^{1}=10x+\frac{1}{3}\tag{6}
\end{align*}
Note that in (6) the integrand $x$ is not replaced by $2x$ since the bound integration variable $x$ is a different species. On the other hand we have
\begin{align*}
&g(2x)=5(2x)+\frac{1}{3}(2x)^3=10x+\frac{8}{3}x^3\\
&g(2x)=5(2x)+\int (2x)^2\,d(2x)=10x+\int 4x^2\cdot 2\,dx=10+\frac{8}{3}x^3
\end{align*}

A: You are correct in your understanding that $x$ is a dummy variable.
$\int x^2\, dx$ means the set of functions $F(\cdot)$, such that $F'(t) = t^2$
If you replace $x$ with $u$ in the definition above, you can see an alternate definition  
"$\int u^2\, du$ means the set of functions $F(\cdot)$, such that $F'(t) = t^2$"
Since the alternate definition specifies the same set of functions $F(\cdot)$, they are equivalent. That is to say, $\int x^2\,dx$ and $\int u^2 \,du$ denote the same set of functions. 
In particular, letting $g_k : t \mapsto \frac{1}{3} t^3 + k$, they denote the set of functions $\{ g_k \}_{k \in \mathbb R}$.
Regarding your other question, the resolution is that the Stewart book was being sloppy with notation. I believe this is the part you referring to.

The key is the part that says 

and so formally, without justifying our calculation, we could write

The textbook is employing "formal" reasoning, which generally means looking at the "form" or the pattern the symbols make, and manipulating those patterns, without trying to reason about the underlying meaning. There are no precise rules when you employ formal reasoning - you just do what feels right.
Formal reasoning is suitable for generating hypothesis which are later verified by an actual proof. An example of formal reasoning is the rewrite rule $\frac{dy}{dx}dx \rightarrow dy$, where a symbol looks like a fraction, so you treat it like one. 
In the example from the textbook, you have $u = 1 + x^2$ and $du = 2x dx$. Since it feels right to substitute these symbols in the integral expression, that's what we do. And then it feels right to carry out the anti-differentiation as if $u$ was a variable, etc. So the equality signs in [2] are not to be taken literally, but are more saying "I hope this will turn out to be justified."
A: first of all you are not integrating variables but functions, secondly you can write $f(x) = x+1$ or $f(some\_var) = some\_var + 1$ what matters is if you have defined function $f$ sufficiently, same in integrals and so on, one thing to keep in mind that when you will perform some sort of variables transformation for equations simplifitactions you have to make sure that you apply this transformation on all occurences of substituted variables, so e.g. when you will substitute some sort of expression and you have derivative of this expression you have to compute derivative of your transformation and then substitute all occurences respectful to your transformations
