Tie a ball to a string and whirl it around your head — it traces a circle, held in by the string. A planet does almost the same thing around the Sun, except the "string" is invisible gravity and the path isn't a perfect circle but a gently squashed one called an ellipse. Four hundred years ago Johannes Kepler stared at years of Mars measurements and pulled out three startlingly simple rules that every orbit obeys.
Law I — the shape. Orbits are ellipses, and the Sun sits at one focus, not at the centre. How squashed the ellipse is depends on one number, the eccentricity $e$: $e=0$ is a perfect circle, and values closer to $1$ are more stretched out. The overall size is set by the semi-major axis $a$ — half the longest way across.
Law II — the pace. Draw a line from the Sun to the planet. In any fixed slice of time that line sweeps out the same area, no matter where the planet is. To cover the same area while close to the Sun, the planet must race; far away, it can dawdle. So planets move fastest at perihelion (closest) and slowest at aphelion (farthest).
Law III — the timing. The farther a planet, the longer its year — and the relationship is wonderfully exact. With the period $T$ measured in years and $a$ in astronomical units (AU, the Earth–Sun distance), $T^2 = a^3$. Try Mars: it orbits at $a\approx 1.52$ AU, so $T=\sqrt{1.52^3}=\sqrt{3.51}\approx 1.88$ years — and a real Martian year is about 687 days. The rule nails it.
The deeper statements above all flow from one source: gravity is an inverse-square central force, so a body's angular momentum $L$ and total energy $E$ stay constant. Constant $L$ is Law II. Constant $E=-GMm/(2a)$ means the energy — and therefore the period — depends only on $a$, not on how stretched the orbit is. The full third law carries a constant $4\pi^2/GM$ that depends only on the central mass $M$, which is exactly why timing an orbit lets astronomers weigh a star. In the sim, the sliders map straight onto these: $a$ sets the orbit's size, $e$ its shape, and $M$ the Sun's mass (heavier star → stronger pull → shorter period).
Try this in the sim above: set $e=0$ and watch the orbit snap into a perfect circle, then push $e$ to $0.8$ and see how lopsided it gets and how the planet sprints through perihelion. Switch to Law II — Equal Areas and notice the shaded wedge keeps the same area even as the planet's speed changes. Open Solar System and check that the farther planets really do take dramatically longer years, with $T^2$ tracking $a^3$.
| Symbol | Meaning | SI Unit |
|---|---|---|
| $a$ | Semi-major axis | m (or AU) |
| $e$ | Eccentricity (0 = circle, →1 = parabola) | dimensionless |
| $\theta$ | True anomaly (angle from perihelion) | rad |
| $r$ | Distance from focus (star) | m |
| $T$ | Orbital period | s (or yr) |
| $M$ | Mass of central body | kg |
| $L$ | Angular momentum of orbiting body | kg m² s⁻¹ |
| $G$ | Gravitational constant 6.674×10⁻¹¹ | N m² kg⁻² |
a (AU) sets the semi-major axis; e sets eccentricity. The simulation integrates Newton's equations using a symplectic leapfrog method, so the orbit closes and energy is conserved over many revolutions. Speed and radius readouts are computed from the live state, while $T$ uses Kepler III directly for verification.An ellipse is the most general bound trajectory under an inverse-square attractive force. A circle is just the special case $e=0$ where the radial velocity happens to be zero everywhere. Any small perturbation gives the orbit a non-zero eccentricity. Mathematically, the conic section $r=p/(1+e\cos\theta)$ with $0\le e<1$ describes ellipses; only one specific energy gives $e=0$.
It integrates the two-body problem in real time. The colored ellipse is the actual computed trajectory. The translucent triangle (Law II mode) sweeps out an area as the planet moves — equal areas in equal times even though the planet moves faster near the star. In Law III mode, multiple planets at different $a$ values demonstrate $T^2\propto a^3$. Live readouts show $r$, $v$, total energy, and $T$ from the analytical Kepler III formula.
Every artificial satellite (GPS, ISS, geostationary) and natural body (planets, moons, asteroids) obeys Kepler's laws. Engineers use Law III to design transfer orbits — Hohmann transfers between Earth and Mars rely directly on $T^2\propto a^3$. Binary star systems are used to weigh stars by measuring $T$ and $a$. Exoplanet detection via transit timing and radial velocity uses Kepler's laws in reverse.
Because the planet has angular momentum. The radial equation of motion contains an effective potential $V_\text{eff}(r)=-GMm/r+L^2/(2mr^2)$. The second term is a centrifugal barrier that prevents $r\to0$ for any non-zero $L$. The planet oscillates between $r_\text{min}=a(1-e)$ (perihelion) and $r_\text{max}=a(1+e)$ (aphelion).
From conservation of energy $E=\tfrac{1}{2}mv^2-GMm/r=-GMm/(2a)$ and angular momentum $L=mvr$ at the apsides (where $\vec{v}\perp\vec{r}$): $v_\text{peri}=\sqrt{GM(1+e)/[a(1-e)]}$ and $v_\text{aph}=\sqrt{GM(1-e)/[a(1+e)]}$. Their ratio is $v_\text{peri}/v_\text{aph}=(1+e)/(1-e)$ — Earth's eccentricity $e\approx0.0167$ gives a 3.4% speed variation over a year.
$T^2\propto a^3$ holds for any inverse-square central force, regardless of system. The proportionality constant $4\pi^2/(GM)$ depends on the central mass, so different stars have different constants. In binary systems, both bodies orbit the common centre of mass and the law uses $M_1+M_2$. General relativity introduces small corrections (Mercury's perihelion precession of 43 arcsec/century).