Question on the bounds of definite integration during a substitution Apologies if this question is rather elementary. I seem to still misunderstand a few things about how bounds change during substitutions still.
I was taught in calc II that to perform a substitution, we set $$u=f(x),\qquad dx=\frac{du}{f'(x)}$$ and plug this into an integral. Then, we let the new $u$ bounds simply be $f(U)$ and $f(L)$ for the original upper $U$ and lower $L$ bounds. For instance, we have $$\int_{-1}^2 \sin(3x)\text{ d}x=\int^6_{-3}\sin(u)\frac{\text{d}u}{3},\qquad u=3x$$
However, I have browsed MSE for a while now, and I have seen many people use a different method of substitution. Instead of a traditional $u$ substitution, they just map $x$ to another function of $x$. For instance, suppose we have $$\int_\sqrt{3}^\infty \frac{1}{x^2}\text{ d}x$$ If we instead do something like $x\rightarrow \dfrac{1-x}{1+x}$, we can just plug this in as $x$, plug in its derivative for $dx$, and set our new bounds by just plugging in stuff to the latter expression to get something like
$$\int^{-1}_{\sqrt3-2}\frac{1}{\left(\frac{1-x}{1+x}\right)^2}\cdot \frac{-2}{(1+x)^2}\text{ d}x$$
Everything here makes sense. The upper bound simply comes from taking the limit of $\frac{1-x}{1+x}$ to infinity, and the lower one comes from plugging in $\sqrt3$ into the fractional expression.
However, here is where I am running into a problem. I recently am attempting to use the second method for the integral $$\int_0^\infty\frac{\ln\left(x^2+1\right)}{x^2+1}\text{ d}x$$ With the regular $u$ sub method, we can simply do $u=\arctan(x)$, which transforms the bounds without problem. However, when I do $x\rightarrow \tan(x)$, this doesn't seem to work? I can't find the upper bound by taking the limit of $\tan(x)$ to infinity.
What is the flaw in my understanding?
Much thanks!
 A: You are using the same variable to represent two different things, and are confusing those two meanings. Don't think of it as "replacing $x$ with $\tan x$. That second $x$ is not the same variable as the first. Give it a different name. Think of it as replacing $x$ with $\tan u$. The $x$ is just a dummy variable for the integration, so its name is unimportant. It is not related to any other use of $x$ in the same argument, and the same goes for $u$. So if after working out the substitution you want to switch the $u$ back to $x$, you are free to do so. But when you think about the substitution itself, you would be wise to label the variables differently.
Now the limits on the original integral are $0$ and $\infty$, which are values of $x$ (with the obvious qualifications about $\infty$). Since $x = \tan u$, you need to find values of $u$ that make $x = 0$ and have $x \to \infty$. When expressed this way, there is a clear answer that $u = 0$ and $u = \frac{\pi}2$ work. These are not the only possibility. $u = \pi$ and $u = \frac{3\pi}2$ is another set of limits that will give you the same value for the integral. However $u = 0$ and $u = \frac{3\pi}2$ do not work. Your substitution should be differentiable everywhere in the domain.
Note that the substitutions $u=\arctan x$ and $x = \tan u$ are exactly the same. This is not a different method of substitution after all. It is the same method expressed in a different way.
