The DE is
(2y-1/x+cos(3x) ).dy/dx+y/x^2 -4x^3+3y sin(3x)=0
Say whether it is exact or not. And solve if it is exact.
Rewrite the DE as
(-y/x^2 +4x^3-3y sin(3x) ).dx+(2y-1/x+cos(3x) ).dy=0
i.e.
P.dx+Q.dy=0
Where P(x,y)=-y/x^2 +4x^3-3y sin(3x)
And, Q(x,y)=2y-1/x+cos(3x)
Doing partial differentiation,
P_y = -1/x^2 -3 sin(3x)
Q_x = 1/x^2 -3 sin(3x)
Now P_y ≠ Q_x, which means that the DE is not exact.
However, the phrasing of the question suggests that the DE should be exact, so I am going to assume that there was a typo when entering the DE.
For P_y=Q_x. We need either
P(x,y)=y/x^2 +4x^3-3y sin(3x) and Q(x,y)=2y-1/x+cos(3x)
Or,
P(x,y)=-y/x^2 +4x^3-3y sin(3x) and Q(x,y)=2y+1/x+cos(3x)
I am going to assumed the 1st option and take
P(x,y)=y/x^2 +4x^3-3y sin(3x) and Q(x,y)=2y-1/x+cos(3x)
Since P_y=Q_x now, then the DE is exact, and we can continue to solve it.
Rewrite the DE again.
P.dx+Q.dy=dU=∂U/∂x.dx+∂U/∂y.dy=0 (Since dU=0, then U(x,y)=const.)
Which means that we can write,
∂U/∂x=P=y/x^2 +4x^3-3y sin(3x)
Then
U(x,y)=-y/x+x^4+ y cos(3x)+k(y)
And
∂U/∂y=Q=2y-1/x+cos(3x)
So,
U(x,y)=y^2-y/x+y cos(3x)+h(x)
Comparing the two forms for U(x,y), we can say that, k(y)=y^2, h(x)=x^4.
Solution: U(x,y)=x^4+y^2-y/x+y cos(3x)=const