# Hadamard in surface code not understood

I am reading how Hadamard is performed in surface code at https://arxiv.org/pdf/1208.0928.pdf

At some point, they apply H on all data qubits, and they claim that it converts X to Z stabilizers and vice versa, and I still do not understand why this identity is true:

Appendix J, page 49, bulletpoint 4:

We perform the key to this process, executing physical Hadamards on all the data qubits in the patch. As this changes the eigenbases from $$\hat Z$$ to $$\hat X$$ and vice versa, we change the identity of the measure qubits from $$\hat X$$ to $$\hat Z$$ stabilization and vice versa, as shown in Fig. 27e. Also, the $$\hat X_L$$ and $$\hat Z_L$$ logical operators swap their identities. This step, and the two that follow, are done in between two cycles of the surface code (so the measure-X and measure-Z qubits do not perform any stabilization on the isolated patch during these three steps).

Perhaps these is 2 different operations? 1) Apply H on data qubits, 2) change stabilizers

Question 2:

After this operation, we still have a stabilized logical qubit, so it can not be in +L state, but just in one of 0L or 1L. So it feels like the H did nothing. What am I missing?

• I took the liberty of copypasting the paragraph, no need to use pictures when you can quote them directly. That helps to avoid broken image links in the future. Jan 31 at 11:07

I think your confusion might come from the wording they use. They do apply the two different operations you mention.

To apply a logical Hadamard, they apply a physical Hadamard gate to each data qubit and each ancilla previously used for measuring an $$X$$ stabilizer now measures a $$Z$$ stabilizer (and vice versa).

The type of stabilizer an ancilla measures is switched by changing the readout circuit.

• Thank you! how it shows it created logical H? Jan 31 at 9:16
• Because it has transformed logical X into logical Z and vice versa. This is the heisenberg/stabilizer formalism representation of a Hadamard gate. Jan 31 at 9:53
• This paper explains the Heisenberg representation: arxiv.org/abs/quant-ph/9807006 Jan 31 at 9:54
• But after this operation, we still have a stabilized logical qubit, so it can not be in +L state, but just in one of 0L or 1L. So it feels like the H did nothing. What am I missing? Feb 1 at 11:14

The main point is that if you apply a unitary $$U$$ to a state described by stabilizers, the action $$|\psi\rangle\rightarrow U|\psi\rangle$$ can be equivalently written as $$g_i\rightarrow Ug_iU^\dagger$$ for all the stabilizers $$g_i$$. (For a code, the action also applies to the logical operators.)

Add that to the fact that $$HXH=Z$$ and $$HZH=X$$, you can see how applying $$H$$ on every qubit changes all the $$X$$s into $$Z$$s and vice versa.

• But after this operation, we still have a stabilized logical qubit, so it can not be in +L state, but just in one of 0L or 1L. So it feels like the H did nothing. What am I missing? Feb 1 at 11:12
• If it was in the state $|0\rangle_L$ to start with, that means it was in the $+1$ eigenstate of $Z_L$. However, when we apply hadamards everywhere, $Z_L\rightarrow X_L$. Hence, the stabilized state is stabilized in the $|+\rangle_L$ state. Feb 1 at 12:06