Learning Quantum Mechanics the Easy Way
I wrote a browser game called Quantum Marble Maze, and this post is about it. If you haven’t played the game, you might want to do so before reading further. Or you might like to read this first: up to you.
It all started with an unfortunate injury. Sliding down a chute of glacial meltwater in a canyon in the French Alps, I misjudged the depth of a plunge pool and sprained my ankle. Sitting around inactive for the rest of this trip gave me the opportunity to read Feynman’s textbooks. I’m a computer scientist turned transport modeller by trade, but have a love of physics, and always aspired to learn more about the quantum world.
The Feynman Lectures didn’t quite make sense at first, so I had to read it again, several times. For a textbook on Quantum Mechanics it was quite apt, I suppose, that my interpretation flipped between multiple states before finally settling into a stationary one. Even so, I still couldn’t quite see how all the components of QM fit together. Where does Plank’s equation come from (linking momentum to frequency), is it axiomatic or derived? If the Schrodinger equation is wavelike, then why do the waves I see on water not move around in localized packets, like particles?
While most people struggle with maths, most humans — and animals too — are pretty good at getting an intuition for things we can see, move and interact with. This means that computer games can be pretty useful tools for learning. I’m not the first person to say this, indeed the MIT Game Lab recently tried to teach the world Einsteinean relativity through their game A Slower Speed of Light. Though I applaud this effort, it saddens me that you don’t need to get to grips with relativistic effects to play that game: it plays like a simple collection task with some trippy effects. Still, their code is open source so maybe somebody can fix that
I’m a bigger fan of Velocity Raptor, by Andy of Test Tube Games, which benefits from a simpler two-dimensional world in which you really have to use time dilation to win!
You can see how all these ideas came together. Could I complete my understanding of QM by making a game about it? The answer turned out to be yes, to some extent. Quantum Marble Maze may not be the world’s most playable game, but it was the first environment in which QM really began to make sense to me.
The rest of this article talks about the quantum effects you can see in Quantum Marble Maze, and some final thoughts on how you could take the game further, and use it in teaching. I’ve managed to avoid using any maths, so I hope the article appeals to specialists and non specialists alike. Perhaps the fact I can discuss QM in depth without any equations is testament to how useful computer games can be?
Please, gods of Physics, let me not be completely wrong! I’ll be pleased to publish corrections if anyone more knowledgeable spots errors.
What is a wavefunction?
A quick interlude for the quantum novice: quantum particles never have a definite state (for the sake of our game, a position and momentum) until you measure them. What you see when you measure a quantum particle is determined by the evolution of its wavefunction, a wave which describes all the things that could possibly happen when you measure it. The strength of the wavefunction — its amplitude — is related to how likely the particle is to be in any particular place.
You can’t measure a wavefunction directly; all you can do is measure where a particle is. If you repeat the same experiment lots of times, you can get a sense for what the wavefunction looks like. So when — in the game — you see wavefunctions flowing over your patio, table and baking tray, that’s sort of artistic license. What the wavefunction would look like is in principle knowable — you could conceive of an experiment to work it out, but it would involve recording your keypresses playing the game and getting a computer to replay them over and over again to see how the measurements work out on average.
As well as amplitude, wavefunctions also have a phase. Sometimes in the game I show you this as well, but that’s definitely artistic license. The phase doesn’t affect the likelihood of finding a particle in any given place, so we have no way of measuring it. The relative phase of one part of the wavefunction compared to another part can cause interesting things to happen, but the absolute phase is not knowable; so much so that you could argue it doesn’t exist at all. (The independence of quantum systems from absolute phase arises from something called gauge symmetry).
It’s wavelike, but not watery
But wait, you say. These wavefunctions do lots of interesting things — for one thing they can act like particles, which you can steer from place to place, at least for a short time. I’ve seen waves before, on the sea for example, and they don’t behave like that. (Or do they?!).
The difference between the Schrodinger equation, and the equations that describe “ordinary” waves in water, is that it’s complex valued. It’s as if a water wave could have an imaginary height as well as a real one. This property makes much more interesting wave shapes possible, for example, waves that keep going up and down in a small patch of water without disturbing the rest of the sea. Those are the ones that look like particles.
Well, almost: ultimately all patterns of waves will spread out until they cover the whole sea. Some waves spread out faster than others, with Gaussian waves — shaped like the famous bell curve — spreading out least. In general, the smaller the wave, the faster it spreads out. This is the uncertainty principle.
Uncertainty
Until I made Quantum Marble Maze (which I’m going to call QMM from now on) I was pretty confused about the uncertainty principle. The way it’s usually taught, without resorting to maths, is to say something like this:
“A particle can have either definite momentum or definite position, but not both. The more you know about one, the less you know about the other.”
This can lead to a bit of confusion, because a lot of people take that to mean that a particle does have definite position and momentum (I mean, all things do, right?!) but you’re sadly not able to find out what it is. Maybe because trying to measure one changes the other — intuitively that makes sense, right?
But this is quantum mechanics (QM), and it doesn’t work like that. In other words, the intuition is wrong, and a particle really cannot have both definite position and momentum, regardless of whether or not you measured it.
Let’s not think about particles, let’s think about their wavefunctions, which in a sense are more real than the particles themselves. The way a wavefunction evolves is a definite, predictable thing; when you measure the particle you may as well roll a die because it could be anywhere, but it was the wavefunction that loaded the die, and somehow seems to be in control of the outcome.
A small wavefunction has all its amplitude (strength) grouped into a small space, and if you measured it, you would find the particle somewhere in that small space. So the particle’s position is fairly well known.
But as I said above, the small wavefunction spreads out fast, so what does that mean for the particle? In the game you see an expanding blob of space that represents where the particle could be. What the expansion in all directions tells you is that momentum is indefinite — it could be going in any of those directions right now, and you don’t know which. Or as I prefer to see it, the wavefunction is spreading in all of those directions but when you measure it, you don’t know which you’re going to get. That’s not because you’re limited in what you can measure, it’s because the wavefunction actually went in all of those directions at once.
(Or so goes the most commonly accepted interpretation of QM. Supporters of hidden variable interpretations may disagree, and may even be right, but as yet there is no experimental evidence either to support or refute their viewpoint. This could easily change in our lifetime — if quantum computers turn out not to work, for example, or work better than expected — but still, all interpretations of QM agree about the wavefunction).
Frequency is momentum. Wait, what?
Until I made QMM I had also never heard a satisfying explanation for why frequency and momentum are the same thing. This is called Planck’s relation. Sure, you can demonstrate classically that higher frequency waves carry more energy, but does that really mean a particle changes frequency if you change its momentum — in other words if you push it?
In QMM you steer particles by applying potential fields; it’s as if you’re tilting a table one way or the other so a marble rolls around. As you do so, you can see the effect of applying a force. First the wavefunction starts to wobble — so it does change frequency — and then it starts moving perpendicular to the wobbles. (A good tip for the game is that you can steer particles more precisely by looking which way their internal waves are pointing).
So yes, in a wavefunction, frequency is momentum is frequency. Mathematically, this result just falls out of the Schrodinger equation.
Falling down a hole
What happens when a particle falls down a hole (or as physicists are fond of calling it, a potential well)? The counterintuitive thing is that, unlike everyday objects, it doesn’t stay there. This is because the subatomic world doesn’t have friction so during its fall, the particle has picked up enough speed to bounce right back out again.
Suppose the particle does lose some energy while it’s down there, though. (It might emit a photon, for example, or in QMM you could slow it down with a potential field). Then it will start to resonate, forming pretty shapes to match the hole it’s in. This is where electron energy levels come from — the “quantum” part of quantum mechanics.
Interestingly, the Schrodinger equation allows a particle to go to places with more potential than the particle has energy. Classically this would not be possible at all, but in the quantum world it just has very low probability — tailing off exponentially beyond the point where it would have stopped classically — with an accompanying high probability that the particle will get back down any available holes to satisfy conservation of energy. This behaviour is what gives rise to tunneling, when a particle jumps as if by magic from one hole to another. You can see that in QMM. You can also see diffraction, in which the wavefunction spreads out after going through a narrow slit.
Decoherence
I said earlier that a wavefunction tells you how likely a particle is to be in a given place when you measure it. I deliberately wasn’t specific about what I meant by measure. Some think measurement has something to do with consciousness — if true this would be very interesting indeed, as it would give insight into one of the biggest mysteries we know.
The textbook definition of measurement is the thing that happens when a quantum system interacts with a non-quantum one. That definition works well enough for practical use in the lab, though begs the question of what separates a quantum from a non-quantum system. Until that question is answered, then we can’t rule out the possibility that consciousness does have something to do with it.
As I understand it, the modern answer to what makes quantum systems stop being quantum is decoherence. This is a phenomenon that happens when multiple particles lose entanglement, but we see something that looks a bit like it with the single particle in the QMM game. It happens when you fail to complete a level because the wavefunction gets so messy bouncing off walls and other obstacles. When this happens, notice how the wave loses all its interesting quantum properties and starts behaving like the sum total of lots of classical particles.
Decoherence doesn’t explain, though, why the wavefunction eventually collapses to a singular thing we call “reality”. So quantum mysticism still has room to flourish.
The curse of dimensionality
At the end of this article and game, it’s humbling to reflect that so much physics, and so much computation, is needed to describe the behaviour of a single particle.
One. Particle.
Could we bring more particles into the game, I wonder?
It won’t be easy. The first problem is how to visualise what they’re doing. With one particle that was fine; we just coloured in the screen brighter the more likely the particle was to be there. Can’t we just do that, but use more colours — perhaps with two particles, one red and one green?
Not if the particles are going to interact, we can’t (and it wouldn’t be very interesting if they didn’t). The trouble is, the position of one particle would depend on the position of the other. If the red is here, the green could be here, here or here — in fact it could be at any point on the screen; we need a whole wavefunction to describe it. But if the red is in a different place, we need a whole other wavefunction to describe the green, and so on for every point on the screen where the red could be. With two particles, we’re already trying to draw a four-dimensional space on a two-dimensional screen; with three particles, it would be six dimensions. And never mind the drawing — we actually have to compute all those wavefunctions first — and every extra particle multiplies the amount of computation by the number of pixels on the screen.
There are some ways we could visualise this, though they aren’t easy to implement. There are quite a few ways we could speed up the computation as well. That’s a topic for another day, but a worthwhile one, as faster computation would also allow some more complex level designs, perhaps even resembling the titular marble maze (if you completed the game you’ll notice that no level was really complex enough to be called a maze). You could also massively simplify particle interactions to make some reasonable gameplay; perhaps even simulate a small quantum computer. Do get in touch with me if you want to do this; I’d be keen to help.
On the challenge of learning quantum mechanics
If it’s not clear from the above, I reckon that personally I’d have found quantum mechanics less confusing, and more satisfying, to learn in this order:
- Play computer games such as QMM to gain an intuition for how quantum systems work.
- Learn about the time dependent Schrodinger equation for a single particle in a potential — essentially describing how the QMM game works internally.
- Learn how all the properties we associate with single particle quantum systems derive (mathematically) from the above.
- Learn state notation (bra, ket, Hamiltonians) initially as a way of simplifying the Schrodinger equation, and computing outcomes for a single particle without computing the whole wavefunction through space.
- Learn that state notation generalizes to particles with spin, and multiple particles.
- Learn multi particle concepts: bosons, fermions etc, using state notation, but occasionally relating this back to what it would mean under stage (2).
That way, I’d have (1) understood the answer to the classical puzzle of particle-wave duality before having to learn counterintuitive state notation, (2) gained an intuition for what state notation represents underneath by the time I started learning it.
I enjoyed reading Feynman’s book, and appreciate that his students didn’t all have high spec laptops back then. But to my mind the book runs backwards, starting with multiple particles and state notation before Schrodinger. While this might be truer to the history of science, it does seem to me that it’s a confusing way to introduce the topic. I found myself baffled trying to understand the connection between state notation, continuous wavefunctions, uncertainty and Planck’s relation.
But this suggestion is entirely based on my own experience, and my own training, which is biased towards thinking about computation, complex systems, and how to simplify them. Having chatted to a couple of physics profs, they disagree on what the hard parts of QM are, and tell me most modern courses take Feynman’s approach. Fair enough. Having never taught QM to another person I can’t guarantee my way would work for anyone else, but we’re all different, so I hope offering an alternative take on the subject is of use to somebody.
Footnote: System states
Feynman dedicates a lot of his book to two state systems. I found this hard to understand, until I realised the following things:
- Base states are arbitrary things*, like a trap or a goal in QMM, but you can still ask what the chances are of a particle being in one of them.
- Stationary states are more like wavefunctions in QMM that stay in a stable condition. Their phase may go on changing, but the amplitude doesn’t. The particle, if measured, could still be anywhere, but the likelihood of finding it in any particular place stays the same over time.
- Systems are like a level in the QMM game. They are configurations of the world that can support a variety of states, some of which may be stationary.
- Feynman’s two state systems are systems with only two possible stationary states. Within any stationary state, the amplitude for finding a particle in each base state stays the same, but the phase of the wavefunction differs in each.
- Stationary states always form a basis, that is to say, any system can be described as a superposition of its stationary states. As stationary states do not change in amplitude over time, this means the time evolution of the system can be expressed as base states going in/out of phase with each other, which is a nice simplification. This generalizes to all systems, not just two state ones.
* arbitrary, but chosen to cover all possibilities without redundancy.
Thanks are owed to many people for their comments on the physics here, including the Hacker News community and Steuard Jensen. They didn’t sign off the final post, though, and may well disagree with my interpretation on some of the more contentious points, so any mistakes remain entirely my own.