From what I understand from my notes (correct me if I'm wrong), electric potential energy is the work done in bringing the charge from infinity to a certain point from the source charge. Let this point be X. In the case of a source charge +Q, an electrostatic force of repulsion will be exerted on the test charge +q and the test charge will accelerate towards infinity and away from the source charge in an isolated system.
Near infinity or as the distance from the test charge and source charge approaches infinity, electric force and electric field strength approaches zero. To bring the test charge to point X, you would need a force exerted on the test charge that acts in the direction towards the source charge. This force is the external force which acts in the opposite direction to the electric force exerted on the test charge.
As the test charge is brought closer to the source charge, the electric force increases, which means the external force has to be made to be constantly equal to electric force in order for the test charge to continue moving towards the source charge at constant velocity. I'm assuming that it is important for the test charge to move at constant velocity, otherwise the work done on the test charge/energy input into the system will consist of both electric potential energy and kinetic energy.
So, work done or electric potential energy would be:
Here's kind of where I'm unsure about things:
1) Near infinity, the test charge would still be accelerating away from the source charge, although the electric force would be very small or close to 0. In order for the test charge to be brought in the opposite direction towards the source charge, the external force has to be more than the electric force at the point near infinity, such that the resultant force exerted on the test charge will be towards the source charge. The test charge will accelerate towards source charge until external force is equal to the electric force, in which it will then travel at constant velocity towards P if external force continues to be equal to electric force. Otherwise, if external force is constantly equal to electric force as stated in my notes, then the test charge would still continue to move away from the source according to Newton's first law. Is this correct?
2) In regards to the test charge moving at constant velocity as it is being displaced from infinity to point X, what happens if external force exerted on the test charge near infinity is equal to the electric force exerted on the test charge at point X or a Newtons (displayed in diagram)? Although the object would accelerate initially, as the magnitude of the acceleration would decrease, the KE would decrease because it would be converted into EPE. Is this another way to calculate EPE?