SimulatorEducationBrainInformation

Three-Body Problem Simulator

Integrate Newton's gravity for three point masses with a velocity-Verlet scheme and watch the orbits unfold. Switch between the figure-8, Lagrange triangle, Burrau's chaotic Pythagorean problem, and other catalogued periodic solutions.

Initial condition

Three equal masses chase each other along a single figure-8. Discovered as a closed orbit in 2000.

Simulated t
0.00
Energy E
-1.287
|ΔE / E₀|
0
Verlet drift
dt
0.0040
Time step (dt)0.0040
Simulation speed2x
Trail length280
Gravity G1.00

Integrator: velocity-Verlet with softening ε = 0.02.

The problem in one paragraph

Take three point masses. Let them attract each other with Newton's law of gravity. Predict where they will be one year from now. For two bodies the answer is a clean conic section that Newton wrote down in 1687. For three, no general closed-form solution exists — the system is genuinely chaotic. Tiny changes to the initial state grow exponentially, and the only reliable prediction is the numerical one you are watching above.

This page integrates the equations of motion with a second-order velocity-Verlet scheme, a symplectic integrator that conserves the total energy E very well over long timescales — far better than naïve Euler. The "|ΔE / E₀|" readout in the stats lets you see exactly how cleanly your chosen dt preserves the conserved quantity.

Equations

For each body i, the acceleration is the sum of pulls from the other two:

r̈ᵢ  =  ∑j ≠ i   G · mⱼ · (rⱼ − rᵢ) / |rⱼ − rᵢ|³

Velocity-Verlet advances one step by computing accelerations, kicking position by v·dt + ½·a·dt², recomputing accelerations at the new position, and then averaging the old and new acceleration to update velocity. The kick-drift-kick symmetry is what makes it conserve energy on a phase-space spiral rather than letting it drift to infinity.

A small softening length ε is added inside the square root to avoid division by zero during near-collisions — without it the timestep would have to shrink dramatically every time two bodies graze, which is exactly what happens in Burrau's problem.

The presets, in order of weirdness

OrbitYearWhat to watch
Figure-82000Three equal masses chase each other along one figure-8 curve. The orbit is stable: it survives perturbations.
Lagrange equilateral1772Three equal masses spin rigidly at the corners of an equilateral triangle — a known exact solution.
Broucke A11975A symmetric periodic orbit from Roger Broucke's catalogue of three-body families.
Yin-Yang II2013One of 13 new periodic orbits found by Šuvakov & Dmitrašinović using a computer search.
Burrau Pythagorean1913Masses 3, 4, 5 dropped from rest at the 3-4-5 right triangle. Chaotic; resolves into a binary plus an ejected single after several near-collisions.

Why it's "impossible"

Henri Poincaré won the King Oscar II prize in 1889 partly by proving that no formula like Kepler's ellipse equation exists for three bodies. What he discovered along the way — that nearby trajectories diverge exponentially and the solution set has a fractal structure — was the birth of chaos theory.

In 1912 Karl Sundman did show that a convergent power series in t1/3 exists for almost all initial conditions, but it converges so slowly that no one has ever computed an orbit from it. For practical work — spacecraft trajectories, galactic dynamics, exoplanet stability — numerical integration is the only game in town.

Special periodic solutions like the ones in the presets are rare measure-zero islands in an otherwise chaotic sea. Finding new ones is an active research topic; Šuvakov and Dmitrašinović's 2013 paper alone added 13 new orbit families to a list that had been at three for centuries.

Things to try in the sim

Watch the energy drift. Crank dt up to 0.01 on Burrau and the |ΔE / E₀| counter explodes — that is your integrator telling you the answer can no longer be trusted. Drop dt back to 0.002 and the conservation is restored.

Perturb gravity. Slide G away from 1.0 and even the figure-8 falls apart within a fraction of an orbit. The closed orbits are exquisitely sensitive to the exact parameters.

Use long trails. Bump the trail length to its maximum on the Broucke or Yin-Yang presets and you can see the full closed shape draw itself out as the bodies retrace the same path.