# Example of Quantum Error Correction [closed]

Shor's 9 Qubit code. Imagine that we encode the state $$| \psi \rangle = \alpha | 0 \rangle + \beta | 1 \rangle$$ using Shor's 9 qubit code, then an X error occurs on the 8th qubit of the encoded state $$| E ( \psi ) \rangle$$.

a) Write down the state following the error.

Apparently the answer is

$$\frac{1}{2 \sqrt2}( \alpha (| 000 \rangle + | 111 \rangle) ( | 000 \rangle + | 111 \rangle) ( | 010 \rangle + | 101 \rangle) \\ + \beta ( | 000 \rangle - | 111 \rangle)( | 000 \rangle - | 111 \rangle)( | 010 \rangle - | 101 \rangle))$$

How has this been derived? I cant see how you do this with an error.

b) We now decode the encoded state, starting by applying the bit flip code decoding algorithm. What are the syndromes returned by the measurements in the algorithm?

Apparently the syndromes are $$00, 00, 10$$. How do I know what measurements to do?

c) Now imagine that $$| E( \psi ) \rangle$$ is affected by two $$X$$ errors, on the 7th and 8th qubits. What are the syndromes returned this time? What state does the decoding algorithm output?

Now the syndromes are $$00, 00, 01$$. The decoding algorithm thus thinks there has been an X error on the 9th qubit. So it "corrects" this by applying an X operation on this qubit, to give the state

$$\frac{1}{2 \sqrt2}( \alpha (| 000 \rangle + | 111 \rangle)( | 000 \rangle + | 111 \rangle)( | 000 \rangle + | 111 \rangle)\\ - \beta ( | 000 \rangle - | 111 \rangle)( | 000 \rangle - | 111 \rangle)( | 000 \rangle - | 111 \rangle))$$

Note that $$\beta$$ now has a minus sign in front of it. After the bit decoding, we are left with $$\alpha | {+++} \rangle - \beta | {---} \rangle$$, which is then decoded to $$\alpha | 0 \rangle - \beta | 1 \rangle$$.

Again how would I know what measurements to take? Also how could I know a priori that I have errors on the 7th and 8th qubits? Why do we apply a $$X$$ operation to the 9th qubit?

• people.maths.bris.ac.uk/~csxam/teaching/qc2020/lecturenotes.pdf Sep 26 '20 at 14:05
• For point (a) if you Ctrl+f 'Shor' in the notes you find the encoding scheme at the top of page 45. Sep 26 '20 at 14:29
• @Rammus ive read the notes again and I still have problems seeing it. However, I have adjusted the question to remove some of the more basic parts which I now understand Sep 26 '20 at 15:20
• @Permian, according to M. Nielsen and I. Chuang textbook: Shor's 9 Qubit code "can protect against the effects of an arbitrary error on a single qubit!". So I think the last question (c) about errors on two qubits is not relevant to this error correction technique. Sep 26 '20 at 16:16
• @DavitKhachatryan people.maths.bris.ac.uk/~csxam/teaching/qc2020/… Sep 26 '20 at 17:07

## 1 Answer

Answer to a)

Initial encoded state with qubit indexes (I will omit $$\frac{1}{2\sqrt{2}}$$ for simplicity):

\begin{align}|\psi\rangle = &\alpha (|0_1 0_2 0_3\rangle + |1_1 1_2 1_3\rangle)(|0_4 0_5 0_6\rangle + |1_4 1_5 1_6\rangle)(|0_7 0_8 0_9\rangle + |1_7 1_8 1_9\rangle) + \\ &\beta (|0_1 0_2 0_3\rangle - |1_1 1_2 1_3\rangle)(|0_4 0_5 0_6\rangle - |1_4 1_5 1_6\rangle)(|0_7 0_8 0_9\rangle - |1_7 1_8 1_9\rangle) \end{align}

After applying $$X$$ gate on $$8$$th qubit (and after removing indexes):

\begin{align}|\psi\rangle = &\alpha (|0 0 0\rangle + |1 1 1\rangle)(|0 0 0\rangle + |1 1 1\rangle)(|0 1 0\rangle + |1 0 1\rangle) + \\ &\beta (|0 0 0\rangle - |1 1 1\rangle)(|0 0 0\rangle - |1 1 1\rangle)(|0 1 0\rangle - |1 0 1\rangle) \end{align}

Answer to b)

One should always do the same operator measurements no matter what error have been acquired. The operators for detecting $$X$$ error are $$Z_1 Z_2$$, $$Z_2 Z_3$$, $$Z_4 Z_5$$, $$Z_5 Z_6$$, $$Z_7 Z_8$$, $$Z_8 Z_9$$. After measuring all these $$6$$ operators one obtains for each of them either $$0$$ or $$1$$. $$00,00,10$$ syndrome measurement is wrong (I guess there is a typo in the exercise). The true syndrome is $$00,00,11$$ and that means only $$Z_7 Z_8$$ and $$Z_8 Z_9$$ operator measurements yielded $$1$$ indicating that the $$X$$ error has been acquired on $$8$$ qubit. One can apply a $$X$$ gate to the same (errored) $$8$$th qubit in order to correct the error. Here is the circuit for all mentioned $$6$$ operator measurements (note that there are $$6$$ measurements).

Answer to c)

With this error-correcting code, we always assume that we have only one qubit error. If there are two qubit errors then this technique with its syndrome may indicate to do something that will not correct the error. In this example, $$00, 00, 01$$ indicates (wrongly, because our assumption of one qubit error is not true for this error example) that $$9$$th qubit has got an error.

I think the main question here is how to do operator measurement for the syndrome. If I am correct then I suggest asking separately a question with a focus on this matter (with maybe this title "How to do $$ZZ$$ operator measurement for Shor's 9 qubit code?").

• Ok I'm not sure that the notes I was dealing with deal with this bit well Sep 27 '20 at 17:00
• I'll need to have a look over this in more detail. I cannot see why you are doing all these Xs and Zs Sep 27 '20 at 17:06
• quantumcomputing.stackexchange.com/questions/14000/… Ill probably rewrite the question tomorrow morning but this is it Oct 3 '20 at 21:26
• I'm not even sure how you would get this from the notes I was given Oct 3 '20 at 21:31