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.