One integral, two solutions? I ran into an interesting integral problem: the indefinite integral of $\int \frac{dx}{a^2 x^2 - b^2}$. I can do a hyperbolic trig substitution and get that the result is $- \frac{1}{ab}\operatorname{arctanh}\frac{ax}{b}$ and Mathematica agrees with this. However, in some integral tables, I was able to find a result that is $\frac{1}{2ab} \ln{ \frac{ax - b}{ax + b}}$. 
Both functions have the same derivative. However, they don't seem to be equal (I've plotted them and even expressed the inverse hyperbolic tangent as a logarithm). Can anyone explain what I am missing? Thank you!
 A: Both those integrals are correct, but over different domains. At least, if we confine all the functions to real values.
The arctanh works in the interval $(-\frac ba, \frac ba)$, the ln for $(-\infty, -\frac ba) \cup (\frac ba, \infty)$ (if both $a$ and $b$ are positive).
Remember, $\mathrm{arctanh}(u)$ has the domain $(-1,1)$. $\ln(u)$ has the domain $(0,\infty)$ and $\frac{ax-b}{ax+b}>0$ for $x<-\frac ba<$ or $\frac ba<x$ if both $a$ and $b$ are positive.
I suppose the full indefinite integral is a combination of those two given answers. (See below for an alternative.) Or, we could allow complex results for either arctanh or ln; then either one would do. Smart graphers like Geogebra apparently allow the complex values, since the derivatives take up the entire (twice-punctured) real line. Dumber graphers, like my TI-Nspire CX, stick to real values and show the reduced domains. Here are some graphs from an emulated TI-Nspire CX. In these graphs, $a=b=1$ for definiteness.


ADDED LATER:
For completeness, I should mention that there is another, easy way to get an integral that gives the derivative over the entire twice-punctured real numbers. Namely, put an absolute value inside the ln function, so we get
$$\frac{1}{2ab} \ln{\left|\frac{ax - b}{ax + b}\right|}$$
This makes sense, since some tables of integrals (such as my CRC 13th Student Edition) assumes that all integrals with $\ln(\cdot)$ in them actually mean $\ln(|\cdot|)$.
See the final graph to see the result.

A: Try to compute
$$\frac1{2ab}\ln\frac{ax-b}{ax+b}+\frac1{ab}\text{arctanh}\frac{ax}b$$
You should eventually obtain a constant.
A: It's possible to get 2 different-looking answers depending on how you integrate, but as hardmath says, as long as they vary by a constant, it doesn't matter.  For an indefinite integral,  you have to "+ C" part, and the difference in C between the two forms can make up the difference.  For a definite integral, you are doing a subtraction, so that the constant difference drops out.
The simplest example of this is 
$$\int \sin x \cos x dx$$
If you let $u=\sin x$, you get $1/2 \sin^2 x +C$.  If you let $u=\cos x$, you get -$1/2 \cos^2 x+C$.  But since $\sin^2 x + \cos^2 x = 1$, these 2 answers differ my a constant, and it turns out to be irrelevant.
A: $\text{arctanh} z = \frac{1}{2} \log \frac{1+z}{1-z}$ and $\text{arctanh} (-z) = -\text{arctanh} (z)$
In your case $z=-\frac{ax}{b}$ and you are done. 
The general solution to an indefinite integral always has an additive constant, so there are infinitely many different solutions.
A: I think there is a second problem with this integral, besides the two antiderivatives differing by a constant as many users have pointed out here. One definition of hyperbolic arctangent is $$\text{arctanh}({x}) = \frac{1}{2}\ln \left(\frac{1+x}{1-x} \right)$$ hence $$\frac{-1}{ab}\text{arctanh}\left(\frac{ax}{b}\right) = \frac{-1}{2ab}\ln\left(\frac{1+\frac{ax}{b}}{1-\frac{ax}{b}} \right) \\ =  \frac{1}{2ab}\ln\left(\frac{1-\frac{ax}{b}}{1+\frac{ax}{b}} \right) \\ = \frac{1}{2ab}\ln\left(\frac{b-ax}{b+ax} \right)$$ and $$\frac{1}{2ab}\ln\left(\frac{b-ax}{b+ax} \right) \neq \frac{1}{2ab}\ln\left(\frac{ax-b}{b+ax} \right)$$ So the incorrect order of terms in the numerator of the argument of the natural log may be contributing to the confusion as well.
