This is a pendulum: a stick with a weight on the end. I'm going to tell you about a cool technique that lets you predict where a pendulum will swing.
As you can see, as it moves, the angle the pendulum makes with the horizontal plane changes.
If I take a pendulum at this angle and let this pendulum go, how do you think it'll move?
Trick question! I never told you if the pendulum was moving. Depending on the pendulum's momentum, it could swing with a longer interval, or even pass over the top in a circle forever. You can't tell where a pendulum will go from just its angle.
In other words, if we want to predict where a pendulum will swing, we need two numbers: its angle, and its momentum.
OK - we know we need both a pendulum's angle and momentum. Let's use a time-honored mathematical technique: generalizing. Instead of figuring out what'll happen with these particular numbers, sometimes in math it's easier to solve for every value at the same time, then pick out the solution for your specific measurements once you're done. In this case, every pendulum is described by two numbers: angle and momentum. How about we graph them?
Let's make the x coordinate represent the angle of the pendulum.
And let's graph the y coordinate to match the pendulum's momentum.
Now let's graph both numbers at the same time as the pendulum moves. If we let the pendulum go, we get something interesting: on this new graph, the pendulum's measurements trace out an ellipse! But why?
It took a mathematician named William Rowan Hamilton to figure out a cool way of showing why. Remember from physics how energy can't be created or destroyed? There are two types of energy in this pendulum: kinetic energy, which we can calculate from the pendulum's momentum, and potential energy, which we can calculate from the pendulum's height - and we can calculate the pendulum's height from its angle.
So we've got a third dimension. For each point on this graph, with X coordinate a certain angle and Y coordinate a certain momentum, let's calculate the total energy the pendulum has and graph that as the Z axis of every point on this surface. (It seems to repeat because an x-coordinate 5° and 365° represent the same angle)
But more importantly: energy is neither created or destroyed. If we look at all the points with the same energy as what we started with, our ellipse appears! Our path in phase space is actually a slice of this weird "energy surface": the slice consisting of all points with the same energy as what we started with. That's the power of "hamiltonian mechanics": it's weaponised conservation of energy!
With this energy surface, now we can see we can see what happens if we give the pendulum too much extra momentum, and therefore more energy:
With this much energy, the slice gets high enough that the path the pendulum takes stops being an ellipse and instead becomes an infinitely long line. And that tells us that angle will get bigger and bigger, and this corresponds to the over-the-top pendulum motion we saw earlier!
This green "energy graph" you're looking at right now is called "phase space", and it's a very useful idea. Phase space lets us study every possible state a system like this pendulum can be in at once - and even better, it lets us take knowledge about surfaces (and higher-dimensional spaces) and apply them to problems like this pendulum.
You might wonder: why did we choose angle and momentum as our two numbers to measure? Why not, for example height and velocity?
It turns out that Hamiltonian mechanics still gives you the right answer. If you change your x-axis to measure height instead of angle, the slicing strategy of hamiltonian mechanics still gives you the path the pendulum follows in phase space. Somehow we're capturing some property of the underlying space, which isn't affected by the way we choose our coordinate system.
Mathematicians use the idea of "manifolds" to study smooth spaces like this one. Phase space shows you why they're so useful: you can transform them in weird ways, but some properties - such as the path a pendulum traces - stay the same, no matter the coordinates you choose to measure with.