Finding potential function for a vector field Let $\mathbf{F}(x,y,z) = y \hat{i} + x \hat{j} + z^2 \hat{k}$ be a vector field. Determine if its conservative, and find a potential if it is.
Attempt at solution:
We have that $\frac{\partial F_1}{\partial y} = 1 = \frac{\partial F_2}{\partial x} $, $\frac{\partial F_1}{\partial z} = 0 = \frac{\partial F_3}{\partial x}$, $\frac{\partial F_2}{\partial z} = 0 =  \frac{\partial F_3}{\partial y}$, so the potential might exist.
Now we need to find a function $f$ such that $\nabla f = \mathbf{F}$.
For the first component, this means that $\frac{\partial f(x,y,z)}{\partial x} = y $, or after integrating, $f(x,y,z) = yx + C(y,z)$. Now I don't know how to determine the constant of integration $C(y,z)$, and I don't understand if I should add another constant when I integrate the second component.
For the second component, we have that $f(x,y,z) = xy + D(x,z)$, and for the third $f(x,y,z) = \frac{z^3}{3} + E(x,y)$. What now?
Any help please? In my textbook this is explained really in a terrible way.
 A: 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!
A: 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}$.
A: Take the derivative of $f(x,y,z)$ by y; this must be equal to $-x$. Then solve for $C(y,z)$ by Integration. You will obtain another Integration constant $C(z)$ that you can obtain by derivative by variable $z$ (must be equal to $z^2$).
