Trivial ODE and trivial question:
$$\ x(y+4)+\frac{dy}{dx}=0 $$ with initial conditions $y=-5, x=0$
After we separate variables we get: $$\ -\frac{dy}{y+4}=x\,dx $$
Integrate left and write parts:
$$-\ln(y+4)=\frac{1}{2}x^2 + C $$
Here we see that if $y=-5 $ we have a log of negative number. Trying not to think about it, I proceed as follows:
Exponentiation of both parts:
$$y = e^{-1/2x^2-C} - 4$$ And then: $$y = e^{-1/2x^2}e^{-C} - 4$$ $$y = e^{-1/2x^2}C - 4$$ (this new $C $ to $e^{-C}$ and cannot be negative) $$-5 = e^{0}C - 4$$ $$C=-1$$ (but we see that it is in fact negative under given initial conditions)
which gives us the correct answer:
$$y = -e^{-1/2x^2} - 4$$
Now I feel that I've cheated somewhere. My only guess that I was able to deal with a log of a negative number and get negative $C $ (which shouldn't be negative) is because I have involved complex numbers between the lines. Is it so? If not, how can I make this solution rigorous?
Thanks!
Hint:
Re: your first integration: remember that $$\int \frac{f'(y)}{f(y)}dy = \ln(|f(y)|) + C$$
So in your case, the LHS should result in $−\ln(|y+4|).$ Hence ...