Differential equations: Shouldn't the method of separation of variables miss the solutions when x=0? This question is regarding "Example 6" from the book "Elementary differential equations with boundary value problems" by Edwards and Penney.
Consider the ODE:
$x \frac{d y}{d x}=2 y$    (1)
We apply the separation of variables technique to obtain:
$\frac{1}{y}dy=\frac{2}{x}dx$ (2)
which provides the general solution:
$y(x)=C x^{2}$  (3)
The book mentions that "the general solution (3) satisfies (1) for any value of the constant C and for all values of the variable x".
However, I believe the statement is wrong when $x=0$. By using the separation of variables, we divided by $x$ and $y$ to obtain (2). Thus, we make the implicit assumption that $x \neq 0$, and the separation of variables will generate solutions where $x \neq 0$.
How can $y$ be defined for any $x$, when we implicitly assume that $x \neq 0$?
 A: You are correct, as an ordinary DE the domain does not contain the vertical line $x=0$. It is a special feature of this equation that you can take two solutions $=C_1x^2$ for $x<0$ and $=C_2x^2$ for $x>0$ and connect them to a differentiable function at $x=0$. But there is no innate connection between the two constants, one can take any random combination.
A: For a differential equation of the form $\alpha(x)y'(x)=f(x)(g\circ{y})(x)$ in $y,$ $y$ need not be differentiable at any points such that $\alpha(x)=0$ in order for the equation to be satisfied everywhere else. Hence, the domain of $y$ must initially be assumed to be $\mathbb{R}\setminus{Z}_{\alpha},$ where $Z_{\alpha}:=\{x\in\mathbb{R}:\alpha(x)=0\},$ and it is only extended to $\mathbb{R}$ if the singularities are removable.
In your example equation, $xy'(x)=2y(x),$ $y$ is assumed implicitly to have domain $\mathbb{R}\setminus\{0\},$ making the domain disconnected. The equation must be separately solved for the cases $x\lt0$ and $x\gt0.$ For the case of $x\lt0,$ there are three further cases to consider: $y\lt0,$ $y=0,$ which is trivial, and $y\gt0.$  For the three cases, one has $$\ln[-y(x)]=2\ln(-x)+C_-$$ $$y(x)=0$$ $$\ln[y(x)]=2\ln(-x)+C_-,$$ respectively. These simplify to $$y(x)=-C_-x^2$$ $$y(x)=0x^2$$ $$y(x)=C_-x^2,$$ which are the cases such that $$y(x)=A_-x^2,\,A_-\lt0$$ $$y(x)=A_-x^2,\,A_-=0$$ $$y(x)=A_-x^2,\,A_-\gt0.$$ The cases can be collapsed into a single case, where $A_-\in\mathbb{R},$ and $y(x)=A_-x^2.$
For $x\gt0,$ the analysis is completely analogous, resulting in the most general solution to be $y(x)=A_+x^2$ where $A_+\in\mathbb{R}.$ Thus, the general solution family for the equation is given by $$y(x)=\begin{cases}A_-x^2&x\lt0\\A_+x^2&x\gt0\end{cases}.$$ Of course, some solutions can be continuously and differentiably extended to $\mathbb{R},$ but this requires that $A_-=A_+=A.$ Such solutions satisfy the differential equation in $\mathbb{R}.$
