# Phase flip

One of the challenges in describing a phase flip error is that it has no equivalent in classical computing. A classical bit is always a 0 or a 1, and a bit flip error causes the value to be the opposite of what it should be. A quantum bit, or qubit, can also be a 0 or a 1, and it can also suffer from bit flip errors. A qubit can also be in a quantum superposition, during which it has some probability of being 0 and some probability of being 1 at the same time. A bit flip error swaps those probabilities, such that the probability of being 0 is now the probability of being 1, and vice versa.

Unlike a classical bit, a qubit also has a phase. If we imagine a light switch, a classical bit is always off or always on. A qubit, while in superposition, is somewhere between off and on; observing the light switch will instantly snap it into either the off or on position. But the quantum light switch can also rotate around its axis. It’s as if the plate of the light switch is connected to the wall at its top and bottom only, so that it can spin around on its vertical axis. The phase can be thought of as the direction that the light switch is pointing in.

Phase flips can be thought of as rotating the light switch on its vertical axis by 180 degrees, so that it points in the exact opposite direction than it was previously pointing at. A phase flip quantum error, therefore, is when this happens unintentionally, and thus undesirably.

## What is Phase-flip Error

Phase flips, when intentional, apply an operation that is commonly called the Pauli-Z gate, or often just the Z gate. Whereas a bit flip swaps the probabilities of a qubit being 0 or 1, a phase flip swaps the probabilities of the qubit being + or -. When an error causes the sign to flip like this, the corrective action is the application of a Z gate.

## Origins of Phase-Flip Errors

Phase errors can result from environmental noise such as cosmic rays or electromagnetism. Another source is decoherence, which is when the time required to execute all the gate operations exceeds a qubit’s ability to retain its phase. And yet another source is the gate operations themselves, as well as crosstalk from gate operations on neighboring qubits.

Essentially, errors are errors. An error from any source can flip a bit, flip a sign, or both. Multi-qubit operations can then propagate these errors, causing a cascading effect throughout the system. These errors can accumulate and result in incorrect solutions as output.

## Consequences of Phase-Flip Errors

The most consequential quantum algorithms leverage phases. These include Quantum Phase Estimation (QPE), the Quantum Fourier Transform (QFT), and Grover’s Algorithm. The first two promise exponential computational speedups, and the third promises a quadratic speedup. These speedups lose their relevance, of course, if the results are inaccurate. Should future algorithms access quantum memories, such as QRAM, then a phase flip memory error could likewise result in inaccurate outcomes.

On the other hand, it is possible to have no consequences at all. Algorithms can operate solely on amplitudes, which are affected by bit flip errors, but not by phase flip errors.

## Mitigating Phase-Flip Errors

Phase flip error correction can be accomplished with a phase flip code, which exclusively detects and correct phase flip errors. For more information, the University of Oxford Department of Physics page titled “Correction of phase errors” explains it using bra-ket notation.

However, fault-tolerant quantum computing (FTQC) will rely on quantum error correction codes (QECC) that detect and correct both bit flip and phase flip errors. For more information, a book by Giuliano Gadioli La Guardia titled “Quantum Error Correction” includes a 17-page chapter titled “Quantum Error-Correcting Codes.”