Math of 'The Martian': How It Adds Up
Matt Damon plays stranded NASA astronaut Mark Watney in the movie "The Martian," which hit theaters in the United States on Oct. 2, 2015.
Credit: 20th Century Fox/The Martian

Computing orbital trajectories, shepherding chemical reactions and just plain counting potatoes: Surviving in the new movie "The Martian" is all about doing the math, which is what makes it feel real.

"The Martian," which came out in theaters Oct. 2, makes a point of plausibility, and the sci-fi survival novel it's based on is even more focused on the science. The movie glosses over many of the solutions vital to protagonist Mark Watney's continued existence, whereas the book explains them fully. In both cases, however, almost all of the solutions take calculation and detailed planning to get off the ground.

"The Martian" is all about math, because exploration is all about math — and spaceflight is the most extreme form of exploration humans have ever attempted. Do the math so you know the exact limits to push, and so you can recalculate to stay on course when you've gotten something wrong. [Learning from 'The Martian' – Matt Damon Talks Movies as Teaching Tools (Video)]

With rocketry, of course, this is very literal: If you're off by a tiny percentage of a degree, you're going to miss your target. When you're thrown into a problem, and don't have enough resources to get through it, you need to learn exactly what you do have — that way, you can figure out how to change the conditions so you can survive.

When NASA astronaut Mark Watney first finds himself alone on Mars with enough food for 50 days (for six people) but four years to go until the next crewed mission touches down, the first thing he does is start counting. (It's the first thing he does after making sure he gets inside to safety, anyway.) Watney tallies up the food he has and figures how much food he'll need to close the gap

I said before that exploration is all about math, but there's actually another element: You need to know what math to do, and that often requires creative leaps. Those leaps are often more interesting to storytellers, but you still need to do the calculations to make them work. (Some viewers' quarrel with the movie is that it skips straight to that more exciting aspect of particular key solutions.)

After finding out exactly how much food he lacks, Watney realizes that he will have to create his own. Luckily, some raw potatoes in the supplies, intended for the crew's Thanksgiving, can act as a stopgap measure. Then he gets to work planting, growing and counting again.

Without spoiling the events of the movie, there are many times when these calculations, or "doing the math" (and often that specific phrase), form a key part of a scene. "The Martian" is a good movie precisely because it stops to do the math. It feels like real exploration should feel, because if you're stuck, you don't pull out a piece of supertech you've had all along to survive. You count, you start thinking, you do the math, and you pull together a solution out of what you have. The leap of creativity only happens when it's earned by quick thinking and a careful reckoning of the circumstances.

A few of the most interesting math moments in "The Martian" are below. Warning: This discussion contains mild plot-based spoilers.

Watney's potato exploits hit a snag early on: He will need to create enough water to nurture the growing plants in the bone-dry Martian soil. (Yes, we now know there's ice and even liquid water on present-day Mars — that doesn't mean they're located where he happened to land.) For that, he uses some chemistry: He combines a precise ratio of hydrogen, drawn from rocket fuel, and oxygen to create the necessary water.

Spoiler Alert! Here's the complicated math problems Mark Watney has to solve, to survive in "The Martian."
Spoiler Alert! Here's the complicated math problems Mark Watney has to solve, to survive in "The Martian."
Credit: by Karl Tate, Infographics Artist

While the calculation works just as planned, Watney makes an explosive mistake. In the movie, he fails to take into account the oxygen in the gas he's breathing out. Everything appears to be going well, but the laws of nature soon assert themselves — in the form of a fireball.

Faulty data, or neglecting to account for outside factors, can lead to dangerous results, which is why Watney carefully tests the range on a modified rover before venturing out too far. He finds through a series of road trips that he can drive a certain distance, pause and let the rover recharge with solar panels he'd brought along, assuming he doesn't use the rover's heating systems. And finding the replacement for that heating is its own careful (and radioactive!) calculation. ['The Martian' Director Ridley Scott Promotes NASA's Mars Dreams (Video)]

Meanwhile, on NASA's end, researchers frantically "do the math" on how soon they can get a supply rocket to Watney. The calculation is intimately tied to time: not just the time to build and test a rocket, but also when best to send it. The changing positions of Earth and Mars mean that a supply rocket will take much longer to reach Mars than Watney's original journey did.

Most of the action in getting a supply rocket to Watney consists of just shaving time off the construction process through little changes and streamlining and negotiations, as well as cutting down on testing. Such measures wouldn't normally be shown in a movie, but they are a vital part of the scientific process, so their inclusion adds some realism to NASA's operations.

And of course, there's the Rich Purnell maneuver: the flashiest "do the math" moment in the movie, when a reclusive astrodynamics researcher discovers that the fastest way to get to Watney isn't in the class of previously recognized solutions at all. Rather, it's a complex calculation that relies on supercomputer simulation, but the basic premise is simple enough — and explaining how it will work is a great twist for the audience.

Near the end of the movie, Watney describes the process that astronauts follow: You solve a problem, and then you solve the next, and then you solve the next … and if you solve enough problems, you get to survive.

In a recent Q&A with Education Week, "The Martian" author Andy Weir discussed how his book was "basically a collection of word problems." While it started as a series of calculations for his own amusement and that of other "space dorks," the problem-driven book proved a hit on a much wider scale than he anticipated.

The movie captures that focus on problem solving and works it into a high-stakes blockbuster in which the demands of nature — and of mathematics itself — take center stage.

Email Sarah Lewin at slewin@space.com or follow her @SarahExplains. Follow us @Spacedotcom, Facebook and Google+. Original article on Space.com.