Quantum Computing, Zero to Hero: Part One — The Physics

A guide to get you from foundation maths and physics, to writing a quantum algorithm and understanding everything between.

Quantum physics isn’t really a difficult subject to understand, despite many famous quotes from people like Feynman:

“If you think you understand quantum mechanics, you don’t understand quantum mechanics.”

The real issue is that it is counter-intuitive; parts of the quantum world don’t act as your gut tells you they should. If you can suspend this disbelief, quantum physics is nothing but a set of rules to learn and follow.

I will do my best to explain, without long proofs, the concepts you need to understand quantum computing. If you want to dig a little deeper I will be adding [Extra Reading] tags like this.

Superposition

Superposition is what we talk about when we say something quantum can be “many things at the same time”.

Intuition: An attribute of something is a known quantity; a bar of steel is either 1kg, or 10kg, whether it is on a scale being weighed, sitting on the ground, or being carried by a weightlifter. It was always 1kg, or 10kg, and until a physical process changes it, it always be either 1kg or 10kg.

Quantum world: A quantum system exists in a superposition of states; the system is in all of its possible states at the same time, but each state has a probability amplitude (a chance) that tells you how likely you are to observe the system in that particular state when you measure it.

Let’s imagine a quantum particle. Our particle has a state that could be represented by a letter: A, B, or C. It could be in a superposition of being A, B and C all at the same time. Let’s say with a 25% chance of being A, 50% of B, and 25% of C.

Then we would measure it. Let’s imagine we have have a machine which goes “Fizz” if you put a particle in state A into it, “Buzz” for a particle in state B, and “Bang” for a particle in state C. The machine needs to find out if the particle is in state A, B or C to know what sound to make. This is “measuring” it, and once we have measured it we say the “superposition has collapsed”. The particle has made its choice, maybe an A in this case, and the machine goes “Fizz”.

A couple of important notes

There is no hidden variable inside the particle that it only lets us see when we measure it. It’s not that we had a 25% chance of putting an A particle into the machine; the particle itself never decided if it was A, B or C until the moment we asked it.

[Extra Reading — Bell’s Theorem ]

It’s worth noting that the particle is in multiple definite states at once, not in between them. Let’s say it the particle is a number, 1 or 0. If it is in a superposition of being both, then it is 1 and 0 at the same time, not half way between them: it is not “0.5”. When we finally measure it, it will only then become 1 or 0.

Spin

What is spin? We don’t know, and like many things we don’t understand we just popped a label on it to make ourselves feel better. The best definition I can give you is: “Something that makes quantum particles pretend they are magnets.” There are better definitions out there, but for the sake of quantum computing this will do.

The concept of spin comes from the Stern-Gerlach experiment. Particles (in the original experiment, silver particles with the chemical symbol Ag) are shot through a magnetic field onto a screen. The magnetic field is spatially varying, meaning the pull on the particles is not even. Otherwise we would expect the North/South pulls to cancel each other out.

Intuition:

In the classical world, if these particles were magnetic, they would have their North and South poles aligned randomly, pointing up, down, or somewhere in between. By using a changing magnetic field, particles are pulled gradually upwards or gradually downwards depending on how their magnetic poles are aligned. If everything is behaving like classical magnets, this would form a vertical line on the screen, because we would expect:

Particles with the “north side” up to go all the way up.

Particles with the “south side” up to go all the way down.

Particles on their side to go straight, because they don’t get pulled at all.

Particles at an angle to go slightly up or slightly down, based on the angle and how much they get pulled.

Quantum world: Nope. They all go either all the way up, or all the way down, forming two dots on the screen instead of a vertical line. One fancy way of saying this of course is that it is quantised (A or B). There is not a classical spectrum of values like letters, where a letter has to be A or B, it can’t be halfway in between.

It’s back to that pesky superposition again: particles are never “on their side,” they are in a superposition of being both up and down. “On their side” just means there was a 50/50 chance of being “north side” up or “south side” up, not having yet made a choice, but then we measured them with the Stern-Gerlach experiment and they made a choice of up or down. So the particles always go either all the way up, or all the way down.

If you were to rotate the apparatus 90 degrees so they were pulled left or right, then you would expect that the results would not change. We would get all left, or all right.

The spin collapsing into either up or down relative to the experiment is as a result of the particular particle interaction with the magnetic field where the only two possible states are up and down.

You will start to see notation like this creeping in later in the series

|φ> = α•|↑> + β • |↓>

Which can look rather alarming, but it’s really quite easy to read once we let you in on the secret.

|φ> just means “The state of the particle”

α•|↑> just means “how likely is it to decide to be up, where α is the size of the chance”

β • |↓> just means “how likely is it to decide to be down where β is the size of the chance”

So a particle that’s always going to be up?

|φ> = 1•|↑> + 0 • |↓>

Or always going to be down?

|φ> = 0•|↑> + 1 • |↓>

Fifty/fifty chance?

|φ> = 1/√2•|↑> + 1/√2 • |↓>

(Okay, that last one is a bit more confusing, I promise we will get around to it in part three.)

[Extra Reading — What is spin]

Entanglement

Entanglement is where quantum physics gets fun (and very useful for quantum computing).

This one is actually reasonably intuitive, although some of the later parts in the further reading I will add are less so.

An important rule to mention now: the laws of physics state there is conservation of certain properties, like spin. Conservation means “we can’t change the total amount in the universe”; in terms of energy this means we can’t create more or destroy any existing energy, we can only transform it. In terms of spin, it means all the UP spins must equal all the DOWN spins, there can’t be more of one than the other.

So, let’s try a thought experiment. Let’s say we create a pair of quantum particles, and they are in superposition. Each is 50/50 between being spin up and spin down. Knowing what we know about conservation of spin, if we make an up, then we also have to make a down, right?

However, they are in superposition — i.e. both up and down at the same time — so what happens if we measure the first one? Say we measure it and observe that it is spin up. What do we then know about the second particle? Well since all the ups and downs must balance, the second particle MUST be spin down.

This means we can set up particles where the probabilities of their spin are interconnected… or entangled! By adjusting the superposition of one, we change the other.

If we could tweak the first particle so that it has a 75% chance of being observed up and a 25% chance of being observed down, then the second (entangled) particle must become 25% likely to be observed up and 75% likely to be observed down. By measuring one we instantly know the state of the other.

There are couple of interesting add-ons to entanglement, which you don’t need to understand right now, but are:

[Extra Reading — No cloning Theorem]

[Extra Reading — Quantum Teleportation]

Onward to Quantum Computing

Lets quickly review what we learned.

1) Superposition: The state of a particle can be many states at once, with a chance of being in each, but when measured it must choose what state it is (and was) in.

2) Spin: This is an attribute of a particle that makes it act like a magnet. It is part of the state of a particle that can be superposition, and must collapse to a single state when measured.

3) Entanglement: The superposition of a particle can become “connected” to the superposition of another, so that by manipulating the superposition of one, you are manipulating the other, and by measuring one, you have measured the other.

In the next section, I will go on to discuss what this all means for creating a quantum computer. But even now you can maybe see the possibilities. Imagine a machine that modifies bits in some unknown way, and we needed to find out what it does.

In a classical computer, we would have to put in “one” and a “zero” in to find out what it did to them. So, two attempts.

If only there was a way to put a bit in that was a one and zero at the same time?! Then we could see what would happen with only one attempt…

Part two is now available: