Evaluate: $$ \int\frac{e^x + e^{3x}}{1-e^{2x}+e^{4x}}\mathop{dx} $$
I'm trying to simplify my answer so that it matches the keys section, no success so far. The integral itself is pretty simple. Factor $e^x$ in the denominator and then make an obvious substitution: $$ I = \int \frac{e^x(1 + e^{2x})}{1-e^{2x}+e^{4x}}\mathop{dx}\\ t = e^x\, , dt = e^x\mathop{dx}\\ $$ Thus: $$ \begin{align} I&=\int \frac{1+t^2}{1-t^2 + t^4}\mathop{dt} \\ &={1\over 2}\int\left(\frac{1}{t^2 + \sqrt3t + 1} + \frac{1}{t^2-\sqrt3t+1}\right)\mathop{dt} \\ &={1\over 2}\int\left(\frac{1}{\left(t+{\sqrt3\over 2}\right)^2+{1\over 4}} + \frac{1}{\left(t-{\sqrt3\over 2}\right)^2+{1\over 4}}\right)\mathop {dt} \end{align} $$
Which after some further substitutions yields: $$ \boxed{I = \arctan(2e^x+\sqrt3) + \arctan(2e^x-\sqrt3)}\tag1 $$
However, the answer section suggests that: $$ I = \arctan(2\sinh x)\tag2 $$
Which matches my answer up to a constant , $-{\pi \over 2}$ in this case.
Even though the answer is correct, I would still like to see how I could arrive from $(1)$ to $(2)$, I've given it several tries without any luck. I would appreciate it if someone could show me why: $$ \arctan(2\sinh x) = \arctan(2e^x+\sqrt3) + \arctan(2e^x-\sqrt3) - {\pi\over 2} $$
Thank you!
As pointed out in the comments by @mickep, there is a way to directly arrive at the desired result. I would like to elaborate on it here. Instead of factoring $e^x$ one could factor $e^{2x}$ which would give: $$ \begin{align} I &= \int \frac{e^{2x}(e^{-x}+e^{x})}{e^{2x}(e^{-2x} - 1 + e^{2x})}\mathop{dx}\\ &= \int \frac{e^{-x}+e^{x}}{e^{-2x} - 1 + e^{2x}}\mathop{dx} \\ &= \int \frac{2(e^{-x}+e^{x})}{2(e^{-2x} - 1 + e^{2x})}\mathop{dx}\\ &= \int \frac{2\cosh x}{e^{-2x} - 1 + e^{2x}}\mathop{dx} \\ &= \int \frac{2\cosh x}{4{e^{-2x} - 2e^{x}e^{-x} + e^{2x}\over 4} + 1}\mathop{dx}\\ &= \int \frac{2\cosh x}{(2\sinh x)^2 + 1}\mathop{dx} \end{align} $$
Now using a substitution $t = 2\sinh x$, one may obtain: $$ I = \int \frac{\mathop{dt}}{t^2 + 1} = \arctan(t) = \arctan(2\sinh x) + C $$
By this approach, we have arrived at the desired result.