# Ordinary differential equation Help!

Math-heads, I'm really struggling with the following ODE which has to be solved by the method of variation of constants and perhaps with some initial substitution:

$\frac{dy}{dx} = -2\frac{y}{x}+xy^2$

Any help is much appreciated!

-
This OE is not a linear equation! I know that the method is applicable foe linear ones. Please light my mind if I am missing something. – Babak S. Feb 9 '13 at 20:05
Towards making a simplifying substitution, note your equation is a Bernoulli equation. – David Mitra Feb 9 '13 at 20:08
Thanks for the help! The reference to the Bernoulli equation is a game changer! – V. Krumov Feb 9 '13 at 20:58

Hint: As @David commented correctly, this non linear ODE is a Bernoulli one. For solving it, you can always set $w=y^{1-n}, n\neq 1,~ 0$ in the original ODE to find another linear one. Here you have $n=2$, because of the power of $y$, so $w=y^{-1}$ and then we are lead to solve the linear following ODE: $${-w'}+\frac{2}{x}w=x$$