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?