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!
 A: 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$.
A: Let us find $$\int\dfrac{du}{u+a}$$
Case$\#1:$  If $u+a>0,$ let $u+a=v\implies du=dv$
Consequently, $$\int\dfrac{du}{u+a}=\log(u+a)+K$$
Case$\#2:$  If $u+a<0,$ let $u+a=-v\implies du=-dv$
Consequently, $$\int\dfrac{du}{u+a}=\log(-u-a)+L$$
Case$\#3:$  What if $u+a=0?$
$$\implies\int\dfrac{du}{u+a}=\log|u+a|+M\text{ for }u+a\ne0$$
Now for $\displaystyle I=\int\dfrac{dx}{x\sqrt{x^2-1}}$
using Trigonometric substitutions, let $x=\sec y, dx=\sec y\tan y\ dy$
Using this, $0\le y\le\pi, y\ne\dfrac\pi2$
Case$\#1:$  If $0\le y<\dfrac\pi2,\sqrt{x^2-1}=+\tan y$ as $\tan y\ge0$
$\displaystyle I=\sec^{-1}x+A$
Case$\#2:$  If $\dfrac\pi2<y\le\pi,\sqrt{x^2-1}=-\tan y$
$\displaystyle I=-\sec^{-1}x+B=\sec^{-1}(-x)+B-\pi$ using How do I prove that $\arccos(x) + \arccos(-x)=\pi$ when $x \in [-1,1]$?
Replace $B-\pi$ with $B'$
All the letters used in capital should be implicitly considered arbitrary constants.
A: 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.
