When to use the modulus symbol and when not to use the modulus symbol in integration and differentiation? I am facing this conceptual doubt for quite some time now.
We know $$\frac{d}{dx}{(\sec^{-1}{x})}=\frac{1}{|x|\sqrt{x^2-1}}$$ whereas $$\frac{d}{dx}{(\csc^{-1}{x})}=\frac{-1}{|x|\sqrt{x^2-1}}$$
Now suppose I need to find the integral 
$$\int\frac{1}{x\sqrt{x^2-1}}dx$$ then will the answer be $\sec^{-1}{x}$ or $\csc^{-1}{x}$ in case the modulus function is not used for $x$ in the denominator? Why?
Another similar doubt I have is that $$\int{\frac{1}{x^2-a^2}} \, dx$$ equals $$\frac{1}{2a}\ln\left(\frac{x-a}{x+a}\right)+C$$ or $$\frac{1}{2a}\ln\left|\frac{x-a}{x+a}\right|+C \text{?}$$
Some books use the former formula and some use the latter.Which one is correct and why? 
Pardon me if you find this question too trivial.But really I'm confused with this thing from the past few months!

The functions $sec^{-1}$ and $-cosec^{-1}$ only differ by a constant in the points where they are both defined. The same is true for $sin^{-1}$ and $-cos^{-1}$. So, when they are both defined, you can choose one or another as you please, as long as you add an additive constant. 
This happens because of the formula $\cos(x) = \sin(\pi/2-x)$ which says that $\sin(x)$ and $\cos(-x)$ are obtained one from the other with an horizontal translation, so their inverse functions correspond one to the other with a vertical translation.
To be more precise, (and to discuss the case of $\log x$ versus $\log |x|$) if the domain of the integrand function is not an interval, it is not enough to add a constant. You need to add a combination of different constant on each different connected component of your domain.
Example. Many books say that
$$
\int \frac{1}{x}\, dx = \log |x| + C.
$$
This is not completely true. All the antiderivatives of $1/x$ are given by a family of functions with two parameters, not one:
$$
  F(X) = \begin{cases} \log x + C_1 & \text{if $x>0$,}\\
  \log (-x) + C_2 & \text{if $x < 0$.}
\end{cases}
$$
It is true that in most applications you only need to find an antiderivative in one fixed interval (for example if you are solving differential equations). So, given the interval, there can be a preferred choice for the solution. If you are integrating $1/x$ for $x<0$, the solution can be written as $log(-x)+C$. If you are integrating $\frac{1}{x\sqrt{x^2-1}}$ on $(-1,0)$ the solution can be written as $cosec^{-1}(x) + C$.
