Solve for the general solution of the equation $(2y^2+3xy-2y+6x)dx + x(x+2y-1)dy=0$ I know that this equation is neither exact nor homogeneous but after I put it in the form \[\frac{dy}{dx} + \frac{2y^2+3xy-2y+6x}{x(x+2y-1)}=0\] 
I don't know how to proceed with it. Maybe some substitutions I overlooked?
Thanks!
 A: Or you can calculate directly an integrating factor. 
Integrating factor. If you write your equation as the line-field represented by the one-form $$(2y^2+3xy-2y+6x)dx + x(x+2y-1)dy=0$$ set $A(x,y) = 2y^2+3xy-2y+6x$ and $B(x,y) = x(x+2y-1)$ and look for a function $\mu(x,y)$ such that the form $\mu \, A \, dx + \mu \, B \, dy$ is exact, i.e. you need to find $\mu$ such that 
$$\frac{\partial (\mu \, A)}{\partial y} - \frac{\partial (\mu \, B)}{\partial x} = 0$$ which expanded gives you
$$A \, \frac{\partial \mu}{\partial y} - B \, \frac{\partial \mu}{\partial x} + \left(\frac{\partial A}{\partial y} - \frac{\partial B}{\partial x}\right) \, \mu = 0$$ First calculate the divergence $$\frac{\partial A}{\partial y} - \frac{\partial B}{\partial x} = 4y+3x-2 - 2x-2y +1 = x + 2y - 1 = \frac{1}{x}\, B$$ Therefore, if you take $\mu = \mu(x)$ to depend only on $x$, then your equation for $\mu$ reduces to 
$$- B \, \frac{\partial \mu}{\partial x} + \frac{1}{x}\, B \, \mu = 0$$ which allows you to cencel-out $B$ on both side yielding 
$$- \frac{\partial \mu}{\partial x} + \frac{1}{x} \mu = 0$$ or if you prefer rewrite it as
$$- x\, \frac{d\mu}{d x} + \mu = 0$$ Well, one very simple non-tirival solution of the latter equation is $\mu(x) = x$ and this is your integrating factor.
A change of variables. Alternatively, because of the factor $(x+2y-1)$ in term $B$ you can consider the new variable $$w = \frac{1}{4} \, (x+2y - 1)^2$$ whose differential is 
$$dw = \frac{1}{2} \, (x+2y - 1) \, d(x+2y) = \frac{1}{2}\, (x+2y - 1) \, dx +  (x+2y - 1) \, dy $$ If we multiply both sides by $x$ we get 
$$x\, dw = \frac{1}{2}\, x \, (x+2y - 1) \, dx +  x\, (x+2y - 1) \, dy = 
\frac{1}{2}\, (x^2+2xy - x) \, dx  + B \, dy$$ i.e. 
$$B \, dy = x \, dw - \frac{1}{2}\, (x^2+2xy - x) \, dx$$
so the equations becomes
$$0 = A\, dx + B \, dy = (2y^2+3xy-2y+6x)\, dx - \frac{1}{2}\, (x^2+2xy - x) \, dx + x \, dw$$
$$0 = \left(2y^2+3xy-2y+6x - \frac{x^2}{2} - xy + \frac{x}{2}\right) \, dx + x \, dw$$
$$0 = \left((2y^2+2xy-2y) +6x - \frac{x^2}{2} + \frac{x}{2}\right) \, dx + x \, dw$$
The change of variable $w = \frac{1}{4} \, (x+2y - 1)^2$ can be expanded as
$$4 \, w = x^2+4y^2 + 1 + 4xy - 2x - 4y = (4y^2 + 4xy - 4y )+ x^2 - 2x + 1$$ and thus 
$$2y^2 + 2xy - 2y = 2 \, w - \frac{x^2}{2} - x + \frac{1}{2}$$
which I can plug back into the equation, replacing $2y^2 + 2xy - 2y$ and obtain the new equation
$$0 = \left(2 \, w - \frac{x^2}{2} - x + \frac{1}{2} +6x - \frac{x^2}{2} + \frac{x}{2}\right) \, dx + x \, dw$$
$$0 = \left(2 \, w - x^2  + \frac{11 \, x}{2} + \frac{1}{2}\right) \, dx + x \, dw$$ in other words, the equation looks like 
$$\big(2 \, w + b(x) \big) \, dx + x \, dw = 0$$ which after representing $w = w(x)$ as a function of $x$ turns into the linear equation
$$x\, \frac{dw}{dx} + 2\, w + b(x) = 0$$
A: Because of the denominator, I should start using $$x+2y-1=z\implies y=z+\frac{1-x}{2}\implies y'=z'-\frac12$$ This should give after simplifications $$4 z \left(x z'+z\right)+(15-2 x) x-1=0\implies 4 z \left(x z'+z\right)=-2 x^2+15 x-1$$ which looks much better (I hope) since making the solution of the homogeneous equation to be $z=\frac c x$.
Now, using variation of parameters, the last ODE becomes $$\frac{4 c c'}{x}=-2 x^2+15 x-1\implies 4c c'=2(c^2)'=-2 x^3+15 x^2-x$$ which is simple.
