# Why should we measure in X/Z basis for Z/X errors in Steane syndrome extraction?

From the Steane syndrome extraction of quantum error correcting code, we use ancilla qubit prepared in logical X/Z basis to detect logical Z/X errors in the logical data state (The CNOT is transversal).

Every material tell me that it works because X errors will propogate to the left part of ancilla and Z errors will propogate to the right part. However, I'm confused how the measurement works. For example in the left part, even there is no error (Or applying a stabilizer), measuring logical + at Z basis will cause uncertain results, and X error just make thing more complex. Can somebody explain how the measure work and why it can get the syndrome? • Where did you get this circuit from? – DaftWullie Apr 27 '20 at 7:41
• arxiv.org/abs/1605.05647v4, there is a lot of other similar cricuit if you search steane syndrome extraction – Lucas Apr 27 '20 at 10:49

At the macro level, the answer is that if you have an $$X$$ error (say), you use a controlled-not to propagate it to another qubit where it appears as an $$X$$ error. Measuring in the $$X$$ basis cannot see that error. For example, if a single qubit state was in $$|+\rangle$$, an $$X$$ error would not change it, and you would be unable to detect the error. On the other hand, if the qubit was initially in $$|0\rangle$$ then the possibility of a flip would put it in either $$|0\rangle$$ or $$|1\rangle$$, which can be detected with a $$Z$$ measurement. (Put another way, $$X$$ errors commute with $$X$$ measurements, so they do not affect each other.)
More specifically, let's start by thinking about what happens if there is no error. In that case, $$|+\rangle$$ is the eigenstate of controlled-not, so it never changes. This is what initially threw me trying to think about a $$Z$$ measurement on this. But of course, it's not logical $$Z$$ measurement, but physical. So, basically, you'll get a single answer corresponding to one of the basis states used in either to 0 or 1 logical state, with no control over which. Let's call that answer $$x$$. What we do know is that $$H\cdot x=0$$, where $$H$$ is the parity-check matrix of the code (I'm being a bit loose about which of the two it is).
Now, what happens if there was a single physical $$X$$ error somewhere on the logical qubit. Controlled-nots (and we should think about the individual physical ones here, not the logical ones) propagate $$X$$ rotations from control to target. So, instead of getting an answer $$x$$, we'd get an answer $$x\oplus e$$ where $$e$$ is a vector representing the single qubit that had the error. So, now, if you apply the parity-check matrix, you get $$H\cdot(x\oplus e)=(H\cdot x)\oplus(H\cdot e)=H\cdot e.$$ The whole point of the parity-check matrices is that they can let you identify any single-qubit $$e$$. Hence, you know what correction to provide.