## Measuring order ancilla qubits in surface code

2

Recently I have been reading about surface codes a little and one thing I came acros was a specific order in which gates should be applied before the ancilla is measured. See for instance figure 2 in this article.

The specific order of the two-qubit gates with the ancilla is important due to some commutation relations which will not be valid otherwise.

Can someone explain in more detail why this order is important? (heavy math is allowed here)
Furthermore, what goes wrong if we use different orders? And why is this order different for $$X$$- and $$Z$$-type plaquettes?

2

To make a simple example, let's imagine we are not doing measurement by instead just applying the stabilizer operators. So we want to do $$XXXX$$ around the $$X$$ plaquettes, and $$ZZZZ$$ around the $$Z$$ plaquettes.

The method in the article you mention applies operations in four steps: first to the 'north east' qubit of each plaquette, then in the order NW $$\to$$ SE $$\to$$ SE for $$X$$ plaquettes and SE $$\to$$ NW $$\to$$ SW for the $$Z$$ plaquettes.

This ensures two properties. One is that no qubit is involved in more than one operation during each step. To see what the other important property, let's focus on two neigbouring plaquettes: one $$X$$ and one $$Z$$.

0---1---3
| X | Z |
3---4---5


Step-by-step, the operation we apply is

$$(Z_{4} X_{3})~~(Z_{1} X_{4})~~(Z_{5} X_{0})~~(Z_{3} X_{1})$$

Now let's do some commutations. We know that $$X$$ and $$Z$$ anticommute when applied to the same qubit, but the operations all commute otherwise. So note that each $$Z$$ commutes to everything to its left. That means we can rewrite this as

$$( Z_{4} Z_{1}Z_{5} Z_{3} )~~( X_{3} X_{4} X_{0} X_{1}).$$

So though we didn't do a complete $$X$$ stabilizer operation followed by a complete $$Z$$ stabilizer operation, the effect is the same as if we had. The same holds true for the stabilizer measurements made using controlled operations. Due to this exact same commutation behaviour, the effect is equivalent to doing them independently, one after the other.

For other sequences of operators, we might instead come out with

$$- ~~ ( Z_{4} Z_{1}Z_{5} Z_{3} )~~( X_{3} X_{4} X_{0} X_{1}),$$

due to an anticommutation that we needed to account for.

When applying stabilizer operators, this just results in a global phase and is not too important. When applying controlled operations for stabilizer measurements, however, the effects are much more drastic. It is no longer possible to separate out the two independent measurements of the two types of stabilizer. Instead, you'll get some strange combined measurements of both plaquettes. This won't tell you about errors, and won't preserve your code space. So it is exactly what you don't what to do in your surface code.

Any method that prevents all neigbouring pairs of plaquette measurements from becoming interleaved in this way is valid. So you could swap the methods for $$X$$ and $$Z$$ in the paper and it would still work.

Okay, clear up to some level. However, what prevents us from doing $(Z_5X_4)(Z_1X_0)$ instead of $(Z_1X_4)(Z_5X_0)$? As both commute and in both cases, each qubit is still involved with only one qubit. – nippon – 2018-12-07T09:13:06.277

1Other orders make work for this particular pair of plaquettes, but you have to check that each plaquette measurement works well with all four of its neighbours. So your proposed ordering may fail at that point. – James Wootton – 2018-12-07T10:48:49.247