When writing $\int_{1}^{x}x^2dx$, is $x$ a variable or a constant?

It is technically not correct, but it's usually accepted in physics for example. Usually, $$\int_1^x x^2\mathrm{d}x=\int_1^x t^2\mathrm{d}t.$$


Of course, one should avoid to use of symbols as integration (or other bounded) variables which are already used in the context. Logically, however, one could argue for a very narrow interpretation of the context of an integral, namely only what is inside the integral. E.g., if the function to integrate is called $f$, then $f$ is forbidden as an intergration variable that is $\int_a^b f(f)df$ is not allowed. I would also opt to not allow the integral sign and the Leibniz symbol $d$ like in $\int_a^b f(\int)d\int$ or $\int_a^b f(d)dd$. But I think that one could consider the bounds $a,b$ as being outside the integral. As far as I remember, computer software like mathemaica do not complain about the use of $\int_0^xf(x)dx$. This is very reasonnable: Imagine the desaster of a computer program which would always complain if a variable which is used in the main program is also used with a different meaning in some subroutine or function.


In the notation $$\int_1^x x^2\,dx,$$ the symbol $x$ represents one thing in some places and a different thing in another place.

The symbol $x$ is a so-called dummy variable within this expression:

$$ x^2 \, dx.$$

The notation $dx$ establishes $x$ as a dummy variable that is defined only within the integrand, which in this case is $x^2.$

On the other hand, the $x$ that appears at the top of the integral sign, $\int^x,$ is a free variable of this expression. You can do things to that variable that will have no effect on the dummy variable inside the integrand.

For example, if we add some text outside the integral,

$$ \int_1^x x^2\,dx \quad \text{where $x = 5$}, $$

the phrase "where $x = 5$" binds the formerly free variable $x$ to the constant value $5.$ So "$\int_1^x x^2\,dx \ \text{where $x = 5$}$" means

$$ \int_1^5 x^2\,dx. $$

The $x$ in $x^2$ isn't touched because, as before, the notation $dx$ declared that this $x$ is not the same thing as any $x$ that occurs outside the expression $x^2\,dx.$

Do you find this confusing? So do I! It is a terrible way to write an integral. The best policy is to choose a name for the dummy variable that is not used for anything else in the formula. For example, we could write $$ \int_1^x t^2\,dt, $$ which means exactly the same thing as $\int_1^x x^2\,dx$ but is much easier to understand and much less likely to cause mistakes.

Using $x$ for two different things in the same expression also leads to questions like this one: Integral notation confusion - $x$ vs. $t$.