Lecture 16 of 22 · Original PDF pages 94–101

Quantum error correction

Read the complete lecture with original mathematical typography and diagrams preserved.

Math fidelity: The original PDF page is displayed as a high-resolution image so that equations, bra–ket notation, matrix layouts and circuit diagrams remain exactly as in the source. The expandable text layer is for searching and may not reproduce every mathematical glyph.

Source page 94

Direct link
Original lecture notes page 94 showing formulas and diagrams
Show extracted searchable text (mathematical glyphs may differ)
CPSC 519/619: Quantum Computation John Watrous, University of Calgary Lecture 16: Quantum error correction March 21, 2006 Any physical realization of a quantum computer is likely to be susceptible to errors (such as noise and inaccuracies)—we cannot build perfect physical systems and isolate them from their environments while still maintaining control over them. In this lecture and the next, we will discuss quantum error correction, which aims to protect quantum information against such errors. Classical repetition codes We will start with a very simple classical error correcting code, the 3 bit repetition code. Initially, just for the sake of having a concrete error model to think about, we will consider errors described by the binary symmetric channel. Here, we have a channel from Alice to Bob that carries 1 bit at a time. There is noise on the channel, so the bit sent by Alice is not always received correctly by Bob. Specifically, we suppose that the noise is parameterized by some real number p 1] that ∈[0,represents the probability of an error: if Alice sends the bit b, then Bob receives b with probability 1 and with probability p: −p ¬b b with probability 1 b −p 7−→ with probability p. ¬b Suppose that Alice needs to send a very important bit to Bob, and the two of them do not wish to accept that Bob will receive the wrong bit with probability p. What can they do? The answer is that they can use an error correcting code to decrease the probability of error. Possibly the simplest example of an error correcting code is the 3 bit repetition code. The encoding is simply to repeat the bit to be transmitted three times, and decoding is just taking the most frequently appearing bit (which is the same as computing the majority function). encoding decoding transmission (3 bits) 0 →000 abc →majority(a, b, c) 1 −→ →111 If 0 or 1 of the bits are flipped during transmission, then Bob will recover the correct bit sent by Alice. The probability of error shrinks from p to 3 p2 p3: −2 Pr[correct transmission] = (1 −p)3 + 3 (1 −p)2p = 1 −(3 p2 −2 p3). (Really this is only a reduction in error when p < 1/2. If p = 1/2, then the channel is useless for transmitting information, and if p > 1/2 then Bob can simply flip every bit which effectively replaces p with 1 −p.) Another way of explaining what this code does (without making any reference to the binary symmetric channel) is to say that it encodes 1 bit into 3 in a way that protects against one bit-flip. Of course much more efficient (and more complicated) error correcting codes exist—this is indeed a very simple code. 94

Source page 95

Direct link
Original lecture notes page 95 showing formulas and diagrams
Show extracted searchable text (mathematical glyphs may differ)
Protecting quantum information against bit-flips Can we encode quantum information in a similar way to the previous example? For instance, suppose Alice has a qubit in the pure state α β she wishes to send to Bob |ψ⟩= |0⟩+ |1⟩thatthrough a noisy quantum channel. We will have to discuss exactly what a noisy quantum channel is, but let us just think about this notion informally for now. Can something analogous to the repetition code be used? First let us note that it is not acceptable to encode |ψ⟩as |ψ⟩|ψ⟩|ψ⟩. In case Alice does notknow α and β, this would violate the no-cloning theorem. It is also not clear how Bob would decode. A more sensible analogue of the repetition code is to perform this encoding: α |0⟩+ β |1⟩7→α |000⟩+ β |111⟩. This encoding could be performed by the following simple circuit:  α β  |0⟩+ |1⟩  |0⟩  α |000⟩+ β |111⟩ |0⟩ Now, this encoding protects against some errors, but actually makes things worse for others as we will see. Let us start off with a type of error that it does correct against: bit-flip errors. Specifically, consider a quantum channel that is similar to the classical binary symmetric channel, again parameterized by a number p 1]: ∈[0, With probability 1 −p, the channel acts as the identity. With the remaining probability p, the channel applies a bit-flip error, meaning that the unitary operation 0 1 σx = 1 0 is performed. This channel can therefore be described by the admissible operation Φ(ρ) = (1 −p) ρ + p σxρσ† x = (1 −p) ρ + p σxρσx. Suppose that Alice encodes α β α β and sends the three qubits |0⟩+ |1⟩as |000⟩+ |111⟩,through the channel (one at a time). Imagine that it happens that the second qubit experiences a bit-flip error, but the first and third are unaffected. The pure state of the three qubits therefore becomes α |010⟩+ β |101⟩. How would Bob decode? Of course he does not know that the bit-flip occurred, and he does not want to measure the three qubits and compute the majority because that would ruin the qubit sent by Alice. Bob’s goal is to recover the qubit α β |0⟩+ |1⟩. 95

Source page 96

Direct link
Original lecture notes page 96 showing formulas and diagrams
Show extracted searchable text (mathematical glyphs may differ)
Consider the following circuit:    from Alice   |0⟩ M |0⟩ Consider what this circuit does in the present case (where a bit-flip error occurred on the second qubit): (α |010⟩+ β |101⟩) |00⟩= α |010⟩|00⟩+ β |101⟩|00⟩ 7→α |010⟩|10⟩+ β |101⟩|10⟩ = (α |010⟩+ β |101⟩) |10⟩. The measurement would give outcome 10 (with certainty). This output string is called the syn- drome; in this case it tells us that a bit-flip error occurred on qubit number 2 (or 10 in binary). So, Bob corrects the error by applying σz to qubit number 2: α |010⟩+ β |101⟩7→α |000⟩+ β |111⟩. Now, by applying the inverse of the encoding procedure he recovers α β |0⟩+ |1⟩: α |000⟩+ β |111⟩7→(α |0⟩+ β |1⟩) |00⟩. The same procedure works in the case that the first or third qubit experiences a bit-flip as well. To see this, consider the syndrome that would result from any classical state: Classical state Syndrome |000⟩ 00 |001⟩ 11 |010⟩ 10 |011⟩ 01 |100⟩ 01 |101⟩ 10 |110⟩ 11 |111⟩ 00 96

Source page 97

Direct link
Original lecture notes page 97 showing formulas and diagrams
Show extracted searchable text (mathematical glyphs may differ)
If no errors occur, or a single bit-flip occurs, the syndrome will correctly diagnose the errors (or lack of errors): No errors = 00. • ⇒Syndrome σx applied to qubit number j 2, = j (in binary). • ∈{1, 3} ⇒Syndrome In general, the decoding procedure is as follows. 1. If the syndrome is 00, do nothing. Otherwise, if the syndrome is j 2, (in binary), apply ∈{1, 3} a σx operation to qubit number j. 2. Apply the reverse of the encoding procedure. The entire code can be represented by a diagram as follows: α |0⟩+ β |1⟩ α |0⟩+ β |1⟩ |0⟩ |0⟩ |0⟩ |0⟩ |0⟩ |0⟩ The code corrects up to one bit-flip error. If two or more bit-flip errors occurred, there are no guarantees. . . You could analyze the precise behavior for the channel described above, but we will not do this. You would find (assuming p < 1/2) that the probability of a correct transmission would increase. (There are more precise technical ways of characterizing how close the output density matrix would be to |ψ⟩⟨ψ|, but this would be too much of a digression at this point in the course.) Other quantum errors Although the above code protects against bit-flips, this is not good enough in general. The problem is that there are different types of quantum errors. For example, a phase-flip error could occur: |a⟩7→(−1)a |a⟩ for a This error is therefore represented by the σz matrix: ∈{0, 1}. 1 0 σz = . 0 −1 The previous code does nothing to protect against phase-flips. For instance, we have α |000⟩+ β |111⟩7→α |000⟩−β |111⟩ 97

Source page 98

Direct link
Original lecture notes page 98 showing formulas and diagrams
Show extracted searchable text (mathematical glyphs may differ)
if any odd number of phase-flips occur. If, say, each phase-flip occurs with probability p 1/2), ∈(0,then the probability that an odd number occur is 3p(1 −p)2 + p3 > p. In other words, the code is making things worse rather than better. Suppose that we are interested in protecting against phase errors. We could change the encod- ing slightly in order to do this: α |0⟩+ β |1⟩7→α |+⟩|+⟩|+⟩+ β |−⟩|−⟩|−⟩. This is easily done by encoding α β α β like before, followed by a |0⟩+ |1⟩as |000⟩+ |111⟩justHadamard transform on each qubit. The effect of a phase-flip on the basis is similar to {|+⟩, |−⟩}the effect of a bit-flip on the standard basis: σz |+⟩= |−⟩, σz |−⟩= |+⟩. Therefore, Bob can easily correct against a phase-flip on a single qubit by first applying Hadamard transforms to all three qubits, and then correcting as before. For instance, if a phase-flip happens on qubit number 1, then the encoding α |+⟩|+⟩|+⟩+ β |−⟩|−⟩|−⟩ changes to α |−⟩|+⟩|+⟩+ β |+⟩|−⟩|−⟩. Bob applies Hadamard transforms to all three qubits to obtain α |100⟩+ β |011⟩. He then corrects just as before to obtain α β This process can be described by the |0⟩+ |1⟩.following circuit: α |0⟩+ β |1⟩ H H α |0⟩+ β |1⟩ H H |0⟩ |0⟩ H H |0⟩ |0⟩ |0⟩ |0⟩ As you would expect, although the new code protects against phase-flips, it fails to protect against bit-flips (and in fact makes matters worse for bit-flips just as happened previously for phase-flips). 98

Source page 99

Direct link
Original lecture notes page 99 showing formulas and diagrams
Show extracted searchable text (mathematical glyphs may differ)
Is there any way to protect against both bit flips and phase flips simultaneously? The answer is yes, but we need to concatenate the codes. In other words, we first apply the code that protects against phase-flips, and then encode each of the three resulting qubits using the code that protects against bit-flips. In other words, we will encode α β |0⟩+ |1⟩as α (|000⟩+ |111⟩)(|000⟩+ |111⟩)(|000⟩+ |111⟩) 2 √ 2 +β (|000⟩−|111⟩)(|000⟩−|111⟩)(|000⟩−|111⟩) . 2 √2 This is known as Shor’s 9 qubit code, because it was first discovered by Shor. A circuit for the encoding procedure looks like this: α |0⟩+ β |1⟩ H |0⟩ |0⟩ |0⟩ H |0⟩ |0⟩ |0⟩ H |0⟩ |0⟩ Now, how does Bob decode? Intuitively it is easy—he first imagines that the 9 qubits form 3 blocks of 3 qubits: block 1 block 2 block 3 Each block represents an encoding of one of the three qubits of the state α |+⟩|+⟩|+⟩+ β |−⟩|−⟩|−⟩, where the encoding is with respect to the bit-flip code. He corrects any bit flips as before, and decodes each block to give a total of three qubits (the first in each block). Assuming at most one bit-flip occurred in each block, the remaining 6 qubits will have all returned to the state |0⟩, andcan be discarded or re-used. When it is time to correct phase flips, the process is again as before. Sometimes it is convenient to separate the decoding phase into two parts—the first being to correct errors so that the original encoding is recovered, and the second being to transform the en- coding back to the original qubit (which is obtained by running the encoding procedure in reverse). In the present case this is done by correcting bit-flip errors in each block as above and then running a slightly modified procedure to correct phase errors: 99

Source page 100

Direct link
Original lecture notes page 100 showing formulas and diagrams
Show extracted searchable text (mathematical glyphs may differ)
H H H H H H H H H H H H H H H H H H |0⟩ M |0⟩ The measurement gives a syndrome that specifies, in binary, which of the three blocks has received a phase-flip error. Any phase-flip error can be corrected by applying a σz operation to any one of the three qubits in that block (or all three if you prefer). Fact. The Shor 9 qubit code can simultaneously protect against up to 1 bit-flip error in each block and any number of phase-flip errors contained in any one block. In particular, it can protect against any one of the four “errors” I, σx, σz, σxσz occurring on a single qubit. Example 17. Suppose the error σxσz occurs on qubit number four. The encoded state becomes α (|000⟩+ |111⟩)(|100⟩−|011⟩)(|000⟩+ |111⟩) 2 √ 2 +β (|000⟩−|111⟩)(|100⟩+ |011⟩)(|000⟩−|111⟩) . 2 √2 The bit-flip code correcting procedure is applied to each block. This results in three 2-bit syn- dromes, which in this case are 00, 01, and 00, respectively—the first block has no bit-flip errors, the second has a bit-flip error in position 1, and the third block has no bit-flip errors. The appropri- ate correction for each block results in the state α (|000⟩+ |111⟩)(|000⟩−|111⟩)(|000⟩+ |111⟩) 2 √ 2 +β (|000⟩−|111⟩)(|000⟩+ |111⟩)(|000⟩−|111⟩) . 2 √2 100

Source page 101

Direct link
Original lecture notes page 101 showing formulas and diagrams
Show extracted searchable text (mathematical glyphs may differ)
Now the phase-flip code correcting procedure is applied, and this gives a single 2-bit syndrome; you can check that the procedure above gives syndrome 10 in this case. This implies that a phase- flip happened somewhere in block 2. Applying a σz gate to any qubit in this block results in α (|000⟩+ |111⟩)(|000⟩+ |111⟩)(|000⟩+ |111⟩) 2 √ 2 +β (|000⟩−|111⟩)(|000⟩−|111⟩)(|000⟩−|111⟩) , 2 √2 which is the original encoding. Next time we will see how arbitrary errors on a single qubit can be corrected by this code (and more generally by any code that can correct the four errors represented by the Pauli matrices: I, σx, σz, σy = −iσxσz). 101

⊗ Circuit walkthrough: entanglement and measurement

The Hadamard gate prepares (|0⟩ + |1⟩)/√2 on the first qubit. The controlled-NOT then creates the Bell state (|00⟩ + |11⟩)/√2. Measuring both qubits in the computational basis produces correlated 00 and 11 outcomes, each with ideal probability 1/2. This example illustrates a circuit building block; it is not a complete implementation of the surrounding algorithm.

q₀q₁HMM
Show runnable Qiskit example
from qiskit import QuantumCircuit
from qiskit_aer import AerSimulator

qc = QuantumCircuit(2, 2)
qc.h(0)             # Superpose the first qubit
qc.cx(0, 1)         # Entangle both qubits
qc.measure([0, 1], [0, 1])
print(qc.draw(output="text"))
result = AerSimulator().run(qc, shots=1024).result()
print(result.get_counts())  # Approximately 00 and 11

Install qiskit and qiskit-aer locally to execute this code. The diagram is a static circuit illustration, not a browser-based simulator.

◈ QuantumVerse Hub