
Orbital mechanics, software engineering, and the computer that saved Apollo 11.
Three Minutes to Landing
On July 20, 1969, at 4:06 PM Eastern Time, the Apollo 11 Lunar Module — call sign Eagle — was three minutes from the surface of the Moon. Astronauts Neil Armstrong and Buzz Aldrin were inside. Michael Collins orbited above in the Command Module, alone.
And then the computer started screaming.
The Apollo Guidance Computer — a machine with 74 kilobytes of memory and a processor that ran at 0.043 megahertz (your smartphone is about 100,000 times more powerful) — flashed a 1202 alarm. Then a 1201 alarm. The numbers meant the same thing: executive overflow. The computer had more tasks than it could handle.
In Mission Control in Houston, a 26-year-old engineer named Steve Bales had fifteen seconds to make a call. Abort the landing and fly back to orbit — safe but a failure? Or continue the descent and trust the computer?
Bales knew something about that computer. He knew that its software had been designed by a team led by Margaret Hamilton, a 33-year-old mathematician at the MIT Instrumentation Laboratory. And he knew that Hamilton had built the software with a feature that was revolutionary for 1969: priority scheduling.
The computer wasn't crashing. It was triaging. When the 1202 alarm fired, the software automatically dropped its lowest-priority tasks — rendezvous radar calculations that weren't needed during landing — and kept running the highest-priority ones: navigation, throttle control, and altitude measurement. The computer was telling the crew: I'm overloaded, but I'm handling it.
"We're GO on that alarm," Bales said.
The descent continued.
Getting There
The journey from Earth to Moon took three days. But the trajectory was not a straight line — it was a precisely calculated curve called a Hohmann transfer orbit.
A Hohmann transfer is the most fuel-efficient way to move between two orbits. Instead of pointing your rocket at the Moon and firing (which would require an enormous amount of fuel), you fire your engine briefly to enter an elliptical orbit whose far point just touches the Moon's orbit. You coast for three days, using no fuel at all. When you arrive at the Moon, you fire again briefly to slow down and enter lunar orbit.
The mathematics was worked out by Walter Hohmann in 1925 — decades before spaceflight was possible. The key equation is the Tsiolkovsky rocket equation:
Δv = ve × ln(m0 / mf)
Where Δv is the change in velocity you need, ve is the exhaust velocity of your rocket engine, m0 is your initial mass (with fuel), and mf is your final mass (without fuel). This equation explains why rockets are mostly fuel: the Saturn V rocket that launched Apollo 11 weighed 2,970 tonnes at liftoff. The spacecraft that reached the Moon weighed 45 tonnes. More than 98% of the launch weight was fuel.
The Computer
The Apollo Guidance Computer (AGC) was the first computer designed for a real-time, life-critical mission. It had to navigate, control the spacecraft's attitude, manage the engine burns, and display information to the crew — all simultaneously, with less computing power than a modern calculator.
Margaret Hamilton's team wrote the software in assembly language — the lowest-level programming language, where every instruction corresponds to a single operation of the processor. The entire program was 145,000 lines of code, hand-woven into rope memory — a physical memory system where copper wires were threaded through or around magnetic cores. A wire through a core was a 1; a wire around it was a 0. Once woven, the memory couldn't be changed.
The priority scheduling system that saved the landing worked like this: every task in the computer was assigned a priority level. When the processor was overloaded, it would interrupt the lowest-priority task, save its state, and run the highest-priority task instead. When the high-priority task finished, it would resume the interrupted task where it left off.
This technique — now called preemptive multitasking — is the foundation of every modern operating system. Every time your phone runs multiple apps simultaneously, it's using the same principle that Margaret Hamilton invented for Apollo.
The Landing
At 4:14 PM, with 25 seconds of fuel remaining, Neil Armstrong saw that the computer was guiding them toward a boulder field. He took manual control, flew the Lunar Module sideways — burning precious fuel — and set it down in a clear area.
"Houston, Tranquility Base here. The Eagle has landed."
In Mission Control, Charlie Duke replied: "Roger, Tranquility, we copy you on the ground. You got a bunch of guys about to turn blue. We're breathing again."
Six hours later, Armstrong climbed down the ladder, placed his left foot on the lunar surface, and said the most famous sentence in the history of exploration.
Four hundred thousand engineers had made this moment possible. Rocket scientists who calculated trajectories. Metallurgists who forged the heat shield. Seamstresses who sewed spacesuits by hand. And a team of software engineers, led by a woman who invented a new way to write code, whose program worked exactly as designed at the most critical moment in the history of computing.
The Numbers
The Apollo program, from 1961 to 1972, cost $25.4 billion (about $200 billion in today's money). It employed 400,000 people. It produced twelve astronauts who walked on the Moon and brought back 382 kilograms of lunar rock and soil.
But its greatest legacy wasn't on the Moon. It was on Earth. The integrated circuit, the fuel cell, freeze-dried food, water purification systems, fireproof materials, and the concept of software engineering itself — all either invented for or advanced by the Apollo program.
Margaret Hamilton later coined the term "software engineering" — arguing that writing code for critical systems deserved the same rigor and respect as any other branch of engineering. The term stuck. Today, software engineering is one of the largest professions on Earth. It began with 145,000 lines of hand-woven code, a 1202 alarm, and a 26-year-old engineer who said "GO."
The end.
Choose your level. Everyone starts with the story — the code gets deeper as you go.
Here is a taste of what Level 1 looks like for this lesson:
import numpy as np
import matplotlib.pyplot as plt
# Your first data analysis with Python
data = [45, 52, 38, 67, 41, 55, 48] # measurements
mean = np.mean(data)
plt.bar(range(len(data)), data)
plt.axhline(mean, color='red', linestyle='--', label=f'Mean: {mean:.1f}')
plt.xlabel("Sample")
plt.ylabel("Value")
plt.title("Orbital Mechanics & Software Engineering — Sample Data")
plt.legend()
plt.show()This is just the first of 6 coding exercises in Level 1. By Level 4, you will build: Build an Orbital Transfer Calculator.
Free
Level 0: Listener
Stories, science concepts, diagrams, quizzes. No coding.
You are here
Level 0 is always free. Coding levels (1-4) are part of our 12-Month Curriculum.
How to get to the Moon — transfer orbits, the rocket equation, and the software that saved the landing.
The big idea: "The Moon Landing" teaches us about Orbital Mechanics & Software Engineering — and you don't need to write a single line of code to understand it.
If you want to drive to a friend's house, you point your car in their direction and go. Simple. But space doesn't work that way.
The Moon is 384,000 km away and moving at 3,680 km/h in its orbit around Earth. If you pointed your rocket at where the Moon is now and fired, by the time you arrived three days later, the Moon would have moved 265,000 km from where it was when you launched. You'd arrive at empty space.
Instead, you have to aim at where the Moon will be three days from now — like throwing a ball to where the running receiver will be, not where they are when you throw. This is called a Hohmann transfer orbit, and it's the most fuel-efficient path between two orbits.
The trick is elegant: you fire your engine briefly to enter an elliptical orbit — a stretched oval — whose far point (apogee) just touches the Moon's orbit. Then you shut down the engine and coast for three days, using no fuel at all. Gravity does the rest. When you arrive at the Moon, you fire again briefly to slow down and enter lunar orbit.
Check yourself: Why is it more fuel-efficient to coast on an elliptical path than to fly in a straight line? (Hint: a straight-line path would require your engine to fight Earth's gravity the entire way.)
Key idea: You can't fly straight to the Moon — it's a moving target 384,000 km away. A Hohmann transfer orbit uses a brief engine burn to enter an elliptical path that intersects the Moon's orbit three days later. Most of the journey is coasting — no fuel needed.
The Saturn V rocket that launched Apollo 11 weighed 2,970 tonnes at liftoff. The spacecraft that actually reached the Moon weighed 45 tonnes. That means 98.5% of the launch weight was fuel that was burned and discarded along the way. Why so much fuel?
The answer is the Tsiolkovsky rocket equation, derived by Russian scientist Konstantin Tsiolkovsky in 1903. It says: to change your speed by a certain amount (called delta-v), you need fuel mass that increases exponentially with the desired speed change.
Here's the intuition: a rocket works by throwing mass backward (exhaust) to push itself forward (Newton's third law — every action has an equal and opposite reaction). But the fuel you carry to accelerate later has to be accelerated now, along with the rocket. So the more fuel you need for later, the more fuel you need for now to carry that future fuel. It's a vicious cycle.
Going to the Moon requires a total delta-v of about 16 km/s (multiple burns for Earth departure, lunar orbit insertion, descent, ascent, and return). With the best chemical rocket engines of the 1960s (exhaust velocity ~4.4 km/s), the rocket equation demands a fuel-to-payload ratio of about 40:1. Hence the massive Saturn V.
Think about it: A car doesn't have this problem. Why? Because a car pushes against the road (friction), not against its own exhaust. It doesn't need to carry its "reaction mass." This is why space travel is fundamentally harder than any form of travel on Earth.
Key idea: The rocket equation explains why rockets are 98% fuel: to accelerate later, you must carry fuel now, and that extra fuel must itself be accelerated. The fuel requirement grows exponentially with the desired speed change. This is the fundamental constraint of space travel.
Access all 130+ lessons, quizzes, interactive tools, and offline activities
Imagine you're juggling five tasks: cooking dinner, answering the phone, helping your child with homework, feeding the dog, and watching a pot that mi...
All the orbital mechanics and software engineering came down to a single human moment. At 4:14 PM on July 20, 1969, Neil Armstrong looked out the wind...