Finding potential function for a vector field

You don't have to find the integration constant immediately. Keep proceeding as follows.

After you determined that $f(x,y,z) = xy+g(y,z)$, differentiate with respect to $y$.

This gives $\frac{\partial f}{\partial y}=x+\frac{\partial g}{\partial y}=F_y=x$.

Thus, $\frac{\partial g}{\partial y}=0$, which implies that $g$ is a function of $z$ only. In turn, this means that $f(x,y,z)=xy+h(z)$.

Next, differentiate $f$ with respect to $z$.

This gives $\frac{\partial f}{\partial z}=h'(z)=F_z=z^2$.

Thus, $h(z)=\frac13z^3+C$.

Finally, $f(x,y,z)=xy+h(z)=xy+\frac13z^3+C$.

To check this, we have $$\vec F=\nabla f(x,y,z)$$

$$=\hat x\frac{\partial f}{\partial x}+\hat y\frac{\partial f}{\partial y}+\hat z\frac{\partial f}{\partial z}$$

$$=\hat xy+\hat yx+\hat zz^2$$which completes the task!


The function $\phi(x,y,z) = xy + \frac{z^3}{3}$ is a potential for $\mathbf{F}$ since $$\operatorname{grad} \phi = \phi_x \mathbf{i} + \phi_y \mathbf{j} + \phi_z \mathbf{k} = y\mathbf{i} + x \mathbf{j} + z^2\mathbf{k} = \mathbf{F}.$$

To actually derive $\phi$, we solve $\phi_x = F_1, \phi_y = F_2, \phi_z = F_3$. Since $\phi_x = F_1 = y$, by integration $\phi(x,y,z) = xy + u(y,z)$. Now $\phi_y = x + u_y$, so from $\phi_y = F_2 = x$, we have $x + u_y = x$, or $u_y = 0$. By integration, $u(y,z) = v(z)$. Thus $\phi(x,y,z) = xy + v(z)$. Then $\phi_z = v'(z)$, so from $\phi_z = F_3 = \frac{z^3}{3}$, we get $v'(z) = \frac{z^3}{3}$, which by integration yields $v(z) = z^2 + C$, where $C$ is a constant independent of $x,y,z$. This gives the general solution $\phi(x,y,z) = xy + \frac{z^3}{3} + C$. For convenience we set $C = 0$, giving the particular solution $\phi(x,y,z) = xy + \frac{z^3}{3}$.