The Quantum Engineer

9. A Qubit

9.1The classical bit and its physical implementations

Start with what you know. A classical bit holds one of two values, and its meaning is independent of its physical carrier: a 5 V wire, a magnetic domain, a charge trap, a "3 nm" transistor with a few hundred atoms of channel. Engineering has driven bit error rates to roughly 10⁻¹⁸ per operation by burying physics under abstraction: voltage margins, ECC in DRAM, and CMOS's nonlinear restoration of logic levels make a noisy physical device behave like a clean mathematical symbol. Two properties matter for the contrast ahead: you can copy a bit freely, and you can read it without changing it. Both feel like birthrights of information. Quantum mechanics revokes both, and the next sections show exactly how much survives.

9.2The qubit and its basis states |0⟩, |1⟩

A qubit (quantum bit) is a two-level quantum system: an electron's spin, a superconducting circuit's two lowest energy levels, an ion's two internal states. Its state is a unit vector in a two-dimensional complex space, written in the computational basis as |ψ⟩ = α|0⟩ + β|1⟩. The basis states are the ground and excited levels — the quantum analogs of 0 and 1 — and they are perfectly good classical states: a qubit prepared in |0⟩ or |1⟩ behaves like a bit. The generalization is that α and β may both be nonzero. Note what a qubit is not: not a bit that is "0 and 1 at once" in any readable sense. It is a vector; reading it (measurement, chapter 11) collapses the description to one outcome with probabilities |α|² and |β|².

9.3Superposition and amplitudes

Superposition means the state is a weighted combination α|0⟩ + β|1⟩; the weights α, β are amplitudes — complex numbers, not probabilities. The Born rule converts them: measuring in the computational basis yields 0 with probability |α|² and 1 with probability |β|². Why complex numbers? Because amplitudes add and interfere: two paths to the same outcome can cancel like waves, which classical probabilities can never do. That interference is the engine of every quantum algorithm (Part VII). A useful sanity bound: |α|² + |β|² = 1 always, so nothing about superposition increases information capacity — one qubit answers one yes/no question per measurement. Superposition is not "more information stored"; it is a richer dynamics for computing with.

9.4Normalization and global phase

Two subtleties, both cheap to handle in code. Normalization: |α|² + |β|² = 1, so a state vector has one redundant real degree of freedom; simulators enforce it explicitly — psi /= np.linalg.norm(psi) — because gates like H are only norm-preserving on normalized inputs, and unnormalized states quietly produce probabilities that sum to 0.97 and other nonsense. Global phase: multiplying the entire state by any unit-modulus complex number, e.g. e^{iπ/4}|ψ⟩, changes nothing observable: every probability and expectation value involves ⟨ψ|ψ⟩-type contractions where the phase cancels. So states with a common global phase are the same physical state. In simulators this is harmless; in hardware it means calibration can ignore the overall phase entirely — a real simplification the phase gate family (10.6) exploits.

9.5Relative phase

What is physical is the relative phase between amplitudes: the angle of β/α, a complex number's argument. |0⟩ + |1⟩ and |0⟩ − |1⟩ have identical measurement statistics in the computational basis — both give 50/50 — yet they are different states, distinguishable by measuring in the X basis (11.6), where they are eigenstates with eigenvalues +1 and −1. Relative phase is where quantum information hides from casual observation, and it is the control surface for interference: algorithms steer relative phases with gates (Z, S, T, Rz), then convert phase differences into outcome-probability differences using H. In the Bloch picture below, relative phase is the longitude; you will manipulate longitudes constantly and measure latitudes. That asymmetry is the daily texture of quantum programming.

9.6Measurement probabilities

For state α|0⟩ + β|1⟩, computational-basis measurement gives p(0) = |α|², p(1) = |β|². Worked examples you should internalize until they are reflexes: |0⟩ → (1, 0); (|0⟩+|1⟩)/√2 → (½, ½); (|0⟩+i|1⟩)/√2 → (½, ½) — same probabilities as the previous state, different state, as 9.5 promised; (√3|0⟩ + |1⟩)/2 → (¾, ¼). One measurement returns one bit and destroys the superposition; the probabilities only reveal themselves over many identical preparations and measurements — shots. This is why quantum benchmarks are statistical and why 1,000 shots give you roughly ±1.5% resolution per probability (11.10). Every hardware readout in this book — IBM, Google, ion traps — produces exactly this: many shots, one histogram.

import numpy as np

def probs(psi):
    return np.abs(psi)**2

states = {
    "|0>":        np.array([1, 0], dtype=complex),
    "|+>":        np.array([1, 1], dtype=complex) / np.sqrt(2),
    "|+i>":       np.array([1, 1j], dtype=complex) / np.sqrt(2),
    "(3|0>+|1>)/2": np.array([np.sqrt(3), 1], dtype=complex) / 2,
}
for name, psi in states.items():
    psi = psi / np.linalg.norm(psi)
    p = probs(psi)
    print(f"{name:12s}  p(0)={p[0]:.3f}  p(1)={p[1]:.3f}")

9.7The Bloch sphere

Because global phase is irrelevant, a qubit's state has two real degrees of freedom, and every pure state maps to a point on the Bloch sphere — a unit sphere with |0⟩ at the north pole, |1⟩ at the south pole, and equatorial points (|0⟩ ± |1⟩)/√2 and (|0⟩ ± i|1⟩)/√2 at the cardinal longitudes. For state α|0⟩ + β|1⟩, write the vector as cos(θ/2)|0⟩ + e^{iφ} sin(θ/2)|1⟩; the Bloch coordinates are (sin θ cos φ, sin θ sin φ, cos θ). The mapping is the engineer's microscope: superposition is latitude away from the poles, relative phase is longitude, and measurement in the Z basis returns 0 with probability cos²(θ/2). Mixed states live inside the sphere, at radius Tr(ρ²) — noise shrinks the vector toward the center, called depolarization.

            z
            |    |0>  (theta = 0)
            |   /
            |  /  theta
            | /         |psi> = cos(theta/2)|0> + e^{i phi} sin(theta/2)|1>
            |/_____ y
           / \    |+i> at phi = +90
          /   \
         x    |+> at phi = 0      |1> at theta = pi (south pole)

9.8Rotations and geometric intuition

Every single-qubit gate is a rotation of the Bloch vector about some axis (up to an invisible global phase) — this is the geometric reading of chapter 10. The rotation gates Rx(θ), Ry(θ), Rz(θ) rotate the Bloch vector by angle θ about the x, y, z axes respectively. Two intuitions to build now. First, the Hadamard gate, which looks algebraic as a matrix of ½'s, is geometrically a 180° rotation about the diagonal axis (x+z)/√2: it swaps the poles with the equator, exactly why it converts between Z-basis and X-basis states. Second, two rotations about non-parallel axes generate every possible rotation — which is why some minimal pair like Rz and √X suffices as a hardware gate set (10.11). Calibration engineers literally think in angles: a mis-tuned pulse is "rotation off by 3°".