Why do we choose $3$ to be positive after $\sqrt{9 - x^2}$ in the following substitution? The integral $$\int \frac{\sqrt{9 - x^2}}{x^2}dx$$ is solved in my book by letting $x = 3\sin\theta$ where $-\frac {\pi}{2} \le \theta \le \frac {\pi}{2}$. 
Then, $dx = 3\cos\theta\,d\theta$ 
and, $$\sqrt{9-x^2} = 3|\cos\theta| = 3\cos\theta$$
So, $$\int \frac{\sqrt{9 - x^2}}{x^2}dx = \int \cot^2 \theta \ d\theta = -\cot\theta - \theta + C$$
Returning to the original variable, $$\int \frac{\sqrt{9 - x^2}}{x^2}dx = -\frac {\sqrt{9 - x^2}}{x} - \sin^{-1}\left(\frac{x}{3}\right) + C$$
I don't understand why $\sqrt{9-x^2} = 3|\cos\theta| = 3\cos\theta \,$ instead of $\sqrt{9-x^2} = |3||\cos\theta| = |3|\cos\theta$. I feel like I have problems understanding this because I am not sure what is the purpose of the absolute value signs in this case, are they to indicate that, for example, $|\cos\theta| = \pm\cos\theta$? If that's the case, why do we choose $3$ to be positive instead of negative?

The core of your problem seems to be a confusion about the meaning of $\left| \cdot \right|$. $\left| x \right|$ is not the same as $\pm x$. Instead:


*

*$\left| x \right| = -x$ if $x \le 0$

*$\left| x \right| = x$ if $x \ge 0$


Now, because $\sqrt{\cdot}$ is a real-valued function, it can only return one of the quadratic roots of its argument. We've chosen that it's the nonnegative one, so $\sqrt{x^2}=\left|x\right|$, while the roots of $x^2-a$ are $\pm \sqrt{a}$.
