<s>[INST] Why Doesn't This Integral $\int \frac{\sqrt{x^2 - 9}}{x^2} \ dx$ Work? I am trying to solve this integral, which is incorrect compared to Wolfram|Alpha. Why doesn't my method work?

Find $\int \frac{\sqrt{x^2 - 9}}{x^2} \ dx$

Side work:

$\sin{\theta} = \frac{3}{x}$
$x = \frac{3}{\sin{\theta}} = 3 \csc{\theta}$
$dx = -3 \csc{\theta}\cot{\theta} \ d\theta$

$-\int \frac{\sqrt{9\csc^2{\theta} - 9}}{27 \csc^3{\theta}} \cdot 3 \csc{\theta}\tan{\theta} \ d\theta$
$-\int \frac{3 \cdot \sqrt{\csc^2{\theta} - 1}}{27 \csc^3{\theta}} \cdot 3 \csc{\theta}\cot{\theta} \ d\theta$
$-\int \frac{\cot{\theta}\csc{\theta}\cot{\theta}}{3 \csc^3{\theta}} \ d\theta$
$-\frac{1}{3} \int \cos^2{\theta} \ d\theta$
$-\frac{1}{3} \int \frac{1}{2} \left(1 + \cos{\left(2\theta\right)}\right) \ d\theta$
$-\frac{1}{6} \int 1 + \cos{\left(2\theta\right)} \ d\theta$
$-\frac{1}{6} \int \ d\theta + \frac{1}{6} \int \cos{\left(2\theta\right)} \ d\theta$

Sidework:
$u = 2\theta$
$du = 2 \ d\theta$

$-\frac{1}{6} \int \ d\theta + \frac{1}{3} \int \cos{u} \ du$
$-\frac{\theta}{6} + \frac{1}{3} \cdot \sin{u} + C$
$-\frac{\theta}{6} + \frac{1}{3} \cdot \sin{2\theta} + C$

Sidework:
$\sin{\left(2\theta\right)} = 2 \sin{\theta} \cos{\theta}$
$\sin{\theta} = \frac{3}{x}$
$\cos{\theta} = \frac{\sqrt{x^2 - 9}}{x}$
$\theta = \sin^{-1}{\left(\frac{3}{x}\right)}$

$-\frac{\sin^{-1}{\left(\frac{3}{x}\right)}}{6} + \frac{2}{3} \cdot \frac{3}{x} \cdot \frac{\sqrt{x^2 - 9}}{x} + C$
$-\frac{\sin^{-1}{\left(\frac{3}{x}\right)}}{6} + \frac{2\sqrt{x^2 - 9}}{x^2} + C$

Thank you for your time.
 [/INST] Let  $I  = \int \frac{\sqrt{x^2 – 9}}{x^2}$
Easiest is a hyperbolic substitution:
Put  $x = 3\cosh{u}, u \le 0$, so $dx = 3\sinh(u)du$
Then \begin{align}
I &=\int\frac{3\sinh(u^2)}{9 \cosh^2(u)}du\\\\
&= \int\tanh^2(u)du\\\\
&= \int\left(1–\mathrm{sech}^2(u)\right)du\\\\
&= u–\tanh(u)+c\\\\
&= u-\frac{3\sinh(u)}{3\cosh(u)}+c\\\\
&= \cosh^{-1}\left(\frac{x}{3}\right)-\frac{\sqrt{x^2–9}}{x}+c\\
\end{align}
</s>