Hint solving an integral using trig substitution I want a hint for the following integral:
$$\int \frac{\sqrt{1- a^{2}+x^{2}}}{x^{2}(a^2-x^2)} dx$$
where $a$ is a real constant.
My attempt:
$$\frac{\sqrt{1- a^{2}+x^{2}}}{x^{2}(a^2-x^2)} = \frac{1}{x^{2}\sqrt{1- a^{2}+x^{2}}}(1-\frac{1}{a^2-x^2})$$
I know from the post
$$\int \frac{dx}{x^{2}\sqrt{1- a^{2}+x^{2}}} = -\frac{\sqrt{1- a^{2}+x^{2}}}{x(1- a^{2})}.$$
But how shoud i solve the following integral???
$$\int \frac{1}{x^{2}\sqrt{1- a^{2}+x^{2}}}\frac{dx}{a^2-x^2} $$
Thanks for your help.
$$$$
 A: Let be
$$
I=\int
\frac{\sqrt{1-a^2+x^2}}{x^2(a^2-x^2)}\mathrm d x
$$
with the substitution
$
\frac{\sqrt{1-a^2+x^2}}{x}=u
$ and $x^2=\frac{1-a^2}{u^2-1}$ and $\mathrm d u=\frac{a^2-1}{x^2\sqrt{1-a^2+x^2}}\mathrm d x$ and then $\frac{x^2\sqrt{1-a^2+x^2}}{a^2-1}\mathrm d u=\mathrm d x$ the integral $I$ becomes
$$
J=\int \frac{u^2}{1-u^2a^2}\mathrm d u
$$
and with the substitution $au=t$ the integral $J$ becomes
$$
K=\frac{1}{a^3}\int \frac{t^2}{1-t^2}\mathrm d t=\begin{cases}\frac{1}{a^3}\left[\tanh^{-1}(t)-t\right]+c & \text{for }|t|<1\\
\frac{1}{a^3}\left[\coth^{-1}(t)-t\right]+c & \text{for }|t|>1
\end{cases}
$$
observing that $\left(\tanh^{-1}(t)\right)'=\frac{1}{1-t^2}$ for $|t|<1$ and $\left(\coth^{-1}(t)\right)'=\frac{1}{1-t^2}$ for $|t|>1$.
Thus
$J=K(au)$ and $I=K\left(a\frac{\sqrt{1-a^2+x^2}}{x}\right)$, that is
$$
I=\begin{cases}\frac{1}{a^3}\left[\tanh^{-1}\left(a\frac{\sqrt{1-a^2+x^2}}{x}\right)-a\frac{\sqrt{1-a^2+x^2}}{x}\right]+c & \text{for }\left|a\frac{\sqrt{1-a^2+x^2}}{x}\right|<1\\
\frac{1}{a^3}\left[\coth^{-1}\left(a\frac{\sqrt{1-a^2+x^2}}{x}\right)-a\frac{\sqrt{1-a^2+x^2}}{x}\right]+c & \text{for }\left|a\frac{\sqrt{1-a^2+x^2}}{x}\right|>1
\end{cases}
$$
or 
$$
I=\begin{cases}\frac{1}{a^3}\left[\tanh^{-1}\left(a\frac{\sqrt{1-a^2+x^2}}{x}\right)-a\frac{\sqrt{1-a^2+x^2}}{x}\right]+c & \text{for }\left|a\frac{\sqrt{1-a^2+x^2}}{x}\right|<1\\
\frac{1}{a^3}\left[\tanh^{-1}\left(\frac{x}{a\sqrt{1-a^2+x^2}}\right)-a\frac{\sqrt{1-a^2+x^2}}{x}\right]+c & \text{for }\left|a\frac{\sqrt{1-a^2+x^2}}{x}\right|>1
\end{cases}
$$
observing that $\tanh^{-1}\left(\frac{1}{z}\right)=\coth^{-1}(z)$.
