# Force to Potential Energy to Force again gives wrong formula

1. Sep 23, 2012

### lavalamp

So I have this vector Force:

$\vec{F} = y\hat{x} + x\hat{y}$

This force is conservative ($\nabla \times \vec{F} = 0$).

So I integrate it to find the potential energy:

$U = -\int \vec{F} \bullet d\vec{s}$
$U = -\int y \delta x - \int x \delta y$
$U = -yx - xy$
$U = -2xy$

Ignoring the arbitrary constant because it can be set to 0.

And now to do what should be the reverse operation:

$\vec{F} = -\nabla U$
$\vec{F} = -\hat{x}\frac{\delta U}{\delta x} - \hat{y}\frac{\delta U}{\delta y}$
$\vec{F} = 2y\hat{x} + 2x\hat{y}$

So somehow, in the process of integrating and then differentiating, the force doubled. I'm not sure where the error is here but I'd very much like to get rid of it. Can anyone point me in the right direction here please?

2. Sep 23, 2012

### Staff: Mentor

You cannot integrate over different x and y like that. Both integrals there have to be the potential (up to an integration constant).
See this thread for a similar problem and its solution (post 7).

3. Sep 23, 2012

### lavalamp

I'm not quite sure I know what you mean, but to expand a little on how the integration proceeded in my first post:

$\vec{F} = y\hat{x} + x\hat{y}$
$d\vec{s} = \hat{x}dx + \hat{y}dy$

$\int \vec{F} \bullet d\vec{s} = \int (y\hat{x} + x\hat{y})\bullet(\hat{x}dx + \hat{y}dy)$

$\int \vec{F} \bullet d\vec{s} = \int y\hat{x} \bullet \hat{x}dx + y\hat{x} \bullet \hat{y}dy + x\hat{y} \bullet \hat{x}dx + x\hat{y} \bullet \hat{y}dy$

But since:
$\hat{x} \bullet \hat{x} = 1$
$\hat{x} \bullet \hat{y} = 0$
$\hat{y} \bullet \hat{x} = 0$
$\hat{y} \bullet \hat{y} = 1$

$\int \vec{F} \bullet d\vec{s} = \int ydx + xdy$

$\int \vec{F} \bullet d\vec{s} = \int ydx + \int xdy$

$\int \vec{F} \bullet d\vec{s} = yx + xy$

$\int \vec{F} \bullet d\vec{s} = 2xy$

$∴U = -2xy$

Essentially, this is the same as saying:

$\vec{F} = y\hat{x} + x\hat{y}$
$F_{x} = y$
$F_{y} = x$

$U = -\int F_{x} dx - \int F_{y} dy$
$U = -\int y dx - \int x dy$
$U = -yx -xy$
$U = -2xy$

If some part of this method is wrong, I don't see what it is.

Last edited: Sep 23, 2012
4. Sep 24, 2012

### gabbagabbahey

When evaluating a line (or path) integral, you must first choose a path. You have

$$U(\mathbf{r}) \equiv -\int_{\mathcal{O}}^{\mathbf{r}}\mathbf{F}(\mathbf{r}') \cdot d\mathbf{r}' = -\int_{\mathcal{O}}^{\mathbf{r}} \left( y'dx'+x'dy'\right) = -\int_{\mathcal{O}}^{\mathbf{r}} y'dx' -\int_{\mathcal{O}}^{\mathbf{r}} \left( x'dy'\right)$$

Where you are integrating over any path from some arbitrary reference point $\mathcal{O}$ to your field point $\mathbf{r}$ (the primes are there to distinguish between the dummy variable of integration and the coordinates at the endpoint of the path, since it is bad notation to write something like $\int_0^x f(x)dx$). Both integrals must be done over the same path. You cannot calculate one integral over a path with constant $y$, and the other over a path with constant $x$.

For example, suppose we choose the origin as our reference point and integrate along the straight line $y'=0$ (so $dy'=0$ for this segment) from $x'=0$ to $x'=x$ and then along the line $x'=x$ (so $dx'=0$ for this segment) from $y'=0$ to $y'=y$ . Then we have:

$$U =-\int_{\mathcal{O}}^{\mathbf{r}} \left( ydx+xdy\right) = \int_{x'=0}^{x'=x} -\left( (0)dx' + x'(0)\right) + \int_{y'=0}^{y'=y} -\left( y'(0)+xdy'\right) = -x\int_{y'=0}^{y'=y} dy' = -xy$$

The reason we can pull the $x$ out of the last integral is because it is a constant (which is made clear by the fact we are integrating over primed coordinates)

Alternatively, we could again choose the origin as our reference point and integrate over an elliptical arc described by the parametric equations $x'(t)=x\sin t$ and $y'(t)=y(1-\cos t)$ from $t=0$ to $t=\frac{\pi}{2}$. Everywhere along the path, we have $dx'=x\cos t dt$ and $dy' = y\sin t dt$, so we have:

$$U =-\int_{\mathcal{O}}^{\mathbf{r}} \left( ydx+xdy\right) = -\int_{t=0}^{t= \frac{\pi}{2}} \left( y(1-\cos t)(x\cos t dt) + x\sin t(y\sin t dt)\right)= -\int_{t=0}^{t= \frac{\pi}{2}} xy\left( \cos t - \cos^2 t + \sin^2 t \right) dt = -xy$$

As you can see, you get the same value for each of the two example paths, as you would expect since the curl of $\mathbf{F}$ is zero.

Of course, all this becomes much easier if you simply recognize that $xdy+ydx=d(xy)$ via the product rule, because then you are just integrating an exact differential and the fundamental theorem of calculus tells you that $\int d(f(x,y)) = f(x,y) + \text{constant}$

5. Sep 24, 2012

### lavalamp

Thank-you gabbagabbahey, that helped my understanding a lot.

Additionally, I didn't spot it at all, but now that you've pointed out that it's basically the product rule, it's like I can't unsee it.