$\int \frac{\sqrt{x}}{x-1}dx$

I wished to solve $$\int \frac{\sqrt{x}}{x-1}dx \tag{1}$$ through hyperbolic trig substitution. My work is as follows:

Let $\sqrt{x}=\tanh (\theta)$. Then $(1)$ becomes $$\int -2\tanh^2(\theta)\ d\theta=-2\theta+2\tanh(\theta) +C.$$ Subbing back in yields $$-2\text{arctanh}\big(\sqrt{x}\big)+2\sqrt{x} +C.$$ Using $$\text{arctanh}(m)=\frac{1}{2}\ln\Big(\frac{1+m}{1-m} \Big)$$ I arrive at the answer $$2\sqrt{x}+\ln\Big(\frac{1-\sqrt{x}}{1+\sqrt{x}} \Big) +C.$$ However, the answer key and other integration methods suggest the answer $$2\sqrt{x}+\ln\Big(\frac{\sqrt{x}-1}{1+\sqrt{x}} \Big) +C.$$ Where did I go wrong?

According to wolfram alpha both answers appear to work; they must somehow differ by an additive constant.

http://www.wolframalpha.com/input/?i=derivative+of+2sqrt(x)%2Bln((sqrt(x)-1)%2F(1%2Bsqrt(x)))

http://www.wolframalpha.com/input/?i=derivative+of+2sqrt(x)%2Bln((1-sqrt(x))%2F(1%2Bsqrt(x)))

In particular that constant should be $\ln(-1)=i\pi$.

In the reals this discrepancy could be explained by understanding the anti-derivative as a piece wise function. When $\sqrt{x}<1$ we must use one form and when $\sqrt{x}>1$ we must use the other.

Your antiderivative should be $$\ln\left| \frac{1-\sqrt{x}}{1+\sqrt{x}}\right|$$

if you want it to hold when $0\leq x<1$ and when $x>1$.

• If restricted to the reals, then for $x>1$ wouldn't we want to use the other form---that is, $\ln\Big(\frac{\sqrt{x}-1}{\sqrt{x}+1} \Big)$? – fruitegg Aug 15 '16 at 5:55
• That is right. Notice that the absolute value sign will take care of this switch for you. – Spencer Aug 15 '16 at 5:56

Strictly speaking, your answer is correct. If $x>0$, then $\ln(-x) = \ln(x)+\pi i$; these two are off by a constant. The difference between the two answers here is that what's in the $\ln$ is off by a factor of $-1$, and so the two functions are off by a constant.