How to solve the following first order ODE I want to solve the following ODE: $$\left(x^2+x y(x)\right) y'(x)+y(x)^2+3 x y(x)=0.$$ However, I didn't find this fit any types in the textbook. For example, I expressed it as $$M(x,y)dx+N(x,y)dy=0$$ and checked whether $M_y=N_x$ which doesn't hold though. Does anyone know how to solve this?
 A: This is a "homogeneous" equation.  Solve for $y^{\prime}$ and then divide the numerator and denominator of the result by $x^2$ to get:
$$y^{\prime} = \frac{-(y/x)^2-3(y/x)}{1+(y/x)}.$$  Then make the substitution $v=y/x$ (which means that $y^{\prime} = (xv)^{\prime} = v^{\prime}x + v$.  After this substitution, your equation will be separable.
A: $$\left(x^2+x y\right) y'+y^2+3 x y=0$$
Make substitution $y=xz$, where $z$ is function of $x$.
$$
\left(x^2+x^2z\right)\left(z+xz^{'}\right)+x^2z^2+3x^2z=0
$$
Factor out $x^2$ and solve separable ODE
$$
\left(1+z\right)\left(z+xz^{'}\right)+z^2+3z=0\to\\
x\frac{dz}{dx}=-z\frac{z+3}{z+1}-z=-z\frac{2z+4}{z+1}\to\\
\frac{z+1}{2z(z+2)}
dz=-\frac{1}{x}dx\to\frac{1}{4}(\ln(z)+\ln(z+2))=-\ln(x)+C^*\to\\
\ln(z(z+2))=\ln(1/x^4)+\ln(C)\to\\
z(z+2)=\frac{C}{x^4}
$$
Which after inverse substitution leads to 
$$
\frac{y}{x}\left(\frac{y}{x}+2\right)=\frac{C}{x^4}\to \color{red}{y(y+2x)=\frac{C}{x^2}}
$$
Check solution
$$
(x+y)y^{'}=(-1)\left(\frac{C}{x^3}+y\right)\\
\left(x^2+xy\right)y'+y^2+3xy=0\to x\left(x+y\right)y'+y(y+2x)+xy=0\to\\
-x\left(\frac{C}{x^3}+y\right)+\frac{C}{x^2}+xy\equiv 0
$$
Note: factoring out $x^2$, mentioned above, gives us additional particular solution, which is not covered by general formula. $\color{red}{y=0}$
A: The equation can be written as
$$ (y^2+3xy)dx+(x^2+xy)dy=0. \tag{1}$$
Leｔ
$$ M=y^2+3xy, N=x^2+xy. $$
Then
$$ \frac{\partial M}{\partial y}=2y+3x, \frac{\partial N}{\partial x}=2x+y $$
and
$$ \frac{\frac{\partial M}{\partial y}-\frac{\partial M}{\partial y}}{N}=\frac1{x}. $$
Thus the equation has the integral factor
$u= e^{\int \frac1xdx}=x.$ Multiplying both sides of (1) by $x$, then one has
$$ (xy^2+3x^2y)dx+(x^3+x^2y)dy=0 $$
which is exat and it is easy to solve.
