$\mathbf{F} = \nabla f$ Get the function f, when given a vector field

For conservative vector fields F the following equation holds

$$\int_c \mathbf{F} \cdot d\mathbf{r} = \int_c \nabla f \cdot d\mathbf{r} = f(\mathbf{r}(b)) - f(\mathbf{r}(a))$$

Now I have a lot of trouble finding the function f so $\mathbf{F} = \nabla f$ holds. Is there a manner to do this?

An example field: $$\mathbf{F}(x,y,z) = e^y\mathbf{i} + xe^y\mathbf{j} + (z + 1) e^z\mathbf{k}$$ How would I convert this field to a function f?

-
$x\cdot e^y + z\cdot e^z$ for the example. Generally, see if special paths (parallel to the axes, straight, for example) help you. – Daniel Fischer Jun 25 '13 at 19:12

This is in most every multivariable calculus book. Integrate $\partial f/\partial x$ to get $f(x,y,z) = xe^y+g(y,z)$. Differentiate, compare to the second component of $\mathbf F$, find $g(y,z)=h(z)$. Then use the last bit of info to get $h'(z)=(z+1)e^z$, integrate, and assemble all your information.

-
I knew that.... If only I could remember it :P – paul23 Jun 25 '13 at 19:27

See that if you add to the $f$ any constant $c$ that $\nabla(f+c)=\vec{F}$ still holds. So pick any point $x_0$ and say for example that $f(x_0) = 0$ than you can define

$$f(x) = \int_\gamma \vec{F}\cdot d\vec{l}$$

where $\gamma$ is any curve $\gamma : [0,1] \rightarrow \mathbb{R}^n$ that $\gamma(0)=x_0$ and $\gamma(1) = x$. As you already know the above integral depends only on the end points. So the definition is valid.

Now we want to be sure that really: $\nabla f = \vec{F}$.

Define $\gamma_x^i: [0,\infty) \rightarrow \mathbb{R}^n$ to satisfy:

$$\gamma_x^i(0) = x_0$$ $$\gamma_x^i(1) = x$$ $$\frac{d\gamma_x^i(t)}{dt}\bigg|_{t=1} = e_i$$ $$\gamma_x^i(t) = x+te_i \qquad t>1$$

Than $$\frac{\partial f(x)}{\partial x_i} = \lim_{h\rightarrow 0^+} \frac{f(x+h)-f(x)}{h} = \lim_{h\rightarrow 0^+} \frac1{h}\int_1^{1+h} \vec{F}(\gamma_x^i(t)) \cdot e_i dt =$$ $$\lim_{h\rightarrow 0^+} \frac1{h}h \vec{F}(\gamma_x^i(\xi)) \cdot e_i = F(x)$$

-
I know that I have a little mistake there, I'll fix it later. The limit should be $h\rightarrow 0$ not $h\rightarrow 0^+$ but than you have to change gamma. – tom Jun 25 '13 at 19:48