Confusion with how to handle constant in differential equation

I'm trying to learn to solve differential equations. Currently in class we are discussing integration factors. Here is one of the problems on the homework -

$$(3xe^y+2y)dx + (x^2e^y+x)dy=0\tag{1}$$

We can quickly see that if we take $$\frac{\partial}{\partial y}$$ of the left term and $$\frac{\partial}{\partial x}$$ of the right term and we see that they are not equal, so we need an integrating factor.

An integrating factor of $$x$$ gets us a bit farther:

$$(3x^2e^y+2xy)dx + (x^3e^y+x^2)dy=0\tag{2}$$

And now when we take $$\frac{\partial}{\partial y}$$ of the left term and $$\frac{\partial}{\partial x}$$ of the right term , the two are equal.

From here, I think we would integrate the left term with respect to $$x$$ and right term with respect to $$y$$ as follows -

$$\int {(3x^2e^y+2xy)dx} + \int (x^3e^y+x^2)dy = 0 \tag{3}$$ $$2x^3e^y+2x^2y+C=0\tag{4}$$ $$x^3e^y+x^2y=C\tag{5}$$

Also, in $$(5)$$, is it fine to move the Constant to the right and absorb the common coefficient of 2 into it to simplify the expression? $$(5)$$ is the answer in the book and (4) was my answer. Either I have done something wrong, or I am confused in regard to what may be combined into the constant $$C$$.

• Here you have some examples with exercices and full solutions. You may find it helpful tutorial.math.lamar.edu/Classes/DE/Exact.aspx – Isham Nov 15 '18 at 8:09
• Just for your curiosity, there is an analytical expression of $y(x)$ in terms of Lambert function. – Claude Leibovici Nov 15 '18 at 8:21

$$(3xe^y+2y)dx + (x^2e^y+x)dy=0\tag{1}$$ multiply by X as integrating factor as you wrote $$(3x^2e^y+2yx)dx + (x^3e^y+x^2)dy=0$$ Rearrange terms $$(3x^2e^ydx+x^3e^ydy)+(2yxdx + x^2dy)=0$$ $$d(x^3e^y)+d(x^2y)=0$$ After integration $$x^3e^y+x^2y=K$$ For the constant yes it absorbs the factor 2 and you can have it on the other side. Your result is correct but I wouldn't write the integrals you wrote... $$2x^3e^y+2x^2y+C=0$$ $$\implies x^3e^y+x^2y=-\frac C 2$$ Substitute $$K=-\frac C2 \implies x^3e^y+x^2y=K$$ K is just a constant.