First theorem: Let $f:[a,b] \to \mathbb{R}$ and $g:[c,d] \to \mathbb{R}$ be continuous and $g$ has a bounded continuous derivative. If $g((c,d)) \subset (a,b)$, then $$\int_{c}^{d}f(g(x))g'(x)dx=\int_{g(c)}^{g(d)}f(x)dx.$$ Second theorem: Let $f:[a,b] \to \mathbb{R}$ and $g:[c,d] \to \mathbb{R}$ be continuous and $g$ has a bounded continuous derivative. If $g((c,d)) \subset (a,b)$, then $$\int_{c}^{d}f(g(x))g'(x)dx=\int_{g((c,d))}f(x)dx.$$
These two theorems are consistent if $g$ is strictly monotonic. The problem arises if $g$ is not strictly monotonic. The first theorem tells us that we can just plug in the limit into $g$. But the second theorem says that the integral is over the interval [min $g([c,d]$, max $g([c,d]$)], which could give different result. So I'm curious which one is correct. The first theorem can be proved by defining $F(x)=\int_{c}^{x}f(y) dy$ and observe $(F \circ g)'(x)=f(g(x))g'(x)$ and use the fundamental theorem of calculus. But it seems like the first theorem also causes some inconsistent result.
Consider the integral $$\int_{0}^{\infty}e^{-x-\frac{1}{x}}dx.$$ Using $u=x+\frac{1}{x}$, we get $$\int_{\infty}^{\infty}\text{(some integrand) }du = 0.$$ But $f(x)=e^{-x-\frac{1}{x}}$ is continuous and positive on $(0,\infty)$. The integral should be greater than zero.
If the first theorem is false, please point out where the proof goes wrong. I appreciate any helps. Thank you.