Is there something wrong in my book's derivation of work done on charge?

For finding potential at a point due to a +ve charge $(q)$, we find work done to move a unit +ve charge $(q_o)$ from infinity to that point in the presence of +ve charge $(q)$

Since both charges being +ve, the force would be repulsive and hence while bringing unit +ve charge $(q_o)$ from infinity to that position, the path would be against force field. Thus the work done by force field should be negative.

But the following calculation/derivation in my book shows that work done is positive:

$$W$$ $$=\int_\infty^r F.dr$$ $$=-\int_\infty^r F dr\\$$ (since path is against force field) $$=-\int_\infty^r \frac{1}{r^{2}}dr\\$$ $$=-\left( {-\frac{1}{r}} \Big |_{\infty}^{r}\right)$$ $$={\frac{1}{r}} \Big |_{\infty}^{r}$$ $$=\frac{1}{r}-\frac{1}{\infty}$$ $$=\frac{1}{r}$$

Why is this contradiction? Where am I (or my book) wrong?

• "Thus work done should be negative" - the work done by the field is negative but the work done by the force bringing the charge in is positive. – Alfred Centauri Dec 11 '16 at 13:37
• The work done by the electrostatic force will be negative whereas work done by the external agent to move the charge is positive – cobra121 Dec 11 '16 at 13:40
• Will they be equal and opposite? – stack exchange Dec 11 '16 at 13:43
• Ideally, assuming no change in KE, yes. – Alfred Centauri Dec 11 '16 at 13:45
• In the derivation, $F$ represents the electrostatic force and not the external force. That is why the path is against the field. So in the derivation, $W$ should represent work done by electrostatic force and not work done by external force. This is turning out to be positive while in reality, it should be negative. – stack exchange Dec 11 '16 at 15:41