<s>[INST] Integrating factor for the ODE $(3x+2y+y^2)dx + (x+4xy+5y^2)dy = 0$ I was asked to find an integrating factor $\mu = \mu(x+y^2)$ for the ODE
$$(3x+2y+y^2)dx + (x+4xy+5y^2)dy = 0.$$
So the natural approach was define $P = 3x+2y+y^2$ and $Q = x+4xy+5y^2.$ Then,
$$\partial_yP = 2+2y,~~~\partial_xQ = 1+4y$$
and hence $\partial_yP - \partial_xQ = 1-2y.$ Let us consider then
$$\frac{\partial_yP-\partial_xQ}{Q} = \frac{1-2y}{x+4xy+5y^2}$$
and define $z = x+y^2.$ Thus,
$$\frac{\partial_yP - \partial_xQ}{Q} = \frac{1-2y}{(z-y^2)(1+4y)+5y^2}.$$
But from here I really don't know how to proceed. Any hint?
 [/INST] $$(3x+2y+y^2)dx + (x+4xy+5y^2)dy = 0$$
That you can rewrite as:
$$(x+y^2)dx+2(x+y)dx + (x+y^2)dy+4y(x+y)dy = 0$$
$$(x+y^2)d(x+y)+2(x+y)(dx+2ydy) = 0$$
$$(x+y^2)d(x+y)+2(x+y)d(x+y^2) = 0$$
$$\dfrac {d(x+y)}{x+y}+2\dfrac {d(x+y^2)}{x+y^2} = 0$$
Integrate.
$$(x+y)(x+y^2)^2 = C$$
</s>