I don’t know where to start with the plot of the movie Captain Marvel. Let me just get to the important stuff with minimal spoilers. Carol Danvers is a superhero (Captain Marvel) and she knows the coordinates of the secret Mar-Vell lab. When some other people finally get these coordinate numbers, they figure it out. They don’t give the location of the lab, they give the state vectors for the lab.

So, what the heck are state vectors? In physics, we like to describe systems. If that system was a ball, one obvious way would be to say exactly where the ball is located. It would have some position value in the same way that your phone has a GPS location. But there are other ways to describe everything there is to know about the ball (we call this the state). Yes, like a state vector. Also, if you know the state vector for a hidden lab in space could you find it? Don’t worry, I’m going to explain all of this.

Here is a fairly straightforward situation. It’s a mass connected to a spring such that it oscillates back and forth. Here is what this looks like. (Yes, you can make an animation like this in GlowScript Python—here’s the code.)

Video: Rhett Allain

How can you represent the motion of this oscillating mass if you don’t want to use an animation? Since it’s in one dimension, it’s possible to make a plot of the x position as a function of time. That would look like this.

Illustration: Rhett Allain

That’s your traditional graph. But how about a different plot? What if I make a plot of the x position versus the x velocity? What would that look like? Well, it’s actually pretty simple to change our plot for this oscillating mass. You could call this a state space plot. A state space is basically the coordinate axis for state vectors. Just for comparison, here is both a position-time plot and a state space plot.

Video: Rhett Allain

In some sense, the position-time plot seems more intuitive. You can see that as time moves on, the position of the mass changes to produce something that looks like a sine function (it’s basically a sine function). However, the state space plot tells us quite a bit too. It shows that the mass essentially makes an “orbit” in state space (not a real orbit).

For a simple case like an oscillating mass, the state space plot doesn’t really give you anything you couldn’t get from the position-time plot. But what if it’s not simple? What if it’s a more complicated system. The following are plots for a damped, driven oscillator. That means there is some type of drag force to slow it down, but there is also something pushing it (imaging that the one end of the spring is attached to something that’s vibrating).

Video: Rhett Allain

The classic position-time plot keeps going on forever. It’s difficult to see trends in patterns in the oscillation motion. On the other hand, in the state space plot, the max velocity and position are finite such that the data stays contained—yes, like some type of orbit.

OK, everything’s not perfect with a state space plot. Imagine you want to plot the motion of a hidden lab orbiting around the Earth. What would this look like? Honestly, it wouldn’t be so easy. In the oscillating spring example, it’s in one dimension. This means there is only one value for the position (the x value) and one value for the velocity (the x velocity). But real life is in 3D. The real position would be a 3D vector (with three values—x, y, and z). Also, the velocity would be a 3D vector with components in the x, y and z directions. That’s six values. You would need six coordinates to fully plot the state space for an orbiting object. Good luck trying to draw a 6D object.