I'm given a problem where I need to determine whether or not force $F$ is conservative, and verify by showing that it is equal to the gradient of potential $\nabla U$, for $F = (y, x, 0)$
I tried solving be verifying that $\nabla \times F = 0$, which I did using taking $\nabla \times F = (0-0)\hat{x} + (0-0)\hat{y} + (\frac{\partial}{\partial x}F_y-\frac{\partial}{\partial y}F_x)\hat{z}=(1-1)\hat{z}=0$ so by the curl method, F is conservative.
But when I took $U=-\int F_xdx-\int F_ydy=-\int ydx-\int xdy=-2xy$, where $\nabla U$ is clearly not $(y,x,0)$. I'm not sure how to deal with the 2 that pops up, and what my mistake is.
We have
$\frac{\partial U}{\partial x}=-y$
so $U=-xy+f(y).$
and
$\frac{\partial U}{\partial y}=-x$
so $U=-xy+g(x)$
thus
$f(y)=g(x)=C$
and
$U=-xy+C$.