Hey guys, i just started a new course in differential equations and im kinda having a hard time. Heres one of the problems I am having difficulty with:

Verify that the piecewise-defined function

$\displaystyle y=\left\{\begin{array}{cc}-x^2,&\mbox{ if }

x < 0\\x^2, & \mbox{ if } x\geq 0\end{array}\right. $

is a solution of the differential equations $\displaystyle xy'-2y = 0 $ on $\displaystyle (-\infty , \infty)$

Thanks!