Single-Qubit Quantum Error Correction

This Demonstration considers the most rudimentary application of error correction in a quantum computer, involving just a single qubit. We make use of the so-called three-qubit bit flip code proposed by Asher Peres in 1985. The object is to transmit the state of a single qubit or through a noisy channel that can possibly flip the state of the qubit.
The original qubit is augmented by two ancillary qubits initialized in the state , shown in red. The three qubits are entangled by two CNOT gates before passing through the noisy channel. Assume that the noise level is sufficiently low that the probability of more than one qubit flipping is negligible. In this Demonstration, the incidence of noise is greatly magnified in order to show the nontrivial operation of the algorithm. The noise is generated randomly and can change during the operation of the quantum computer. The second pair of CNOT gates determine whether an error occurred and identify its location. Finally, the Toffoli gate makes the correction to the output bit.
The state of the three-qubit system is shown under the circuit diagram. It is revealed stepwise as the "run computation" slider is advanced. The final result is the output qubit at the right, which should match the input qubit if the error-correcting algorithm is successful. It is therefore possible to detect and correct errors without interfering with the quantum computation.


  • [Snapshot]
  • [Snapshot]
  • [Snapshot]


The CNOT gate (left) flips the target qubit if the control qubit is . The Toffoli gate (right) flips the target qubit if both the control qubits are .
[1] Z. Nazario, "How to Fix Quantum Computing Bugs," Scientific American, 326(5), 2022 pp. 28–35.
[2] Wikipedia. "Quantum Error Correction." (May 2, 2022)
    • Share:

Embed Interactive Demonstration New!

Just copy and paste this snippet of JavaScript code into your website or blog to put the live Demonstration on your site. More details »

Files require Wolfram CDF Player or Mathematica.