Newton's Law of Gravity

Newton, while studying mechanics and motion which lead to his Three Laws of Universal Motion, realized that a single, simple law could describe both falling bodies and orbiting objects. Whether or not this realization came to him after being hit on the head by a falling apple at his family's orchard is questionable. In fact, its highly doubtful, but it makes for a good story. Regardless of how he arrived at his formulation of the Law of Gravity, it still is a powerful way of modeling the motion of objects both near the surface of a planetary body as well as the orbits and trajectories of objects out in space. This law is given as

\begin{align} \vec F = -G \frac {m_1 m_2} {r^2} \hat r \end{align}

where $G = 6.67 \times 10^{-11} \frac {N m^2} {kg^2}$ and is called the Universal Gravitational Constant, m1 and m2 are the two masses of the two objects, and r is the distance between the centers of the two objects. Notice that this force will always be an attractive force, always in the $- \hat r$ direction.

Determine the magnitude of the gravitational force that a 5.00x1013-kg asteroid exerts on a 3.50x1012-kg asteroid if their centers are 2.40x106 m apart.

$F = 6.67 \times 10^{-11} \frac{ 5.00 \times 10^{13} \cdot 3.50 \times 10^{12}}{ \left( 2.40 \times 10^6 \right)^2}$
$F = 2026 N$

Determine the weight of a 75-kg person in low-Earth orbit at an altitude of 300 km. Compare this to the weight of the person when on the ground. (($R_E = 6380 km, M_E = 5.98 \times 10^24 kg$)

When computing gravitational forces in a computer program, one will often have the position vectors for the two objects rather than the distance between them, also the direction of the gravitational force will often be required.

Determine the gravitational force exerted by a 5.00x1013-kg located at $\vec r_1 = 1.20 Mm \hat x - 2.10 Mm \hat y + 0.80 Mm \hat z$ onto a 3.50x1012-kg asteroid located at $\vec r_2 = 2.20 Mm \hat x + 0.50 Mm \hat y - 1.80 Mm \hat z$

$\vec r_{12} = \vec r_2 - \vec r_1 = \left( 2.2 - 1.2 \right) Mm \hat x + \left( 0.5 - \neg 2.1 \right) Mm \hat y + \left( -1.8 - 0.8 \right) Mm \hat z$
$\vec r_{12} = -1.00 Mm \hat x - 2.60 Mm \hat y + 2.60 Mm \hat z$
$|r_{12}| = \sqrt { \left( 1.00 \right)^2 + \left( 2.6 \right)^2 + \left( -2.6 \right)^2 } = 3.81 \times 10^6 m$
$\hat r_{12} = \vec r_{12} / |r_{12}| = 0.262 \hat x + 0.682 \hat y - 0.682 \hat z$
$|F| = 6.67 \times 10^{-11} \cdot 5.00 \times 10^{13} \cdot 3.50 \times 10^{12} / \left( 3.81 \times 10^6 \right)^2 = 795.7 N$
$\vec F = - |F| \hat r = -208 N \hat x - 543 N \hat y + 543 N \hat z$

This can be coded very easily if the positions and are already defined as vectors using the Vector3D class constructed in the lab. Here's a sample function for finding the gravitational force using the positions and masses of two objects as inputs.

\* Determine the gravitational force between two objects given their masses  *\
\* in kilograms and their positions in meters.                               *\
Vector3D GravForce (Vector3D r1, Vector3D r2, float m1, float m2) {
    Vector3D r12;    \\Radius vector from object 1 to object 2 (meters)
    Vector3D Fg;     \\Gravitational force between the two objects (Newtons)
    r12 = r2 - r1;    
    float invr12mag = 1.0f / r12.getMagnitude  \\Reciprocal of the distance between object 1 and object 2
    Fg = !r12 & (6.67300e-11 * m1 * m2) * invr12mag * invr12mag ;
    return Fg;

If we go back and reevaluate our definition of weight, we can arrive at an expression for the acceleration of gravity. For an object close to the surface of the Earth, the distance between the object and the center of the Earth is approximately the same as the radius of the Earth. Recall that the definition of weight was the force of gravity on an object, and we can create the following expression:

\begin{align} mg = G \frac {m M_E} {R_E^2} \end{align}

Since the mass of the object will never be zero, we can safely divide to arrive at an expression for the acceleration due to gravity, $g$.

\begin{align} g = G \frac {M_E} {R_E^2} \end{align}

We can generalize this formula for use on the surface of any celestial body. For example if we wanted the acceleration due to gravity on the surface of the Moon, simply use the mass of the Moon and the radius of the Moon in Eq. 3

Determine the acceleration due to gravity at the surface of the Moon. ($M_{Moon} = 7.35 \times 10^{22} kg, R_{Moon} = 1735 km$)
$g = 6.67 \times 10^{-11} \cdot 7.35 \times 10^{22} / \left( 1.735 \times 10^6 \right)^2 = 1.63 m/s^2$


Eccentricity and Orbital Velocities

Not all orbits are circular. In fact, not all trajectories possible under Newton's Laws of Motion and Law of Gravity are even closed orbits. All of the Conic Sections are potential trajectories for an object under the influence of a single gravitating body. All of these different orbits and trajectories can be identified by their eccentricity. The eccentricity of a conic section curve is defined as the ratio of the distance between a fixed point, the focus, and shortest distance from the curve to a fixed line, the directrix.


A perfect circle has an eccentricity of exactly zero, e=0. An ellipse, of which a circle is a special case, has an eccentricity less than one, e<1. A parabola has an eccentricity exactly equal to one, e=1, and a hyperbola has an eccentricity greater than one, e>1. Which type of orbit or trajectory an object will follow depends upon its velocity relative to what's called the escape velocity. The escape velocity is the speed needed to escape from the gravitational field of an object and can be calculated using the following equation:

\begin{align} v_{esc} = \sqrt{ \frac {2 G M} {r} }, \end{align}

where $G$ is the Universal Gravitational Constant, $M$ is the mass of the central object (not the object in motion), and $r$ is the distance to the center of the central object. As an example, let's determine the escape velocities from the surface of the Earth and from the surface of the Moon.


The Earth has a mass of 5.98x1024 kg and a radius of 6.38x106 m. What is the escape velocity from the surface of the Earth?
$v_{esc} = \sqrt{ \frac {2 G M } {r} }$
$v_{esc} = \sqrt{ \frac {2 * 6.67 \times 10^{-11} * 5.98 \times 10^{24} } {6.38 \times 10^6} }$
$v_{esc} = 11,200 m/s = 11.2 km/s$


The Moon has a mass of 7.35x1022 kg and a radius of 1.734x106 m. What is the escape velocity from the surface of the Earth?

Notice the significant difference between the two values of the escape velocity. This is why we needed the most powerful machine ever created by humans, the Saturn V rocket, to get three astronauts to the Moon, but only a small thruster on the Lunar Module (LM) to get them back to the Earth.

The speed of an object relative to this escape velocity is what determines the eccentricity of the orbit. If the object's speed is exactly equal to the escape velocity, the object will follow a parabolic trajectory. If it is less, the object will follow an elliptical orbit. If it is more, the object will follow a hyperbolic trajectory. The eccentricity isn't a simple ratio of the speed to the escape velocity, though. Consider an object with zero velocity. It won't follow a circular path whose eccentricity is zero. It will fall straight down. In order to follow an exactly circular orbit, the object must move with the following velocity:

\begin{align} v_{circ} = \sqrt { \frac {G M } {r} } \end{align}

Once you know the speed of an object in a circular orbit, it is simple to determine the orbital period. Consider that speed is the distance traveled divided by the time it takes to travel that distance. The distance traveled by an object in a circular orbit is the circumference of the orbit, $2 \pi r$. This gives is the equation for the speed, then, as

\begin{align} v_{circ} = \frac {2 \pi r} {T}, \end{align}

where $T$ is the orbital period, or the time to complete one orbit. Solving for the period then yields

\begin{align} T = \frac {2 \pi r} {v_{circ}} \end{align}


The International Space Station (ISS) travels in a circular orbit whose altitude is 401 km. Knowing that the Earth has a mass of 5.98x1024 kg and a radius of 6380 km, determine the orbital velocity and period of the ISS.

Keep in mind that the altitude is just the height above the planet's surface. The orbital radius is the radius of the planet plus the orbital altitude.

$r = R_{Earth} + h = 6380 km + 401 km = 6781 km = 6.781 \times 10^6 m$

$v_{circ} = \sqrt{ \frac {G M } {r} }$
$v_{circ} = \sqrt{ \frac {6.67 \times 10^{-11} * 5.98 \times 10^{24}} {6.781 \times 10^6}}$
$v_{circ} = 7670 m/s$

$T = \frac {2 \pi r} {v_{circ}}$
$T = \frac {2 \pi 6.781 \times 10^6} {7670}$
$T = 5555 sec = 92.6 minutes$

Making the Code Work

The general gravitational force can be included in your sum of forces line along with all of your other forces such as thrust or drag. The only difference is in how the general gravitational force is calculated. Let's take a look at the simplest scenario, a two-body problem with one large massive and immobile object with a smaller object in orbit around it. In this example, we will consider a moon in orbit around a planet.

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License