Question regarding $\int \frac{e^x}{e^x-2} \,dx$ I tried to solve this integral in the following way:
$$
\text{Let } u = e^x-2 \Rightarrow  du = e^x \, dx \Rightarrow dx = \frac{du}{e^x} \\
\int \frac{e^x}{e^x-2} \,dx = \int \frac{e^x}{u}\, \frac{du}{e^x} = \\
=\int \frac{du}{u} = \ln(u) = \ln(e^x-2)
$$
I think that might be correct but the answer seems to be $\ln(2-e^x)$ which I can obtain by:
$$
\text{Let } u = 2-e^x \Rightarrow du = -e^x \,dx \Rightarrow dx = -\frac{du}{e^x} \\
\int \frac{e^x \cdot (-1)}{(e^x-2) \cdot (-1)} \,dx = -\int \frac{e^x}{2-e^x}\,dx = \\
= -\int \frac{e^x}{u}\cdot (-1) \frac{du}{e^x} = \int \frac{du}{u} =  \\
= \ln(u) = \ln(2-e^x)
$$
Even if I derivate both of the results I get back to what I wanted to integrate, so both solutions might be right. However I plotted both functions to be sure that are different and they are.
I'm kind of lost and I can't really accept by myself that both functions are the solution. I'm still thinking there should be a silly mistake I can't see. Any idea?
 A: Neither function makes sense if you allow $x$ to run over the whole line, as the argument of the logarithm needs to be positive (i.e. the first function makes no sense for $x<\ln2$ and the second one for $x>\ln2$). 
When it is not clear that you are dealing with positive numbers, the antiderivative of $1/u$ is $\ln(|u|)$. And then the ambiguity disappears. 
A: The substitution theorem (i.e., u-substitution) states that if $f$ and $g$ are appropriate functions such that $\int f(x) dx = \phi(x) + k$, then $\int (f \circ g)(x)g'(x) dx = (\phi \circ g)(x) + k$. In this case, we have functions $f(x) = x^{- 1}$ and $g(x) = e^x - 2$ with $\int f(x) dx = \log |x| + k$. Thus, our answer must be $\int (f \circ g)(x)g'(x) dx = \log{|e^x - 2|} + k$. If we recall the defining property of the absolute value function, we see that $\log|e^x - 2|$ is equivalent to $\log |2 - e^x|$. You should be able to derive the intended result by examining appropriate values of $x$ (i.e., consider $e^x - 2 \geq 0$ and $e^x - 2 < 0$).
