How to calculate $\int \frac{1}{x^{2}-1}dx$ I got different answers when I use substitution of $x=\sec(t)$ or split the term. Also as I calculated, the answer is $\frac{1}{2}(\ln(x-1)-\ln(x+1))+c$, while the answer given by Wolfram Alpha is $\frac{1}{2}(\ln(1-x)-\ln(x+1))+c$. Where is the problem? Thanks!

Just know that: $$\dfrac{1}{x^2-1}=\dfrac{-1}{2(x+1)}+\dfrac{1}{2(x-1)}$$
Now, use the fact that $$\int \dfrac{\mathrm{d}x}{x+1}=\log |x+1|+\mathrm{constant.}$$
and
$$\int \dfrac{\mathrm{d}x}{x-1}=\log |x-1|+\mathrm{constant.}$$
