# Can Shor‘s code correct two- or three-qubit errors?

I have read some articles about Shor's code (e.g. this one). It is said that Shor's code can correct a single-qubit error. What about two qubit errors? Three qubit errors? It confused me a lot...

• +1 and welcome to the community! We hope to see much more of you here in the future! As for the close vote and downvote, they were by someone else, but I suspect that you might your questions would get a more positive response if you used complete sentences, rather than sentence fragments like "Three qubit errors?", or the problem is that you talk about "single errors" and "single-qubit errors" like they're the same thing. A single 3-qubit error is still a single error. Anyway, hopefully the answer by Adam was useful! Jan 25, 2021 at 23:30
• Thank you so much for your useful suggestions! Jan 29, 2021 at 18:01

We can combine weaker codes to obtain stronger codes using concatenation (see this paper or chapter X B in this paper).

Suppose we have a quantum error correcting code that encodes a logical qubit into $$n$$ physical qubits. Let $$d$$ denote the code distance, i.e. the smallest number of qubits we must act on with a local Pauli operator in order to induce a non-trivial logical transformation on the code subspace. Similarly to the case of classical codes, if an error affects no more than $$t=\big\lfloor\frac{d-1}{2}\big\rfloor$$ qubits the decoder can diagnose the error correctly.

Now, we can use the code to encode $$n$$ logical qubits in $$n^2$$ physical qubits and then we can add a second level of encoding to encode a second-level logical qubit into the $$n$$ first-level logical qubits. Then the smallest number of qubits we must act on with a local Pauli operator in order to induce a non-trivial logical transformation on the code subspace is $$d'=d^2$$. Consequently, the two-level concatenated code can correct any

$$t'=\bigg\lfloor\frac{d'-1}{2}\bigg\rfloor=\bigg\lfloor\frac{d^2-1}{2}\bigg\rfloor$$

physical errors and if $$d>1$$ then $$t'>t$$. For example, the two level Shor's code can correct any four physical errors.

Concatenation can be continued to any number of levels and if the physical error rate is low enough it allows us to bring the logical error rate below any desired target value. This last result is known as the threshold theorem.

• Thank you for your reply. So if we have two qubits errors, we need to combine two 9-qubits shor's code as a whole system? Jan 26, 2021 at 5:38
• Yes, if you'd like to be able to recover from errors on any two physical qubits, then one way is to use two-level concatenated Shor's code. Note that this is excessive in the sense that it can actually recover from errors on any three physical qubits. Jan 26, 2021 at 5:54
• Thanks for your reply! So if I just have a 9 qubits Shor's code (only), I cannot correct 2 qubits errors. But if one is phase error and the other one is flip error, the 9 qubits shor's code can complete. Isn't it? Jan 26, 2021 at 7:34
• Yes, if one error is a bit-flip and the other is a phase-flip then we can correct them using the 9-qubit Shor's code. However, if the first error is a bit-flip on the first qubit and the second error is a bit-flip on the second qubit, then we can't correct them. The point is that with 9 qubit Shor's code we cannot correct arbitrary two-qubit errors - we have to get lucky. However, we have a guarantee that we can correct arbitrary $t=1$ qubit errors. Similarly, with two levels of concatenation we have a guarantee that we can correct arbitrary $t=3$ qubit errors - no need for luck :-) Jan 26, 2021 at 16:20
• @AdamZalcman I thought the two-level Shor code has a code distance $d^2$ where $d=3$ so it can correct arbitrary $\lfloor (d^2-1)/2 \rfloor = 4$ errors? but your analysis only gives $3$, not the strongest condition. what happened? (see e.g. quantumcomputing.stackexchange.com/questions/31819/…) Mar 26, 2023 at 12:54

Shor's code is specifically designed to correct all possible single-qubit errors. There are some two-qubit errors that it can correct for (e.g. Pauli $$X$$ on one qubit and Pauli $$Z$$ on another). You will also be able to find specific combinations of multiple-qubit errors for which it can correct, but those will be the exception rather than the rule. Instead, if you want to protect against two-qubit errors, you employ different strategies - either code concatenation, or just find a different error correcting code with a larger distance.

• Thank you so much! That means if qubit 1 has an X error and qubit 2 has a Z error, the shor's code can correct it. Isn't it? Jan 29, 2021 at 17:58
• Yes. Any X error together with any Z error (including X and Z errors on the same qubit, i.e. a Y error) can be corrected in the 9-qubit Shor's code. Jan 29, 2021 at 21:45

The distance 3 Shor code can't correct 2 errors. There are pairs of errors that have symptoms that look identical to a single error, but require different corrections.

However, the distance 5 Shor code can correct 2 errors.

• The code can't correct all weight-2 errors, but it can correct some of them. For example it can correct $X_1X_4$. Also, the syndrome of $X_1X_4$ is different from the syndrome of every weight-1 error. I'm using stabilizer generators $Z_1Z_2$, $Z_2Z_3$, $Z_4Z_5$, $Z_5Z_6$, $Z_7Z_8$, $Z_8Z_9$, $X_1X_2X_3X_4X_5X_6$ and $X_4X_5X_6X_7X_8X_9$. Nov 30, 2023 at 3:16

Let me provide a sketch proof for why it cannot detect 2 qbit errors: Let's define two different 2 qubits errors one will be applied on the state 0 and the other on the state 1. If we show that $$E_1 0_s = E_2 1_s$$ This proves that Shor's encoding cannot correct 2 qubit errors.

Now we can find such errors:

$$E_1 = Z$$ on the first Qbit meaning $$Z \otimes I \otimes ... \otimes I$$

$$E_2 = Z$$ on the fourth and seventh Qbits meaning $$I \otimes I \otimes I \otimes Z \otimes I \otimes I \otimes Z \otimes I \otimes I$$

you can do the and you'll get that $$E_1 \neq E_2$$ however $$E_1 |0\rangle_s = E_2 |1\rangle_s$$