# Why can I make a non-injective variable substitution?

I was using integration by substitution to solve this fairly simple indefinite integral:

$$\int xe^{x^2}~dx$$

I simply made the substitution $$x^2=t$$ $$dt=2x~dx$$ But it occurred to me that I don't actually understand how this is possible, because the substitution I made is not injective! In this case the integral is indefinite, but what if I were trying to integrate over some interval? Couldn't a non-injective substitution destroy important information - for example, eliminating signs if I square a variable - or something like that, thus giving the wrong answer?

• Your substitution is injective. No information will be lost. – Doc Nov 18 '13 at 23:36
• As mentioned, your substituin is injective. In the notation of my answer here, you're using $\varphi(t)=\sqrt t$. – Git Gud Nov 18 '13 at 23:51
• I disagree that this substitution is injective. The OP is correct: $f(t) = t^2$ is not an injective function. Indeed, one can give specific examples of substitutions for definite integrals that make the question more pertinent, e.g. $\displaystyle\int_{-1}^{2} xe^{x^2}dx = \int_1^4 \frac{1}{2} e^t\, dt$. – Jim Belk Dec 27 '13 at 8:33
• So @GitGud and Doc would have no problems with an integral where $x=\sqrt t$ ranges from $-1$ to $1$. I know that you could handle that integral, I know. But that is IMHO a bad way of dismissing a valid concern. Andreas, a quick way of resolving your problem is to check that the derivative of the indefinite integral you get is your integrand. Everywhere. Therefore you can use it to calculate definite integrals also as per Newton-Leibniz. On another occasion the indefinite integral might have discontinuities. And in those cases you need to exercise extra care. – Jyrki Lahtonen Dec 27 '13 at 8:37
• @JimBelk What is the problem in this example? The integrand on the left is odd so integral from -1 to 2 will give the same result as integral from 1 to 2. Can you clarify what can go wrong? – martinkunev Feb 7 '17 at 9:40

The point is that for definite integrals you just need your substitution to be "piecewise injective", since you can split your integrals in finitely many parts on which your piecewise injective substitution is injective. For instance, the substitution $x^2 = t$ is injective if you restrict $x$ to $[0,\infty[$ or $]-\infty,0]$, so essentially you can use this change of variables everywhere. Same goes with any polynomial substitution $t = p(x)$ ; the polynomial $p'(x)$ has finitely many zeros, hence the derivative of $p(x)$ can change sign only finitely many times, thus is piecewise injective.