<s>[INST] In $\frac{1}{a^2-x^2}$, how can $a\sin(\theta)$ be substituted for $x$ when finding the anti-derivative? $$\int{\frac{1}{a^2-x^2}}dx\tag{1}$$
When finding the above anti-derivative, $x$ is substituted with $a\sin(\theta)$. However, the range of $x$ is $\mathbb{R}-\{-a,a\}$ while the range of $a\sin(\theta)$ is $[-a,a]$.
Graph of $\frac{1}{a^2-x^2}[a=0.5]$
Needless to say,
$$\mathbb{R}-\{-a,a\}\ne[-a,a]$$
So, how can $a\sin\theta$ be substituted for $x$ in $(1)$ when the range of $x$ and $a\sin\theta$ are not the same?

Related
 [/INST] When $x\in (a, +\infty)$, you can substitute $x = a \cosh \theta$, thus
\begin{equation}
\int \frac{d x}{a^2 - x^2} = \int\frac{1}{a^2}\frac{a\sinh \theta d\theta}{1 -\cosh^2 \theta}
= -\frac{1}{a}\int\frac{d\theta}{\sinh\theta}
\end{equation}
You can then use $u = e^\theta$ or $t = \tanh\frac{\theta}{2}$.
Of course, you could decompose directly from the beginning
\begin{equation}
\frac{1}{a^2-x^2} = \frac{1}{2a}\left(\frac{1}{a-x} + \frac{1}{a+x}\right)
\end{equation}
</s>