Blog · Computational Physics · Post 6

The Three-Body Problem: When Gravity Refuses to Behave Politely

Two bodies are elegant. Three bodies are where gravity starts acting like it has read philosophy and decided to become difficult.

This post is my personal introduction to the three-body problem: why Newtonian gravity becomes hard so quickly, how numerical simulations help, and why a tiny change in starting position can completely alter the future. There is also a browser simulation, because sometimes the best way to understand chaos is to let it misbehave in front of you.

Three-Body Problem Gravity Chaos Numerical Simulation Computational Physics
Three glowing bodies orbiting chaotically in deep space
Conceptual visual of 3 body problem· Biswajit Jana © 2026
Computational Physics · Gravity · Chaos

The Three-Body Problem

A simple law, three masses, and a reminder that the universe does not owe us closed-form solutions.

Why three bodies are annoying in the best possible way

In physics, some problems look innocent until you actually try to solve them. The three-body problem is one of those. Put two massive bodies in empty space and Newton gives you beautiful conic sections: circles, ellipses, parabolas, hyperbolas. Add a third body and suddenly the universe stops being polite.

The issue is not that Newton's law fails. The issue is that it works too well. Every body pulls on every other body at the same time. Each object changes the gravitational field that changes the motion of the others, which then changes the field again. It is a feedback loop written in gravity.

The three-body problem is not difficult because the force law is complicated. It is difficult because the consequences are.
§ 1 — The Newtonian formulation

The equation is simple. The behaviour is not.

For three point masses, the acceleration of each body is calculated by summing the gravitational pull from the other two. In vector form, body i feels:

Newtonian N-body acceleration
ai = G Σj≠i mj (rj − ri) / |rj − ri|3

Here, ri is the position of body i, mj is the mass of body j, and G is the gravitational constant. The denominator has |rj − ri|3 because the force direction comes from the separation vector while the gravitational strength falls as distance squared.

That expression is compact enough to fit into one line of code. The irony is that one line can generate motion so sensitive that long-term prediction becomes extremely difficult. This is the part of physics where the mathematics smiles politely and then ruins your afternoon.

Total energy in the Newtonian three-body problem
E = Σi ½mi|vi|² − Σi<j Gmimj/|ri − rj|

In an ideal isolated system, total energy should be conserved. In a numerical simulation, the value slowly drifts because we are approximating a continuous system using finite time steps. That is why the simulator includes an energy-drift readout.

Angular momentum check
L = Σi mi (ri × vi)

Angular momentum is another useful sanity check. If the code is behaving, L should not wander wildly unless the step size is too large, the close encounter is too violent, or the computer is politely asking me to stop pretending this is a professional ephemeris solver.

2 bodiesClosed-form Keplerian solution in ideal Newtonian gravity.
3 bodiesNo general closed-form solution for arbitrary initial conditions.
ChaosTiny changes in starting conditions can grow into very different outcomes.
SimulationNumerical integration becomes the practical route for most cases.
§ 2 — Why numerical methods matter

How a computer follows the motion

A browser simulation like the one below does not solve the three-body problem in some magical final sense. It repeatedly estimates the gravitational acceleration, updates velocities, then updates positions. That is numerical integration. It is not perfect, but it is useful.

For the interactive demo, I use a velocity-Verlet style update. It is still simple enough for a web page, but it behaves better than the most naive Euler method because it treats position and velocity updates more symmetrically. For an educational visual, that is a sensible compromise: clear, fast, and not too embarrassing in front of people who know what symplectic means.

Velocity-Verlet position update
r(t+Δt) ≈ r(t) + v(t)Δt + ½a(t)Δt²

After updating the position, the code recalculates the acceleration and then updates velocity using the average of the old and new acceleration.

Velocity update
v(t+Δt) ≈ v(t) + ½[a(t) + a(t+Δt)]Δt

This is still an approximation, so energy will not be perfectly conserved, especially with large time steps or very close encounters. That is not a failure of gravity. It is my browser trying its best.

Interactive mini simulation — three bodies, one headache

Try different presets, change gravity and time step, add a tiny kick, or turn on centre-of-mass locking. Click the canvas to pause or resume.

PresetTriangle
Statusrunning
Energy drift0.000%
|L drift|0.000%
Simulation time0.0

This is an educational browser model using softened Newtonian gravity and scaled units. It is designed for intuition, not precision orbital mechanics.

§ 3 — Chaos is not randomness

Chaos means deterministic but fragile

A chaotic system is not random in the casual sense. The rules are deterministic: if you know the exact initial positions and velocities with infinite precision, the future is fixed. The problem is that we never know anything with infinite precision. A tiny measurement error today can grow into a completely different future state.

That is what makes the three-body problem philosophically irritating. The system is not saying, “I have no rules.” It is saying, “I have rules, but your ability to use them forever is limited.” Very rude, but scientifically fair.

Sensitivity to initial conditions
|δx(t)| ≈ |δx(0)| eλt

In many chaotic systems, a small initial separation δx(0) grows approximately exponentially for some time. The parameter λ is related to the Lyapunov exponent. A positive value indicates sensitive dependence on initial conditions.

A small numerical example makes the point more painful. Suppose two simulated systems differ initially by only one part in a billion: |δx(0)| = 10−9. If the effective Lyapunov exponent is λ = 0.2 per simulation time unit, then after t = 100 units:

Tiny error growth example
|δx(100)| ≈ 10−9 e20 ≈ 4.85 × 10−1

A difference that initially looked irrelevant can become a difference of order one. This is why the “tiny kick” button in the simulator is not a joke. It is basically chaos with a polite user interface.

Conceptual illustration of diverging chaotic three-body trajectories
Conceptual visual · Biswajit Jana © 2026

Conceptual visual for chaotic orbital divergence. It is an illustration, not a measured astronomical system.

§ 4 — Real triple-star examples

The universe does actually build these things

This is not only a textbook toy. Multiple-star systems are common in astronomy, and triple systems are a very real playground for gravitational dynamics. Two useful examples are Alpha Centauri and Polaris.

Alpha Centauri is the closest neighbouring star system to the Sun. NASA describes it as a triple system: Alpha Centauri A and B form a relatively close pair with an orbital period of about 80 years, while Proxima Centauri is gravitationally associated with them on a much wider orbit. Proxima is also the nearest individual star to Earth and hosts at least one planet. That is already enough complexity for one cosmic household. Imagine the family WhatsApp group, but gravitational.

Polaris, the North Star, is also a triple star system. Hubble observations directly imaged Polaris Ab, a close companion to Polaris A, while Polaris B is a wider companion separated by roughly 240 billion miles. The close companion Polaris Ab is about 2 billion miles from Polaris A. So even the star we use as a symbol of “direction” is quietly running a multiple-body situation in the background.

Alpha CentauriA+B form an 80-year binary; Proxima orbits much farther out.
PolarisA triple system with a close companion and a wider companion.
HierarchicalMany real triples survive because one orbit is much wider than the inner binary.
Non-hierarchicalMore compact triples are often chaotic and can eject one member.
§ 5 — Why astrophysics cares

This is not just a decorative headache

The three-body problem appears in real astrophysics: star clusters, planetary systems, binary stars with a third companion, asteroid scattering, close encounters, and gravitational interactions near compact objects. Any time more than two bodies strongly interact, the clean two-body picture starts to fray.

In many real systems, astronomers use approximations. A hierarchical triple, for example, can be treated roughly as an inner binary plus a distant third body. That approximation can work well for a while, but it has limits. The third body can slowly exchange angular momentum with the inner binary, tilt orbits, trigger eccentricity oscillations, or destabilise the system over long timescales.

Hierarchy idea
aouter ≫ ainner

If the outer orbit is much larger than the inner binary orbit, the system is often more stable and easier to approximate. If the separations become comparable, the polite approximation starts sweating.

Of course, real systems are often much worse. They can involve gas, radiation pressure, relativity, tides, collisions, non-point masses, and millions of bodies. At that point the three-body problem looks almost polite. Almost.

Practical lesson
simple law + multiple interactions + time = complex behaviour

The lesson is bigger than gravity. Many physical systems become hard not because the local rule is impossible, but because repeated interactions create behaviour that is difficult to predict globally.

What I like about this problem

I like the three-body problem because it sits at a strange emotional boundary. It is simple enough to explain with Newton's law, but deep enough that it still humbles us. It reminds me that physics is not only about finding neat equations. Sometimes it is about accepting that a neat equation can produce a messy universe.

And honestly, there is something reassuring about that. The universe does not owe us simplicity. We are the ones trying to compress it into diagrams, simulations, and equations. Sometimes it cooperates. Sometimes it throws in a third body and watches us suffer.

Selected references

  1. Binney, J. and Tremaine, S. (2008) Galactic Dynamics. 2nd edn. Princeton: Princeton University Press.
  2. Heggie, D. and Hut, P. (2003) The Gravitational Million-Body Problem. Cambridge: Cambridge University Press.
  3. Leimkuhler, B. and Reich, S. (2004) Simulating Hamiltonian Dynamics. Cambridge: Cambridge University Press.
  4. NASA (2018) Alpha Centauri: A Triple Star System about 4 Light Years from Earth. Available at: nasa.gov (Accessed: 7 May 2026).
  5. NASA Science (2006) There’s More to the North Star Than Meets the Eye. Available at: science.nasa.gov (Accessed: 7 May 2026).
  6. Poincaré, H. (1890) 'Sur le problème des trois corps et les équations de la dynamique', Acta Mathematica, 13, pp. 1–270.
  7. Press, W. H. et al. (2007) Numerical Recipes: The Art of Scientific Computing. 3rd edn. Cambridge: Cambridge University Press.
  8. Strogatz, S. H. (2018) Nonlinear Dynamics and Chaos. 2nd edn. Boca Raton: CRC Press.
  9. Valtonen, M. and Karttunen, H. (2006) The Three-Body Problem. Cambridge: Cambridge University Press.

Comments & reactions

Powered by GitHub Discussions via giscus.