This is the hardest part of this chapter because the formula for potential energy ends up looking strange. The trick is that we will use a convention where potential energy will always be negative. The biggest value it could be is zero. This come from integrating the force over distance. This is shown in the image below.
We end up with the general formula for potential energy which is
The negative sign and the 1/r often cause confusions. Be careful when solving.