This is part of a project to get people involved with quantum error correction. See here for more info.
It's been almost a month since part 3 in our series on the toric code. Since then we released our app, and the source code. But now it's finally time to see how the toric code deals with things being measured when they shouldn't be. For this we'll need to meet a couple of new friends, called + and -.
Summary
Let's quickly remind ourselves what's going on. We have a bunch of qubits, which are just like bits (with values 0 and 1) except that they are allowed to do quantum stuff.
Unfortunately, things happen to our qubits that we don't want. Sometimes they get bit flipped, which turns 0 to 1 or 1 to 0. Sometimes they get measured, which interferes with quantum stuff. All this noise means that we can't use our qubits to make quantum computers. Not without some fancy tricks, anyway.
The fanciest of tricks is quantum error correction. We take many of these noisy qubits, which we call `physical qubits', and use them to build one almost noiseless `logical qubit'.
In the toric code we do this by putting the physical qubits on a grid that's wrapped around a torus, and imposing the rule that there must always be an even number of 0's around each white square. This still lets us have many different patterns of 0s and 1s, as below. When we want our logical qubit to have value 1, we use patterns like (c) and (d) which have a big loop of 1s around the torus (or any odd number of these loops). When we want our logical qubit to be 0 we use something like (a) or (b) which don't have a loop like that, or have an even number.
Using the toric code makes a logical bit that's hard to flip. You need to flip a whole bunch of physical bits on a line to make (a) become (c), or (b) become (d), or anything else that's logical 0 become logical 1.
It's most likely that noise won't be able to do a complete loop of bit flips, but instead will just do some flips here and there. These will usually break the rule that there should be an even number of 1s around each white square. So by checking the squares to see where the rules are broken, the bit flips can be detected and corrected.
The toric code also makes it hard to measure whether the logical qubit is 0 or 1. For that we also need to use a big long loop, this time one going the other way.
If we measured each physical qubit along the blue loop, we could work out whether there was an odd or even number of loops passing from left to right, and so whether the logical qubit is 0 or 1. We could also do it with the green loop, or a whole bunch of others. But anything less than a big loop through the torus won't be able to tell us anything.
Even so, suppose that every second there is a 1 in 100 chance that a Gremlin finds and measures each physical qubit. After a few minutes, the chance that each has been measured at least once is pretty high. If the Gremlins teamed up, they'd almost certainly have enough information to work out what the logical qubit is doing.
This is not good enough. We need some way to keep the Gremlins from getting this information. We need to be able to detect when they measure, and then change things around so their information is out of date. Can we do this?
The + and - states
So far we've always described qubits as things that can be 0 or 1, or a quantum superposition of the two. This suggests that 0 and 1 are special states, and the superpositions are just weird quantum things. But that's not true.
So why have we focussed on 0 and 1? One very useful thing about them is that 0 and 1 are completely different from each other. A bit or qubit can be one or the other. But it can't be neither or both. Even when a qubit is a quantum superposition of the two it isn't really both. It's still either one or the other, but just refuses to make up its mind.
Because of the difference between these two states, it makes sense to ask whether a qubit is 0 or 1. This is a measurement that quantum mechanics allows us to make, and all the measurements we've imagined so far have used this fact.
But there are other states that are like this. An infinite amount of them, in fact. But today we'll start looking at everyone's second favourite: + and -.
The state + is a superposition of 0 and 1. If you had a qubit that was +, and you measured whether it was 0 or 1, it would randomly choose one or the other. The same is true for -.
But the types of superposition going on in + and - are very different. It takes a bit of maths to explain this, so we won't go into any more detail here. But, if you're interested, check out this post, where they go by the names 'left' and 'right'.
The states + and - are as different from each other as 0 and 1 are, and we can use them to measure our qubit. So if we have a qubit in state 0, and measure whether it is + or -, what happens? Well it turns out that 0 can just be thought of as a superposition of + and -, so we get a random result out.
We can also use them to describe the state of our qubit. Instead of saying that a qubit is in state 0, or 1, or some superposition of the two, we can say that is +, or -, or some superposition of the two. Any state can be described in either way. Both are just ways that we can talk about strange quantum states in a way that makes sense to our monkey brains, that would rather be thinking about something simple like bananas. Neither is more important than the other, or the infinitely many other ways we could describe quantum states.
Detecting unwanted measurements
Putting this behaviour together gives us a clue about how to detect whether or not Gremlins are going around measuring our stuff. Say we make a qubit in state + and then go off to make a cup of tea. While we're away, a Gremlin comes along and measures whether it is 0 or 1. The qubit then randomly chooses to be one or the other. Either way, it is no longer a simple +. Instead it is a superposition of + and -.
Now we come back from our tea break and want to check if everything is okay. So we measure if the qubit is + or -, expecting it to still be + as we left it. But the result will instead be randomly either + or -.
If we get the result +, we think that all is well. And indeed it is. Though the Gremlin made a measurement, our qubit is back as we wanted it. Also, the information that the Gremlin has become useless. By updating the state of the qubit, our measurement has made the Gremlin's measurement result irrelevant.
If we get the result -, our measurement has still updated the qubit and made the Gremlin's information irrelevant. But, since it is not the + we expected, it has also given us a clue that something dodgy is going on. We'll need to be more careful during our next tea break!
Complementary observables
It is possible for us to make a qubit which, when asked if it is 0 or 1, will always reply 0. That qubit would simply be in state 0.
It is also possible for us to make a qubit which, when asked if it is + or -, will always reply +. That qubit would simply be in state +.
But it is impossible for us to make a qubit which has both properties. It can never be certain of its answer to both questions. Otherwise 0 and + would have to be the same thing, which they're not. Any questions like these, where a quantum system cannot be fully certain of its answer to both at once, are called complementary observables.
Interestingly, there are very similar measurements we can do, which somehow manage to avoid this. But for these, we'll need a pair of qubits.
Suppose we ask the pair of qubits to look at whether they are 0 and 1, but only tell us whether there is an even or odd number of 1s. If we want the answer to be 'even', we can make them both be 0, or both be 1, or be any superposition of these two.
We could also ask the qubits whether they have an even or odd number of -'s. Again, if we want the answer to be even, we can make them both be +, or both be -, or be any superposition of the two
What if we want them always to answer 'even', whichever of these two questions is asked? For this we would need a state that can be described as a superposition of both qubits being 0 and both being 1, and can also be described as a superposition of both qubits being + and both being -. Then it would always has an even number of 1s, or an even number of -'s, depending on how you look at it.
It turns out that such a thing does exist. In fact it is a so-called entangled state, which has properties that Einstein described as 'spooky'. We'll look at the maths of this in a more mathsy post in a few weeks.
Next time we will use these properties to add some new rules to the toric code, based on the states + and -. These won't disturb what we've done so far, but they'll let us detect and correct stray measurements just as we did before with bit flips.