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?
 A: $$(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$$
A: You may want to introduce your integrating factor at an earlier stage of the process.  Put it into the partial derivative equation:
$\partial_y(P\mu)=\partial_x(Q\mu)$
From the product rule for differentiation:
$\partial_yP(\mu)+P\partial_y(\mu)=\partial_xQ(\mu)+Q\partial_x(\mu)$
To apply this equation given $\mu=\mu(z),z\equiv x+y^2$ we need to convert the partial derivatives $\partial_x\mu, \partial_y\mu$ into the total derivative $\mu'=d\mu/dz$.  This is done with the Chain Rule, thus
$\partial_y\mu=\partial_y(x+y^2)(\mu')=2y\mu'$
$\partial_x\mu=\text{reader fills that in}$
With the partial derivatives of $\mu$ thus resolved, we substitute in $P,Q$ and their derivatives and we should get
$2y\mu'(3x+2y+y^2)+\mu(2+2y)=\mu'(x+4xy+5y^2)+\mu(1+4y)$
We should be able to rearrange this to get
$\mu'\color{blue}{(2y^3-y^2+2xy-x)}-\mu(2y-1)=0$
Then after factoring the expression in blue ultimately get an ordinary differential equation containing only $\mu$ and $z$, which is easy to solve:
$\mu'z-\mu=0$
and plug $z=x+y^2$ into the identified solution.
I checked the result directly and the partial derivative equation is satisfied with the solution I chose for the ordinary differential equation.
