Why is this secant substitution allowed? On Paul's Math Notes covering Trig Substitutions for Integrals we start with an integral:
$$\int{{\frac{{\sqrt {25{x^2} - 4} }}{x}\,dx}}$$
Right away he says to substitute $x=\frac{2}{5}\sec(θ)$.  Why is that allowed?
Looking further down onto how he approaches the problem, it seems like it's allowed because it's compensated for with a dx:
$$dx = \frac{2}{5}\sec \theta \tan \theta \,d\theta$$
Is that what's going on here? It's fair to say you can substitute x with whatever you want so long as you update dx?  Seems like it wouldn't work for constant functions of x, like $x = 5$.. since that'd get you $dx=0$ and clearly be wrong.  So what rules are in play here for substitution?

To add some information to Greg Martin's answer, this is because in some cases, integrals with $\sqrt{\pm(ax)^2 \pm b^2}$ can be solved using trigonometric substitutions. Recall the identities $$\sin^2\theta + \cos^2\theta = 1, \\ 1 + \cot^2\theta = \csc^2\theta, \\ \tan^2\theta + 1 =\sec^2\theta.$$
In the case $\sqrt{(ax)^2 - b^2}$, we can factor out $b^2$ from the square root, giving us $b\sqrt{(\frac{a}{b}x)^2 -1}$. By comparing the term inside the square root to the trig identities, it looks the same to $\csc^2\theta - 1$ and $\sec^2\theta - 1$. Hence, we can use $\frac{a}{b}x = \csc\theta \Leftrightarrow x = \frac{b}{a}\csc\theta$ or $\frac{a}{b}x = \sec\theta \Leftrightarrow x = \frac{b}{a}\sec\theta$.

Let's try to solve $$\int{{\frac{{\sqrt {25{x^2} - 4} }}{x}\,dx}}$$ using the substitution $x = \frac{2}{5}\csc\theta$. Then, $dx = -\frac{2}{5}\csc\theta\cot\theta$. Also, $\sqrt{25x^2 - 4}$ becomes $2\cot\theta$ assuming that $\cot\theta > 0$. This gives us $$\int \frac{2\cot\theta}{\frac{2}{5}\csc\theta}\left(-\frac{2}{5}\csc\theta\cot\theta\right) \\ -2\int\cot^2\theta\,d\theta \\ -2\int(\csc^2\theta - 1)\,d\theta \\ -2(-\cot\theta - \theta) + C \\ 2(\cot\theta + \theta) + C \\ 2\left(\frac{\sqrt{25x^2 - 4}}{2} + \sin^{-1}\left(\frac{2}{5x}\right)\right) + C \\ \sqrt{25x^2 - 4} + 2\sin^{-1}\left(\frac{2}{5x}\right) + C.$$
Comparing the answer obtained when $x = \frac{2}{5}\sec\theta$: $$\sqrt {25{x^2} - 4}  - 2{\cos ^{ - 1}}\left( {\frac{2}{{5x}}} \right) + C$$ to the substitution $x = \frac{2}{5}\csc\theta$, we can see that for all $x \in \mathbb{R}$, $$\sin^{-1}\left(\frac{2}{5x}\right) = -\cos^{-1}\left(\frac{2}{5x}\right) + C$$ will hold if and only if $C = \frac{\pi}{2}$. By substituting values of $x$, we can see that it is indeed the case.
