TrendPulse Logo

NASA’s Apollo moon missions relied on this computer scientist and differential equations

Source: Scientific AmericanView Original
scienceMay 12, 2026

May 12, 2026

6 min read

Add Us On GoogleAdd SciAm

NASA’s Apollo moon missions relied on this computer scientist and differential equations

Margaret Hamilton designed safety features for NASA inspired in part by her four-year-old

By Manon Bischoff edited by Daisy Yuhas

Margaret Hamilton (above) saved the first moon landing.

NASA Image Collection/Alamy

Love math? Sign up for our weekly newsletter Proof PositiveEnter your email

I agree my information will be processed in accordance with the Scientific American and Springer Nature Limited Privacy Policy. We leverage third party services to both verify and deliver email. By providing your email address, you also consent to having the email address shared with third parties for those purposes.

Sign Up

It’s July 20, 1969. Neil Armstrong and Buzz Aldrin are about to land on the moon. They will be the first humans to set foot on Earth’s only natural satellite. Suddenly, the onboard computer flashes: “Alarm 1202.” Over the next 278 seconds, four more alarms trigger: “Alarm 1202,” “Alarm 1201,” “Alarm 1202,” “Alarm 1202.”

The system is overloaded. Aldrin and Armstrong are instructed by the NASA crew on the ground to proceed with the landing. But the NASA team members know that their colleagues have done a good job and programmed in a safety net. And thanks to the error messages, they know how to address the problem.

Computer scientist Margaret Hamilton was one of the people responsible for the features that ultimately made the moon landing possible, despite those error messages. And her then four-year-old daughter may have helped spur her thoughts.

On supporting science journalism

If you're enjoying this article, consider supporting our award-winning journalism by subscribing. By purchasing a subscription you are helping to ensure the future of impactful stories about the discoveries and ideas shaping our world today.

How to Describe the World with a Computer

The computer onboard Apollo 11’s lunar module had about a mere 74 kilobytes of storage in the form of read-only memory (ROM). To put that in perspective, today’s smartphones easily have 128 gigabytes of ROM storage, which is about two million times more—all so we can kill time on Instagram and TikTok.

Programming was also completely different in the 1960s. Common programming languages such as Python or Rust, which contain roughly understandable plaintext commands for arithmetic operations, didn’t exist back then. Computers of that era looked completely different from the compact devices we use today, too.

When Hamilton began working with computers, she had to make entirely different considerations than today’s programmers: Which register stores which number? How must the contents of the registers interact to add and multiply two numbers? Which memory space do I allocate for these registers, and which do I block off?

The lunar module’s onboard computer had to determine the speed, altitude and rotation of the module—which are all variable quantities. In principle, the onboard computer solved differential equations, which depend not only on variables such as x and y but also on their derivatives.

Such equations describe everything that changes. But there is no universally applicable method for solving these differential equations. Many don’t even have an exact solution. Therefore, we have to rely on approximation methods.

To understand how these methods work, consider the following example problem: suppose a spaceship is moving with constant acceleration, a, and you want to find out the distance it travels in a certain time, t. You know both the initial position, x0, and the initial velocity of the spaceship, v0. To solve the problem exactly, you have to solve the following differential equations:

You can find the solution directly for these problems. But if that’s not possible, you could work out the solution via step-by-step increments in position and velocity:

xn + 1 = xn + vnΔt,

vn + 1 = vn + aΔt

To evaluate these equations for a small time step (such as Δt = 1 second), first calculate x1 = x0 + v0 × 1s and v1 = v0 + a × 1s. You can then substitute the respective results of x1 and v1back into the equations to obtain x2 and v2 and obtain subsequent results in the same way. You can then work through the process like this until you find the distance the spaceship has traveled after a certain time, t.

Such recursive systems of equations are still part of fundamental research today, albeit in a significantly more complex form. Regardless of whether one studies cosmology, particle physics, medicine or chemical processes, one is always dealing with variable systems and thus with differential equations. And to solve these, you generally employ a set of recursive equations that a computer can evaluate.

In Hamilton’s time, c