I'm stuck with this differential equation $ \frac {dy}{dx}=- \frac {xy}{x+1} $ This is what I've been able to do so far: 
\begin{align}
\frac{dy}{dx} &= -\frac{xy}{x+1} \\
\implies \int \frac{1}{y}dy &= \int -\frac{x}{x+1}\,dx
\end{align}
Here I substitute $u = x+1 \implies du = dx, x = u-1$ and I get 
\begin{align}
\ln|y| &= -\int \frac{u-1}{u}\,du \\
&= -\int 1 - \frac{1}{u}\,du \\
&= -x + \ln|x+1| + C
\end{align}
Then I exponentiate: 
\begin{align}
e^{\ln|y|} &= e^{-x + \ln|x+1| + C} \\
\implies |y| &= e^{-x+C}|x+1| 
\end{align}
I'm not sure that I haven't made any mistakes so far, or how to move forward given the absolute value bars. How would you rewrite in terms of $y = f(x)$ without the absolute value bars?
 A: The function $\frac{1}{x}$ has two anti-derivatives, $\log(x)$ and $\log(-x)$ depending on whether or not $x$ is positive or negative. The function comes in two "pieces", so for example, you cannot integrate $\frac{1}{x}$ from $-1$ to $1$ as $\log(1) - \log(-(-1)) = 0$.
The point is, you need to decide whether or not $x + 1$ is going to be positive or negative and this gives you two separate cases. Or if you prefer, use $\log(\pm x)$ instead of $\log|x|$ with the knowledge that this means $+x$ if $x > 0$ and $-x$ if $x < 0$. This gives you
$$ \pm y = \pm e^{-x + C}(x + 1). $$
As you probably know, $e^C$ can be replaced by a constant $C'$ because usually $y = 0$ is also a solution (as is $y = -f(x)$ if $y = f(x)$ is a solution). Next, note that $\pm a = \pm b$ has only two possibilities: $a = \pm b$ because if we have $-a$ on the left we can just move that $-$ sign over.
Thus we have
$$ y = \pm C' e^{-x}(x + 1) $$
where the sign is $+$ if $x + 1 > 0$ and $-$ if $x + 1 < 0$.
We can finally write this concisely as
$$ y = C' e^{-x}|x + 1|. $$
And notice, because $C'$ is allowed to be negative, we didn't lose those solutions.

So that's a whole bunch of bugging around. We should also check that it still satisfies the original equation:
$$ \frac{dy}{dx} = - C'e^{-x}|x + 1| + C'e^{-x}\frac{|x + 1|}{x + 1} $$
where $|a|/a$ just gives us $1$ if $a > 0$ and $-1$ if $a < 0$ (exercise: check that the derivative of $|x|$ is $|x|/x$ if $x \ne 0$).
We now use the fact that $y = C'e^{-x}|x + 1|$ to simplify this to
$$ \frac{dy}{dx} = - y + \frac{y}{x + 1} = - \frac{xy}{x + 1}.$$

For bonus points: notice that the function
$$ y =
\begin{cases}
C_1 e^{-x} (x + 1) & \text{if } x + 1 > 0 \\
C_2 e^{-x} (x + 1) & \text{if } x + 1 < 0
\end{cases}
$$
is a solution for all $C_1, C_2$. This goes back to my first point which is that the function $\frac{1}{x}$ is in two pieces: they don't see each other.
A: At each point, $y=e^{-x+C}|x+1|$ or $y=-e^{-x+C}|x+1|$.
Given that $y$ is differentiable, it's continuous so the $\pm$ part can only switch at points where $y=0$. Since $e^{-x+c}$ is always nonzero, the only root is $x=-1$.
However note that if the $\pm$ doesn't swap at $x=-1$, $y$ is non-differentiable at that point. Therefore $y=e^{-x+C}(x+1)$ or $y=-e^{-x+C}(x+1)$ are the two solutions.
This might help to illustrate the non-differentiability of y.
A: Looks right. You have $$ \ln |\frac{y}{x+1}| = -x +C \ \implies |\frac{y}{x+1}|=B e^{-x} $$
for $B> 0$. But this is equivalent to $$ \frac{y}{x+1}=D e^{-x} \implies y=D (x+1)  e^{-x}$$
for $D$ arbitrary.
And you can check that this indeed verifies the original differential equation.
