TITLE: How is it justified in indefinite integral to make trig substitutions whose range is not all real numbers?
QUESTION [6 upvotes]: How in indefinite integral we can do the substitution without bothering about the variable or function we are substituting the variable with? For example, it is very common to make trigonometric substitutions for evaluating indefinite integrals like we put x = sint or cosect or cost etc. But how can we do that when we know that the original variable x can assume any real values but the function sint, cost by definition can only asse values in [-1,1] . Now It is okay to make the substitutions x in terms of tan or cot as they can assume all real values. But how is it justified for other trig functions? Also why in indefinite integrals we generally ignore the modulus or domain etc. As in Paul's online notes http://tutorial.math.lamar.edu/Classes/CalcII/TrigSubstitutions.aspx While solving and only take care in definite integral?

REPLY [3 votes]: Let's consider the first use of trigonometric substitution on the page you linked:
$$
\int \frac{\sqrt{25x^2 - 4}}{x} \,dx.
$$
Observe that the integrand is not real for all values of $x.$
For example, if you put $x=\frac15,$ the integrand becomes
$$
\frac{\sqrt{25\left(\frac15\right)^2 - 4}}{\left(\frac15\right)} =
5 \sqrt{-3}.
$$
In fact, the integrand is defined only when $25x^2 - 4 \geq 0,$ that is, for 
$x \in \left(-\infty,-\frac25\right] \cup \left[\frac25,\infty\right).$
Notice that the recommended substitution in this integral is
$$
x = \frac25 \sec\theta,
$$
which happens to be able to take on any value in
$\left(-\infty,-\frac25\right] \cup \left[\frac25,\infty\right).$
Later on the same page, there is an integral in which the expression
$\sqrt{9 - x^2}$ occurs. As explained in that example, the $\sec\theta$
substitution does not work in that case, because it results
in taking a square root of a negative value (except at some isolated points).
Instead, we substitute
$$
x = 3 \sin\theta,
$$
which very happily can produce all values of $x$ in the interval $[-3,3],$
which happens to be all the values of $x$ for which $9 - x^2 \geq 0.$
In short, the premise that $x$ can take on every real value in every indefinite integral is not true.
There can be large gaps in the set of values of $x$ for which the integrand is defined over real numbers.
In some cases $x$ can only take values in a finite interval.
The typical trigonometric substitutions that we make for $x$
do not always support every real number as a value of $x,$
but they are able to produce all values of $x$ for which the integral is defined.