# In Shor’s 9-qubit code, is the error syndrome for qubit 5 phase-flip the same as that for qubit 6 phase-flip?

The Shor’s 9-qubit code has the following stabilizers

$$\hat{S}_1= \hat{Z}_1\hat{Z}_2$$ , $$\hat{S}_2= \hat{Z}_2\hat{Z}_3$$, $$\hat{S}_3= \hat{Z}_4\hat{Z}_5$$

$$\hat{S}_4= \hat{Z}_5\hat{Z}_6$$, $$\hat{S}_5= \hat{Z}_7\hat{Z}_8$$ , $$\hat{S}_6= \hat{Z}_8\hat{Z}_9$$

$$\hat{S}_7= \hat{X}_1\hat{X}_2\hat{X}_3\hat{X}_4\hat{X}_5\hat{X}_6$$ , $$\hat{S}_8= \hat{X}_4\hat{X}_5\hat{X}_6\hat{X}_7\hat{X}_8\hat{X}_9$$

Is it true that error syndrome for qubit 5 phase-flip is the same as that for qubit 6 phase-flip?

• Do you want a simple yes or no answer (the answer is in fact yes) or do you want to see the mathematics?
– JSdJ
Apr 2 '21 at 13:49
• Also, small nitpick regarding terminology (knowing which might benefit you): these are the generators of the stabilizer group - the wording stabilizers itself is a bit ambiguous.
– JSdJ
Apr 2 '21 at 13:50
• @JSdJ I need to see the mathematics to get better understanding of it. Apr 2 '21 at 21:18
• This comment doesn't answer your question, but you can play around with this code and check step by step what is being done in the Shor's 9-qubit algorithm for correcting quantum errors: github.com/sebastianvromero/qecc_shor9q . Just run it locally downloading it or launch it in Binder. Cheers! Apr 5 '21 at 23:59

TL;DR Yes, the two error syndromes are identical, because the two errors trip the same set of stabilizers.

Let $$|\psi\rangle$$ denote a state in the code subspace of the Shor's 9-qubit code. Every operator $$\hat{S}$$ in the stabilizer group $$S$$ of the code fixes $$|\psi\rangle$$, i.e. $$\hat{S}|\psi\rangle = |\psi\rangle$$. In particular, generators $$\hat{S}_1, \dots \hat{S}_8$$ fix $$|\psi\rangle$$, i.e. $$\hat{S}_i|\psi\rangle = |\psi\rangle\tag1$$ for $$i=1,\dots,8$$. Let $$|\psi_5\rangle$$ denote the result of a phase-flip error on qubit 5, i.e. $$|\psi_5\rangle = \hat{Z}_5|\psi\rangle$$ and similarly $$|\psi_6\rangle = \hat{Z}_6|\psi\rangle$$.

We begin computing the errors syndrome for $$|\psi_5\rangle$$ with the $$Z$$ type stabilizer generators, i.e. $$\hat{S}_j$$ for $$j=1,\dots,6$$. Note that $$\hat{S}_j=\hat{Z}_a\hat{Z}_b$$ for some qubits $$a$$ and $$b$$. We calculate

$$\hat{S}_j|\psi_5\rangle = \hat{Z}_a\hat{Z}_b\hat{Z}_5|\psi\rangle = \hat{Z}_5\hat{Z}_a\hat{Z}_b|\psi\rangle = \hat{Z}_5\hat{S}_j|\psi\rangle = \hat{Z}_5|\psi\rangle = |\psi_5\rangle\tag2$$

where we first used the definitions of $$\hat{S}_j$$ and $$|\psi_5\rangle$$, then the fact that $$\hat{Z}_q$$ and $$\hat{Z}_r$$ commute for any qubits $$q$$ and $$r$$, then the definition of $$\hat{S}_j$$ again, then $$(1)$$ with $$i=j$$ and finally the definition of $$|\psi_5\rangle$$. Thus, we see that $$|\psi_5\rangle$$ is an eigenvector of $$\hat{S}_j$$ for $$j=1,\dots,6$$ associated with eigenvalue $$+1$$ and therefore a measurement of $$\hat{S}_j$$ on this state yields $$+1$$ with probability $$1$$. Note that analogous calculation yields the same result on $$|\psi_6\rangle$$

$$\hat{S}_j|\psi_6\rangle = \hat{Z}_a\hat{Z}_b\hat{Z}_6|\psi\rangle = \hat{Z}_6\hat{Z}_a\hat{Z}_b|\psi\rangle = \hat{Z}_6\hat{S}_j|\psi\rangle = \hat{Z}_6|\psi\rangle = |\psi_6\rangle\tag3$$

for $$j=1,\dots,6$$ as before.

Now, let us turn to the $$X$$ type stabilizer generators $$\hat{S}_7$$ and $$\hat{S}_8$$. For the state $$|\psi_5\rangle$$, we find

\begin{align} \hat{S}_7|\psi_5\rangle &= \hat{X}_1\hat{X}_2\hat{X}_3\hat{X}_4\hat{X}_5\hat{X}_6\hat{Z}_5|\psi\rangle \\ &= -\hat{Z}_5\hat{X}_1\hat{X}_2\hat{X}_3\hat{X}_4\hat{X}_5\hat{X}_6|\psi\rangle \\ &= -\hat{Z}_5\hat{S}_7|\psi\rangle \\ &= -\hat{Z}_5|\psi\rangle \\ &= -|\psi_5\rangle \end{align}\tag4

where first we used the definitions of $$\hat{S}_7$$ and $$|\psi_5\rangle$$, then the facts that $$\hat{X}_i$$ and $$\hat{Z}_j$$ commute when $$i\ne j$$ and anticommute when $$i=j$$, then once again the definition of $$\hat{S}_7$$, then $$(1)$$ with $$i=7$$ and finally the definition of $$|\psi_5\rangle$$. Thus, we see that $$|\psi_5\rangle$$ is an eigenvector of $$\hat{S}_7$$ associated with eigenvalue $$-1$$ and therefore a measurement of $$\hat{S}_7$$ on $$|\psi_5\rangle$$ yields $$-1$$ with probability $$1$$. Analogous calculation for $$\hat{S}_8$$ shows that $$|\psi_5\rangle$$ is an eigenvector of $$\hat{S}_8$$ associated with eigenvalue $$-1$$. Finally, the same calculation with $$|\psi_6\rangle$$ in place of $$|\psi_5\rangle$$ shows that $$|\psi_6\rangle$$ is an eigenvector of $$\hat{S}_7$$ and $$\hat{S}_8$$ associated with eigenvalue $$-1$$.

We conclude that measuring $$(\hat{S}_1, \hat{S}_2, \hat{S}_3, \hat{S}_4, \hat{S}_5, \hat{S}_6, \hat{S}_7, \hat{S}_8)$$ on states $$|\psi_5\rangle$$ and $$|\psi_6\rangle$$ yields the same syndrome $$(+1, +1, +1, +1, +1, +1, -1, -1)$$.

Remark: The calculation above shows a useful fact about CSS codes: phase flips are detected by the $$X$$ type stabilizers and leave the $$Z$$ type stabilizers unaffected. Similarly, bit flips are detected by the $$Z$$ type stabilizers and leave the $$X$$ type stabilizers unaffected.