You are on page 1of 14

Quantum error correction | Random physics http://verga.cpt.univ-mrs.fr/pages/AQ-error.

html

Random physics (/)


Alberto Verga, research notebook

blog (/) | about (/pages/about.html) lectures (/pages/lectures.html)

Lectures (/pages/AQ-index.html) on advanced quantum mechanics

Error Correction
We know from the theory of open systems that the interaction with the environment destroys the intrinsic
coherence of the unitary evolution. In terms of quantum information the modification of the state of a qubit due
to different forms of decoherence, and not to the normal operation of the unitary gates, defines an error.
Protecting the quantum channels from the effects of noise is the goal of error correction codes. For instance, we
may consider an imperfect channel that introduces a qubit flip with probability p , leading to the mixed state

f (|ψ⟩⟨ψ|) = (1 − p)|ψ⟩⟨ψ| + pX|ψ⟩⟨ψ|X ,

from an arbitrary initial one qubit state |ψ⟩. Schematically,

1 of 14 1/21/22, 13:26
Quantum error correction | Random physics http://verga.cpt.univ-mrs.fr/pages/AQ-error.html

The flip error is related to the kraus operator M = √p


‾X ; therefore, if the initial state is |ψ⟩, the channel output
is ρ and the flip error probability is

pf = 1 − ⟨ψ|ρ|ψ⟩ = αp, α = 1 − ⟨ψ|X|ψ ⟩2

is proportional to p . An error correction code is a strategy to reduce the error probability, and ideally, to detect
and correct the errors.

The idea of quantum correction codes is to use entanglement of the information carrying qubits (the message)
with supplementary qubits, and to use a set of local operators whose action on the total space vectors, allow the
identification of the modified qubits, without altering the original message subspace.

As an example, to correct errors due to spin flips, we start by creating the entangled state:

(a|0⟩ + b|1⟩) ⊗ |0⟩ ⊗ |0⟩ → |iL ⟩ = a|000⟩ + b|111⟩

using the circuit

where |ψ⟩ = a|0⟩ + b|1⟩ is the “message” state, and |iL ⟩ ∈ L is then the logical input state, and L the
logical hilbert space.1 In the input state |iL ⟩ the message qubit states |0⟩ and |1⟩ are encoded using the
logical qubits:

|0L ⟩ = |000⟩, |1L ⟩ = |111⟩ ,

which encodes each original qubit into three qubits. This redundancy allows the reduction of the error

2 of 14 1/21/22, 13:26
Quantum error correction | Random physics http://verga.cpt.univ-mrs.fr/pages/AQ-error.html

probability (see exercise), as in the classical error correction codes using majority voting. The qubits building
the logical states are the physical qubits processed in the computer. The set {|0L ⟩, |1L ⟩} is our first example of
a quantum code space.

Flipping one qubit of the encoded state |iL ⟩, can lead to one of the following three output states:

|iL ⟩ → |o1 ⟩ = a|100⟩ + b|011⟩

if it is the qubit the one that is reversed,

|iL ⟩ → |o2 ⟩ = a|010⟩ + b|101⟩

if qubit two is reversed, and

|iL ⟩ → |o3 ⟩ = a|001⟩ + b|110⟩

if it is qubit three. Therefore, considering that it is also possible that no qubit at all is reversed, we have four
different output states. A method to identify these four possibilities form the information contained in the
logical state, is to apply successively the operators

Z1 Z2 = Z ⊗ Z ⊗ 12

and

Z2 Z3 = 12 ⊗ Z ⊗ Z

to the output state and to record the eigenvalue:

3 of 14 1/21/22, 13:26
Quantum error correction | Random physics http://verga.cpt.univ-mrs.fr/pages/AQ-error.html

Error correction code

State Z1 Z2 Z2 Z3 Apply

|i⟩ + + 12

|o1 ⟩ − + X1

|o2 ⟩ − − X2

|o3 ⟩ + − X3

We observe that the operators ZZ check the parity of the encoded states. The set of their eigenvalues, when
applied to the faulty states, is called the error syndrome. In order to detect the ±1 eigenvalues of the ZZ gates,
we may use the circuit of Ex. 1 (/pages/AQ-circuit.html), in the circuits lecture, in which the ancilla controlled
unitary operator, put in between two hadamard gates, has precisely eigenvalues ±1. A complete implementation
of the error correcting code is given by the circuit:

4 of 14 1/21/22, 13:26
Quantum error correction | Random physics http://verga.cpt.univ-mrs.fr/pages/AQ-error.html

We distinguish three steps to achieve error correction: (i) a preparation step in which the initial state is encoded,
followed by (ii) the syndrome step in which a set of gates is used to detect the errors, and (iii) a final correction
step. The correction step may use information provided by the measurement of the ancilla qubits (syndrome
measurement), or might be implemented by a set of unitary multi-controlled cnot gates to obtain a self-
correction algorithm.

An interesting observation is that applying the two operators Z1 Z2 and Z2 Z3 , to the basis vectors of the
extended  ⊗3 hilbert space, we find that the set {|000⟩, |111⟩} remains unchanged; this invariant set is the
quantum code to correct spin flip errors.

If instead of a spin flip, the error was a phase flip:

|ψ⟩ = a|0⟩ + b|0⟩ → a|0⟩ − b|0⟩ ,

we may use an analogous strategy to encode |ψ⟩ into a state |iL ⟩,

|ψ⟩ → |iL ⟩ = a|0L ⟩ + b|1L ⟩

using the quantum code:

|0L ⟩ = |+ + +⟩, |qL ⟩ = |− − −⟩ ,

where |±⟩ are, as usual, the eigenvectors of X . The idea behind this encoding is that the phase error is related to
a Z kraus operator, instead of the flip X , and the transformation:

Z = HXH

transform then a flip into a phase error; as a consequence we also transform the basis vectors:

|+⟩ = H|0⟩, |−⟩ = H|1⟩ .

In 1995 Shor demonstrated that the code:2

5 of 14 1/21/22, 13:26
Quantum error correction | Random physics http://verga.cpt.univ-mrs.fr/pages/AQ-error.html

1
1/2 (
|000⟩ + |111⟩)
⊗3
|0⟩ → |0L ⟩ = ,
8
1
1/2 (
|000⟩ − |111⟩)
⊗3
|1⟩ → |1L ⟩ = ,
8
allows the correction of any one qubit error. If more than one qubit is modified the redundancy leads to a
probability of error which is the product O(p2 ) of one error probabilities.

In summary, we showed a procedure to encode a message qubit into a logical qubit in an extended hilbert space,
allowing an arbitrary state |ψ⟩

|ψ⟩ → |iL ⟩ ,

to be manipulated through its logical counterpart |iL ⟩, in such a way that the errors (|iL ⟩) (the noisy channel),
can eventually be corrected. A quantum code is then a well chosen subspace of the expanded hilbert space, such
that its vectors are not affected by the errors, implying that the information encoded within this subspace can be
recovered even after being corrupted by a specific set of discrete errors.

Error correction conditions


We saw that the spin flip error was related with the X kraus operator; similarly, the phase flip error is related
with the Z pauli matrix, and the more general depolarizing error, which combines flips, phase and amplitude
changes, is related with the set of kraus operators:

p
‾‾ p
‾‾ p
‾‾
√3 √3 √3
M0 = √‾1‾‾‾
− p‾12 , M1 = X, M2 = Y, M3 = Z.

Generally, errors E on a one qubit channel can be expressed in the pauli matrices basis:

E ∈ {12 , X, Y, Z}

the pauli group (we may add the constants {±1, ±i} to close the products); this is a simple consequence of the
fact that any operation on twodimensional hilbert vectors can be decomposed as a linear combination of this set.

6 of 14 1/21/22, 13:26
Quantum error correction | Random physics http://verga.cpt.univ-mrs.fr/pages/AQ-error.html

A general error operator En , in a N dimensional space, is a tensor product of pauli matrices (including the
identity) acting on the set of N qubits. Therefore, a schematic way to write the action of the environment is,


|ψ⟩|e⟩ → En |ψ⟩|en ⟩ ,
n

where |e⟩ refers to the initial environment state, |en ⟩ are the environment related states; the sum spans the set
of possible errors.

Then an error n transforms |ψ⟩ into En |ψ⟩ ; correction of this error consists in transforming back En |ψ⟩ into
|ψ⟩, which amounts at correcting X , Z and XZ type errors: the linear nature of quantum states leads to the fact
that correcting spin and phase errors will correct all errors (even such for which the mixed state is subject to
nonunitary relaxation).

A quantum code  = {|iL ⟩, i = 0, 1, …} allows correction of a set {E1 , E2 , …} of errors if the code words
|iL ⟩, |jL ⟩ ∈  satisfy,

⟨iL |E1 E2 |jL ⟩ = 0

and

⟨iL |E1 E2 |iL ⟩ = ⟨jL |E1 E2 |jL ⟩ .

The first condition ensures discrimination between errors: the overlap of two errors over two different code
words vanishes; the second condition says that the overlap of two errors on each word is independent on the
code word. Then, even if two erroneous versions E1 |iL ⟩ and E2 |iL ⟩ of the same word may overlap, as long as
this overlap is the same for all code words, the code can correct the set of errors.

Let us denote R the recovery procedure:

R|a1 ⟩E1 |iL ⟩ = |A1 ⟩|iL ⟩

where |a⟩ and |A⟩ are the initial and final ancilla states; R is a unitary operator acting on the whole code space,
including the message, noise and ancilla systems. We have, R|a2 ⟩E2 |jL ⟩ = |A2 ⟩|jL ⟩

7 of 14 1/21/22, 13:26
Quantum error correction | Random physics http://verga.cpt.univ-mrs.fr/pages/AQ-error.html

⟨iL |E1 ⟨a1 |R† R|a2 ⟩E2 |jL ⟩ = ⟨A1 |A2 ⟩⟨iL |jL ⟩ = 0

and also

⟨iL |E1 ⟨a1 |R† R|a2 ⟩E2 |jL ⟩ = ⟨iL |E1 E2 |jL ⟩ ,

(for the case ⟨a1 |a2 ⟩ = ⟨a|a⟩ = 1, which must be included as a possible recovery case) leading to the first
condition. Similarly, the second condition results from,

⟨iL |E1 ⟨a|R† R|a⟩E2 |iL ⟩ = ⟨iL |E1 E2 |iL ⟩ = ⟨A1 |A2 ⟩ ,

which is independent of |iL ⟩, thus, we can replace |iL ⟩ by another |jL ⟩, everywhere.

The stabilizer code


A stabilizer is an operator such that, when applied to a given state |ψ⟩ in the logical hilbert space L , leaves the
state invariant

g|ψ⟩ = |ψ⟩ ,

|ψ⟩ is then an eigenvector of g with eigenvalue 1. We observe that two such operators g1 , g2 :

g1 |ψ⟩ = |ψ⟩ , g2 |ψ⟩ = |ψ⟩ ,

commute g1 g2 = g2 g1 , and their product g = g1 g2 is also a stabilizer. Therefore, we can define the
generators set

 = ⟨g1 , g2 , …⟩
= {gn ∣ gn |ψ⟩ = |ψ⟩, [gn , gm ] = 0, ∀(n, m)}

of the stabilizer group  . The important point is that  defines a set of states |iL ⟩, the code states, as the
invariant set under the action of the given gn . Therefore, instead of using the code states, which depend on 2N
parameters for N qubits, we use the generators of the stabilizer group, whose size is essentially of the order of
N.

8 of 14 1/21/22, 13:26
Quantum error correction | Random physics http://verga.cpt.univ-mrs.fr/pages/AQ-error.html

More precisely, we define , the code space, as a subset of the logical hilbert space  ⊂ L such that:

 = {|iL ⟩ ∈ L ∣ gn |iL ⟩ = |iL ⟩, ∀n} .

Error correction using the stabilizers results form the fact that, either the error operator E commutes with
the stabilizer

gE = Eg

or it anti-commutes

gE = −Eg .

Remember that pauli matrices commute or anti-commute, e.g. X1 X2 − X2 X1 = 0 , X1 Z1 + Z1 X1 = 0 ).


Correcting an error reduces then to the detection of the eigenvalue ±1, as we found in the case of the spin
flip example:

gn E|ψ⟩ = ±Egn |ψ⟩ = ±E|ψ⟩ .

If the error is in the set of stabilizers, its eigenvalue is +1, correction is the identity, since these errors do not
change the logical basis. If instead, the eigenvalue is −1, we may identify the error through the measurement of
the generator gn , the observables in the stabilizer space. In the case of the spin flip code, measurement of Z1 Z2
and Z2 Z3 , gave us the necessary information to apply X to the correct qubit.

More specifically, consider a message space of K dimensions and a code space of N > K dimensions. A set of
independent observables g of dimension N − K should be enough to detect the errors (syndrome extraction).
Using the formalism of the previous section, we note that a noisy state has the form:


|0A ⟩ En |iL ⟩|en ⟩
n

(the first term corresponds to the ancillary space, of dimension N − K ). To extract the eigenvalue associated to
the generator gn , we may follow the steps (see the circuit above):

9 of 14 1/21/22, 13:26
Quantum error correction | Random physics http://verga.cpt.univ-mrs.fr/pages/AQ-error.html

put the ancilla in the |+⟩ state by applying the hadamard gate H ,
use the ancilla qubit to control the action of the stabilizer gn on the logical space,
apply the hadamard gate to the ancilla to put it in the state:

1 + sn 1 − sn 1±1
|0⟩ + |1⟩ = |bn ⟩ , bn = ,
2 2 2
where sn is the eigenvalue of gn .

The string of N − K bits bn = 0, 1 allows the syndrome extraction,

|bn ⟩(En |iL ⟩)|en ⟩ → (En̄ |iL ⟩)|en̄ ⟩ ,


∑ ∑
|0A ⟩ En |iL ⟩|en ⟩ →
n n

where the first step is the syndrome extraction procedure, and the second the ancilla measurement projecting the
message state to the corresponding error En̄ |iL ⟩ state. Note that this projected state is disentangled, applying the
operator En̄† to it we recover the original state |iL ⟩ (or any superposition of logical states).

The Steane code3


Quantum codes are labeled by the number of qubits N in the code words, the number of original qubits K < N ,
and the minimal hamming distance between two code words d : [[N, K, d]] . The hamming distance between two
binary strings of length N is the number of different bits (d(01101, 01001) = 1 ), the weight of a string b is its
number of ones wt(b) = d(0, b) ; note that d(b1 , b2 ) = wt(b1 + b2 ), where the addition is in ℤ2 .

The Steane code [[7, 1, 3]] , derived from the classical hamming (https://en.wikipedia.org/wiki/Hamming(7,4))
(7, 4, 3) code, encodes one qubit K = 1 into seven N = 7 , and can correct any one qubit error
t = (d − 1)/2 = 1; its two logical words are:

1
|0L ⟩ = (|0000000⟩ + |1010101⟩ + |0110011⟩ + |1100110⟩+
81/2
|0001111⟩ + |1011010⟩ + |0111100⟩ + |1101001⟩

and

10 of 14 1/21/22, 13:26
Quantum error correction | Random physics http://verga.cpt.univ-mrs.fr/pages/AQ-error.html

|1L ⟩ = X1 X2 X3 X4 X5 X6 X7 |0L ⟩ .

The total dimension of the logical hilbert space is 27 ; the seven qubits might be subject to individual errors,

E ∈ {X1 , … , X7 , Z1 , … , Z7 , X1 Z1 , … , X7 Z7 } .

However, only the two logical codewords are important, because their superposition carries the message
information (that depends on only two amplitudes |ψ⟩ = a|0⟩ + b|1⟩ → |iL ⟩ = a|0L ⟩ + b|1L ⟩ ∈ L ). This
means that we can shrink the number of relevant states, and this can be accomplished by using a set of six
stabilizers of the logical qubits:

g1 = 111XXXX, g2 = X1X1X1X, g3 = 1XX11XX,


g4 = 111ZZZZ, g5 = Z1Z1Z1Z, g6 = 1ZZ11ZZ,

the number of stabilizers is found observing that 27−6 = 2, which corresponds to the dimension of the invariant
subset of 27 states under the action of  = ⟨g1 , … , g6 ⟩ . Remark that since any two stabilizers commute, they
divide the 27 hilbert space into 26 subspaces of dimension 2. In general, the number of stabilizers is such that
N − || = K , the number of encoded qubits (or the number of original qubits). Note that the operator
X̄ = XXXXXXX exchange the two logical states:

X̄ |0L ⟩ = |1L ⟩

and Z̄ = ZZZZZZZ , distinguishes between these two states by their phase:

Z̄ |0L ⟩ = |0L ⟩, Z̄ |1L ⟩ = −|1L ⟩ .

The encoding of the logical states is:

1
|0L ⟩ = 1/2
(1 + g1 )(1 + g2 )(1 + g3 )|0⟩⊗7
8
The circuit for error syndrome is:

11 of 14 1/21/22, 13:26
Quantum error correction | Random physics http://verga.cpt.univ-mrs.fr/pages/AQ-error.html


HA Λn (gn )HA
n=1

where we introduced the notations HA for the hadamard gates applied to the 6 ancilla qubits,

HA = H ⊗6 ⊗ 17 ,

and the controlled gate operator O with control n and target the logical space,

Λn (O)|b⟩|iL ⟩ = |b1 … b6 ⟩Obn |iL ⟩ ,

where |b⟩ is an ancilla basis state b = b1 … b6 , bn = 0, 1. The measurement of the ancilla space identifies the
error for subsequent correction.

Exercises
1. Apply the flip channel f , conveniently generalized to 3 qubits, to the |i⟩ = a|0L ⟩ + b|1L ⟩) . The
resulting state ρ contains 8 terms corresponding to the 8 flips. Perform a projective measurement
σm = Pm ρPm (m = 0, 1, 2, 3), with,

P0 = |000⟩⟨000| + |111⟩⟨111|, P1 = X1 P0 X1 , P1 = X1 P0 X1 , P1 = X1 P0 X1 , P1
= X1 P0 X1 ,

where each Xn applies to the n = 1, 2, 3 qubit, respectively; note that σm is not normalized; thus, its trace
gives the corresponding probability. What is the meaning of Pm ? Calculate the (non normalized) state:

σ̄ = σ0 + X1 σ1 X1 + X2 σ2 X2 + X3 σ3 X3

and compute the error probability (which is the sum of probabilities for the four cases, just contained in
σ̄ )

pf = 1 − ⟨i|σ̄ |i⟩

12 of 14 1/21/22, 13:26
Quantum error correction | Random physics http://verga.cpt.univ-mrs.fr/pages/AQ-error.html

and show that it is

pf = p2 (3 − 2p)(1 − ⟨i|X1 X2 X3 |i⟩ .

Therefore we reduced the flip error in the final state to second order in p .

Remark. The generalization of the one qubit channel  to N qubits is  ⊗N . The matrices
X1 , X2 , X3 commute.
2. Replace the measurement of the ancilla qubits in the circuit correcting one flip errors by a unitary
operation in order to obtain a self-correcting algorithm. The idea is to insert two controlled cnot gates and
a multi-controlled cnot.

3. Show that the set,

{Z1 Z2 , Z2 Z3 , Z4 Z5 , Z5 Z6 , Z7 Z8 , Z8 Z9 ,
X1 X2 X3 X4 X5 X6 X7 , X4 X5 X6 X7 X8 X9 }

stabilizes the Shor code.

4. Find the equivalent of the pauli and cnot gates acting on the Steane logical states |0L ⟩ and |1L ⟩. For
example, X → X̄ = X ⊗7 , since X̄ |0L ⟩ = |1L ⟩. For the cnot case, consider two logical (seven qubit)
states |0L ⟩ and |1L ⟩. Give your answer in the form of a circuit.

Notes
1. Sometimes the original, uncoded, qubits are called “logical”, and the encoded qubits “physical”; we adopt
here the convention that the unecoded qubits are the “message” or “original” ones, while the labelled “ L ”
states are the “encoded” or “logical” qubits. Note however that the number of encoded qubits corresponds
to the number of original ones, generally denoted by K . We denote N the dimension of the encoded
qubits. ↩

2. Shor, P. A., Scheme for reducing decoherence in quantum computer memory, Phys. Rev. A 52, R2493

13 of 14 1/21/22, 13:26
Quantum error correction | Random physics http://verga.cpt.univ-mrs.fr/pages/AQ-error.html

(1995) ↩

3. Steane, A. M., A Tutorial on Quantum Error Correction, (Proceedings of the International School of
Physics “Enrico Fermi”, 2006) .pdf (/pdfs/Steane-2006.pdf) ↩

Archives (/archives.html) Pelican (https://github.com/getpelican/pelican) /


Categories (/categories.html) Tags (/tags.html) (https://getbootstrap.com) /
(http://creativecommons.org/licenses/by-nc/4.0/) CC
4.0

14 of 14 1/21/22, 13:26

You might also like