I've encountered an obstacle while trying to solve the following integral:
$$\int{\frac{\sqrt{x^2+2x+1}}{x}dx}$$
First thing we shall do is see that under the square root is actually $(x+1)^2$. When I cancelled the square root I got the following integral:
$$\int{\frac{|x+1|}{x}\,\mathrm dx}$$
After that I've separated the problem into two cases:
$1.$ Case:
$$\int{\frac{\sqrt{x^2+2x+1}}{x}dx}=-x-\ln|x|+C,\space x<-1$$
$2.$ Case:
$$\int{\frac{\sqrt{x^2+2x+1}}{x}dx}=x+\ln|x|+C,\space x>-1, x\neq{0}$$
But this apparently isn't the correct solution and the only solution is: $$\int{\frac{\sqrt{x^2+2x+1}}{x}dx}=x+\ln|x|+C,\space x\neq{0}$$ Is this really the case, and if yes, then why?
\begin{align} \int{\frac{\sqrt{x^2+2x+1}}{x}\,\mathrm dx}={}&\int\frac{|x+1|}{x}\,\mathrm dx\\ ={}&\int\operatorname{sgn}(x+1)\left(1+\frac1x\right)\,\mathrm dx\\ ={}&\begin{cases} -x-\ln(-x)-2+C_1, &x<-1;\\ x+\ln(-x)+C_1, &-1\le x<0;\\ x+\ln(x)+C_2, &x>0 \end{cases} \end{align}
-2adjustment in the first case (alternatively: a+2adjustment in the second case) is necessary! Without it, the left piece of each antiderivative (i.e., for each $(C_1,C_2)$ couple) is discontinuous, and therefore not differentiable, at $-1$ (a non-differentiable antiderivative is of course a contradiction). It is easy to neglect this adjustment and write† \begin{align} \int_{-2}^{-0.5}\frac{|x+1|}{x}\,\mathrm dx ={}&\int_{-2}^{-0.5}\operatorname{sgn}(x+1)\left(1+\frac1x\right)\,\mathrm dx\\ \color{red}={}&\Big[\operatorname{sgn}(x+1)\left(x+\ln(-x)\right)\Big]_{-2}^{-0.5}\quad\quad\Large\color{red}✗\\ ={}&-2.5,\end{align} which is incorrect, because in fact $$\int_{-2}^{-0.5}\frac{|x+1|}{x}\,\mathrm dx=-0.5.$$A visual proof:
†When computing the integral on $[a,b]$ of a continuous piecewise function, using the FTC piece-wise is equivalent to determining its indefinite integral then using the FTC once (at $a$ and $b$).