Official solution
\[y + {{xdy} \over {dx}} = {x^2}\] (given)
\[ \Rightarrow {{dy} \over {dx}} + {y \over x} = x\]
If \[{e^{\int {{1 \over x}dx} }} = x\]
Solution of DE
\[ \Rightarrow y\,.\,x = \int {x\,.\,x\,dx} \]
\[ \Rightarrow xy = {{{x^3}} \over 3} + {c \over 3}\]
Passes through (-2, 2), so
-12 = - 8 + c \[\Rightarrow\] c = - 4
\[\therefore\] 3xy = x3 - 4
i.e. 3x . f(x) = x3 - 4