TITLE: Simplifying the result of integration of $\int\frac{e^x + e^{3x}}{1-e^{2x}+e^{4x}}\mathop{dx}$
QUESTION [6 upvotes]: 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.

REPLY [2 votes]: Let's start off from
$$\sinh(x) = \frac{e^x-e^{-x}}{2} = -\frac{e^{-x}-e^x}{2} = -\frac{\frac{1}{e^x}-e^x}{2} = -\frac{1-e^{2x}}{2e^x} = -\frac{4-4e^{2x}}{8e^{2x}} = \\ = -\frac{1-(4e^{2x}-3)}{8e^x} = -\frac{1-(2e^x+\sqrt{3})(2e^x-\sqrt{3})}{8e^x}.$$
For conveniency, I'll rewrite this as:
$$2\sinh(x)=-\frac{1-(2e^x+\sqrt{3})(2e^x-\sqrt{3})}{4e^x}.\tag{1}$$
Now since
$$\cot(\arctan(x)) = \frac{1}{\tan(\arctan(x))} = \frac{1}{x}$$
We can just take the $\cot(\arctan())$ of the reciprocal of the right side of $(1)$:
$$2\sinh(x) = -\cot\left(\arctan\left(\frac{4e^x}{1-(2e^x+\sqrt{3})(2e^x-\sqrt{3})}\right)\right) = \\ = -\cot\left(\arctan\left(\frac{2e^x+\sqrt{3}+2e^x-\sqrt{3}}{1-(2e^x+\sqrt{3})(2e^x-\sqrt{3})}\right)\right)\tag{2}$$
Now we'll show a formula for $\arctan(x) + \arctan(y)$:
$$\tan(\alpha+\beta) = \frac{\tan(\alpha)+\tan(\beta)}{1+\tan(\alpha)\tan(\beta)}$$
$$\alpha+\beta = \arctan\left(\frac{\tan(\alpha)+\tan(\beta)}{1+\tan(\alpha)\tan(\beta)}\right)$$
Now with the substitution $\alpha = \arctan(x)$ and $\beta = \arctan(y) \leftrightarrow x = \tan(\alpha), y = \tan(\beta)$:
$$\arctan(x) + \arctan(y) = \arctan\left(\frac{x+y}{1-xy}\right) \tag{3}$$
Now we'll use $(3)$ with $x=2e^x+\sqrt{3}, y=2e^x-\sqrt{3}$ on $(2)$:
$$2\sinh(x) = -\cot(\arctan(2e^x+\sqrt{3})+\arctan(2e^x-\sqrt{3}))\tag{4}$$
Now finally, we'll use the equality that
$$\tan\left(x-\frac{\pi}{2}\right) = -\cot(x)\tag{5}$$
Putting $(5)$ into $(4)$ we get:
$$2\sinh(x) = \tan\left(\arctan(2e^x+\sqrt{3})+\arctan(2e^x-\sqrt{3})-\frac{\pi}{2}\right)$$
Or:
$$\arctan(2\sinh(x)) = \arctan(2e^x+\sqrt{3})+\arctan(2e^x-\sqrt{3})-\frac{\pi}{2}.$$