# Same indefinite integral yielding two different domains

So I tried evaluating the following indefinite integral and I did two solutions: $$\int \sqrt{1+\frac 3x}dx$$ 1. My first solution was to use a substitution $$u=1+\frac3x$$ and my approach went as follows: $$\int \sqrt{1+\frac 3x}dx\,\begin{vmatrix}u=1+\frac3x \\du=-\frac {3}{x^2}dx\end{vmatrix}\,=\int \frac{-\sqrt{u}x^2}{3}du=-3\int \frac{\sqrt{u}}{(u-1)^2}du\,\begin{vmatrix}v=\sqrt{u} \\dv=\frac {1}{2\sqrt{u}}du\end{vmatrix}\\ =-6\int \frac{v^2}{(v^2-1)^2}dv$$ This integral comes out to be $$\frac{3v}{(v^2-1)}-\frac{3}{2}(\ln|v-1|-\ln|v+1|)$$ Substituting back in terms of u's and then x's gives the final answer of $$x\sqrt{1+\frac{3}{x}}-\frac{3}{2}\left(\ln\left\lvert\sqrt{1+\frac{3}{x}}-1\right\rvert-\ln\left\lvert\sqrt{1+\frac{3}{x}}+1\right\rvert\right)+c$$ 2. My second solution was to use the trigonometric substitution $$x=3\cot^2(\theta)$$ and my solution was: $$\int \sqrt{1+\frac{3}{x}}dx\,\begin{vmatrix}x=3\cot^2(\theta) \\dx=-6\cot(\theta)\csc^2(\theta)d\theta\end{vmatrix}\,=-6\int \sqrt{1+\tan^2(\theta)}\cot(\theta)\csc^2(\theta)d\theta\\ =-6\int \sec{\theta}\cot(\theta)\csc^2(\theta)d\theta=-6\int \csc^3(\theta)d\theta$$ Using the reduction formula $$\int \csc^n(\theta)d\theta=-\left(\frac{1}{n-1}\right)\csc^{n-2}(\theta)\cot(\theta)+\left(\frac{n-2}{n-1}\right)\int \csc^{n-2}(\theta)d\theta$$ , this integral comes out to be $$3\csc(\theta)\cot(\theta)+3\ln|\csc(\theta)+\cot(\theta)|$$ After setting up a right triangle and substitution back in for x's I end up with $$\sqrt{x^2+3x}+3 \ln|\sqrt{x+3}+\sqrt{x}|+c$$ When I graphed both answers, I realized that my first solution yielded a graph that was defined for along the entire domain of the original function , while my second solution yielded a graph that was only defined along the positive domain of the original function. So my question is, why does this occur, whether or not I am missing something, and how do I determine the approach that would guarantee an antiderivative defined along the entire domain of the original function? Any feedback would be appreciated.

When you make the substitution $x=3\cot^2\theta,$ you guarantee that $x$ will be nonnegative.