The question was as follows: $$\int{\sqrt{\frac{e^x-1}{e^x+1}}}dx$$ Which I evaluated as follows: $$\int{\sqrt{\frac{e^x-1}{e^x+1}}}dx$$ $$=\int{\frac{e^x-1}{\sqrt{e^{2x}-1}}}dx$$ $$=\int{\frac{t-1}{t \sqrt{t^2-1}}}dt$$ (Taking $t=e^x$ and $dt= tdx$) $$=\int{\frac{t}{t\sqrt{t^2-1}}}dt-\int{\frac{1}{t\sqrt{t^2-1}}}dt$$ $$=\sin^{-1}(t)-\int{\frac{z}{z×t^2}}dz$$ (Taking $z^2=t^2-1$ and $dt=\cfrac{z}{t}dz$) $$=\sin^{-1}(t)-\int{\frac{1}{z^2+1}}dz$$ $$=\sin^{-1}(t)-\tan^{-1}(z)$$ $$=\sin^{-1}(e^x)-\tan^{-1}(\sqrt{e^{2x}-1})+C$$
But the answer given is: $$\ln (e^x+\sqrt{e^{2x}-1})-\sec^{-1}(e^x)+C$$
What did I do wrong and How to obtain the correct answer?
The integrand can be rewritten as $\sqrt{\tanh \frac{x}{2}}$ so use the substitution $x = 2\tanh^{-1}u^2 $
$$I = \int \frac{4u^2}{1-u^4}du = \int\frac{2}{1-u^2}-\frac{2}{1+u^2}du = 2\tanh^{-1}u - 2\tan^{-1}u + C$$
Therefore the final answer is
$$\boxed{2\tanh^{-1}\sqrt{\tanh\frac{x}{2}}-2\tan^{-1}\sqrt{\tanh\frac{x}{2}}+C}$$
or equivalently
$$\boxed{2\tanh^{-1}\sqrt{\frac{e^x-1}{e^x+1}}-2\tan^{-1}\sqrt{\frac{e^x-1}{e^x+1}}+C}$$
This is equal to your given answer. For the arctan term, we have that
$$\alpha\in(0,1) \implies 2\tan^{-1}\alpha = \tan^{-1}\frac{2\alpha}{1-\alpha^2}$$
which means
$$2\tan^{-1}\sqrt{\frac{e^x-1}{e^x+1}} = \tan^{-1}\sqrt{e^{2x}-1} = \sec^{-1}e^x$$
by considering a right triangle with sides $\sqrt{e^{2x}-1}$ opposite, $1$ adjacent, and hypotenuse $e^x$. I will let you confirm the artanh term on your own.