# Poking holes and cutting corners in a quantum computer

Just as normal computers do useful stuff by meddling with bits, quantum computers will do it by meddling with *qubits*.

I and some others wrote a paper about some new ways to do that meddling, recently published in the journal Phys. Rev. X (free version here). This article is a layman’s introduction to the basics of what we did (as well as many other things that we build upon).

#### Qubits, and why they aren’t bits

A bit is a thing that’s either *0* or *1*. A qubit is the same, except that it can be indecisive. It might be *0*, it might be *1*, or it might be both as a so-called quantum superposition.

What does it mean for something to be 0 and 1 at the same time? It sounds weird and magical. And I don’t like it when science sounds magical!

So let’s describe bits a little differently. Instead of *0* and *1*, let’s call the two states *up* and *down*. This doesn’t change anything important: *0* and *1* are only labels anyway.

But it does change something. It changes how we think about the bits. If there is *up* and *down*, why not *left* and *right*? Why now *forward* and *backward*?

A simple bit is not complicated enough for these things to make sense. It just lives in a 1D world of up and down.

But qubits are complicated by quantumness. And this gives them the freedom to spread out. For qubits, *left* does make sense. It is a particular kind of superposition state. And *right* is another, and completely opposite superposition.

Forward and backward are two other possible ways that you can have a superposition of *up* and *down*. So now we have six states, all labelled by nice and easily understandable directions.

#### Qubits, and why they aren’t dice

A bit is like a coin. Both have only two possible states: *0* and *1* for the former and *heads* and *tails* for the latter.

Qubits have six states that we’ve talked about so far. Just like dice. But qubits are far more complicated than dice. Though all qubit states are equal, some are more equal than others.

The end of equality comes when we want to measure them. Whenever you measure a qubit, you have to go back to imagining that only two of the possible states are weird, and everything else is quantum nonsense.

So you could ask the qubit if it is *up* or *down. *The laws of physics will force it to answer one way or the other. If it was *up*, it will obviously answer that. But what if it was *left*? In this case, the qubit must randomly decide which to be. And then it will forget that it was ever anything else.

Another very important way that qubits differ from dice is that qubits aren’t limited to these six states. They are allowed to roam all the infinite possible directions. But we will not let our qubits be quite so free in this article. Not on purpose, anyway.

#### Clifford, the big red group

If you only have one bit, and you want to do something to it, you are very limited. You could do a so-called NOT gate, which rotates *0* to *1* and *1* to *0*. But that’s about it.

Once you let quantumness in, the floodgates open. You are able to do any of the infinite number of possible rotations from *up* and *down* to any other possible pair of opposing rotations.

But infinity is a big number. Not only is it a lot of operations to fit in our brain, it is a lot to work out how to do without making mistakes. What if we overshoot a little on our rotation, for example? That would be another, equally valid rotation.

The qubit can’t tell the difference between what we did and what we wanted to do. So our mistake cannot be detected and removed. This is a serious issue. Any errors, no matter how small, will seriously impact our ability to do useful stuff.

Because of this, we often limit ourselves to a smaller set of rotations, called the Clifford group. When we have just one qubit, these are the rotations that rotate *up* only to one of its five favourite friends: *down*, *left*, *right*, *forward* and *backward*. And the same for the rest of them. None of these six states will be left pointing in some weird direction by a Clifford rotation.

There are only a finite number of possible Clifford rotations, and they are all very different. So if we know that we are only intending to do Clifford stuff, there are ways to detect when we accidentally mess one up.

We do this using quantum error correction. This does far more than just clean up dodgy Cliffords. It also protects against all the kinds of noise that qubits can suffer from.

To do QEC, we start with the fact that there are particles in nature that work exactly as we would want our qubits to work. Except for one important fact: they are noisy. They get buffeted about by all kinds of horrible effects, as well as suffering from our cack-handed attempts at rotations.

To deal with this, we don’t just use one particle to build our qubits. Instead, we erect giant quantum fortresses of many particles, which allow us to fend off errors.

But a giant quantum fortress isn’t quite as easy to manipulate as a single particle. The same tactics that stop noise messing with our qubit, and stops us bludgeoning it with our incompetency, also makes it hard for us to do the things we actually want to.

Typically our fortresses are designed to make sure that at least some of our favourite rotations, the Cliffords, can be done relatively straightforwardly and with no fear of error. Often it’s hard to get all of them, unfortunately. But we can do a few of them at least.

Even if we do get them all, a quantum computer cannot be built from Cliffords alone. This poses a problem. But not an insurmountable one. Error corrected Cliffords provide a strong foundation for a quantum computer. We just need to find a few more tricks to get the other things we need.

That’s not what our paper us about, though. This paper is about our struggle just to get the Cliffords. So let’s move on.

#### The surface code, and a couple of Cliffords

The surface code is one particular way architecture for a fortress of quantumness that provides quantum error correction. Many particles are laid out on a 2D surface, and measurements are constantly made to check what these particles are doing in relation to each other.

You don’t need the nitty-gritty details of this. But if you want them, you can check out a series of articles I wrote. Or a here’s a short video.

The most important thing is that we can pretend that the surface code is a 2D universe that we’ve made in the lab. When we are doing this quantum roleplay, the measurements we make are interpreted as telling us whether there are any pretend particles around in our pretend universe.

The pretend particles in this universe are called anyons. That’s a lot shorter and less stupid sounding name than ‘pretend particles’. So we’ll call them anyons from now on.

When all is well, and there is no noise, there will be no anyons. If an error happens somewhere, it will result in a particle/antiparticle pair of anyons being created. By detecting these signatures of the errors, we can push the particles and antiparticles back together to get rid if them.

Let’s assume all is well, and the only anyons there will ever be are ones we create on purpose.

One thing we can do with any anyons we create is throw them off the edge of the universe.

This isn’t just some random fact I’m telling you. It is actually how we do a couple of Clifford rotations with this code. For one we call *X*, which turns *up* to *down* and *down* to *up*, we first create a couple of anyons, and then throw them off opposite sides. This process is depicted by the blue line in the picture above.

You might wonder how the left and right edges of this code relate to the *left* and *right* states of a qubit. The short answer is: they don’t. Many things have lefts and rights. Lots of planets have a north. And sometimes they are unrelated. The long answer is: they do, but this is neither the time nor the place to worry about it.

Another Clifford rotation called *Z*, which turns left to right and right to left, is done similarly. We create a couple of anyons, throw one off the top and the other off the bottom. If you are wondering why I missed out *Y*, don’t worry. The *Y *exists too. Itis simply the combination of an *X* and a *Z*.

Now you may be able to see how it’s hard to mess up these rotations when using this code. When rotating a single particle, it is possible to slightly undershoot an *X* rotation, and end up rotating *up* to a direction close to but not quite *down*.

But when our qubit is built from a surface code, there is no way to accidentally throw 0.99 particles off an edge. You throw one or none. You do it or you don’t. There is no middle ground. Even when we make some errors during the process, it will just leave some traces here and there as pairs of anyons. We just need toannihilate them with each other, and all is well.

All this has been known for many years. Time to start talking about something that we contributed.

The white crosses in the picture above denote the corners of the code. You might ask why we did such an odd thing to denote corners. There is a far more straightforward thing we could have done: just draw the code as a square. Then the corners would simply be the corners!

We did this because we discovered an odd thing you can do with the corners. You can pull them inside the code and move them around. In fact, you can play with them as if they were another kind of particle living in our 2D universe!

But what does this do to our Clifford rotations X, Y and Z?

Now the corners become goalposts. To do an *X*, you need to make sure that one of your particles passes through the pairs of goalposts at the sides before being thrown off the edge of the universe. This is shown with the red and blue line, with the line changing colour when it passes through the goalposts.

For a Z you need to throw them off opposite edges without passing through the goalposts. For a Y, again, you simply need to do both.

#### The surface code with all the Cliffords

So far, we’ve just messed the code up and made it a bit more weird. But now its time to out that weirdness to use.

The Clifford rotations *X, Y* and *Z* are pretty boring ones. To do interesting stuff with qubits, it’s important to be able to more interesting rotations, like ones that can rotate *up* to *left*, *right*, *forward* or *backward*.

They are traditionally quite hard to do with the surface code. But our trick of pulling the corners in makes them relatively straightforward. All we have to do is pull some corners in, swap them, and then put them back in place again.

Let’s start with the easiest. The so-called Hadamard rotation turns *up* to *right* and *down* to *left*. This means that the effect of an *X* turns into the effect of a *Z*, and vice-versa.

To see how to do this, let’s first draw the goal line between the goalposts.

The easiest way to get a Hadamard is just rotate all the corners around. Move the top-left one to the top-right, the top-right to the bottom right, and so on. Then the goal lines will be moved from the sides to the top and bottom. Making a pair of particles and throwing them off the top and bottom will therefore no longer do a *Z*, as before. It’ll do an *X* because it would be crossing the goal lines.

This is nice, but there are ways of doing Hadamards to the surface code without needing to pull the corners in and sending them on a merry-go-round. Our method really begins to boldly go where no method has gone before when you consider another Clifford rotation. This is corresponds to half an X rotation, and it rotates *up* to *forward* and *down* to *backward*.

Doing this would turn the effects of a *Z* into those of a *Y*, and vice-versa. To do it, we need to swap the corners at the bottom.

The following picture takes us through the process, step-by-step. But rather than the pretty pictures from the paper, we’ll switch over to some scribble by my own fair hands. Note that the corners and goal lines have become orange.

In (a) we have everything before the swap. The red line shows us how to do a *Z* in this case.

In (b) we start the move. The red line has to swerve to avoid the corners. Changing the path that the anyons move along like this doesn’t change anything.

In (c), part of the swerve gets a bit out of control. An anyon falls of the edge, and has to get sucked back again.

But that just paves the way for (d), where one of the corners completes its journey to the opposite side. Now the need to fall off the edge and get sucked back on becomes permanent.

In (e) we just tidy up (d) a bit. We can change the paths of the anyons, and the end effect will be the same. The only restriction is that we can’t just decide to send them the other way around a goal post. As in football, that changes stuff.

In (f), one of the anyons decides to have a bit of a holiday before meeting its doom. Which is fair enough.

But then it goes crazy in (g). It falls off the universe and needs to be rescued. Then it can carry on and meet its fate.

There are now two places that an anyon falls off the universe at the top, and one place it gets sucked back on. We can pull two of these back to form the original loop in (f). Or we can do it to form the new one in (h). Both are equally valid.

Steps (i) and (j) are then simply a bit more tidying up. We end up with two distinct processes. In one, a pair of anyons is created, and they are then thrown off the top and bottom. In the other the same happens, but with left and right, and with a little dance with a corner in between.

The corner in the middle finally gets bored and starts to move in (k), so the location of the dance moves with it.

Finally, by pushing the corner into the edge, we end up with (l). We also do a bit of tidying up on the goal lines. But that’s not the important part. They are just to help us remember what’s going on. They aren’t real things.

What’s important is that the *Z*, which started as just a pair of particles thrown of the top and bottom, has changed into something very different. It is now composed of two pairs of particles, one thrown off the top and bottom and the other off the sides. The *Z* has been turned into a *Y*.

Swapping the bottom corners turned the *Z* into a *Y*. Which is surprising. Perhaps more surprising is the fact that you just followed the quantum mechanical proof of this statement!

#### And that’s not all

We also do other stuff in our paper. We look at other ways to mess about with surface codes. We also look at surface codes with more than one qubit in, which gives us even more corners to play with. But I think we should leave it here, and all go lie down for a while.