<s>[INST] How do you find appropriate trig substitution for $\int \frac{\sqrt{16x^2 - 9}}{x} \, dx$? I want to solve the below:
$$\int \frac{\sqrt{16x^2 - 9}}{x} \, dx$$
I know for trig substitution, if I have something in the form of $\sqrt{x^2-a^2}$, I can use $x = a\sec{u}$; it just so happens my integral has a numerator in this form: $\sqrt{16x^2 - 3^2}$ so I know to use $x = 3\sec u$:
$$
\begin{align}
& \int \frac{\sqrt{16x^2 - 9}}{x} \, dx \\
= {} & \int \frac{\sqrt{16x^2 - 3^2}}{x} \, dx \\
= {} & \int \frac{\sqrt{16(3\sec u)^2 - 3^2}}{3\sec u} 3\sec u\tan u \, du \\
= {} & \int \frac{(\sqrt{16(3\sec u)^2 - 3^2)}(3\sec u\tan u)}{3\sec u} \, du \\
= {} & \int \sqrt{(16(3\sec u)^2 - 3^2)}(\tan u) \, du
\end{align}
$$
This doesn't seem to make it easy. However, using a calculator online, it suggests I instead use $x = \dfrac{3}{4}\sec{u}$ which simplifies the integral to a crisp $\int 3\tan^2 u \, du$.
My question is, how did the calculator get $a = \dfrac{3}{4}$ and is there a way to determine an ideal trig substitution for a given function?
 [/INST] Note: $\sqrt{16x^2-3^2}$ is a difference of squares.  Draw a picture of a right triangle suggested by this: $4x$ the hypotenuse, $3$ one of the legs (say the side opposite angle $\theta$), and $\sqrt{16x^2-3^2}$ the side adjacent to angle $\theta$.  
Do it, don't just rely on my description. 
So then:
$$
\sin\theta = \frac{3}{4x},
\\
\cos\theta = \frac{\sqrt{16x^2-3^2}}{4x},
\\
\tan\theta = \frac{3}{\sqrt{16x^2-3^2}}.
$$
Use the simplest one to suggest the substitution:
$$
x = \frac{3}{4}\csc \theta,
\\
dx = -\frac{3}{4}\csc\theta\cot\theta\;d\theta
$$
Then substitute back into your integral, looking at your picture to find how to move between $x$ and $\theta$.  Here
$$
\frac{\sqrt{16x^2 - 9}}{x} = 4\cos \theta
$$
so we get
\begin{align}
\int\frac{\sqrt{16x^2 - 9}}{x}\;dx &= -\int 4\cos \theta
 \frac{3}{4}\csc\theta\cot\theta\;d\theta
\\ &= -3\int\frac{\cos^2\theta}{\sin^2\theta}\;d\theta = 
3\big(\cot \theta + \theta\big)+C
\end{align}
and then look at the picture to get
$$
3\big(\cot \theta + \theta\big)+C=
3 \left[\frac{\sqrt{16x^2-3^2}}{3} + \arcsin\frac{3}{4x}\right]+C
$$

this method also works for "sum of squares".  Draw the right triangle
suggested by that particular sum of squares.
</s>