Given $\dfrac{dy}{dx} = -\dfrac{y}{x}, y(-2) = -2$
I wish to solve for $y(x)$.
Separating the variables, I have,
$\dfrac{1}{y} dy = -\dfrac{1}{x} dx$
So
$\ln(|y|) = -\ln(|x|) + c$
So
$|y| = \exp({-\ln(|x|)+ c)}) = K \exp({\ln(\dfrac{1}{|x|})}) = K\dfrac{1}{|x|}$
At this step, I am unsure how to deal with the absolute value sign. Does anyone have idea as to how to proceed?
Note that you can solve it without absolute value $$\dfrac{dy}{dx} = -\dfrac{y}{x}, y(-2) = -2$$ $$y'x+y=0$$ $$(xy)'= 0\implies xy=K \implies K=4$$ Therefore $$y=\frac 4x$$