L27 Shor's 9 Qubit Code I
Overview
Hiu-Yung Wong develops the three-qubit phase-flip repetition code, showing how encoding, syndrome measurement, and conditional correction work under the assumption of at most one phase error. He connects the circuit to stabilizer generators and the identity HZH = X, then begins constructing Shor’s nine-qubit code by nesting three-qubit bit-flip blocks inside a phase-flip encoding.
Key takeaways
- The three-qubit phase-flip code encodes |0_L> as |+++> and |1_L> as |--->, and can correct one Z error under its stated noise assumption.
- Hadamard conjugation maps phase errors to bit errors through HZH = X, allowing the phase-flip code to reuse bit-flip syndrome and recovery logic.
- The phase-flip code’s stabilizer generators are adjacent-pair checks, X1X2 and X2X3; their measured eigenvalues form the syndrome without directly measuring the logical state.
- Shor’s nine-qubit code nests three-qubit bit-flip repetition blocks inside a three-qubit phase-flip code, producing logical states from three factors of |000> ± |111>.
- The encoding sequence creates repetition correlations across Q0, Q3, and Q6, applies Hadamards to those qubits, then uses them as controls to fill out the three physical-qubit blocks.
Chapters
- The logical basis is encoded as |0_L> = |+++> and |1_L> = |--->, rather than the bit-flip code’s |000> and |111>.
- Starting from (alpha|0> + beta|1>)|00>, two CNOT gates create alpha|000> + beta|111>.
- Applying Hadamard gates to all three qubits converts the state to alpha|+++> + beta|--->.
- The code’s stated noise model allows one Z error on any of the three data qubits, or no error.
- Two ancilla qubits collect syndrome information through CNOT-based checks, followed by measurement.
- A classical controller uses the syndrome to choose a correction, with Hadamard gates returning the data to the phase-flip code basis.
- The sequence H, error, H maps a Z error to an X error because HZH = X.
- In the transformed basis, the phase-flip code behaves like the familiar three-qubit bit-flip repetition code.
- This equivalence lets the same syndrome-extraction logic detect which of the three qubits was affected.
- After syndrome measurement in the bit-flip basis, the correction is an X on the identified qubit.
- Hadamard gates convert that correction back to Z in the original phase-flip basis.
- The resulting recovery operations are IIZ, IZI, or ZII for errors on the third, second, or first qubit, respectively.
- The code’s generators are X3X2I and IX2X1, equivalent to adjacent-pair X checks.
- Both |+++> and |---> have eigenvalue +1 under each generator, so their superpositions remain in the code space.
- The generators preserve the encoded state while making error information measurable through their eigenvalues.
- A syndrome records the measured eigenvalues of the stabilizer generators after an error.
- With no error, both checks return +1; the example IIZ produces +1 for X3X2I and -1 for IX2X1.
- The changed eigenvalue identifies an error without requiring a direct measurement of the encoded logical state.
- Wong traces how an ancilla initialized in |0> responds to a data qubit after a possible Z error and a Hadamard.
- The identity HZH = X explains why a phase error becomes a bit flip that the CNOT-based measurement can reveal.
- The check circuit couples ancillas to neighboring data qubits so the measured results distinguish single-qubit error locations.
- Each syndrome bit checks a neighboring pair, corresponding to the generators X3X2I and IX2X1.
- A pair with matching phase-basis signs yields syndrome 0, while a mismatch yields syndrome 1.
- Under the single-error assumption, the two check results distinguish errors on the first, middle, or last data qubit.
- The syndrome checks observe only two-qubit relationships, so decoding relies on the assumption that no more than one data qubit has an error.
- Wong maps a first-qubit phase error to a change in the check involving that qubit, while the middle-qubit error affects both neighboring checks.
- The lecture notes that bit-flip and phase-flip errors cannot both be handled by this three-qubit code alone.
- Shor’s code uses nine physical qubits and forms a superposition of eight computational-basis terms per logical codeword.
- The logical zero is built from three copies of (|000> + |111>)/sqrt(2), giving an overall normalization of 1/(2sqrt(2)).
- The logical one uses three copies of (|000> - |111>)/sqrt(2), changing the relative signs while preserving the nested structure.
- Wong labels the nine physical qubits from Q8 down to Q0 and applies an example bit flip to Q4.
- Q4 belongs to the middle three-qubit block, covering Q5, Q4, and Q3.
- The familiar bit-flip repetition-code checks can detect the altered block because its ideal patterns are |000> and |111>.
- The encoding begins with the logical state alpha|0> + beta|1> and eight additional qubits initialized to |0>.
- CNOTs from Q0 to Q3 and Q6 create alpha|000> + beta|111> across positions Q0, Q3, and Q6.
- Those three qubits act as the controls for the three separate repetition-code blocks.
- Hadamard gates are applied to Q0, Q3, and Q6, converting |0> to |+> and |1> to |->.
- The logical branches become alpha|+++> + beta|---> across the three block-control qubits.
- This step embeds the three-qubit phase-flip code into the larger nine-qubit construction.
- Each of Q0, Q3, and Q6 controls CNOTs targeting the other two qubits in its three-qubit block.
- The CNOTs turn each outer |+> or |-> component into a repetition block with correlated |000> and |111> terms.
- The qubits are regrouped by position after the gates, so Wong emphasizes tracking Q8 through Q0 carefully.
- Expanding the control-gate action produces the two encoded branches built from three |000> ± |111> blocks.
- The resulting logical states match the nine-qubit codewords introduced earlier, with relative signs distinguishing logical zero from logical one.
- The derivation stops after encoding; bit- and phase-error correction for the full Shor code is left for the next class.
Transcript excerpt
0:07 We have this register for E274. Last time we have talked about free cubit uh bit flip code. Right. So here I would like to talk about phase flip. Um we are doing this because our purpose is just to keep immerse ourself in the concept and try different things and hopefully we can get an idea on how quantum error correction work under the hood right uh so again I said this won't be a part of the exam in the sense that you don't need to memorize everything or put in cheat sheet but what we are doing here step by step are just the fundamental So in principle if I guide you in the exam you should be
0:54 able to go through this each gate right and give the answer. So the most important thing here when we talk about phase flip code we need to talk about encoding. So what exactly are we encoding now? So if you remember we have a logical cubit and in the bit flip we encode it by what? Do you remember? We have three bits for bit. How do we encode it? When we encode it we say that we encode it with a larger space with free cubit. Right? So how do we represent a logical cubit? >> 0 0 exactly. But here what we're going
1:46 to do is encode it as plus+ plus. Okay. So plus+ plus is the logical zero and - - is logical one. Why? Because it works. Okay. So let's see how we encode it. This is not difficult. If we look at the state, we start with uh this state. This is s 0 0 right? In other words, it is alpha 0 plus beta 1 tensor product 0 0. Right? At this
This is the start of the transcript. Save this video free for the whole transcript, searchable and time-coded.
In this course
Related notes
Summary, takeaways, and chapters were generated by AI from the video's transcript and may contain errors. The video belongs to its creator, Quantum Computing, TCAD, Semicond by Hiu-Yung Wong.