# Why does this error correcting code not work?

I was thinking of an error correcting code to correct 1-qubit errors. I came up with the following, which I guess has to have a mistake somewhere, but I am not able to find it.

The code is the same as the 9 qubit Shor code with one small difference. As in the Shor code, first we encode our qubit using the 3-qubit phase code. Then, instead of further encoding the 3 qubits against bit-flip errors, we only encode one of them, namely, the one that contains the state that we want to protect. The resulting code would be the following $$\small{|0\rangle \rightarrow |00000\rangle + |00001\rangle + |00010\rangle + |11100\rangle + |00011\rangle + |11101\rangle + |11110\rangle + |11111\rangle}$$

$$\small{|1\rangle \rightarrow |00000\rangle - |00001\rangle - |00010\rangle - |11100\rangle + |00011\rangle + |11101\rangle + |11110\rangle - |11111\rangle}$$

Thank you!

• Hi, Alvaro! Welcome to Quantum Computing SE. I've edited your question to replace >'s with \rangle's, as that's the appropriate notation while denoting kets. – Sanchayan Dutta Nov 3 '18 at 5:19
• There's a small typo with 111000 being 6 qubits instead of 5. – AHusain Nov 3 '18 at 8:42
• This is a bit like trying to keep your password secret by making three copies, putting one of them in a safe, and then leaving the other two just lying around on your desk. Then, when someone reads the copies on your desk, you say "but I put it in a safe!". – Craig Gidney Nov 3 '18 at 15:53

## 1 Answer

It’s worth noting that it’s not impossible that your code could work - there is a 5 qubit code that is capable of correcting a single error (look up the perfect quantum error correcting code, just beware that I seem to remember there was a slight error in one of the circuit diagrams in one of the original papers).

However, to see that your particular code does not work, consider applying an X gate on the last qubit. Logical 0 stays as logical 0, while logical 1 is returned as logical 1, but with an overall negative sign. In other words, that single X implements logical Z. So, when this gate is applied, there is no error that an be detected let alone corrected, but obviously the logical state is not preserved.