Steven GellerQuantum Computing, End to End

Book contents

Current section

Part III. Circuit Model

  1. Circuit Notation as a Programming Language
  2. One-Qubit Gates and the Bloch Sphere
  3. Controlled Gates and Reversible Classical Computation
  4. Multi-Qubit Circuits
  5. Bell States and GHZ States
  6. No-Cloning and Why Copying Breaks Quantum Logic
  7. Circuit Cost: Depth, Width, Gate Set, Connectivity

Part III. Circuit Model · Chapter 17

One-Qubit Gates and the Bloch Sphere

Every one-qubit pure state is a point on a sphere, and every one-qubit gate is a rotation of that sphere — but the sphere is the illustration and the matrices are the authority. This chapter teaches you to move between the two without mistaking one for the other.

Lab
In this chapter 8 sections

Reader question. How do one-qubit gates transform both a statevector and its Bloch-sphere representation?

Up to global phase, a pure qubit maps to a point on the Bloch sphere, and one-qubit unitaries act as rotations; matrix multiplication remains the computational authority while the sphere exposes axes, relative phase, and composition geometry.

Scope and non-goals.
  • This chapter does not use the Bloch sphere for mixed states beyond naming the interior boundary.
  • It does not imply that spatial axes are literal device orientation or replace matrix calculation.
One qubit drawn as a sphere One qubit, drawn as a sphere |0⟩ |1⟩ |+⟩ |ψ⟩ north pole: |0⟩ south pole: |1⟩ equator: equal superpositions, sorted by phase every one-qubit gate: a rotation of the sphere
Figure 17.1. Notice that +\lvert + \rangle and \lvert - \rangle sit at opposite ends of the equator: identical Z-basis statistics, opposite relative phases. The sphere keeps phase visible in a way a probability table never can.

From amplitudes to three real coordinates

Derive x, y, z from θ and φ or Pauli expectations.

A one-qubit state is:

α0+β1,α2+β2=1\alpha\lvert0\rangle+\beta\lvert1\rangle,\qquad \lvert\alpha\rvert^2+\lvert\beta\rvert^2=1(17.1)

A one-qubit gate is a 2×22\times2 unitary that rewrites those amplitudes while preserving the normalization. The Bloch sphere visualizes pure one-qubit states up to global phase: the poles are the basis states, the equator holds the equal superpositions, and every gate is a rotation. It is excellent intuition for rotations, basis changes, and phase; but the calculations still come from matrix-vector multiplication. The sphere summarizes; it does not compute.

The distinction that runs the chapter is global versus relative phase. Multiply the whole state by eiθe^{i\theta} and nothing measurable changes. Change the phase between 0\lvert0\rangle and 1\lvert1\rangle and you have changed what later gates will produce; a relative phase is a physical fact waiting for a basis change to expose it.

Evidence boundary. Pure one-qubit states modulo global phase correspond to points on the Bloch sphere. [Michael A. Nielsen] [John Preskill] [T. D. Ladd et al.]

X, Y, and Z as half-turns

Match matrices to rotations and basis-state movement.

Three gates cover most of the territory:

stateXXZZHH
0\lvert0\rangle1\lvert1\rangle0\lvert0\rangle(0+1)/2(\lvert0\rangle+\lvert1\rangle)/\sqrt2
1\lvert1\rangle0\lvert0\rangle1-\lvert1\rangle(01)/2(\lvert0\rangle-\lvert1\rangle)/\sqrt2

Two Hadamard identities earn their keep constantly: H2=IH^2=I; Hadamard is its own inverse; and HZH=XH Z H = X; conjugating by H swaps the X and Z bases.

And the global-phase rule sets the boundary of what matters:

ψeiθψ\lvert\psi\rangle\sim e^{i\theta}\lvert\psi\rangle(17.2)

That rule does not make all phase irrelevant. A sign change on one component is relative phase, and a later gate can convert it into a different measurement distribution; as the worked example shows with three gates you already own.

Evidence boundary. Pauli and phase gates act as rotations on Bloch vectors while matrices act on statevectors. [John Watrous] [Michael A. Nielsen]

H is not a coordinate-axis flip

Decompose its geometric action carefully.

Conjugation shows the geometry: H X H=Z, H Z H=X, and H Y H=-Y. Thus H exchanges the x and z axes and reverses y; it is a pi rotation about the (x+z)/sqrt(2) axis, not a reflection that an arbitrary vector can undergo under unitary evolution. Testing the three Pauli axes catches a misleading two-dimensional sketch.

Evidence boundary. Global phase is absent from the Bloch vector, but relative phase changes its azimuth. [Michael A. Nielsen] [John Preskill]

ψ=cos(θ/2)0+eiϕsin(θ/2)1,r=(X,Y,Z)\lvert\psi\rangle=\cos(\theta/2)\lvert0\rangle+e^{i\phi}\sin(\theta/2)\lvert1\rangle,\quad \mathbf r=(\langle X\rangle,\langle Y\rangle,\langle Z\rangle)(17.3)

Notation contract: |ψ>=cos(θ/2)|0>+e^{iφ}sin(θ/2)|1>; Bloch vector r=(<X>,<Y>,<Z>); rotation angles use radians.

S and phase around the equator

Track relative phase without changing Z populations.

For a software engineer, one-qubit gates are primitive instructions with exact semantics. The simulator implements them as matrix-vector multiplication. The compiler may replace a requested gate with native rotations the device prefers. The hardware implements those rotations with pulses, each carrying fidelity and calibration limits.

You should be able to move freely among four representations of the same operation:

  • Gate name; the symbol on the diagram.
  • Matrix action; the authoritative semantics.
  • Statevector update; the concrete effect on α and β.
  • Bloch-sphere movement; the geometric summary.

If the four ever disagree, trust the algebra. The diagram and the sphere are interface views over the same mathematical operation, and views can lie in ways matrices cannot.

Matrix answer, sphere diagnostic

Use both representations to catch a sign or global-phase mistake.

The statevector or matrix supplies the calculation; the Bloch sphere supplies a diagnostic. Convert a normalized state to (x,y,z)=(2 Re(alpha-bar beta),2 Im(alpha-bar beta),|alpha|^2-|beta|^2) and require x^2+y^2+z^2=1 for a pure state. Agreement of matrix evolution and rotated coordinates is a strong independent check, but it does not extend as independent arrows for entangled qubits.

Bloch/statevector round-trip viewer

Acceptance contract for Bloch/statevector round-trip viewer
FieldReader-visible record
FormatInteractive sphere plus tested conversion and gate library
VerificationProperty tests round-trip states up to global phase and match matrix gates to expected SO(3) rotations.
AvailabilitySource-embedded acceptance record; no separate download is claimed
{
  "artifact": "Bloch/statevector round-trip viewer",
  "format": "Interactive sphere plus tested conversion and gate library",
  "acceptance_test": "Property tests round-trip states up to global phase and match matrix gates to expected SO(3) rotations.",
  "publication_state": "source-embedded contract and worked fixture"
}

Executable reference fixture

Run with Python 3.11 or later. The final assertion is the chapter-level pass condition for this small instance.

import cmath
import math

def normalize(state):
    norm = math.sqrt(sum(abs(value) ** 2 for value in state))
    if norm < 1e-15:
        raise ValueError("the zero vector is not a state")
    return tuple(value / norm for value in state)

def state_to_bloch(state):
    alpha, beta = normalize(state)
    coherence = alpha.conjugate() * beta
    return 2 * coherence.real, 2 * coherence.imag, abs(alpha) ** 2 - abs(beta) ** 2

def bloch_to_state(point):
    x, y, z = point
    radius = math.sqrt(x * x + y * y + z * z)
    if abs(radius - 1.0) > 1e-12:
        raise ValueError("pure-state Bloch vectors must have unit radius")
    if z < -1 + 1e-12:
        return 0j, 1 + 0j
    alpha = math.sqrt((1 + z) / 2)
    return alpha, complex(x, y) / (2 * alpha)

def matvec(matrix, state):
    return tuple(sum(matrix[row][column] * state[column] for column in range(2)) for row in range(2))

def fidelity(left, right):
    left, right = normalize(left), normalize(right)
    overlap = sum(a.conjugate() * b for a, b in zip(left, right))
    return abs(overlap) ** 2

scale = math.sqrt(0.5)
states = []
for theta, phi in ((0, 0), (math.pi, 0), (math.pi / 3, 0.7), (math.pi / 2, -1.2), (2.2, 2.6)):
    states.append((math.cos(theta / 2), cmath.exp(1j * phi) * math.sin(theta / 2)))
states.append(tuple(cmath.exp(0.91j) * value for value in states[2]))

max_roundtrip_infidelity = 0.0
for state in states:
    point = state_to_bloch(state)
    assert abs(sum(axis * axis for axis in point) - 1.0) < 1e-12
    recovered = bloch_to_state(point)
    infidelity = 1.0 - fidelity(state, recovered)
    max_roundtrip_infidelity = max(max_roundtrip_infidelity, abs(infidelity))
assert max_roundtrip_infidelity < 1e-12
assert all(abs(a - b) < 1e-12 for a, b in zip(state_to_bloch(states[2]), state_to_bloch(states[-1])))

I = ((1, 0), (0, 1))
X = ((0, 1), (1, 0))
Y = ((0, -1j), (1j, 0))
Z = ((1, 0), (0, -1))
H = ((scale, scale), (scale, -scale))
S = ((1, 0), (0, 1j))
rotations = {
    "I": (I, lambda x, y, z: (x, y, z)),
    "X": (X, lambda x, y, z: (x, -y, -z)),
    "Y": (Y, lambda x, y, z: (-x, y, -z)),
    "Z": (Z, lambda x, y, z: (-x, -y, z)),
    "H": (H, lambda x, y, z: (z, -y, x)),
    "S": (S, lambda x, y, z: (-y, x, z)),
}
max_rotation_error = 0.0
for matrix, rotation in rotations.values():
    for state in states:
        actual = state_to_bloch(matvec(matrix, state))
        expected = rotation(*state_to_bloch(state))
        max_rotation_error = max(max_rotation_error, *(abs(a - b) for a, b in zip(actual, expected)))
assert max_rotation_error < 1e-12

mixed_point_rejected = False
try:
    bloch_to_state((0.2, 0.0, 0.0))
except ValueError:
    mixed_point_rejected = True
assert mixed_point_rejected
wrong_y = lambda state: -2 * (state[0].conjugate() * state[1]).imag
assert abs(wrong_y(states[3]) - state_to_bloch(states[3])[1]) > 0.5
print(f"PASS: 17 Bloch viewer round-trips {len(states)} states through {len(rotations)} gate rotations; last |infidelity|={abs(infidelity):.2e}, max infidelity={max_roundtrip_infidelity:.2e}, max SO(3) error={max_rotation_error:.2e}")

Scope boundary

  • This chapter does not use the Bloch sphere for mixed states beyond naming the interior boundary.
  • It does not imply that spatial axes are literal device orientation or replace matrix calculation.

Depth commitment. One coordinate derivation, five gate movements, one composition trace, and property tests.

Practice problem

Starting at |0>, apply H, S, and X; give the statevector and Bloch coordinates after every gate.

Deliverable
Three statevector rows, three coordinate triples, and one global-phase equivalence check.
Pass condition
The viewer regenerates every point and checks unit Bloch radius plus matrix/sphere agreement.

Verification record

Expected solution form. Exact state trace with generated sphere coordinates.

Model answer. After H the state is |+> with Bloch coordinates (1,0,0). After S it is (|0>+i|1>)/sqrt(2) with (0,1,0). After X it is (i|0>+|1>)/sqrt(2), equivalent up to global phase to a state with coordinates (0,-1,0).

Model result and check. Tests compare Pauli-expectation coordinates to the visualizer's output.

Acceptance test. The viewer regenerates every point and checks unit Bloch radius plus matrix/sphere agreement.

Companion work

Artifacts for this chapter

These entries resolve to checked-in local source. Commands are reproduced exactly from the chapter manifest, and source-embedded fixtures are exported as direct downloads.

  1. Reproduce or test

    python3 tools/validate_briefs.py --briefs data/editorial_briefs_00_35.json --from 0 --through 35 --check-rewritten-sources --execute-artifacts

Provenance

Sources and review

  1. Michael A. Nielsen and Isaac L. Chuang. Quantum Computation and Quantum Information. Cambridge University Press. 2010textbook
  2. John Preskill. Lecture Notes for Physics 219: Quantum Computation. California Institute of Technology. 2018graduate lecture notes
  3. T. D. Ladd et al.. Quantum computers. Nature. 2010peer-reviewed review
  4. John Watrous. The Theory of Quantum Information. Cambridge University Press / University of Waterloo. 2018textbook

The load-bearing claims in the chapter are mapped inline to this registered source set. A citation supports only the bounded claim beside it.

Cite this chapter