I need help to integrate the following integral: $$\int \frac{1}{x+\text{sgn}(x)}\mathrm{d}x$$ Where $$\text{sgn}(x):=\begin{cases}\dfrac{|x|}{x}&\text{if }x\neq0\\0&\text{if x=0}\end{cases}\;\Rightarrow\text{sgn}(x)=\begin{cases}1&\text{if }x>0\\-1&\text{if }x<0\\0&\text{if }x=0\end{cases}$$
But in this case of integrals I can't understand which value I will consider for $\text{sgn}(x)$. Because in the case of indefinite integrals no limits are given. Now since no limits are given therefore it is very difficult for me to understand which value of $\text{sgn}(x)$ to take. If I assume $\text{sgn}(x)=1$ then the above integral will be
$$\int \frac{1}{x+1}\mathrm{d}x=\ln|x+1|+C$$
If I assume the value of $\text{sgn}(x)=-1$ then the above integral will be $$\int \frac{1}{x-1}\mathrm{d}x=\ln|x-1|+C$$
And lastly if I assume $\text{sgn}(x)=0$, then the above integral will be $$\int \frac{1}{x}\mathrm{d}x=\ln|x|+C$$
But how can be $3$ results possible for an indefinite integral? Here in this case, we can clearly see that there are $3$ different results occurring. Please help me out with this discrepancy. I am very much confused with this integral.
As you have noticed correctly that
if $x>0$ $\text{sgn}(x)=1$ then the above integral will be
$$\int \frac{1}{x+1}\mathrm{d}x=\ln|x+1|+C$$
If $x<0$ $\text{sgn}(x)=-1$ then the above integral will be $$\int \frac{1}{x-1}\mathrm{d}x=\ln|x-1|+C$$
$x=0$ is not in domain of the function Now consider sum
$$\ln|x+1|+\ln|x-1|$$
When $x<0$ we want the first term of the sum to disappear, When $x>0$,We want second term of the sum to disappear
How can we do that? Notice
for $x<0$, $\text{sgn}(x)=-1$ which means $1+\text{sgn}(x)=0$
for $x<0$, $\text{sgn}(x)=-1$ which means $\frac{1-\text{sgn}(x)}{2}=1$
for $x>0$, $\text{sgn}(x)=1$ which means $1-\text{sgn}(x)=0$
for $x>0$, $\text{sgn}(x)=1$ which means $\frac{1+\text{sgn}(x)}{2}=1$
These equations are exactly suitable for disappearance of the intended parts of sum as per range of $x$
The final sum becomes
$$\frac{\left(1+\text{sgn}\left(x\right)\right)\ln|x+1|}{2}+\frac{\left(1-\text{sgn}\left(x\right)\right)\ln|x-1|}{2}$$
Which can be further rearranged as
$$\frac{\ln|x^2-1|}{2}+\left(\frac{\ln\frac{|x+1|}{|x-1|}}{2}\right)\left(\text{sgn}\left(x\right)\right)$$
$$=\frac{\ln|x^2-1|}{2}+\left(\frac{\ln\left(\frac{|x+1|}{|x-1|}\right)^{\left(\text{sgn}\left(x\right)\right)}}{2}\right)$$ $$=\frac{1}{2}\ln\left[{|x^2-1|\cdot\left(\frac{|x+1|}{|x-1|}\right)^{\left(\text{sgn}\left(x\right)\right)}}\right]$$ $$=\ln\left[\sqrt {\left[{|x^2-1|\cdot\left(\frac{|x+1|}{|x-1|}\right)^{\left(\text{sgn}\left(x\right)\right)}}\right]}\right]$$
Finally $$\int \frac{1}{x+\text{sgn}(x)}\mathrm{d}x=\ln\left[\sqrt {\left[{|x^2-1|\cdot\left(\frac{|x+1|}{|x-1|}\right)^{\left(\text{sgn}\left(x\right)\right)}}\right]}\right]+C$$