Integrate: $\int \frac{dx}{x \sqrt{(x+a) ^2- b^2}}$

I substituted $x=1/y$ and got

$$-\int \frac{dy}{\sqrt{1+2 a y+(a^2-b^2) y^2}}$$

I then completed the square in the square root to get

$$-\frac{1}{\sqrt{a^2-b^2}} \int \frac{dy}{\displaystyle\sqrt{\left(y+\frac{a}{a^2-b^2}\right)^2-\left(\frac{a}{a^2-b^2}\right)^2}}$$

Now let

$$y=\frac{a}{a^2-b^2} (\cosh{u}-1)$$

Then the integral becomes

$$-\frac{1}{\sqrt{a^2-b^2}} \int du \frac{\sinh{u}}{\sinh{u}} = -\frac{1}{\sqrt{a^2-b^2}} u+C$$

where $C$ is a constant of integration. Back substituting, we get

$$\int \frac{dx}{x \sqrt{(x+a)^2-b^2}} = -\frac{1}{\sqrt{a^2-b^2}}\text{arccosh}{\left(\frac{a^2-b^2}{a x}+1 \right)} + C $$

Use $\text{arccosh}{z} = \log{(z+\sqrt{z^2-1})}$ to express the result in terms of logs.


First, examine separately intervals where $\tan\theta>0$ and where $\tan\theta<0$. After that, see if you can express the answer in a way that's less-than-explicitly piecewise (perhaps by using absolute values).