- Introduction to gravity
- Orbital motion
- The 2-body problem
- Free vs bound systems
- The 3-body problem
- The Trojan Java Applet
- N-body systems
- Conclusions
- References and further reading

Get the Trojan java applet source code trojan.java and the HTML calling page test.html and the compiled trojan.class file. The astrophotographs below were taken from the NASA image gallery.

Modern physics is aware of 4 fundamental forces (physicists prefer to call them *interactions*). The weakest of those is the gravitational interaction; nonetheless it has great impact on our everyday lives.

The reason why gravitation is so important albeit its weakness is that it is neither shielded nor has a finite range. The only other known force which has an infinite range is the *electromagnetic interaction* which is responsible for the phenomena of electricity and magnetism, but also for light propagation, radio waves and even X-rays. It is also the force which binds atoms together and collects them to form molecules.

The remaining two forces, the *strong* and the *weak* forces (I am sorry, but there doesn't seem to be a more beautiful name for them; although physicists have invented nice-sounding names for a lot of phenomena, they seem to have failed to invent something better in these cases), have only a finite range which is of the order of the atomic nucleus or even less. They play no role for larger distances. There is better mathematical notion of what “finite range” means, but I don't want to go into that.

Today we have a very powerful theory of gravity, namely Einstein's general relativity (GR). However, in the cases we are interested in this tutorial one can show, that it is sufficient to consider only the mechanics first formulated by Sir Isaac Newton in the 17th century. One can show that GR reduces to Newtonian mechanics if one only consider velocities small compared to the velocity of light and weak gravity fields. In most computations which involve gravity in our solar system it is sufficient to use Newtonian mechanics unless one requires extremely high accuracy.

The simplest problem of gravity is the so called “1-body-problem”. It involves a single moving body in the field of a fixed massive body (in order to be able to consider the other body to be “fixed”, we must assume that the mass of the moving body is very close to zero). Let's see what forces are involved: The first one is the gravitational force which Newton postulated to be:

M is the mass of the central body, m is the mass of the moving body, r is the distance and a constant to fix the units (which is commonly called *constant of gravity*). This expression only gives the absolute value of the force so far; its direction coincides with the r vector (the “-” sign tells us that it points in the opposite direction).

But wait! Didn't I just require the smaller bodies mass to be negligibly small? So shouldn't the force be negligible as well? Well, one rule of thumb in physics is always that you should only take limits in the *final* expression, so let's keep the mass for a while and only let it vanish in the final expression.

The second force we have to consider is the centrifugal force whose direction coincides again with the radial vector, but now has a positive sign:

v is the tangential velocity of the body, i.e. the component of the velocity which is perpendicular to r. Graphically the situation looks as follows:

Please note: No quantity in the above picture depends on the absolute location of the large mass (neither the forces nor the distance or velocity does). So for the forces (and the quantities they depend on, i.e. the distance r and the velocity v) it makes no difference where you put the center of your picture. For them **any choice is as good as another**.

Now let's see what happens if the body is in a circular orbit: This means that the radius r is constant and does not change with time. If we draw the above graphic at two different times, one picture will be a rotated version of the other.

There are important consequences from the above observation: Similar considerations led to the discovery of symmetries in physics. E.g. there is a famous theorem of Emmy Noether for with each symmetry of a system one can find a constant of motion. And indeed, with some maths one can show that with a generalization of the above considerations, one can find a conserved quantity called “angular momentum”. This is just a mathematical notion of Kepler's 3rd law!

The point is now that in the rotated version the forces will still be the same, together with the radial distance r and the tangential velocity v. So the quantities don't change with time and there is no motion in the radial direction. But we know from Newton's equations that if there is no change in a coordinate, the resulting force must be zero, so the sum of F_{G} and F_{C} must be equal to 0.

There is one subtlety which I didn't mention but which looks confusing if you already know about coordinate systems; namely the fact that Newton's equations are not truly independent of the choice of coordinates, but require the use of Cartesian coordinates. But above I implicitly introduced spherical coordinates when talking about the distance r and the angle of rotation.

In fact, I didn't consider a fixed Cartesian coordinate system, but one which rotates and has one axis pointing from M to m. If I am working with a rotating Cartesian system, additional terms will appear which arise from the coordinate transformation. But this term is just the centrifugal force! So I am justified to use Newton's equations although I do not actually have a fixed Cartesian coordinate system.

So if we write down this equation:

we see that it is actually independent of m for arbitrarily small , because we can divide it out. The resulting expression yields a relation between m, v and r which must be fulfilled in order to have a circular orbit. When solving the equation for v, we get for the absolute value of the tangential velocity

What happens if v differs from the above value? Well, with some more maths we can show, that the resulting curve will no longer be a circle but rather be an ellipse. I'm not going to do the calculation here, because it has already been done in a number of excellent textbooks and it's not so important for the following. (Well, admittedly I am also too lazy and I do not have a really simple and elegant derivation for these facts that does not involve loads of lengthy calculations.)

We just examined the 1-body problem above which considered a body moving in a fixed gravitational field of another body. You may be tempted to believe that the 2-body problem introduces an additional body in the problem above. Well, this is not the case — actually it is far simpler: You again take the same 2 bodies as above, but now the small mass m is not *negligibly* small! This means that we now have to write down Newton's equation for the first body m but also for the second body M as well! And these two equations will no longer be independent of each other.

This sounds rather complicated but there is a way out: One can show that there is a neat mathematical trick which reduces the 2-body problem to a 1-body problem. If you want to know the details, feel free to look in the literature – see the list at the end of this document.

The point is that there exists a position in space which is called “center of mass” — or alternatively “barycenter” — of the two bodies and lies somewhere on the line going from one body to the other. And we can pretend that each one of the two bodies just moves as a body in the 1-body problem above.

Now let d be the distance from the mass M to the imaginary body in the center. If we keep this point fixed, we can treat the two other bodies as being one-body problems with this point being the central body. We can compute d as follows

Given this distance, one can again calculate the velocities of the two bodies in a circular orbit:

Note, however that these must now point into opposite directions perpendicular to the distance vector! Exactly like in the 1-body case, we have elliptic orbits if the initial velocities are different. However, the situation is more subtly since we cannot choose the two starting velocities to be arbitrary anymore! If we did this, the center of mass of the two bodies would no longer be static, but moving as well with constant velocity. So we should better continue with our circular orbits.

So far we have considered bodies “orbiting” each other, i.e. the bodies stayed at a fixed distance from each other. The cases we only noted in passing (i.e. elliptical orbits) are similar in the sense that there is a maximum distance the bodies can reach. All these cases (when the bodies are no further than a finite distance apart at all times) all called *bound systems*.

But two bodies do not need to form a bound system; if they were bound in any case, we couldn't even build a space probe which leaves Earth's orbit. So there is also the alternative that the two bodies can fly apart from each other without an upper limit. This case is called a “free system”. The difference lies in a quantity which we can compute from the distance and the absolute values of the velocity of a body and is called the “energy”. In the one-body case it looks like this:

**Note**: It will look like this in *any* case, i.e. regardless if we compute it in the free case, the bound case or whatever. One special feature which makes this quantity so interesting that it is *constant*, i.e. if you compute it once, it will stay the same at all time. The other special feature is that we can use it to decide if a particle is bound or free.

If we examine the equation more closely, we find it is the sum of a positive and a negative term. You already encountered them in Newtonian mechanics — the first one is the so-called “kinetic energy”, the second one is the so-called “potential energy”. The potential energy is negative, the kinetic energy is positive. So if the potential energy is larger, the total energy will be negative and if the kinetic energy is larger, the total energy will be positive. Please note that in an elliptic orbit, both the kinetic energy and the potential energy will change over the time. It is only their *sum* which has to stay constant!

Now one can show that if the total energy is negative, the system will be bound and if the kinetic energy is larger, the body will be unbound. This criterion enables us to distinguish bound and unbound systems at any time.

You can convince yourself now that if the kinetic energy in the one- and two-body systems is larger than the total energy at any time, it will stay larger at all times (although the kinetic and potential energy will in general vary with time). The same is true vice versa. This is no great news in the one-body and the 2-body system since we already knew that the bound states will look like circles or ellipses, but it is a new way to formulate this statement. And in fact a more powerful way, because computing the energy is obviously simpler than calculating the orbit of the particle.

If we computed general-relativistic corrections to the Newtonian system, finding the orbits (which are no longer ellipses in this case) is a very complicated task, but computing the energy will be a lot simpler. And we still can immediately decide if the body is bound or not.

We started with the 1-body problem, continued with the 2-body problem and guess which problem we are now going to examine? Yes, exactly! However, so far we had been able to solve the problems exactly, i.e. we could in principle predict how the system would look like at any time if we only knew how it looked like at some initial time. And we could even compute how it looked like at any earlier time.

Now, if we add a 3rd body, these solutions are no longer available for an arbitrary initial setup! What we can do then is to write down Newton's equation in a fixed coordinate system and then solve them numerically i.e. using a computer. There are several methods to do this — one is to assume elliptic orbits and compute their bodies' deviations from elliptic orbits. This method only works well if the true paths really look at least roughly like ellipses and it introduces small systematic errors. This is the method of choice if we want to compute the paths of planets in our solar system, but it doesn't work for systems of bodies of equal mass whose paths don't look anything like ellipses.

A more general albeit less accurate technique would be to take the system at some time and compute its appearance a little time later. This step is called an “iteration” and will necessarily introduce a systematic error which depends on the size of the time step. This method works fine if you don't consider too large times, however, you cannot say anything about the long-term stability of the system. You even cannot say if a single particle in a 3-body system will be stay bound or not. In a 3-body system it may happen in certain situations that 2 bodies form a stable elliptical orbit and the 3rd body gets shot away! Or the bodies may continue to stay together for some time. If you only could compute small finite time-steps you cannot say how the system ends up finally. The systematic error complicates the situation further — how do you know if your result after millions of iterations still reflects the correct behavior of the system or is spoiled by numerical errors?

In the Java-Applet which accompanies these tutorial, I used the last method to simulate the system. This allows you to study the behavior of the system under any initial conditions.

You may have gotten the feeling that there is nothing we can say about 3-body systems any more, but this is a little exaggerated. There are some special systems which are solvable exactly and which are **known to be stable**! These are important, because they allow long-term stability analysis and they allow to estimate how large deviations in our solar system may be.

Let's consider the so-called *restricted 3-body system*. We start with a 2-body system with one body being reasonably lighter than the other one. The 3rd body will be considered to be so small that its effect on the other two is negligible. Let's assume the 2 large bodies are in a circular orbit; are there any points where the 3rd body can be placed so that it will stay where you put it?

It turns out that in fact five points of this sort exist. These points are referred to as **Lagrange points** to honor Joseph-Louis Lagrange for his pioneering work “Essai sur le Problème des Trois Corps” (1772 Paris Prize (shared) winner), see also the English translation of Chapters I & II. The exact location of all five points can be found by computing the centrifugal forces *together* with the gravitational forces which act on the 3rd body. Three points lie on the line connecting the two larger bodies and the other two are positioned such that the 3 bodies form an equilateral triangle:

There are peculiarities concerning the Lagrange points: Only the points L_{4} and L_{5} are stable! If you put a body at L_{1}, L_{2} or L_{3} it will only stay there if you put it *exactly* at the point and don't perturb it afterward! However, at L_{4} and L_{5} you can even kick it a little and the body (unless you kicked it too hard) won't move out of his position! This is what makes the points L_{4} and L_{5} so interesting, because they allow for a semi-stable system of 3 bodies!

In our solar system, we indeed find several asteroids located at the points L_{4} and L_{5} if we take M to be the sun and m to be Jupiter. These asteroids are named after characters in Homer's Iliad. The current convention in use is to place the Greeks at the (eastern, preceding) Lagrangian point L_{4} and the Trojans at L_{5}. There are 3.5 times more Greeks than Trojans.

There is even a more general theorem about stability of 3-body systems. It is valid even if the mass of the 3rd body is non-negligible: A triangle consisting of 3 masses is stable if it is always equilateral. So we can allow the length of the legs of the triangle to vary as long as they always have the same length! There are some restrictions on the masses if we want the system to be stable against perturbations and this is exactly what we can study with the Java applet below.

You can now experiment yourself with this small Java applet. You can examine how stable the system is or where the limits are. Here is a situation where the light asteroid stays where it started, although it has been given a slight kick:

>But you can do more with it. If you want to do some experiments yourself, then read on in this chapter. However, you should already have a little knowledge about **Java applets** and **HTML**! If you don't care, then you can skip to the next section.

The trojan java applet allows use to simulate the restricted 3-body system. In order to use it, please download the file trojan.class and test.html to your computer (with most browsers this can be done if you click on the link with the right mouse button and then select *Save link as ...* from the menu). You can edit **test.html** with any text editor (if you are using Windows, you can e.g. use the Notepad; Linux users can use Emacs and Mac users TextEdit).

In the file **test.html** you have to locate the following lines:

```
<APPLET CODE="trojan.class" WIDTH="150" HEIGHT="130">
```

<PARAM name="dt" value="0.1d">

<PARAM name="lp" value="1">

<PARAM name="vtx" value="0.0d">

<PARAM name="vty" value="-0.9d">

<PARAM name="showtrace" value="1">

</APPLET>

To change a parameter, you have edit the part `name="X" value="Y"`

with `Y`

being the new value for the parameter `X`

. The parameter `X`

can be one of the following:

`dt`

- Iteration time step. Usually you don't need to alter this value since the default of 0.1 is acceptable in most situations.
`lp`

- The number of the Lagrange point to start with (4-5). Default is 4. I decided to skip the points L
_{1}-L_{3}because they are too close to the sun and the planet to make any sense. `vtx, vty`

- At the beginning, the trojan applet already puts the 3rd body at the Lagrange point L
_{4}. The initial velocity is exactly the velocity needed for a stable orbit. However, the values you enter here will be added to this initial velocity. Watch what happens if you add too large values here. `showtrace`

- The color of the trace of the trojan. The default value is 0 (which is identical to the background color and thus will result in no trace at all).

After adjusting **test.html** to your needs you can open it with your Web browser (with Java enabled) and watch how the system behaves. As a starting point, I found some interesting parameter values you can start with:

```
<PARAM name="dt" value="0.1d">
```

<PARAM name="lp" value="1">

<PARAM name="vtx" value="0.0d">

<PARAM name="vty" value="-0.9d">

<PARAM name="showtrace" value="1">

Here you will see something different:

```
<PARAM name="dt" value="0.1d">
```

<PARAM name="lp" value="1">

<PARAM name="vtx" value="-0.50d">

<PARAM name="vty" value="0.0d">

<PARAM name="showtrace" value="1">

But only a tiny change in initial conditions leads to a completely different behavior:

```
<PARAM name="dt" value="0.1d">
```

<PARAM name="lp" value="1">

<PARAM name="vtx" value="-0.495d">

<PARAM name="vty" value="0.0d">

<PARAM name="showtrace" value="3">

Another small and innocent-looking change and the situation is even more dramatic:

```
<PARAM name="dt" value="0.1d">
```

<PARAM name="lp" value="1">

<PARAM name="vtx" value="-0.49">

<PARAM name="vty" value="0.0d">

<PARAM name="showtrace" value="3">

Enjoy playing with the parameters!

You may wonder why I choose to edit the input parameters as parameters in an HTML-file. Admittedly this is very user unfriendly. Well, the reason is that I wanted the applet to be compatible with Java 1.0 and there have been significant changes in event handling between Java 1.0 and 1.1. A GUI written for 1.0 is deprecated in 1.1 and with higher version numbers it is likely that there are still more changes. The current mechanism works fine with all Java version we have so far. Once the rapid Java development has settled down, this excuse wouldn't help me any longer, but so far we should better wait and see what happens.

The situation for n-body simulations is still more complicated than for 3-body systems. Sadly these systems are the ones which are most interesting in astronomy. Astronomers distinguish between *few-body systems* and *many-body systems*. Few body systems are systems with about a dozen of bodies. Many-body systems consist of several thousands up to millions of bodies or even more.

In all these cases the central question is about stability. If you setup a system, will it look similar after a few million years? Or a few billion years? A very interesting question is long-term stability of our solar system. It is actually more than 4 billion years old. Apparently it stayed more or less stable and no catastrophe like Earth being shot out of the system has happened since. If you already played around with the trojan applet a little, you may have found out that there are numerous cases when the 3rd body gets shot out of the system — the situation would look worse if it had equal mass as the planet (then the planet would get shot out similarly often). So how is it possible that in our solar system (where the planets have roughly similar masses) everything worked out so nicely? And **will it stay stable**?

Answering this question is also important if we want to know how probable it is that there are other solar systems similar to ours which may have planets able to house life. This is a playing ground of chaos theory and an active research field with obvious importance for the whole mankind.

The galaxy **NGC4414** contains billions of bodies.

But also for many-body systems stability is vitally important. Many-body systems are found in nature in the shape of globular clusters, galaxies and even clusters of galaxies. How long do these objects typically stay stable? For galaxies the answer is not as urgent as e.g. for our solar system since they may live for several billions of years or even longer than our universe exists. But in the case of globular clusters it may turn out that they only live several billions of years. They may shoot out several stars and become more compact before they finally collapse. At the end of their lives they may become black holes or similar fantastic objects. If we knew how long these objects typically live, we would even gain an independent idea of how old our universe actually is!

The object **Abell 2218** is a cluster of galaxies and thus one of the most complex objects in existence.

We have learned how to treat a few special cases of systems of astronomical interest. We also saw what their relation to open questions in modern research are. And I hope that you are able to use the trojan applet and probably learn more. The whole field is still extremely interesting and with the prospects of manned spaceflights we may be able to learn more about our universe than with computer simulations alone.

The Java source code referred to on this page is licensed under the GPLv3 and can be downloaded as a .java source-file and as a compiled trojan.class file. The test page that embeds the applet can be found here: test.html.

I have to thank John Stockton for his reading of this article and his feedback in 2011.

If you want to learn mechanics properly, I suggest you to start with a book like**R.P. Feynman, Mainly mechanics, radiation and heat, Feynman lectures in Physics, 1967**

If you are interested in mechanics in general have a look at**Scheck, Mechanik, Springer-Verlag Berlin Heidelberg 1992**

There is also an English translation available, but I don't know where it appeared.

If you are more interested in astronomy, check out**O. Montenbruck, T. Pfleger: Astronomie mit dem Personal Computer, Springer Verlag Berlin, 1994**

I do not know about an English translation.

If you already know a lot about mechanics and are specifically interested in celestial mechanics, then the books to read are**W. Neutsch, K. Scherer, Celestial mechanics: An introduction to classical and contemporary methods, BI Wissenschaftsverlag Zürich 1992****M. Schneider: Himmelsmechanik I+II, BI Wissenschaftsverlag Zürich 1992**

One of the founding papers in German is:**C. Caratheodore: Über die strengen Lösungen des Dreikörperproblems, Sitzungsberichte der Bayer. Akad. der Wiss., S.257, 1993**

There is also a good (albeit quite technically advanced) review of more techniques and applications of N-body systems on Scholarpedia. If you want to dig deeper into the matter and need a collection of methods and their practical implementations for all sorts of gravitational systems in existence, this is the place to go to.

A selection of English books on the topic has been recommended to me by John Stockton and can be found on here on Amazon.

In recent years a lot of excellent material has appeared on the web: there is a Wikipedia article and a very thorough, albeit quite technical online book by Dr. Stockton who I feel indebted to for several corrections and links to original literature.

Imprint / Impressum

© 1997-2013 Dr. Wolfram Schroers. This site is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.

Additional permissions available at http://www.field-theory.org/editorial/index.html.

See the Imprint or Impressum (in German) for further information.

About

Wolfram is a leading software engineer focused on Enterprise and B2B apps on iOS. His clients rank from small independent studios to companies in the German DAX index.

He has worked at top Universities on three continents in the past decade and is a popular speaker at conferences. He is currently working in Berlin, Germany, and can be reached at his company website.