|q⟩ Bad Qubits

intermediate · Programming · Quantum Error Detection (Intro)

Logical vs Physical Qubits

Every computation ultimately runs on physical hardware, but the hardware is noisy. The concept of a logical qubit is the bridge between what a quantum algorithm demands (a perfect, noise-free qubit) and what hardware actually provides (an imperfect, decoherence-prone device).

Physical qubits

A physical qubit is a two-level quantum system realized in hardware: a superconducting transmon, a trapped ion, a photonic mode, a spin in a semiconductor, or any other controllable system with states 0|0\rangle and 1|1\rangle. Physical qubits are the atoms of quantum hardware.

Every physical qubit interacts, however weakly, with its surroundings. That interaction causes decoherence: the qubit's state gradually drifts away from the intended value. Two timescales characterize this:

Current superconducting hardware achieves T1T_1 and T2T_2 of hundreds of microseconds, while a two-qubit gate takes roughly tens of nanoseconds. The ratio gives only a few thousand error-free operations before significant errors accumulate — far fewer than a useful algorithm requires.

The logical qubit

A logical qubit is an information-carrying degree of freedom that is encoded into several physical qubits in such a way that errors on any small subset of those physical qubits can be detected and corrected without ever measuring the logical data.

Formally, a quantum error-correcting code with nn physical qubits and one logical qubit maps the two-dimensional Hilbert space of the logical qubit into a two-dimensional code space C(C2)n\mathcal{C} \subseteq (\mathbb{C}^2)^{\otimes n}. The two orthonormal vectors spanning C\mathcal{C} are called the logical basis states, denoted 0L|0_L\rangle and 1L|1_L\rangle. An arbitrary logical state α0L+β1L\alpha|0_L\rangle + \beta|1_L\rangle lives entirely within C\mathcal{C} as long as no errors have occurred.

For the three-qubit bit-flip code covered earlier in this module, the code space is spanned by

0L=000,1L=111.|0_L\rangle = |000\rangle, \qquad |1_L\rangle = |111\rangle.

A single-qubit bit flip moves the state out of C\mathcal{C} (for example, 001|001\rangle is not a valid codeword). Syndrome measurement detects this excursion without revealing whether the logical state is 0L|0_L\rangle, 1L|1_L\rangle, or a superposition thereof.

The encoding ratio

The number of physical qubits needed per logical qubit is called the encoding overhead or code rate. For the simple three-qubit repetition code the ratio is 3:1; for the nine-qubit Shor code it is 9:1. More sophisticated topological codes such as the surface code require on the order of O(d2)O(d^2) physical qubits per logical qubit to achieve a code distance dd. Distance controls how many simultaneous errors can be corrected: a code of distance dd corrects any error on up to (d1)/2\lfloor(d-1)/2\rfloor physical qubits.

The overhead is not wasted. Each additional physical qubit strengthens the code's ability to suppress logical errors. Provided the physical error rate pp lies below a threshold pthp_{\mathrm{th}}, the logical error rate decreases exponentially with dd:

pL(ppth)(d1)/2+1.p_L \sim \left(\frac{p}{p_{\mathrm{th}}}\right)^{\lfloor(d-1)/2\rfloor + 1}.

For ppthp \ll p_{\mathrm{th}} this is an extraordinary bargain: a modest increase in qubit count yields an exponential suppression of errors.

Logical gates

Operating on a logical qubit means performing a logical gate — a physical circuit acting on all nn physical qubits that implements, say, a logical XLX_L or logical HLH_L, while keeping the state within C\mathcal{C} (or moving it predictably between valid states). Designing logical gates that are also fault-tolerant (so that a single physical error during the gate cannot corrupt the logical result) is one of the central challenges of quantum hardware engineering.

The transversal gate is the simplest example: apply the same one-qubit gate to every physical qubit in parallel. For the three-qubit bit-flip code, applying XX to all three qubits maps 0L=000111=1L|0_L\rangle = |000\rangle \mapsto |111\rangle = |1_L\rangle, implementing XLX_L correctly. Transversal gates are automatically fault-tolerant because an error on one physical qubit during the gate cannot propagate to the others — each qubit is acted on independently.

Why the distinction matters

The logical/physical split is the reason quantum error correction can work at all. An algorithm is written entirely in terms of logical qubits: it specifies logical gates, logical measurements, and logical ancillae. The hardware layer translates each logical instruction into physical operations, inserts syndrome-measurement cycles, and corrects errors — all transparently. From the algorithm's perspective, the logical qubit behaves as if it were a perfect, noiseless qubit.

This layered abstraction, often called the fault-tolerance stack, is the same conceptual move that classical computing made when it introduced transistors, then logic gates, then machine code, then compilers: each layer hides the imperfections of the layer below it. The logical qubit is quantum computing's analogue of the classical bit stored in a flip-flop — a reliable logical variable built from unreliable physical components.

Sign in on the full site to ask questions and join the discussion.