Skip to main content

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

The Tribe of Math Mentors: 11 Questions Every Educator Should Answer

It is easy to get caught up in the vague, existential questions of education: How do I become a better teacher? How do I make math engaging? How do I survive the burnout? But as author Tim Ferriss noted when writing his book Tribe of Mentors, "Life punishes the vague wish and rewards the specific ask." When Ferriss set out to deconstruct the habits of world-class performers, he didn’t ask them broad questions about "the secret to success." He engineered 11 highly specific questions designed to bypass rehearsed answers and force his subjects to share actionable, vulnerable, and unconventional insights. Recently, I started thinking about how perfectly this methodology translates to our world. What if we asked these exact types of questions to master math teachers? What if we used them to guide the next generation of educators? Here is my best thinking of what Ferriss’s Tribe of Mentors questionnaire looks like when translated into the context of the mathematics classr...

Beyond Taylor Series: The Magic and History of Padé Approximations

If you have ever taken a calculus class, you probably remember the Taylor series. It is the mathematical magic trick that lets you turn complicated functions—like sines, cosines, and exponentials—into simple, infinitely long polynomials. For centuries, it has been a cornerstone of numerical mathematics. But the Taylor series has a dark secret: it frequently breaks. If a function has a vertical asymptote (a pole) or if you move too far from your starting point, the Taylor series spirals out of control into infinity. It is strictly bounded by what mathematicians call a "radius of convergence." Enter the Padé approximation . Instead of using a single polynomial to estimate a function, a Padé approximant uses a fraction (a ratio of two polynomials). This simple structural change unlocks a profound level of mathematical power, allowing us to see past the limits of Taylor series and model complex, chaotic systems in modern physics and engineering. A Brief History: From Franc...

Unlocking the Matrix: A Guide to Solving Systems of 3 Equations

    If you have ever felt like algebra is just moving letters around a page until a number falls out, solving systems of equations in three variables might seem like the ultimate boss battle. Instead of just dealing with x and y on a flat piece of paper, a third variable (like z, or in our case r, s, and t) brings the math into three-dimensional space. Every equation represents a flat plane, and solving the system means finding the exact 3D coordinate where all three planes intersect. But before we dive into a full 3x3 system, let's talk about what happens when the number of equations doesn't perfectly match the number of variables. The Goldilocks Problem: Too Many or Not Enough Equations? For a system to have a single, beautifully neat solution, you generally need exactly as many equations as you have variables. But what if the balance is off? Not Enough Equations (Underdetermined Systems): Let's say you have 3 variables but only 2 equations. This is like having two plane...