Solution of first order inexact differential equation I have following differential equation before me:
$(2y sin(x)+3y^4 sin(x)cos(x))dx-(4y^3 cos^2(x)+cos(x))dy=0$
It is an inexact differential equation. Its Integrating factor comes out to be $cos(x)$.
New $M= 2ysin(x)cos(x)+3y^4sin(x)cos^2(x)$
New $N= -(4y^3cos^3(x)+cos^2(x))$
When I integrate $M$ treating $y$ as a constant, there are more than one way of doing this.
The term $2sin(x)cos(x)$ in $M$ can be integrated to give either $sin^2(x)$ or $-cos(2x)/2$ which differ by a constant. Also in $N$,$cos^2(x)$ could be written either as $1-sin^2(x)$ or $(1+cos(2x))/2$ giving the terms which do not contain $x$ as either $1$ or $1/2$.
All these integrands yield different solutions. I am confused as to which one of these is the correct solution? Are all of them correct?

$$-\dfrac {\cos (2x) }2=\dfrac 12 (2\cos^2  x-1)=\dfrac 12(1-2\sin^2 x)$$
All the constants are absorbed by the constant on the right side of the solution:
$$F(x,y)=C$$

$$(2y \sin(x)+3y^4 \sin(x)\cos(x))dx-(4y^3 \cos^2(x)+\cos(x))dy=0$$
$$y d(\cos^2x)+y^4 d(\cos^3(x))+ \cos^3(x)dy^4+cos^2(x)dy=0$$
$$ d(y\cos^2x)+d(y^4\cos^3(x))=0$$
After integration:
$$\boxed {y\cos^2x+y^4\cos^3(x)=K}$$
The constant on the right side absorbs all the constants so all the solutions are equivalent and correct.

I am not sure to clearly understand the problem but let's integrate the way you did:
$$M= 2y\sin(x)\cos(x)+3y^4\sin(x)\cos^2(x)$$
We have that
$$\partial_x F=M$$
$$F= \int Mdx$$
$$F=\int 2y\sin(x)\cos(x)+3y^4\sin(x)\cos^2(x)dx$$
Don't forget the constant of integration:
$$F=y\sin^2(x)-y^4\cos^3(x)+\color{red}{g(y)}$$
$$F=-y\cos^2(x)-y^4\cos^3(x)+\color{red}{g(y)+y}$$
$$F=-y\cos^2(x)-y^4\cos^3(x)+\color{red}{h(y)}$$
Do the same for $N$:
$$F =\int  -(4y^3\cos^3(x)+\cos^2(x))dy$$
$$F = -y^4\cos^3(x)-y\cos^2(x) +\color {green}{r(x)}$$
From these two equations about $F$ we deduce that $h(y)=r(x)=c$. So that the solution is now:
$$F(x,y)=K$$
$$y^4\cos^3(x)+y\cos^2(x) =\color {green}{C}$$
It ends with the same answer as we find before.
