Categories: Quantum information.
A repetition code is a simple approach to error correction: to protect a bit , make two copies:
If a single-bit error occurs, e.g. , a majority vote resets the minority bit. Clearly, this does not protect against multi-bit errors, but that is usually not necessary.
In quantum computing, where error correction is much more important, repetition codes can also be used, albeit with some complications, as discussed below.
Bit flip code
Suppose that we want to detect errors in the following arbitrary qubit state :
For now, let us limit ourselves to detecting bit flips, where and get switched:
One way to defend against this is the quantum version of a classical repetition code:
In other words, a logical (written ) is represented by 3 physical qubits, and vice versa:
Such a transformation is easy to achieve with the following sequence of quantum gates:
So, a little while after encoding the state like that, a bit flip occurs on the 2nd qubit:
But now there is a problem: how do we detect this error? We could measure the state, but that would make it collapse, which is probably not what we want.
The trick is to use operators called stabilizers, in this case for example , where is identity and is the Pauli- gate. The 3-qubit basis states are its eigenvectors:
We could measure for , and if the eigenvalue is , we know that a bit flip has occurred, whereas if the eigenvalue is , there is maybe no error ( and are false negatives).
These false negatives are fixed by including another stabilizer , with these eigenvectors:
In which case and are false negatives. In other words, cannot detect if the 1st qubit was flipped, while cannot protect the 3rd qubit. But by using both, we know exactly which qubit was flipped thanks to the eigenvalues:
Where e.g. denotes that the 3rd qubit was flipped. The measurement outcomes on the last three rows are called error syndromes, and are obtained by a syndrome measurement.
Fortunately, we can measure and without affecting itself, by applying s to some ancillary qubits and then measuring those:
The two measurements, respectively representing and , yield if a bit flip definitely occurred, and otherwise. There is no entanglement, so the input is untouched.
Phase flip code
The above system protects us against all single-qubit bit flips. Unfortunately, that is not enough: qubits can also experience a phase flip:
How to detect that? If we want to protect against phase flips instead of bit flips, we can simply do the same as before, but along the -axis intead of the -axis:
Such that an arbitrary state is encoded as follows, by the circuit shown below:
A phase flip along the -axis corresponds to a bit flip along the -axis . In this case, the stabilizers are and , and the error detection circuit is as follows:
This system protects us against all single-qubit phase flips, but not against bit flips.
What kind of repetition code would we need if we want to detect both bit flips and phase flips? The most straightforward option is the Shor code. Starting from a phase flip encoding:
We add protection against bit flips by using a repetition code for each physical qubit:
This encoding is achieved by the following quantum circuit, which simply consists of the phase flip encoder, followed by 3 copies of the bit flip encoder:
We thus use 9 physical qubits to store 1 logical qubit. Fortunately, more efficient schemes exist.
The bit flip stabilizers and are applied on a per-block basis, like so:
Whereas the phase flip stabilizers and are applied to entire blocks at once:
- J.S. Neergaard-Nielsen, Quantum information: lectures notes, 2021, unpublished.
- S. Aaronson, Introduction to quantum information science: lecture notes, 2018, unpublished.