Here is my attempt at derivation:

First you must find a vector function for the gravitational force.

By the inverse square law, the magnitude of gravitational force between two bodies of mass $m$ and $M$ of distance $r$ apart is: $$G \frac{M m}{r^2}$$

The direction of this force points towards the other body. If you let $\vec{r}$ be the position vector from the other body towards you, then $\frac{-\vec{r}}{\|\vec{r}\|}$ gives you a unit radial vector pointing in the direction of the other body. This can be scaled by the magnitude to give the force vector as:

$$F(\vec{r}) = G \frac{M m}{\|\vec{r}\|^2} * \frac{-\vec{r}}{\|\vec{r}\|} = -G \frac{M m}{\|\vec{r}\|^3}\vec{r}$$

Now, potential energy is defined as

$$ U = -W = -\int_C F(\vec{r}) \cdot d\vec{r}$$

The path along which we take the line integral needs to be from an infinite distance away (which we set as our reference point with zero potential) to our current position.

The radial displacement vector $\vec{r}$ can be broken up into a component-wise displacement vector:

$$\vec{r} = x\hat{i} + y\hat{j} + z\hat{k}$$

The differential $dr$ is then

$$d\vec{r} = dx\hat{i} + dy\hat{j} + dz\hat{k}$$

Substituting into the expression for the dot product, we get that:

$$ F(\vec{r}) \cdot d\vec{r} = -G \frac{M m}{\left(\sqrt{x^2 + y^2 + z^2}\right)^3}(x\hat{i} + y\hat{j} + z\hat{k}) \cdot (dx\hat{i} + dy\hat{j} + dz\hat{k})$$

This gives

$$-\frac{G m M x}{\left(x^2+y^2+z^2\right)^{3/2}}dx -\frac{G m M y}{\left(x^2+y^2+z^2\right)^{3/2}}dy-\frac{G m M z}{\left(x^2+y^2+z^2\right)^{3/2}}dz$$

This can then be integrated term by term. The limits of integration of each should vary from $\infty$ to the current position ($x$, $y$, or $z$ since gravity is a conservative force (which can be verified mathematically by checking if the y-partial of the x component and the x-partial of the y component are equal) and thus path you take when computing work done does not matter -- it depends only on the initial and final positions.

This gives

$$\int_{\infty }^x -\frac{G m M x}{\left(x^2+y^2+z^2\right)^{3/2}} \, dx + \int_{\infty }^y -\frac{G m M y}{\left(x^2+y^2+z^2\right)^{3/2}} \, dy + \int_{\infty }^z -\frac{G m M z}{\left(x^2+y^2+z^2\right)^{3/2}} \, dz$$

This evaluates to

$$\frac{G m M}{\sqrt{x^2+y^2+z^2}} + \frac{G m M}{\sqrt{x^2+y^2+z^2}} + \frac{G m M}{\sqrt{x^2+y^2+z^2}} = \frac{3 G m M}{\|\vec{r}\|}$$

Then taking potential as the negative of the work done we get

$$U = -\frac{3 G m M}{\|\vec{r}\|}$$ However, this is clearly incorrect as there is a factor of three that should not be there.

Did I integrate incorrectly or am I missing something else?

  • $\begingroup$ @ReghuKrishnanG No I think I did the actual integration fine -- I verified with mathematica. $\endgroup$
    – 1110101001
    Jun 30, 2015 at 8:38
  • $\begingroup$ Oops, sorry my mistake. $\endgroup$ Jun 30, 2015 at 9:16

1 Answer 1


I am not sure what is the path $C$ you are integrating over? In your definition you evaluate $U(C)$ which in the present case of force is independent on the explicit path you choose but still depends on initial and final point, i.e. $U(p_1,p_2)$. In your final result it seems you are actually 'walking' three times the path $p_1=(-\infty,y,z)$ to $p_2=(-x,y,z)$. only by relabeling your coordinate system. Thus the factor of $3$ in your final formula.

Best practice is to parametrize the path $C$ in terms of a function $\vec{s}(\lambda)=(x(\lambda),y(\lambda),z(\lambda))$ and integrating over $\lambda$.

In Detail

In order to evaluate the potential you have to know the path you are integrating over: $$ U(C)=-\int_{\vec{r}\in C} d\vec{r}\cdot \vec{F}(\vec{r})$$ In the present case the function (the force) is conservative (vanishing curl) and thus the result only depends on the initial and final point $\vec{r}_{i}$ and $\vec{r}_f$ of $C$. Now, what is the initial point and the final point in your setting. You say $C$ should connect infinity with the point $\vec{r}_f=(x,y,z)$. Thus, what is $\vec{r}_i$ here? Basically you can choose any 'boundary' point of $\mathbb{R}^3$. A good choice would be $\vec{r}_i=(-\infty,y,z)$, though other choices as for instance $\vec{r}_i=(-\infty,-\infty,-\infty)$ are also suitable. Now you can basically choose any path connecting $\vec{r}_i$ and $\vec{r}_f$ it will give the same result. So take a very simple one $C_s$: $\vec{s}(\lambda)=(\lambda ,y,z)$ with $\lambda\in (-\infty,x]$. The integral is then parametrized and what you have to evaluate is

$$ U(\vec{r}_i,\vec{r}_f)=-\int_{\vec{s}\in C_s} d\vec{r}\cdot \vec{F}(\vec{r})\equiv -\int_{-\infty}^{x}d \lambda \frac{d\vec{s}(\lambda)}{d\lambda}\cdot \vec{F}(\vec{s}(\lambda))=-\int_{-\infty}^{x}d \lambda \, \hat{e}_x\cdot \vec{F}(\vec{s}(\lambda))$$ Now insert the path $\vec{s}(\lambda)=(\lambda ,y,z)$ and you obtain $$U(\vec{r}_i,\vec{r}_f)= -\int_{-\infty}^{x}d \lambda \, \left(-G m M \frac{\lambda}{(\lambda^2+y^2+z^2)^{3/2}} \right) $$ Other paths will yield the same result, but in your case you follow a route starting from three different points $(-\infty,y,z)$, $(x,-\infty,z)$, and $(x,y,-\infty)$ and terminate at $(x,y,z)$. Thus a factor of $3$ appears.

The same holds true for the initial point $\vec{r}_i=(-\infty,-\infty,-\infty)$. Basically, you can think of any path connecting $\vec{r}_i$ with $\vec{r}_f$ and then try to find a function that describes this curve. A naive and very simple choice would be a straight line: $ \vec{s}(\lambda)=(\lambda x, \lambda y, \lambda z)$ with $\lambda\in (-\infty,1]$ and $\frac{d\vec{s}(\lambda)}{d\lambda}=x\hat{e}_x+y\hat{e}_y+z \hat{e}_z$. However, actually you are crossing the origin for which the force diverges.

Nevertheless, just for simplicity we following this path along which the force assumes the form $$\vec{F}(\vec{s}(\lambda))=-GmM \frac{ x\lambda \hat{e}_x+y\lambda \hat{e}_y+z\lambda \hat{e}_z}{( (x\lambda)^2+(y\lambda)^2+(z\lambda)^2 )^{3/2}}= -GmM \frac{ x\hat{e}_x+y\hat{e}_y+z \hat{e}_z}{( x^2+y^2+z^2 )^{3/2}} \frac{1}{\lambda^2}$$ Hence, the kernel of the integral looks like: $$\frac{d\vec{s}(\lambda)}{d\lambda}\cdot \vec{F}(\vec{s}(\lambda))= -GmM \frac{x^2+y^2+z^2}{(x^2+y^2+z^2)^{3/2}}\frac{1}{\lambda^2}\equiv -\frac{GmM}{r} \frac{1}{\lambda^2} $$ whereby $r=\sqrt{x^2+y^2+z^2}$ the radial of the end-point.

Now, the integral can easily be evaluated: $$U(\vec{r}_i,\vec{r}_f)= -\int_{-\infty}^{1}d \lambda \, \left(- \frac{G mM}{r} \frac{1}{\lambda^2} \right) =-\frac{G mM}{r} \left[\frac{1}{\lambda} \right]^{1}_{-\infty}=-\frac{G mM}{r}$$

Surely, you can convert the result into spherical coordinates and use a path that is radial.

  • $\begingroup$ I don't understand how I am walking the path three times. I am integrating over the x, y, and z components separately. Could you please elaborate on how the integration should be done if it were to be done based on a switch of coordinates from radial to x,y,z? Also, how would you do the integration sticking with radial vector? Finally, I don't quite understand what you mean by parameterizing the path in terms of a function $\vec{s}$. In this case what would an appropriate parameter be (perhaps radius?) $\endgroup$
    – 1110101001
    Jun 30, 2015 at 9:16
  • 1
    $\begingroup$ I extended my original answer . Hope that helps. $\endgroup$ Jun 30, 2015 at 9:42
  • $\begingroup$ Ok cool I think I got it -- one last question though: how would you do it if you wanted $\vec{r}_i$ to be $<-\infty,-\infty, -\infty>$? Oh and shouldn't $U(C)$ be negative of the work done along the path (I think you missed the negative sign?) $\endgroup$
    – 1110101001
    Jun 30, 2015 at 18:59
  • 1
    $\begingroup$ I corrected the minus in the equation. I hope I did not missed any. In addition, I inserted another comment concerning your question. However as mentioned this (straight) path passing the origin should not be taken too seriously it just demonstrates the method. In principle you can think of any path (e.g. a spiral curve) that avoids $\vec{0}$ not necessarily a line. $\endgroup$ Jul 1, 2015 at 8:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.