# Work done by electric force when moving like charges together

Consider two positive charges. I would like to find the work done by the electric force on charge +q as it is brought closer to charge +Q from radius a to b.

I first define electric force as a radially outward vector, $$\vec{F}_E = \frac{Qq}{4\pi\varepsilon_0r^2} \hat{r}$$

then displacement as radially inward, $$d\vec{s} = -dr \hat{r}$$ By direct integration, \begin{align} W & = \int_a^b \vec{F}_E \cdot d\vec{s} \\ & = \int_a^b \frac{Qq}{4\pi\varepsilon_0r^2} \hat{r} \cdot (-dr) \hat{r} \\ & = - \frac{Qq}{4\pi\varepsilon_0} \left[-\frac{1}{r}\right]_a^b \\ & = \frac{Qq}{4\pi\varepsilon_0} \left( \frac{1}{b} - \frac{1}{a} \right) \end{align} This gives positive work because b < a. However, this seems wrong since the electric force and displacement are in opposite directions, which should produce negative work. How should I set up my vectors to properly calculate work done by electric force?

(I have seen other forms of this problem online but I want to use the definition of work instead deriving work from electrical potential energy)

You've overcounted your minus signs. You say that $$d\vec r = - dr \hat r$$

where $$r$$ ranges from $$a$$ to $$b$$. However, if $$b < a$$, then $$dr$$ (which you can think of as the limit of $$\Delta r\sim \frac{b-a}{N}$$) is already negative, so adding an additional minus sign is incorrect, and yields the wrong sign as you have seen.

As an example, consider integrating the function $$f(x) = x$$ from $$x=1$$ to $$0$$. You should know this should give you $$-1/2$$. The negative sign, however, comes from the fact that the lower integral bound is greater than the upper one; if you use $$-dx$$ as the integration measure, you'll get the wrong sign at the end.

Your answer is correct. The work done $$W$$ is positive because the work is done by the external agent on charge $$+q$$ to bring it closer to charge $$+Q$$ against electro-static force of repulsion. This happens when two like electric charges are brought closer.

Negative work means the work is gained by the external agent from the system which is true when two unlike electric charges are brought closer to each other.

Just by looking at the diagram, and noting that the charges have the same sign and therefore repel one another, positive external work $$W_{\rm external}$$ must be done do to bring the charges closer together.

If the work done by the electric field is $$W_{\rm electric}$$, then assuming that there is no change in the kinetic energy of the charges as they a brought together, the work-energy theorem produces the relationship $$W_{\rm external} + W_{\rm electric} = 0$$.

Hence if $$W_{\rm external}$$ is positive then $$W_{\rm electric}$$ is negative.

The fact that $$W_{\rm electric}$$ is negative you suspected when evaluating $$w_{\rm electric}$$ because the electric field and the displacement are in opposite directions.

Your error is in this equation $$d\vec{s} = {\Large \color {red}-}dr \,\hat{r}$$ which has a negative sign in it.
The equation should be written as $$d\vec{s} = dr \,\hat{r}$$.

Forget about doing a proper integration and just imagine that in moving change $$+q$$ from a position $$r_{\rm start} =b \,\hat r$$ away from $$+Q$$ to position $$r_{\rm finish} =a\, \hat r$$, with $$r_{\rm finish} < r_{\rm start}$$, there is some sort of average electric force, $$\vec F_{\rm average} \,\hat r$$, acting on charge $$+q$$.

The displacement $$\Delta \vec s = r_{\rm finish}\, \hat r-r_{\rm start} \,\hat r= (r_{\rm finish}-r_{\rm start}) \,\hat r$$ ie in the negative $$hat r$$ direction.

The work done by the electric force is $$(\vec F_{\rm average} \,\hat r) \cdot (r_{\rm finish}-r_{\rm start}) \,\hat r$$

From this the work done in moving the charge $$+q$$ between those two positions is negative as you suspected.

So going back to your mistake.

I wrote $$\Delta \vec s = r_{\rm finish}\, \hat r-r_{\rm start} \,\hat r=(r_{\rm finish}-r_{\rm start}) \,\hat r$$ which I can rewrite as $$\Delta \vec a = \Delta r \,\hat r$$.

How did I figure out what $$\Delta r$$ should be?

As per convention it is $$\text{finish - start}$$

How does the integral figure out what to do?

Surely it is the same, $$\displaystyle \int^{r_{\rm finish}} _{r_{\rm start}}\, ds =\displaystyle \int^{r_{\rm finish}} _{r_{\rm start}}\, dr = {r_{\rm finish}} -{r_{\rm start}}$$ and you will note that the limits of integration decide on the sign of $$ds$$.

In the integral the sign of $$dr$$ is dictated by the limits used in the integral.
You adding that minus sign changed the order of integration with the lower limit now $$a$$ and the upper limit $$b$$ with the result that, after doing the integration, you get the correct result for an increase in separation of the two charges, the work done by the electric field is positive.

• Thank you for the answer! Understanding the problem in terms of Δr was really helpful. May 6, 2020 at 7:48

The formula you used is for the work done by an external agent. The test charge $$q$$ feels a repulsive force away from $$Q$$. The applied force is therefore toward $$Q$$ in order to balance it. Thus, the applied force is in the same direction as displacement and the work done by the external agent is positive.

Therefore, the work done by electric force is the negative of this because the two forces are equal and opposite.

• I’m looking for the work done by the electric force May 6, 2020 at 2:27
• @Programmer The work done by the electric force is the negative of the work you do. May 6, 2020 at 2:29
• Could you explain how to set up an equation for work done by electric force and not external agent? May 6, 2020 at 2:36
• @Programmer As I have already said above, because the forces are equal and opposite, you just need to add a negative sign to the integrand in your equation. May 6, 2020 at 2:37
• In which step? I tried setting up the vectors of electric force and displacement so that they represent the situation. The final result was from calculation using the vectors I set up. May 6, 2020 at 2:44