Determine whether or not each of the given vector fields is conservative.
If the vector field is conservative, find a potential function for the field.
(a) $\vec{F}\left(x, y\right) = \left(x^2 + y^2\right)\vec{i} - 2x\vec{j}$
(b) $\vec{F}\left(x, y\right) = \left(2x + y\cos \left(xy\right), x\cos \left(xy\right)-1\right)$
my attempt
(a) $P = x^2 + y^2$ and $Q = -2x$
$\frac{dP}{dy} = 2y$ and $\frac{dQ}{dx} = -2$
since $\frac{dP}{dy} ≠ \frac{dQ}{dx}$ F cannot be conservative
(b)
$P = 2x + y \cos \left(xy\right)$ and $Q = x\cos \left(xy\right) - 1$
$\frac{dP}{dy} = \cos \left(xy\right) - xy\sin \left(xy\right)$
$\frac{dQ}{dx} = \cos \left(xy\right) - xy\left(\sin \left(xy\right)\right)$
since they're equal $F$ has to be conservative
so let (1) (2) respectively : $\frac{df}{dx} = 2x + y \cos \left(xy\right), \frac{df}{dy} = x\cos \left(xy\right)-1$
integrate (1) with x
$f\left(x, y\right) = x^2 + \sin \left(xy\right) + g\left(y\right)$ (3)
diff with y
$\frac{df}{dy} = x\cos \left(xy\right) + g'\left(y\right)$
combine from (2)
$x\cos \left(xy\right) + g'\left(y\right) = x\cos \left(xy\right) - 1$
$g'\left(y\right) = -1$
integrate with y
$g\left(y\right) = -y$
from (3)
$f\left(x, y\right) = x^2 + \sin \left(xy\right) - y$ is a potential function
is this right?