# Rotated surface code vs unrotated surface code - Boundary stabilizers

I use these image for the questions below:

When we look at the surface code, we can define it in two slightly different ways.

The first figure shows a way where we keep all the data qubits and ancilla qubits inside the black region. The second figure shows a way where we keep all the data qubits and ancilla qubits inside the orange region. The boundaries of Figure 1 have 2-qubit stabilizers while the boundaries of Figure 2 have 3-qubit stabilizers.

Question 1: For the surface code in Figure 1, why do we drop the stabilizers in yellow circles? How did we know to drop those but keep the other stabilizers?

For example, looking at data qubits $$Da$$ and $$Db$$, the $$Z$$ stabilizer that connects them is dropped along with the other data qubits it used to connect to. On the other hand, looking at $$Db$$ and $$Dc$$, the $$X$$ stabilizer that connects them is retained.

What is the rationale behind which boundary stabilizers to keep and which ones to discard?

Question 2: What happens to the surface code of Figure 1 if I add those additional stabilizers circled in yellow? Since I add one data qubit and one stabilizer each time, do I just get the same encoded state as before?

For the surface code in Figure 1, why do we drop the stabilizers in yellow circles? How did we know to drop those but keep the other stabilizers?

After deleting data qubits outside the black-outlined region, these stabilizers would anticommute with the other stabilizers that have been included. Including these anticommuting stabilizers would break the other stabilizers.

At each location on the boundary, you have to choose whether you're keeping the adjacent X stabilizer that lost qubits or the adjacent Z stabilizer that lost qubits. The choices you make will determine how many logical qubits are present, and what their distance is.

Making entire sides be one type maximizes distance. Alternating the sides between choose-X and choose-Z leaves one logical qubit.

What happens to the surface code of Figure 1 if I add those additional stabilizers circled in yellow?

First, you will not have a stabilizer code anymore, because your stabilizers anticommute. So now you have what's called a "gauge code".

Second, in this gauge code, you will no longer have any logical observable with distance greater than 1. You will have destroyed the fault tolerance.

Your terminology for "surface code" and "rotated surface code" seems to match mine. I have seen other references to "surface codes" with different definitions; for example non-CSS types (which have better distance).

They're basically different codes from different families (different number of qubits and distance,...). The rotated version is more efficient in that it needs 9 qubits instead of 13; I think this makes more popular in current hardware implementations : the "surface-17" code is the $$[[9,1,3]]$$ code, the 17 comes from adding the 8 stabilizer to the 9 qubits...more terminology fog!

Here are quantum tanner graphs for the codes in your question.

circles are qubits, blue rectangles are x-stabilizer, red rectangles are z-stabilizers.

First, as a remark, removing four qubits and four linearly independant stabilizers means that the unrotated and the rotated surface codes encode the same number of logical qubits: 1. The removed qubits and stabilizers are carefully chosen so that:

• the induced stabilizers (i.e. stabilizers kept by the procedure, with their support updated to exclude any removed qubit) still commute with each other. This is mandatory if you want your old set of stabilizers to still form a stabilizer code.

• the distance of the rotated code is the same as the unrotated one. This means their error correction capabilities are the same, hence the rotated code offers a net gain compared to the unrotated one (it requires fewer qubits).

There aren't a lot of ways to achieve this.

You more or less have to remove the data qubits from the boundaries of your code. If you try to remove one data qubit from the bulk of the code instead, the induced stabilizers won't commute anymore, and there are too many of them to remove them all.

For example, try to remove $$De$$, then $$Xb$$ and $$Xc$$ will both anticommute with $$Zb$$ and $$Zc$$. Removing one qubit from the bulk forces you to remove two stabilizers, but this cannot keep going as you have to remove the same amount of qubits and stabilizers.

You will most likely want to preserve the 90° symmetry of the code. I have no strong argument for it but if you try to remove one line of data qubits from the unrotated surface code, you will hinder its ability to correct one type of logical errors compared to the other. Enforcing this symmetry forces you to remove $$4k$$ qubits. Incidentally, the rotated code always has $$(d-1)^2$$ less qubits than the unrotated one, which is always a multiple of 4 if $$d$$ is odd. I am not sure what the rotated even -istance surface code looks like.

Removing a data qubit from a boundary still has consequences on the commutativity of the neighboring induced stabilizers: a pair of them will anticommute. Hence, you need to remove one of these two. These forces you to either remove the top yellow circled $$Z$$ or the $$Xa$$ stabilizer, once you chose to remove the data qubit in the top corner.

The $$d=3$$ case isn't large enough to show it, but I think in larger odd cases, you will have to alternate removing and keeping data qubits along the boundaries, otherwise you won't get a checkboard like pattern for your stabilizers, which is also a problem for commutativity.

As discussed above, not removing one pair of data qubit/adjacent stabilizer, might slightly skew your correcting performances towards correcting $$X$$ or $$Z$$ errors but it will not have an impact on the distance of the code. You will still get an encoded state from a stabilizer code that is somewhere in between the unrotated and the rotated surface code.

Whether you have the exact same encoded state might depend on your procedure. If you start with one encoded state of the unrotated code and remove one less pair of data qubit/stabilizer (i.e. physically mesuring one less qubit), your encoded state in the end will be the same in the (semi)rotated code you get.

If you start with an encoded state in the rotated code and add some pairs of data qubits/stabilizers, you will have to perform a round of stabilizer measurements with the newly grown stabilizers ($$Xd / Xa / Za$$ or $$Zd$$ in your example) as well as the newly introducted stabilizers, to ensure your stabilizer checks are satisfied. A correction round might be required here. If everything worked out with no unrecoverable error, you will also get the same encoded state (this is a form of lattice surgery).