Curriculum / Noise & Error Correction / Phase-Flip Errors
Phase-Flip Errors
Phase errors and Z-basis detection, uniquely quantum errors.
Phase-Flip Errors
The phase-flip error has no classical counterpart at all. It is the second half of the Pauli error group, and understanding it is the real entry point to quantum error correction. Classical computers need only protect against bit flips (0 becomes 1). Quantum computers need to protect against bit flips and phase flips (a sign change on the |1⟩ amplitude), because both are equally likely to occur on real hardware.
The Gate Matrix and What It Does
A phase-flip error applies the Pauli Z gate:
Z = [[1, 0],
[0, -1]]On the computational basis states:
- •Z|0⟩ = |0⟩
- •Z|1⟩ = −|1⟩
So on a general state α|0⟩ + β|1⟩ the effect is α|0⟩ − β|1⟩. Crucially, the probabilities in the computational basis are unchanged: |α|² and |β|² are the same before and after. Measured directly in the Z basis, a phase-flip looks like nothing happened, the error is silent.
On superpositions, however, the effect is dramatic. Z|+⟩ = |−⟩, and Z|−⟩ = |+⟩. The state has completely flipped into its orthogonal partner. The information is still there; it is just hiding in the phase.
The Invisible Error, Made Visible
The trick for detecting phase flips is to change basis. A phase flip in the Z basis is a bit flip in the X basis. Formally:
H · Z · H = X
That single identity is the whole strategy. If you wrap any Z error in a pair of Hadamards, it becomes an X error, which you already know how to detect. The workflow for a single-qubit phase-flip detector is:
- 1.Apply H to move the state from the Z basis into the X basis.
- 2.Noise happens. Any Z error in the original basis now looks like an X error.
- 3.Apply H again to move back.
- 4.Measure in the Z basis, a Z error that snuck in between the Hadamards now appears as a flipped bit.
This is the opening of the lesson. The full walkthrough, the interactive circuit, and the graded challenge continue inside myqubit.
How this lesson works
A hands-on coding challenge. You write Qiskit-compatible Python in the browser editor, run it instantly via WebAssembly, watch the circuit and Bloch sphere react, and pass automatic output checks. The AI tutor Qubitus gives Socratic hints if you get stuck.
Part of: Noise & Error Correction
Understand quantum noise and build error correction codes to protect quantum information.
This lesson is part of Pro
Unlock Noise & Error Correction and all 10 tracks with Pro: $12.99/month, $79/year, or $97 lifetime. Start with the free track first if you are new.