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, \begin{equation} \frac{1}{t(t^2+1)}=\frac{A}{t}+\frac{Bt+C}{t^2+1}\implies 1=A(t^2+1)+t(Bt+C) \end{equation} $$ \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 ?
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.