3D Orbits and Planetary Motion: Ellipses in Space

We've seen how a particle can move in an elliptical path and how energy varies throughout the motion. But here's something exciting — planets also move in ellipses. This is where mathematics meets astronomy. In this post, we’ll explore Kepler’s Laws, simulate a simple planetary orbit in 3D using Octave, and discover how a flat ellipse turns into a space-filling orbit. ---

Kepler’s First Law: The Ellipse of Orbits

In the early 1600s, Johannes Kepler studied the planets and found something surprising:
Kepler’s First Law: The orbit of a planet is an ellipse, with the sun at one focus.
This means that planetary motion is not circular — but elliptical, just like the math we’ve been studying! ---

Position in 3D: Tilting the Ellipse

Let’s say the 2D elliptical orbit is: r(t) = < a*cos(θ), b*sin(θ) > To lift this into 3D, we rotate the ellipse out of the xy-plane. That’s done by applying a tilt angle (called inclination) and optional rotation around the z-axis. We’ll define the orbit in 3D space as:
x = a * cos(θ)
y = b * sin(θ) * cos(inclination)
z = b * sin(θ) * sin(inclination)
This simulates a planet orbiting in a tilted plane — like the way Earth orbits the Sun at a tilt. ---

Octave Code to Simulate a 3D Orbit

Let’s write Octave code to simulate one full orbit in 3D space.
% Parameters
a = 5;                    % Major axis length
b = 3;                    % Minor axis length
inclination = pi/6;       % Tilt angle (30 degrees)
theta = linspace(0, 2*pi, 1000);  % Full orbit

% Parametric 3D orbit
x = a * cos(theta);
y = b * sin(theta) * cos(inclination);
z = b * sin(theta) * sin(inclination);

% Plot in 3D
figure;
plot3(x, y, z);
grid on;
xlabel('x');
ylabel('y');
zlabel('z');
title('3D Elliptical Orbit');
axis equal;
---

What Does This Show?

The orbit is a 3D ellipse, tilted relative to the base plane. The sun would sit at one focus (not the center), but in this simple example we place it at the origin. This basic idea can be extended to real solar system models! ---

Kepler’s Second Law: The Law of Equal Areas

Kepler’s Second Law: A planet sweeps out equal areas in equal times.
This means that the planet moves faster when it is closer to the sun and slower when farther away — conserving angular momentum. We can simulate this by letting the angle θ grow nonlinearly in time (just like we did in the spiral blog post). That’s how real orbits behave. ---

What Does This Teach Us?

  • Orbits in space are 3D ellipses — not perfect circles.
  • Kepler’s Laws are geometric, but they arise from physics and conservation laws.
  • Simple equations can model real planetary behavior when extended into 3D.
---

Try This Yourself:

  • Change the inclination angle to see how the orbit rotates.
  • Try different values of a and b to simulate comets (which have very stretched ellipses).
  • Add a second body (like a moon) orbiting the first body — simulate nested orbits!
--- If you're curious how gravity creates these orbits or want to add forces into the simulation — you’re getting ready to explore Newton's Laws and orbital mechanics. Let me know in the comments what you'd like to simulate next.

Comments

Popular posts from this blog

What is Mathematical Fluency?

Unlocking the Group: Cosets, Cayley’s Theorem, and Lagrange’s Theorem

Verifying the Binomial Formula with Mathematical Induction