# Sign mistake calculating electrostatic potential energy formula! [duplicate]

I have a problem calculating the electrostatic potential energy.

I rely on these equations coming from mechanics:

$$U_{B}-U_{A} = -W_{A \ \rightarrow \ B} (done\ by \ the \ field \ force)$$

$$U_{B}-U_{A} = W_{A \ \rightarrow \ B} (done\ by \ the \ opposite \ force)$$

According to the next picture

Work done by the coulomb force (field force) is:

$$W= \int_{A}^{B} \! \vec{F}.\,\vec{dr}$$

According to the picture

$$F = \frac{q_{1}q_{2}}{4\pi e_{o} x^{2}} \vec{i}$$

$$\vec{dr} =- dx \vec{i}$$

Therefore:

$$W= \int_{A}^{B} \! \vec{\frac{q_{1}q_{2}}{4\pi e_{o} x^{2}} \vec{i}}.\,(- dx \vec{i})$$

let $B=r$ and A=$\infty$ be $$W= -\int_{\infty}^{r} \! \frac{q_{1}q_{2}}{4\pi e_{o} x^{2}} \, dx$$

Let $B=r$ and A=$\infty$ be $$W= \frac{q_{1}q_{2}}{4\pi e_{o} } (\frac{1}{x} from\ \infty \ to \ r )$$

Then:

$$W= \frac{q_{1}q_{2}}{4\pi e_{o} r}$$

When I put this result into equations at the top:

$$U_{B}-U_{A} = -\frac{q_{1}q_{2}}{4\pi e_{o} r}$$ As $U_{A} =0$ Finally: $$U_{B} = -\frac{q_{1}q_{2}}{4\pi e_{o} r}$$ It turned out the potential energy is negative, but it is suppose to be positive since a external force is putting energy into the system. I don't know where my mistake is!

## marked as duplicate by David Z♦Oct 30 '17 at 22:43

• Duplicate with the confusion about the sign of dr? physics.stackexchange.com/q/265562 – Farcher Jul 6 '16 at 8:18
• Somehow similar. – Omar Jul 6 '16 at 14:23
• @DavidZ This might be the same issue as the other question, but the duplicate-linked question is poorly and confusingly written and the answers wrong or not ideal/not answering the question. I believe the actual issue in both questions is very different from what has been answered until now (see my answer below here). It seems that the point has been misunderstood due to lack of clarity in the questions. I am therefore voting for reopening the present question, which is far clearer. – Steeven Oct 30 '17 at 23:52
• @Steeven Do you think the other question should be closed as a duplicate of this one instead? That's a reasonable option, and if so I'd appreciate you voting accordingly (if the system will let you). But I'd note that none of the reasons you pointed out are really valid objections to one of these questions being a duplicate of the other. If a duplicate target is confusingly written, we can edit it; if none of the answers address it adequately, we can post new answers that do. – David Z Oct 31 '17 at 0:03
• @DavidZ Your first suggestion might be on point. – Steeven Oct 31 '17 at 0:08

You are doing a "backwards" integration. From higher to lower rather than from lower to higher x-axis values.

Integrating "backwards" from $\infty$ to $r$ (backwards because $\infty>r$) is the "flipped" and "opposite" version of the one from $r$ to $\infty$,

$$\int_\infty^r \dots dx=-\int_r^\infty \dots dx\,.$$

$\int$ is a generalized summation symbol. It sums up all the small bits. $\int_\infty^r$ and $\int_r^\infty$ should cover the exact same thing. Mathematically, the same area under the drawn graph; physically the same displacement. One is just columns summed left-to-right, and the other columns summed right-to-left; or physically summations over the same path, just starting from the right and then from the left. They should be exactly equal.

But writing them out will give a sign issue, because we always say "final situation" minus "starting situation":

$$\int_\infty^r \dots dx=\underbrace{F_r}_\text{final}-\underbrace{F_\infty}_\text{start}\qquad\quad \int_r^\infty \dots dx=\underbrace{F_\infty}_\text{final}-\underbrace{F_r}_\text{start}$$

$F_r-F_\infty$ and $F_\infty-F_r$ are not the same - their signs are opposite. But we know that they are exactly equal - just summed from different starting points. This mathematical issue means that integrating "backwards" requires us to add a minus sign. Otherwise we do not get the same area under the graph or the same path summation.