Real Analysis – Simplifying the Result of Integration of $\\int\\frac{e^x + e^{3x}}{1-e^{2x}+e^{4x}}\\mathop{dx}$

algebra-precalculusreal-analysis

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.

Best Answer

Note that since $$\tan(A\pm B)=\frac{\tan A\pm\tan B}{1\mp\tan A\tan B},$$ replacing $\arctan C:=A$ and $\arctan D:=B$ yields $$\arctan C\pm\arctan D=\arctan\frac{C\pm D}{1\mp CD}\pm\left\{0,\pi\right\}\tag1$$ due to its periodic nature. As $\pm0$ is attained whenever $1\mp CD>0$, \begin{align}\arctan(2e^x+\sqrt3)+\arctan(2e^x-\sqrt3)&=\arctan\frac{2e^x+\sqrt3+2e^x-\sqrt3}{1-(2e^x+\sqrt3)(2e^x-\sqrt3)}\\&=\arctan\frac{4e^x}{4-4e^{2x}}\\&=\arctan\frac{1}{e^x-e^{-x}}\\&=-\arctan\frac1{2\sinh x}\end{align} for $4-4e^{2x}>0\implies x<0$. Now for positive $x$, \begin{align}\arctan(\pm x)+\arctan\frac1{\pm x}=\pm\frac\pi2,\tag2\end{align} and since $2\sinh x>0$, taking the negative sign of $(2)$ gives $$-\arctan\frac1{2\sinh x}=\arctan(2\sinh x)+\frac\pi2,$$ and hence $$\boxed{\arctan(2e^x+\sqrt3)+\arctan(2e^x-\sqrt3)=\arctan(2\sinh x)+\frac\pi2,\quad x<0}$$ so your equality is proven for $x<0$. Finally, for $x>0$, we get from $(1)$ that \begin{align}\arctan(2e^x+\sqrt3)+\arctan(2e^x-\sqrt3)&=-\arctan\frac1{2\sinh x}+\pi\end{align} where the positive sign is taken as the LHS is positive on the whole of $x\in\Bbb R$. Taking the positive sign of $(2)$ yields $$-\arctan\frac1{2\sinh x}=\arctan(2\sinh x)-\frac\pi2$$ and thus $$\boxed{\arctan(2e^x+\sqrt3)+\arctan(2e^x-\sqrt3)=\arctan(2\sinh x)+\frac\pi2,\quad x>0.}$$ After checking the point $x=0$, the result follows. $\square$