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 modulus expressions are absolutely fine.
So if you differentiate $\csc^{-1}x$ w.r.t. $x$ where $|x|>1$ from definition, you get after simplification,
$\large\frac{d}{dx}(\csc^{-1}x)=-\frac{1}{\csc y.\cot y}$ (where $y=\csc^{-1}x$)
$=\large-\frac{1}{\pm \csc y\sqrt {\csc^2y-1}}=-\frac{1}{|x|\sqrt {x^2-1}}$;$\quad (|x|>1)$
$[\because$ for $-\frac{\pi}{2}<y<\frac{\pi}{2}$, $\csc y\cot y>0 ]$
Similarly if $z=\sec^{-1}x$, 
then $\large\frac{d}{dx}(\sec^{-1}x)=\frac{1}{\sec z\tan z}$
$\large=\frac{1}{\pm \left[\sec z\sqrt {\sec^2z-1}\right]}=\frac{1}{|x|\sqrt {x^2-1}}$; $\quad (|x|>1)$
$[\because$ for $0<z<\pi \quad (z\neq \frac{\pi}{2}), \sec z\tan z>0]$
Hence, $\displaystyle\int \frac{dx}{x\sqrt {x^2-1}}=\sec^{-1}|x|+c$ $\quad$or$\quad$ $-\csc^{-1}|x|+c;$ $($both for $|x|>1)$.
Note that whenever differentiations of inverse trigonometric functions are considered, only the principal values of the functions are taken into account, and the respective ranges against each of the formulas are to be taken care of. For instance, we see that the formula $\frac{d}{dx}(\sin^{-1}x)=\frac{1}{\sqrt {1-x^2}}$ does not remain valid for $\frac{\pi}{2}<\sin^{-1}x<\frac{3\pi}{2}$.

As for your last integral, it makes sense to include the modulus sign if you accept the fact that $\displaystyle\int \frac{dx}{x}=\ln {|x|}+c; \quad (x\neq 0)$, which is the right thing to say after combining the two cases of $x>0$ and $x<0$.

So, for completeness, you should use the modulus symbol in these cases.
