# Problem with Deriving work done by gravitational force and gravitational potential energy from the first principles

Suppose we have a system with Two point masses of mass $$M$$ and mass $$m$$. And we want to derive Work done. Lets say M is fixed or $$M>>m$$. Initially assume mass m is at rest at a distance of $$a$$ from $$M$$ and after some time it reaches $$b$$. And we want to calculate work done. Since magnitude of Gravitational Force is $$\frac{GMm}{r^2}$$ and displacement of $$m$$ is towards the big mass so Force and dissplacement are in same direction so work done should we positive. But if we calculate $$\int_a^b F\cos(\theta) \,dx$$ you get a different answer its negative. Since $$b (Gravity is a repulsive force and after some time distance decreases between masses final distance is b and initial is a by definition) and gravitational force is just $$\int_a^b \frac{GMm}{r^2} \,dr$$. This has to be right because both displacement and Force are in same direction so Force multiplied by dr is as I showed above. Now when you calculate this integral you get $$GMm(\frac{1}{a}-\frac{1}{b})$$ which is clearly negative. What am I doing wrong. If you continue with this working to calculate potential energy you get it as positive which is also wrong. whats the mistake. The same reasoning I did for spring force and other phenonmenon its correct but gravity something wrong is happening what is it.

• $b < a$ is confusing. Maybe make it $r_1$ and $r_2$, with $r_1 < r_2$. It would make your reasoning easier to follow.
– JEB
Commented Mar 19 at 15:01
• Your integral is simply bounded incorrectly. The integral from b to a is the negative of the integral from a to b. It's convention to have the lower bound less than the upper bound. This would fix your issue. Commented Mar 19 at 15:19

One way to look at what is going on is that when you do an integral like $$\int_a^b f(r) dr$$ with $$a>b$$, then $$dr$$ is negative. More precisely, if you convert this integral into a Riemann sum, $$\sum_{i=1}^N f(r_i) \Delta r$$ with $$r_1=a>r_N=b$$, then $$\Delta r=\frac{b-a}{N}<0$$.

So let's go back to how we would do the dot product to get to the integral for work. To do this carefully, we need a vector expression for the force (not just the magnitude). We introduce a unit vector $$\hat{e}_r$$ that points radially outward. Then $$\vec{F} = -\frac{GMm}{r^2}\hat{e}_r$$ since the force points radially inward.

Now we come to the displacement vector -- this is the tricky part. What you would like to say is that the displacement is radially inward, so that $$d\vec{r} = -\hat{e}_r dr \ \ \ {\rm (WRONG)}$$ However, this is wrong, because:

• We know $$-\hat{e}_r$$ points radially inward
• We know that $$dr$$ is negative, by the argument above.
• Therefore, combining the above two points, $$-\hat{e}_r dr$$ points radially outward, but we know that the actual displacement $$d\vec{r}$$ must point radially inward.

Therefore, the correct equation here is $$d\vec{r} = {\color{red} +} \hat{e}_r dr$$ With this substituion, we get $$\begin{eqnarray} W = \int \vec{F} \cdot d\vec{r} = - (\hat{e}_r \cdot \hat{e}_r) \int_a^b \frac{GMm}{r^2} dr = {\color{red}-} \int_a^b \frac{GMm}{r^2} dr = GMm \left(\frac{1}{b}-\frac{1}{a}\right) > 0 \end{eqnarray}$$ as expected.

Another way to say this, which is perhaps less error prone, is that the displacement is $$d\vec{r} = \hat{e}_r |dr|$$ You can avoid having to worry about the sign, if you remember that $$|dr|$$ means you should always choose the limits of integration to go from the smaller $$r$$ value to the larger $$r$$ value, so that $$dr>0$$ and $$|dr|=dr$$.