Ron Cohen

21 ביוני 2022

.

After :

Reading the previous article about the importance of Quantum Error Correction (QEC)

You are aligned with the pocket guide to the fundamentals that you need

And you understand how the source of the errors and how do we describe them

We can start and learn the most basic QEC scheme - **Repetition Code. **To those of you who fill familiar with repetition code, I recommend staying tuned for the next article about **a demonstration of coherent error correction using repetition code.**

The simplest thing to do when your grandfather can't hear you is to repeat what you say again and again:

Repetition Code is doing almost the same, just instead of saving the information in one qubit, it saves it on more qubits. It can **identify and correct** the state in case of an X/Z error (depending on the type of the code). Let's see how it's done in case of an __X-error correction code:__

We start with a qubit that contains the

**information**, which is the 2 probability coefficients of |0⟩ and |1⟩.**Entangle/share/encode**this information, using a**CNOT**gate, with 2 more qubits.Use two more ancilla qubits that are initialized to |0⟩, and

**will be measured to look for an error at the end**.Entangle/share the information of qubits

**1,2 with the first ancilla**.Entangle/share the information of qubits

**2,3 with the second ancilla**.**Measure**the state of the two ancillaries.

__In case there is ____no error____-__ the measurement will return (0,0) since, in every term of the superposition, each ancilla **flipped itself an even amount** of times (zero times in the |000⟩ term and two times in the |111⟩ term):

We can treat the encoded state as a new base for our computation, and we can call |000⟩=|0L⟩ (**Logical Zero**) and |111⟩=|1L⟩ (**Logical One**).

__In case there is ____1 X error____-__ for example in the 2nd qubit, the measurement will return (1,1) since, in every term of the superposition, each ancilla **flipped itself an odd amount of times** (one time in each term):

Now try it by yourself, what will be the result in case of an X error on the 1st qubit? And what if it will be on the 3rd one?

##### Distance of Codes

*"Hold on! there is only **one error **that happened in your examples!". *Yes, the maximum amount of errors that this code can handle is only one X error. There is a very intuitive way to understand why, look at this example of __2 X errors__:

Notice that since both qubits 1 and 2 flipped with the X error, the first ancilla actually flipped itself an even amount of times!

Flipped 2 times from the |000⟩ term that became |011⟩ because of the errors.

And zero times from the |111⟩ term that became |100⟩ because of the errors.

The **Distance of Quantum Code** (and also for classical codes) is defined to be the number of bits you have to flip, in order to switch between logical states. In our case, flipping 3 qubits is needed to switch between the 2 logical states |0L⟩=|000⟩ and |1L⟩=|111⟩. Therefore, we say that this is a **code with distance d=3**.

__How many errors a code with distance d can suffer?__ Just like in a democracy, since we are looking at the value with the majority in the state (the value that is shown a higher amount of times in the term) we can say that the maximum errors that are allowed with a logical error to happen are **less than half**: RoundDown(d/2) = RoundDown(3/2) = 1.

And what if it is higher? well, sometimes the opposition wins...

##### More Types of Errors

Dealing with Z errors (phase flip errors) can be done in a very similar code, that change's its base from eigenstates of Z (|0⟩ and |1⟩) into eigenstates of X (|+⟩ and |-⟩). Use the pocket guide to understand how can we change bases, and try to convince yourself that this code can handle Z errors in the same way:

And that Shor's Code which is the combination of the X and Z Repetition Code, can handle both X and Z errors:

The most interesting type of errors are **Coherent Errors**, which are more complicated than probabilistic Bit/Phase Flip, but a certain **superposition of both of them**! You will be surprised to discover in my next article, that **the same circuit** is used to treat coherent errors.

__Please vote:__

💡 If you learned anything new

🤔If it was all a piece of cake for you, but you still want to learn more about QEC

👏If you are professional ducks, that liked the explanation

👍If you just want to share your love :)

🙋 Please feel free to ask anything! 🙋

*Stay tuned...*