# Evaluate $\int \frac{e^{2x}-1}{e^{2x}+1}dx$ using partial fractions

Integrate the function $\frac{e^{2x}-1}{e^{2x}+1}$ using partial fractions.

My Attempt $$\int\frac{e^{2x}-1}{e^{2x}+1}dx=\frac{1}{2}\int\frac{2.e^{2x}}{e^{2x}+1}dx-\int\frac{dx}{e^{2x}+1}=\frac{1}{2}\log|e^{2x}+1|-\int\frac{dx}{e^{2x}+1}$$ Put $t=e^x\implies dt=e^xdx=tdx\implies dx=\frac{dt}{t}$ $$\int\frac{dx}{e^{2x}+1}=\int\frac{dt}{t(t^2+1)}$$ Using partial fractions, $$\frac{1}{t(t^2+1)}=\frac{A}{t}+\frac{Bt+C}{t^2+1}\implies 1=A(t^2+1)+t(Bt+C)$$ \begin{multline} \begin{aligned} &t=0\implies \boxed{A=1}\\ &1=t^2+1+t(Bt+C)\implies -t^2=t(Bt+C)\\ &\implies-t=Bt+C\text{ if } t\neq 0\\ &t=0\implies \boxed{C=0}\implies \boxed{B=-1} \end{aligned} \end{multline} \begin{multline} \begin{aligned} \int\frac{dt}{t(t^2+1)}&=\int\frac{dt}{t}-\frac{1}{2}\int\frac{2t.dt}{t^2+1}=\log|t|-\frac{1}{2}\log|t^2+1|\\ &=\log|e^x|-\frac{1}{2}\log|e^{2x}+1|+C_1 \end{aligned} \end{multline} $$\int\frac{e^{2x}-1}{e^{2x}+1}dx=\frac{1}{2}\log|e^{2x}+1|-\log|e^x|+\frac{1}{2}\log|e^{2x}+1|+C=\log|e^x+e^{-x}|+C$$ Doubt

While doing partial fractions, first i have assumed $t=0$ but $t=e^x\neq{0}$ and even if I accept that, in the second step the equation is transformed into a new form assuming $t\neq{0}$. But, in the next step I need to again assume $t=0$ to get $B$ and $C$. How can I jusify this and why am I getting the right answer after all ?

• Multiply top and bottom by $e^{-x}$. – Rene Schipperus May 6 '18 at 19:04
• @ReneSchipperus I am aware of that, doing that will make the numerator the derivative of the denominator, follows direct answer with log. But, my doubt is regarding why am I getting the correct result while doing these absurd assumptions whn trying to solve it as I mentioned. – ss1729 May 6 '18 at 19:06
• You can use, for instance, the quadratic formula to factor something like $a\cdot e^{2x}+b\cdot e^x+c$, even though $e^x$ is never zero. That is no problem. The same goes for partial fraction decomposition. Even more explicitly, $x^2+2x+1=(x+1)^2$ is as true when $x\in \Bbb R$ as when $x$ is limited to $x>0$. – Arthur May 6 '18 at 19:06
• you just try to integrat the tan hyperbolic in fact – Isham May 6 '18 at 19:21

What you're really doing is requiring two expressions to have the same $t\to 0^+$ (i.e. $x\to -\infty$) limiting behaviour, which is legitimate.

$$\int \frac{e^{2x}-1}{e^{2x}+1}dx=\ln \left|e^{2x}+1\right|-x+k,\quad k\in \mathbb{R}$$

In fact

$$\int \frac{e^{2x}-1}{e^{2x}+1}dx=\int \left[\frac{2e^{2x}}{e^{2x}+1}-1\right]dx=*$$

being

$$\frac{e^{2x}-1}{e^{2x}+1}=\frac{e^{2x}-1+\left(e^{2x}+1\right)}{e^{2x}+1}-1=\frac{2e^{2x}}{e^{2x}+1}-1$$

After we have:

$$*=\int \left[\frac{2e^{2x}}{e^{2x}+1}-1\right]dx=**$$

Using integration for substitution $t=e^{2x}+1$ (with $\int f'/g dx=\ln |g|+\mathrm{const.}$) we have:

$$**=\ln \left|e^{2x}+1\right|-x+k,\quad k\in \mathbb{R}$$

$$$$\frac{1}{t(t^2+1)}=\frac{A}{t}+\frac{Bt+C}{t^2+1}\implies 1=A(t^2+1)+t(Bt+C)$$$$ This is for all t you get that $$1=t^2(A+B)+Ct+A \quad \color{red}{\forall t}$$ $$A+B=0, A=1, C=0$$ $$(A,B,C)=(1,-1,0)$$

Note that you just integrate $\tanh(x)$ $$\int \frac{e^{2x}-1}{e^{2x}+1} dx= \int \tanh(x)dx= \ln|\cosh(x)|+K$$