Consider a point charge Q at the origin. For Q > 0, the work done against the repulsive force on the test charge is positive. Choose a convenient path along the radial direction from infinity to the point P.
At some intermediate point P′ on the path, the electrostatic force on a unit positive charge is
where rˆ′ is the unit vector along OP′. Work done against this force from r′ to r′ + ∆r′ is
The negative sign appears because for ∆r′ < 0, ∆W is positive. Total work done (W) by the external force is obtained by integrating from r′ = ∞ to r′ = r,
This, by definition is the potential at P due to the charge Q
Figure below shows how the electrostatic potential ( ∝ 1/r) and the electrostatic field ( ∝ 1/r2 ) varies with r.