Trig Substitution Problem - Integration Suppose I want to integrate this (I chose an easy one):
$$\int \frac {dx}{\sqrt{x^2-4}}$$
Method 1: (Trig Substitution) $x=2\sec(\theta)$
$$\int \frac {dx}{\sqrt{x^2-4}}=\int \frac{\sec(\theta)\tan{(\theta)}}{|\tan(\theta)|}d\theta$$
Now removing the absolute value I find is tough. The inverse secant function splits out values of $\theta$ between $0$ and $\pi/2$, and $\pi/2$ to $\pi$. How can I resolve this? Tangent is positive from $0$ and $\pi/2$ - first quadrant, and negative from $\pi/2$ to $\pi$. I know most books overlook this, but I want to be most accurate. 
I say "Method 1" because I also have another question right after this.

Notice that the integrand $\dfrac{1}{\sqrt{x^2-4}}$ is only defined on $(-\infty,-2)\cup(2,\infty)$. 
Hence, we can consider the antiderivative on $x > 2$ and on $x < -2$ seperately. 
If $x > 2$, then we substitute $x = 2\sec \theta$ where $0 < \theta < \tfrac{\pi}{2}$. 
Over this range, $\tan \theta > 0$. So, $\sqrt{x^2-4} = 2\tan \theta$, and thus, 
$\displaystyle\int\dfrac{dx}{\sqrt{x^2-4}} = \int \dfrac{2\sec \theta \tan \theta}{|2\tan \theta|} \,d\theta = \int \dfrac{\sec \theta \tan \theta}{\tan \theta} \,d\theta = \int \sec \theta \,d\theta$ 
$= \ln|\sec\theta + \tan \theta|+C = \ln\left|\frac{x}{2}+\frac{\sqrt{x^2-4}}{2}\right|+C = \ln\left(\frac{x}{2}+\frac{\sqrt{x^2-4}}{2}\right)+C$ 
If $x < -2$, then we substitute $x = 2\sec \theta$ where $\tfrac{\pi}{2} < \theta < \pi$. 
Over this range, $\tan \theta < 0$. So, $\sqrt{x^2-4} = -2\tan \theta$, and thus, 
$\displaystyle\int\dfrac{dx}{\sqrt{x^2-4}} = \int \dfrac{2\sec \theta \tan \theta}{|2\tan \theta|} \,d\theta = \int \dfrac{\sec \theta \tan \theta}{-\tan \theta} \,d\theta = -\int \sec \theta \,d\theta$ 
$= -\ln|\sec\theta + \tan \theta|+C = -\ln\left|\frac{x}{2}-\frac{\sqrt{x^2-4}}{2}\right|+C = \ln\left|\dfrac{1}{\frac{x}{2}-\frac{\sqrt{x^2-4}}{2}}\right|+C$. 
$= \ln\left|\dfrac{\frac{x}{2}+\frac{\sqrt{x^2-4}}{2}}{\left(\frac{x}{2}-\frac{\sqrt{x^2-4}}{2}\right)\left(\frac{x}{2}+\frac{\sqrt{x^2-4}}{2}\right)}\right|+C = \ln\left|\dfrac{\frac{x}{2}+\frac{\sqrt{x^2-4}}{2}}{\frac{x^2}{4}-\frac{x^2-4}{4}}\right|+C = \ln\left|\frac{x}{2}+\frac{\sqrt{x^2-4}}{2}\right|+C$
As you can see, the two expressions are the same. So, in this case, we don't lose anything by carelessly writing $\sqrt{x^2-4} = 2\tan \theta$ instead of $|2\tan \theta|$.
Alternatively, if $x < -2$, then substitute $x = 2\sec \theta$ where $\pi < \theta < \frac{3\pi}{2}$. Then $\tan \theta > 0$ over this range, and so, we don't need to worry about the absolute value signs. 
