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?
 A: The exact rule is: if $x(t)$ is a differentiable function of $t$, then for any continuous integrand $f(t)$,
$$
\int f\big( x(t) \big) x'(t)\,dt = \bigg( \int f(x)\,dx \bigg) \bigg| _{x=x(t)},
$$
where the subscript on the right-hand side means that after the indefinite integral $\int f(x)\,dx$ is evaluated, one then plugs in $x(t)$ for $x$. This can be proven easily by differentiating both sides with respect to $t$—the right-hand side is a composition of two functions, with the inner function being $x(t)$, by the definition of the notation.
You're interested in the situation where we start from the right-hand side and choose the function $x(t)$ (as opposed to the more standard substitution method where one starts from the left-hand side); in particular you're asking what happens if you set $x=5$ for example. Then the left-hand side is $\int 0\,dt = C$, while if $F(x)$ is an antiderivative of $f(x)$ then the right-hand side is $\big(F(x)+C'\big)\big|_{x=5}$, which is simply $F(5)+C'$. Since $C$ and $C'$ represent arbitrary constants and $F(5)$ is some constant, these two answers represent the same family of functions. It's not wrong after all—just not useful!
A: 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.
A: You need to remember the Pythagorean trigonometric identity that says $$ \sec^2 \theta-1 = \tan^2\theta. $$
Where you see $\Big( \big(\text{variable}\big)^2 - \text{positive constant} \Big),$ you can often use this substitution in just the way in which it is used here.
