Both ways seems right to me The question: $$\int {2e^x \over e^{2x}-1}dx $$
Solution 1 (we solv it this way in the exam today)
$\int {2e^x \over (e^x-1)(e^x+1)}dx = \int {(\frac{A}{e^x-1} + \frac{B}{e^x+1})dx} \qquad $from this, $A=1$ and $B=1$. Then,
$\int {\frac{1}{e^x-1} }dx + \int {\frac{1}{e^x+1}}dx = \ln(e^x-1)+\ln(e^x+1)+c = \ln(e^{2x}-1)+c$
Solution 2 (teacher's way)
Let $\ e^x=u \ $ and $\ e^xdx=du \ $. So the integral changes to $\ \int{2\over u^2-1}du \ $. Then,
$\int{({A \over u-1}+{B \over u+1})}du \qquad$ from this, $A=1$ and $B=-1$. Then,
$\int{({1 \over u-1}-{1 \over u+1})}du = \int{1 \over u-1}du - \int{1 \over u+1}du = \ln(u-1)-ln(u+1)+c = \ln(\frac{u-1}{u+1})+c$
And if we replace $u$ with $e^x$: $\ln(\frac{e^x-1}{e^x+1})+c$
So, which one is the right answer?
 A: In solution (1) $\int \frac{1}{e^x\pm 1} dx = \log(e^x\pm 1)$ is not correct, the derivative of $\log(e^x \pm 1)$ is $e^x/(e^x \pm 1)$.
A: This is a Chain Rule (or $u$-substitution) confusion: the integral of $f(g(x))$ is not always (in fact, is usually not) $(\int f(x)dx)(g(x))$. This is what you are doing, with $f(x)={1\over x}$ and $g(x)=e^x+1$ (or $e^x-1$).
Specifically: your integral $\int {1\over e^x+1}dx=\ln(e^x+1)+c$ is incorrect.
To see this, set $u=e^x+1$. Then ${du\over dx}=e^x$, so $dx={du\over e^x}$, so we get $$\int {1\over e^x+1}dx=\int {1\over u}{1\over u-1}du,$$ which is ugly.
And, of course, ditto for $\int {1\over e^x-1}dx$.

EDIT: I wrote, "to see this, [$u$-substitution]." We could also test the answer by differentiating it: this would show that $${d\over dx}(\ln(e^x+1))={1\over e^x+1}\cdot e^x.$$
A: $$\dfrac{d[\ln(e^x+a)]}{dx}=\dfrac{e^x}{e^x+a}\ne\dfrac1{e^x+a}$$ in general
OR
For $I=\int\dfrac{dx}{e^x+a},$
set $e^x+a=y\iff e^x\ dx=dy$
$I=\int\dfrac1{y(y-a)}\ dy=\dfrac1a\left[\dfrac1{y-a}-\dfrac1y\right]$
$=\dfrac1a\left[\ln|y-a|-\ln|y|\right]+K$
$=\dfrac1a\left[x-\ln|e^x+a|\right]+K$
A: You can do it that way, but your integration is incorrect. Check by differentiating:
$$\frac{d}{dx}\Big(\ln(e^x-1)\Big)=\frac{e^x}{e^x-1}=1+\frac1{e^x-1}$$
and
$$\frac{d}{dx}\Big(\ln(e^x+1)\Big)=\frac{e^x}{e^x+1}=1-\frac1{e^x+1}\;.$$
Thus, solving for $\frac1{e^x\pm 1}$ and integrating both sides, we have
$$\int\frac{dx}{e^x-1}=\ln(e^x-1)-x+C_1$$
and
$$\int\frac{dx}{e^x+1}=x-\ln(e^x+1)+C_2\;,$$
and the original integral is therefore
$$\ln(e^x+1)-\ln(e^x-1)+C=\ln\frac{e^x+1}{e^x-1}+C\;,$$
agreeing with the teacher’s answer.
A: You can re-write you integrand as $$\frac{2}{e^{x}-e^{-x}}=\text{cosech} x.$$ Thus
\begin{eqnarray}
\int\text{cosech}xdx &=& \ln \text{tanh} \frac{x}{2}+c \\
                     &=& \ln \left(\frac{e^{\frac{x}{2}}-e^{\frac{x}{2}}}{e^{\frac{x}{2}}+e^{\frac{x}{2}}}\right)+c
\end{eqnarray}
A: Another way to continue with the way you had started:
$$\int\frac{dx}{e^x-1}+\int\frac{dx}{e^x+1}=\int\frac{e^{-x}dx}{1-e^{-x}}+\int\frac{e^{-x}dx}{1+e^{-x}}=$$
$$\ln(1-e^{-x})-\ln(1+e^{-x})+C=\ln\frac{1-e^{-x}}{1+e^{-x}}+C$$
From this point, you could rewrite it a few ways, including multiplying numerator and denominator by $e^x$ to get your teacher's answer or bringing the constant inside the natural log (If $C=\ln k$, then...).
