Skip to content
Tushar Pandey

Step 6 of 8

Lesson 3: Preparing a T state

Quantum Error Correction in Practice, part 2: Computing with logical qubits

Read

H and T on q0 make the T state on one physical qubit; the encoder from lesson 1 carries it over as |T⟩⁠L. It is read in X (and Y): ideally 1 comes up in 14.6% of shots.

Patches and gate layers

X check Z check fired undetermined gate XL, ZL = +1

What this lesson shows

H and then T on q0 make the T state on one physical qubit. The lesson 1 encoder carries it into the patch as |T⟩⁠L. Neither X⁠L nor Z⁠L holds now, because the T state is an eigenstate of neither. To read X⁠L, H on all nine qubits swaps X and Z: the checks swap type and all eight still hold. Measuring every qubit in Z then gives X⁠L, which ideally reads 1 in 14.6% of shots. Lesson 4 teleports this state to another patch.

Things to try

  • Step with the arrow keys on the slider and watch the state panel go from q0 = |+⟩ to q0 = T|+⟩ to |T⟩⁠L.
  • Stop on the step H on A, the readout rotation: the checks swap type and all eight still hold.
  • In the Simulated results table, compare the X and Y rows. Both have the ideal 14.6%; the other columns come from a noisy simulation in Qiskit Aer. A patch read in Y has no checks to read, so its check columns show n/a.

The ideal logical circuit

Step by step

  1. prepare A. H puts q0 in |+⟩, as in lesson 2.
  2. prepare A. T adds a pi/4 phase to |1⟩: q0 now holds the T state.
  3. encode A. The lesson 1 encoder carries the T state over as |T⟩⁠L. Neither X⁠L nor Z⁠L holds: the T state is not an eigenstate of either.
  4. H on A. H on all nine qubits of A swaps X and Z: the checks swap type, and all eight still hold.
  5. measure. Every qubit is measured in Z. Only the checks that are Z parities can still be read. After the rotation these bits read X⁠L: ideally 1 in 14.6% of shots.

Results

How to read this table

Every shot ends with all data qubits measured, and the checks are worked out from those bits. Clean shots only gives the rate over the shots in which no check fired. Corrected by the code is the share of shots in which checks fired and a table of single errors named a qubit to flip back; After correction is the rate over all kept shots once that flip is made. Discarded by the checks is the share of shots whose fired checks are not in the table at all: those shots are dropped. No correction reads the raw bits of every shot. Bare qubits runs the same logical circuit with one unprotected qubit in place of each patch: no encoder and no checks. Each rate comes with one binomial standard error.

A patch read in Y has no checks to read, so its row gets no correction: After correction equals No correction, and the check columns show n/a. The bare rows prepare the T state on one qubit with no encoder and land within about one standard error of the ideal 14.6%. The encoded X row does too; the encoded Y row, with nothing to correct it, is the furthest from the ideal. The encoder is the one from lesson 1, which a single faulty CNOT can defeat.

Cite this lesson T. Pandey, "Lesson 3: Preparing a T state", Quantum Error Correction in Practice (2026), https://pandey-tushar.com/qec-in-practice/lesson-3.html