Absolute value in solution of first order linear differential equation Let’s solve the first order linear equation $ y’ + {1\over{x}}y = 0$.
$ y’/y = -1/x $
$ ln|y| = -ln|x| + C $
$ |y| = {C\over{|x|}} $
So it seems to me, I have to choose every y that equals to $C/|x|$ if I get the absolute value of y.
Both $C/|x|$ and $C/x$ seems to satisfy this requirement. However, my textbook only has $C/x$ as the solution.
Did I do something wrong?
Or is it a convention to just ignore the absolute value? If so, why?
 A: I appreciate that you thought deeply about this question and raised it again after our comments of a couple of months ago.
As you noted, things can become complicated with the absolute value. The functions $y=\frac{C}{x}$ and $y=\frac{C}{|x|}$ are not the same. Note that in general the value of $C$ can be positive or negative, which produces different functions. Which function should we choose as the solution to the equation? The answer depends on the constraints of the problem.
Let's look more carefully at the following combinations of functions and $C$ signs. For simplicity, I chose $|C|=1$ but that doesn't reduce the generality of the arguments that follow. Clearly, $x=0$ is excluded from the domains.
$$y = \frac 1x $$

Notice that $x$ and $y$ always have the same sign and that the function is always descending ($y' < 0$) .
$$ $$
$$y = \frac {-1}{x} $$

Notice the contrast with the previous function. Here, $x$ and $y$ always have opposite signs and the function is always ascending ($y' > 0$) .
$$ $$
$$y = \frac {1}{|x|} $$

$y$ is always positive. When $x < 0$ , $x$ and $y$ have opposite signs. When $x > 0$ , $x$ and $y$ have the same sign. The function is ascending for $x < 0$ and descending for $x > 0$ .
$$ $$
$$y = \frac {-1}{|x|} $$

$y$ is always negative. The function is descending for $x < 0$ and ascending for $x > 0$ .
Notice how fundamentally different the absolute value functions are from the non-absolute value functions. Now, which one(s) of these should we choose as the solutions to the original equation? Let's look at the equation more closely. We have:
$$y' = - \frac yx $$
The sign of $y'$ is the opposite of the sign of $\frac yx$ .
If $\frac yx > 0$ , that is, if $x$ and $y$ have the same sign, then $y' < 0$ and the curve of the function is descending.
If $\frac yx < 0$ , that is, if $x$ and $y$ have opposite signs, then $y' > 0$ and the curve of the function is ascending.
Now, if all over the domain of $x$ only one of the above two cases applies, that is, if $\frac yx > 0$ for all $x$ in the domain, or if $\frac yx < 0$ for all $x$ in the domain, then the sign of $y'$ does not change in the domain. You can see from the figures above that in these cases, $y = \frac Cx$ is the solution to the equation. You have also verified that this solution satisfies the equation.
Alternatively, it is possible that $x$ and $y$ have the same sign in some part of the domain, opposite signs in another part of the domain. There is nothing mentioned in the original problem that prevents this case. In such a case, as the last two graphs show, the solution of the equation is $y = \frac{C}{|x|}$ , and you have verified that this, too, satisfies the equation.
Your textbook says $y = \frac Cx$ is the answer. User @yves-daoust gives an answer that seems to be always positive, so suggesting that $y = \frac {C}{|x|}$ is the answer. I would say they are all right, as long as they are not exclusive answers. To give you a specific example, if we know that the curve of the function passes through point $(1,1)$ then the solution function may be $y = \frac 1x$ , and it may as well be $y = \frac {1}{|x|}$ . We saw in the figures that these two functions are not the same, and yet they both satisfy the original equation. I would say, in order to choose one of these two functions, we need one more piece of information.
Such additional information can be a second point, whose $x$ has the opposite sign of the first point. For example, if we are told that $(-1,-1)$ is the second point on the curve of the function, then we are certain that $y = \frac 1x$ is the only solution to the equation. Conversely, if we were told that $(-1,1)$ is the second point on the curve of the function, then $y = \frac{1}{|x|}$ would be the solution. However, all of this may sound weird because we expect to need only one point of the curve (and not two) in order to find the solution to a 1st order ODE.
Alternatively, the additional piece of information to help us specify the solution can be the range of $y$ . If we are told that we should find a solution that ranges in $R^+$ only (or in $R^-$ only), then we could say that the answer involves the absolute value function. Conversely, if we are told that the solution ranges in $R^+$ and $R^-$ , then we know that the answer does not include the absolute value function.
A: The equation is defined either on the domain with $x>0$ or the one with $x<0$.
$y=0$ is a solution. You need to discuss this case first as to avoid division by zero.
For $x\ne 0$ the equation is Lipschitz in $y$, thus all solutions are unique.
In total, each solution is constrained to the quadrant that contains the initial point, the sign of $x$ and $y(x)$ is constant. Thus you can push the signs as constant factors into the constants.

Of course you could also notice that $(xy)'=xy'+y=0$ so that $xy(x)=C$, which removes any sign discussions.
A: The ubiquitous antiderivative of $\dfrac1x$, namely $\log|x|$ is highly questionable, because it does not express that you may not cross $x=0$.
If we use your solution, we have
$$y=\pm\frac c{|x|}.$$
Then, plugging this result in the equation, we get
$$\mp\frac c{x^2}\text{sgn}(x)\pm\frac c{x|x|}=0$$ which is indeed an identity.

Anyway, I claim that the general solution is
$$\begin{cases}x<0\to y=\dfrac{c_-}x,\\x>0\to y=\dfrac{c_+}x.\end{cases}$$
Indeed, these two expressions satisfy the ODE, except at $x=0$.
