# Errors while encoding (3 qubit code)

I am relatively new to quantum error correction, so apologies if this question appears is naive.

In the three qubit code, there seems to always be the assumption that errors occur after encoding the logical qubit, as illustrated by figure 1 in this paper. However, in the introduction to quantum error correction in the qiskit textbook, the first basic simulation of noise involves $$p_{gate}$$, the probability of a bit flip error on any gate operation.

Thus, if an error does occurs during encoding, is there anything that can be done about this, or is this just a limitation of the three qubit code?

• as far as I know there's nothing you can do if the error occurs in the encoding part. This is similar to the classical case and is true for all codes. Sep 15, 2022 at 17:23
• It's worth noting that a lot of intuition on quantum coding comes from classical coding, and classical coding is generally used for transmitting information, e.g. with WiFi or 5G. So in that case you really can perfectly encode and perfectly decode information, because your computer is basically perfect, it's just the transmitter that's not great. But obviously, this is not a realistic setting for many quantum devices. Sep 17, 2022 at 21:23

This is the key distinction between codes for communication and codes for computation.

In a communication code you assume the sender and receiver are amazing and the only thing that matters is noise during transmission from one to the other. So error during encoding and decoding is irrelevant. In a computation code there is nothing amazing to rely on, all quantum operations are potentially faulty, so you also need to worry about errors during encoding.

It's actually a bit weird to even talk about "encoding" in the context of a computational code. You instead think about initializing. For example, you want to prepare the logical $$|0\rangle$$ state. This is similar to the encoding problem, but it doesn't have to work for any state it just has to work for that one state, and this is often very important to things working.

• In the "communication" setting, I wouldn't say that errors in encoding/decoding are "irrelevant"...they're very relevant and will break the system completely...so they're not allowed. I don't think the "compute" setting is much different : if you have an error in the encode (or initialization part if you prefer) then you never get to the codespace to begin with...so all the properties of the code (like distance, ...) don't apply to whatever state you get. So what can you do if you have and error in the initialization step? Sep 30, 2022 at 23:40

The assumptions you choose depends on your noise model of course. You can consider a variety of noise models that make sense.

A common noise model (which is different from the Steane paper but I think equivalent to the qiskit one) is to consider adding some kind of noise channel after any single operation, such as a gate, or preparing a state.

For example after any single qubit gate you apply a noise channel to that qubit, and if you apply a CNOT, you might assume that the "target" receives an error, but the "control" part is left alone. In this noise model, you could imagine that errors not only occur during encoding, but decoding and even preparing your $$|0\rangle$$ state ancillas.

In the 3 qubit code code and above noise model, your "correct" step can recover from any error that exists on a single qubit. In the encode step, you might see an error in either CNOT, or an error on preparing the $$|0\rangle$$ state. The encode step doesn't propagate errors as written, because one error on any gate results in one error out of the three qubits.

This is not true if, say at the beginning we apply a gate to the first qubit. If this gate were to have error, then the CNOT gates would spread the error to all qubits.

In general though, you have to make this consideration because the simplest way of implementing an error correction algorithm may introduce more errors than you can correct for.