TITLE: Absolute value in trigonometric substitutions
QUESTION [9 upvotes]: In general, when we are trying to remove radicals from integrals, we perform a trigonometric substitution (either a circular or hyperbolic trig function), but often this results in a radical of the form $\sqrt{(f(x))^2}$, with $f$ being an arbitrary trigonometric function. 
What most texts tend to do is simply take $\sqrt{(f(x))^2} = f(x)$, without the absolute value of |f(x)|, and the texts do not offer any motivation as to why $\sqrt{(f(x))^2} = f(x) \neq |f(x)|$. I would have assumed the correct way to proceed would be $\sqrt{(f(x))^2} = |f(x)|$. Why is this the case? 
I'll give an example to show further explain what I'm trying to ask :
$$\text{Integrate} \ \ \  \int{\frac{1}{\sqrt{x^2 + 16}}}\ dx$$
We let $\ x = 4\tan\theta \implies dx = 4\sec^2\theta \ d\theta$
\begin{equation} \label{eq1}
\begin{split}
\implies\int{\frac{1}{\sqrt{x^2 + 16}}}\ dx & = \int{\frac{4\sec^2\theta \ }{\sqrt{(4\tan\theta)^2 + 4^2}}}\ d\theta \\
 & = \int{\frac{4\sec^2\theta \ }{\sqrt{(4^2\sec^2\theta)}}}\ d\theta \\
&= \int{\frac{4\sec^2\theta \ }{4\cdot|\sec\theta \ |}}\ d\theta \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \  \text{(*)}\\
\end{split}
\end{equation}
What most texts do is omit the absolute value in the last starred step. Thus the denomitor of the integral becomes $\ 4\sec\theta \ $ instead of $4\cdot|\sec\theta \ |$ and there is no need to break the integral up into cases. Why is that so? We have not assumed $\sec\theta > 0$, so how can $|\sec\theta \ | = \sec\theta$?

REPLY [8 votes]: The substitution you do must be bijective. When you set $x=4\tan\theta$, you're tacitly assuming $\theta\in(-\pi/2,\pi/2)$ and, in this case, $\sec\theta>0$. Thus there's no need of $\lvert\sec\theta\rvert$.
You're right, however, that the possibility of removing the absolute value should be checked.