# How are logical operators performed and measured on the surface code, in a defect-free way?

I am reading about the surface code and I am still not sure how to perform and measure logical operators, such as $$X_L$$ or $$Z_L$$, without creating defects. Suppose I stabilise my qubit array into a quiescent state $$|\psi\rangle$$, knowing all stabilizer eigenvalues. Performing $$X_L$$ on the qubit array does change the quiescent state non-trivially, but the syndrome remains equal. So by stabilizer measurements alone, I cannot detect that I applied the logical $$X$$ operator. So how do you perform such an operation, in a way that it can be read out?

Extra question, how do you even prepare an eigenstate of these operators, i.e. $$|0\rangle_L, |1\rangle_L, |+\rangle_L, |-\rangle_L$$ to begin with?

All the answers I find require defects.

I am still not sure how to perform [...] $$X_L$$ or $$Z_L$$

To perform logical X or logical Z in any code, apply the Pauli operators of the observable. This is always fault tolerant, in any stabilizer code. If the X operator is a line of qubits going from the bottom boundary to the top boundary, apply X to the qubits along that line and you'll do the X operator.

Actually, for a stabilizer code like the surface code, it's simply a waste of time to perform any Pauli operator on the quantum computer except for purposes such as spin echo. You can just update the control system's Pauli frame instead, which is faster and more flexible and more accurate. Pauli gates are never important to whether or not something is fault tolerant, they're just distracting finicky details.

how do you even prepare an eigenstate of these operators

$$X_L$$ and $$Z_L$$ observables are prepared and measured transversally. To prepare $$|+\rangle$$, initialize every data qubit in the patch into $$|+\rangle$$. To measure $$Z_L$$, measure every data qubit in the patch in the Z basis.

$$Y_L$$ is prepared and measured by moving corner twists within the patch.

$$|T\rangle$$ is prepared by distillation.

Arbitrary signle qubit states are prepared by approximate decomposition into a series of H and T gates.

• Moderators, I'm sorry I think someone has hacked my account and answered some questions using ChatGPT. I'm really sorry for this unhealthy discussions. I'm attemoting to delete this account.
– user18115
Mar 12, 2023 at 5:24
• @Someone I'm assuming this comment refers to the other (deleted) answer, and not this specific one you've commented on. Which I did write myself (e.g. ChatGPT isn't capable of embedding screenshots of papers into its output). Mar 12, 2023 at 11:20
• Thanks for the answer! So to apply $X_L$, one can perform $X$-operators on the entire line of qubits going from the bottom boundary to the top boundary? But that does not change the syndrome, so how can we distinguish between the $|0\rangle_L$ and $X_L|0\rangle_L=|1\rangle_L$ state in principle?
– JoJo
Mar 13, 2023 at 14:48
• @JoJo The goal is to NOT distinguish 0 from 1 under normal operation (except measurement). Otherwise the qubit wouldn't survive. Mar 13, 2023 at 16:37
• @JoJo I repeat: you aren't supposed to know if it's 0 or 1. That would be a measurement. This is a quantum bit. Measuring it destroys it. You only want to measure it when you want to measure it, not when you're just trying to rotate it. Mar 18, 2023 at 14:45