<s>[INST] Two different answers from integrating $\int\frac{dx}{x\sqrt{x^2-1}}$ in two ways. What did I do wrong? I want to calculate the answer of the integral $$\int\frac{dx}{x\sqrt{x^2-1}}$$ I use the substitution $x=\cosh(t)$ ($t \ge 0$) which yields $dx=\sinh(t)\,dt$. By using the fact that $\cosh^2(t)-\sinh^2(t)=1$ we can write $x^2-1=\cosh^2(t)-1=\sinh^2(t)$. Since $t\ge 0$, $\sinh(t)\ge 0$, and we have $\sqrt{x^2-1}=\sinh(t)$. Now, by substituting for $x$, $dx$, and $\sqrt{x^2-1}$ in the first integral, we have 
$$\int\frac{dt}{\cosh(t)}$$
Since $\cosh(t)=(e^t+e^{-t})/2$ by substituting this in this integral we have 
$$2\int\frac{dt}{e^t+e^{-t}}.$$ 
Now by multiplying numerator and denominator in $e^t$ one can write:$$2\int\frac{e^t\,dt}{1+e^{2t}}$$ 
Now by using $z=e^t$ in this integral one can write ($dz=e^t\,dt$): $$2\int\frac{dz}{1+z^2}$$ 
So we have $$\int\frac{dt}{\cosh(t)}=2\arctan(z)=2\arctan(e^t)$$ 
On the other hand $$t=\cosh^{-1}(x)=\ln\left(x+\sqrt{x^2-1}\right)$$ 
So we have $$\int\frac{dx}{x\sqrt{x^2-1}}=\int\frac{dt}{\cosh(t)}=2\arctan(\exp(\ln(x+\sqrt{x^2-1})))$$
which yields 

$$\int\frac{dx}{x\sqrt{x^2-1}}=2\arctan(x+\sqrt{x^2-1})$$

but this answer is wrong. The true answer can be obtained by direct substitution $u=\sqrt{x^2-1}$ and is  

$$\int\frac{dx}{x\sqrt{x^2-1}}=\arctan(\sqrt{x^2-1})$$

I don't want to know the answer of the integral. I want to know what I did wrong? Can somebody help?
 [/INST] Verify by differentiation.
$$(2\arctan(x+\sqrt{x^2-1}))'=2\frac{1+\dfrac x{\sqrt{x^2-1}}}{(x+\sqrt{x^2-1})^2+1}=2\frac{x+\sqrt{x^2-1}}{2(x^2+x\sqrt{x^2-1)}\sqrt{x^2-1}}$$
and
$$(\arctan\sqrt{x^2-1})'=\frac{\dfrac{x}{\sqrt{x^2-1}}}{(\sqrt{x^2-1})^2+1}.$$
Hence both answers are correct.
</s>