Confusion on differential equations involving ln |y| In the differential equation $\frac{dy}{y}=\frac{2dx}{x}$, taking the antiderivatives gives $\ln |y|=2\ln |x|+c$, and exponentiation gives $|y|=e^c x^2$, and we could write this as $|y|=ax^2$ ($a \in \mathbb{R}$). There are, however, many other functions $y=f(x)$ that satisfy $|y|=ax^2$ aside from the standard $y=cx^2$, since we are allowed to have piecewise function. 
The restriction that $y=f(x)$ has to be continuous implies that the constant has to be equal for all $y \geq 0$ and all $y \leq 0$, but there does not seem to be a problem with a piecewise solution, $y=c_1 x^2$ for $x > 0$ and $y=c_2 x^2$ for $x < 0$ (with y=0 for x=0). This is because the differential equation would be true over both $x>0$ and $x<0$, and for $x=0$, the derivative would be $0$ (by taking both right-hand and left-hand limits). However, the solution says $y=cx^2$ for $c \in \mathbb{R}$, without giving any mention to piecewise function. 
Am I missing something here? Are piecewise functions (as described) actually allowed?
 A: As said by @HansLundmark, the equation is not defined when $x=0$ or $y=0$ and the question doesn't make sense.
We can fix by considering
$$xy'(x)=2y(x)$$ instead.
When $x=0$, it reduces to $y(0)=0$, hence any solution must be by $(0,0)$.
When $y(x)=0$, either $x=0$ (already seen) or $y'(x)=0$, giving the trivial solution $y(x)=0$.
Besides this, the piecewise solution
$$y(x)=\begin{cases}x\le0\to c_-x^2,\\x\ge0\to c_+x^2\end{cases}$$ is perfectly valid, as can be established by integrating with logarithms in the respective domains where no "division by zero" occurs and integrals are proper.

The morale is that you cannot integrate an equation across singularities, and treat
$$\frac {y'(x)}{y(x)}=\frac2x$$ as if it was true everywhere.
A: If the differential equation is $y'=2y/x$ to begin with, it's not even defined at $x=0$. So if you're working over the real numbers, it really only makes sense to consider solutions on the intervals $x>0$ and $x<0$ separately. If $x$ is complex and you seek a solution which is analytic for $x \neq 0$, then it must be $y=cx^2$ (for some $c \in \mathbb{C}$).
