Bizarre gravitational energy equation

In "Electricity and magnetism" by Benjamin Crowell page 39 there is this:

Recall that the gravitational energy of two gravitationally interacting spheres is given by $PE = -Gm_1m_2/r$ where $r$ is the center-to-center distance.

Is this true? I think comes from the force by distance equation for energy where the force is $F_g = -Gm_1m_2/r^2$ and the distance is $r$ but that implies that the force is constant over the whole range of motion. We can only make such assumptions if the distance between the objects is a lot larger than the range of motion but here they are equal.

I can not just let this slide because we are supposed to make analogy from this about electromagnetic interactions which are referenced numerous times in the rest of the book and it makes appearances in example questions. Am I missing something?

The force is not constant, it is a function of $\dfrac{1}{r^2}$ (omitting constants for clarity). The integral of $\dfrac{1}{r^2}$ with $r$ going from $r$ to $\infty$ is:

$$\int_r^\infty \dfrac{1}{x^2}dx = -\dfrac{1}{r}$$

• I think you mean from r to infinity, the integral diverges around r=0. – enumaris Apr 5 '18 at 21:01
• Could you also distinguish between the inner and the outer $r$ in the integral? – Jasper Apr 5 '18 at 21:43
• @Jasper I assume that is intuitive, at least I do often use same letters in the outer and inner variables in similar cases; but okay, I've edited the post. – nicael Apr 5 '18 at 21:51
• Yeah, don't use the same letter for the inner and outer variables in your integrals, otherwise mathematicians will want to stab you. ;) – PM 2Ring Apr 6 '18 at 18:08