The Celestial Two-Body Problem

Requires a Wolfram Notebook System

Interact on desktop, mobile and cloud with the free Wolfram CDF Player or other Wolfram Language products.

Requires a Wolfram Notebook System

Edit on desktop, mobile and cloud with any Wolfram Language product.

Two celestial bodies interacting gravitationally can establish a stable system in which both trace out elliptical (or possibly circular) orbits about their mutual barycenter (center of mass), marked with a red dot. Each orbit individually follows Kepler's three laws of planetary motion.


Kepler's first law specifies that each orbit is an ellipse with one focus at the barycenter.

According to Kepler's second law, each orbit sweeps out equal areas in equal times. Thus for an eccentric orbit, the speed increases closer to the barycenter.

Kepler's third law states that the square of the period of an orbit is proportional to the cube of its semimajor axis. Accordingly, the outer planets of the Solar System have much longer "years" than Earth.

When one of the interacting bodies is much more massive than the other, as in the typical case of a planet orbiting a star, the more elementary form of Kepler's laws pertains, with the star itself at the focus of an elliptical orbit. Actually, the barycenter is then located within the body of the star, but not at its exact center. This can cause the star to "wobble" when a Jupiter-sized planet orbits around it. In recent years, the existence of extrasolar planets has been detected in this way.

In this Demonstration, you can vary the mass ratio and the eccentricity ϵ of the orbit. For a circular orbit,, while for an ellipse . You can adjust the apoapses, the vectors from the barycenter to the farthest point of each orbit, also known as Laplace–Runge–Lenz vectors. (Apogee, aphelion, and apoastron are more familiar synonyms for apoapsis pertaining to specific celestial bodies.) Rotating the three-dimensional figure can show the orbits from different angles. From an edge-on perspective, the motions of the orbiting bodies appear to follow irregular linear trajectories.


Contributed by: S. M. Blinder (March 2011)
After suggestions by: Jeff Bryant and Ed Pegg Jr
Open content licensed under CC BY-NC-SA



Snapshot 1: the binary or double star 61 Cygni, also known as Bessel's star; the period of rotation is approximately 659 years

Snapshot 2: the dwarf planet Pluto with its companion Charon, with about a seventh of the mass; the barycenter of the system orbits the Sun with a period of 248.5 years

Snapshot 3: a star with a planet 1/50 of its mass; the star's wobbling motion is apparent

Snapshot 4: approximate representation of a comet in orbit around the Sun; the eccentricity approaches 1

Snapshot 5: the lowest Bohr orbit for a muonic atom: a negative muon orbiting a proton; the Bohr radius is about 1/207 that of a hydrogen atom

Feedback (field required)
Email (field required) Name
Occupation Organization
Note: Your message & contact information may be shared with the author of any specific Demonstration for which you give feedback.