Which integration formula for $\frac{1}{a^2-x^2}$ is correct? In my book integration formula for $\frac{1}{x^2-a^2}$ is given as $\frac{1}{2a}\ln(\frac{x-a}{x+a})$.
From the above formula we can write the formula for integration of $\frac{1}{a^2-x^2}$ as   $-\frac{1}{2a}\ln(\frac{x-a}{x+a}) = \frac{1}{2a}\ln(\frac{x+a}{x-a}) $ [as we know $\ln(\frac{1}{x})=-\ln(x)$]
But, in my book the integration of  $\frac{1}{a^2-x^2}$ is written as $\frac{1}{2a}\ln(\frac{x+a}{{a-x}}) $.
We know that the integration in the second case cannot be $\frac{1}{2a}\ln(\frac{x+a}{x-a}) $ and $\frac{1}{2a}\ln(\frac{x+a}{{a-x}}) $ at the same time. Which formula is the correct one and why?
 A: Neither is correct.
It's not restrictive to assume $a>0$ (for $a=0$ the antiderivative has a different form; for $a<0$ change the intervals below accordingly).
The function $\frac{1}{x^2-a^2}$ is defined for $x\ne\pm a$ and is negative over $(-a,a)$, positive over $(-\infty,-a)$ and $(a,\infty)$.
The sign of $\frac{x-a}{x+a}$ is the same as the sign of $x^2-a^2$ (for $x\ne\pm a$, of course), so it's clear that
$$
\frac{1}{2a}\ln\frac{x-a}{x+a}
$$
cannot be an antiderivative over $(-a,a)$, because it is undefined there.
There's a simple way out. An antiderivative of $1/x$ is $\ln|x|$ (up to an arbitrary constant over $(-\infty,0)$ and an arbitrary constant on $(0,\infty)$, with no connection between each other).
The partial fraction decomposition is
$$
\frac{1}{x^2-a^2}=\frac{1}{2a}\frac{1}{x-a}-\frac{1}{2a}\frac{1}{x+a}
$$
so we can write
$$
\int\frac{1}{x^2-a^2}\,dx=
\frac{1}{2a}(\ln|x-a|-\ln|x+a|)=
\frac{1}{2a}\ln\left|\frac{x-a}{x+a}\right|
$$
up to arbitrary constants in the intervals $(-\infty,-a)$, $(-a,a)$ and $(a,\infty)$.
Since $1/(a^2-x^2)=-1/(x^2-a^2)$, we have
$$
\int\frac{1}{a^2-x^2}\,dx=
-\frac{1}{2a}\ln\left|\frac{x-a}{x+a}\right|=
\frac{1}{2a}\ln\left|\frac{x-a}{x+a}\right|^{-1}=
\frac{1}{2a}\ln\left|\frac{x+a}{x-a}\right|
$$
again up to constants as before.
A: We do have that $$I =\int \frac {1}{a^2-x^2} dx =\frac {1}{2a}\ln \frac {x+a}{x-a} $$ But however we apply the absolute value function to arguments of logarithm functions in order to extend the antiderivative's domain giving us: $$I =\int \frac {1}{a^2-x^2} dx =\frac {1}{2a} \ln |\frac {x+a}{x-a}|$$Hope it helps. 
A: WLOG, $a>0$. As there are singularities at $x=-a$ and $x=a$, the expressions can differ in the intervals $(-\infty,-a)$, $(-a,a)$ and $(a,\infty)$, depending on the signs of $x+a$ and $x-a$.
Correct expressions are
$$\int\frac{dx}{x^2-a^2}=\frac1{2a}\log\left|\frac{x+a}{x-a}\right|=\frac1{2a}\log\left|\frac{a+x}{a-x}\right|.$$
(But you are not allowed to evaluate the definite integrals across the singularities.)
Then the effect of a change of sign is
$$\int\frac{dx}{a^2-x^2}=-\frac1{2a}\log\left|\frac{x+a}{x-a}\right|=\frac1{2a}\log\left|\frac{x-a}{x+a}\right|=\frac1{2a}\log\left|\frac{a-x}{a+x}\right|.$$
A: Let $f(x)=\frac{1}{x^2-a^2}$.
$f$ is continuous at $(-\infty,-|a|),(-|a|,|a|)$ and $(|a|,+\infty)$.
in each interval
$$2af(x)=\frac{1}{x-a}-\frac{1}{x+a}$$
and $$\int f(x)dx=\frac{1}{2a}\ln(\frac{|x-a|}{|x+a|}).$$
the final expression depends on which interval $J$  we want the antiderivative.
for example, if $a>0$ and $J=(-a,a)$, we have
$$\int f(x)dx=\frac{1}{2a}\ln( \frac{a-x}{x+a} )+C$$
