TITLE: Integral of $\int \frac{dx}{\sqrt{x^2 -9}}$
QUESTION [6 upvotes]: $$\int \frac{dx}{\sqrt{x^2 -9}}$$
$x = 3 \sec \theta \implies dx = 3 \sec\theta \tan\theta d\theta$
$$\begin{align} \int \frac{dx}{\sqrt{x^2 -9}} & = \frac{1}{3}\int \frac{3 \sec\theta \tan\theta d\theta}{\tan\theta} \\ \\ & = \int  \sec\theta d\theta \\ \\ & = \ln | \sec\theta + \tan\theta| + c\end{align}$$
$x = 3\sec \theta  \implies \sec\theta = \frac {x}{3}$
$\tan\theta = \frac{\sqrt{x^2 - 9}}{x}$
I have have confused x with 3 but I cannot get the proper answer which is
$$\ln | x +  \sqrt{x^2 - 9}| + c$$
I always get $\dfrac{x}{3}$ or $\dfrac{\sqrt{x^2 - 9}}{x}$ or some variation of that, I can't eliminate them to get their answer.

REPLY [7 votes]: What you should end with is 
$\sec\theta = \dfrac x3\quad$ and $\quad\tan \theta = \dfrac{\sqrt{ x^2 - 9}}{3}$.
Then you have $$\begin{align} \log \Big| \frac 13\left(x + \sqrt{x^2 - 9}\right)\Big| + C & = \log|x +\sqrt{x^2 - 9}| -\log 3 + C \\ \\ & = \log|x + \sqrt{x^2 - 9}| + C'\end{align}$$