In a table of integrals, I see the following two formulas:

$\int \frac{dx}{(a+x)(b+x)} = \frac{1}{b-a}\ln\frac{a+x}{b+x}$, and $\int \frac{dx}{ax^2+bx+c} = \frac{2}{\sqrt{4ac-b^2}}\tan^{-1}\frac{2ax+b}{\sqrt{4ac-b^2}}$.

How can these both be true? It seems like if we expand $(a+x)(b+x)$ out to $x^2+(a+b)x+ab$, we can apply the 2nd equation to get

$\int \frac{dx}{(a+x)(b+x)} = \frac{2}{\sqrt{4ab-(a+b)^2}}\tan^{-1}\frac{2x+a+b}{\sqrt{4ab-(a+b)^2}}$, which is surely not equivalent to $\frac{1}{b-a}\ln\frac{a+x}{b+x}$ (one involves a logarithm and the other involves an arctan, so no amount of algebraic fussing can reconcile them, can it?!)

-
Well, $\log$ and $\tan^{-1}$ are related via the complex exponential... –  Zhen Lin Nov 9 '12 at 17:53

Take a look at the logarithmic form of the complex arctangent:

$$\tan^{-1}x=\frac12i\Big(\ln(1-ix)-\ln(1+ix)\Big)\;.\tag{1}$$

For instance, consider the integral

$$\int\frac{dx}{(1+x)(2+x)}=\int\frac{dx}{x^2+3x+2}\;.$$ The two integration formulas yield the antiderivatives

$$\ln\frac{1+x}{2+x}\tag{2}$$ and

$$\frac2i\tan^{-1}\frac{2x+3}i\tag{3}\;.$$

From $(1)$ we have

\begin{align*} \frac2i\tan^{-1}\frac{2x+3}i&=\Big(\ln(1-(2x+3))-\ln(1+2x+3)\Big)\\ &=\ln\frac{-2-2x}{4+2x}\\ &=\ln\frac{-1-x}{2+x}\\ &=\ln\frac{1+x}{2+x}+\ln(-1)\\ &=\ln\frac{1+x}{2+x}+i\pi\;, \end{align*}

using the principal value of the log. Thus, $(2)$ and $(3)$ really do differ only by a constant, and there is no problem.

-

You take the square root of a negative number $\left(-(a-b)^2\right)$, so the argument of arctan is complex. Using the following formula you should be able to turn one solution into the other: $$\arctan(z) = {\ln(1 - iz) - \ln(1 + iz) \over 2}$$

-