TITLE: Differential equation $y' ^2+(y-1)y'-y=0$
QUESTION [7 upvotes]: I am puzzled over the following differential equation:
$$y' ^2+(y-1)y'-y=0$$
I tried solving for $y$ and got $$y=\frac{y'(y'-1)}{1-y'}$$
But I am not sure where that takes me or if that was even the right approach. Grateful for any tips!

REPLY [16 votes]: The given equation can be written as $(y'+y)(y'-1)=0$, so either $y'=-y$ or $y'=1$, so $y=Ce^{-x}$ and $y=x+C$ are solutions.
Another solution is a piecewise combination of the above. At any point where we switch between the two forms, we have  $-y = y' = 1$, so $Ce^{-x}=-1$. This can only occur if $C<0$, at $x=\log(-C)=c$, giving the following additional solutions:
$$y(x) = \begin{cases}
-e^{c-x} & x \le c \\
x-c-1 & x \ge c
\end{cases}$$
and 
$$y(x) = \begin{cases}
x-c-1 & x \le c \\
-e^{c-x} & x \ge c
\end{cases}$$