Solve $$\frac{dy}{dx}=\frac{1}{x}$$
$$\int \frac{dy}{dx} dx = \int \frac{1}{x} dx$$
$$y = \log(|x|) + C$$
Is this solution right? I don't think this solution is right. I think the following solution is right.
$$y = \begin{cases} \log(x) + C_1 &\text{if} \quad x \in (0, \infty)\\ \log(-x) + C_2 & \text{if} \quad x \in (-\infty, 0)\end{cases}$$
When we find a function which satisfies a differential equation, do we find a function whose domain is an interval?