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.
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.
- 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.
From amplitudes to three real coordinates
Derive x, y, z from θ and φ or Pauli expectations.
A one-qubit state is:
A one-qubit gate is a 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 and nothing measurable changes. Change the phase between and 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:
| state | |||
|---|---|---|---|
Two Hadamard identities earn their keep constantly: ; Hadamard is its own inverse; and ; conjugating by H swaps the X and Z bases.
And the global-phase rule sets the boundary of what matters:
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]
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
| Field | Reader-visible record |
|---|---|
| Format | Interactive sphere plus tested conversion and gate library |
| Verification | Property tests round-trip states up to global phase and match matrix gates to expected SO(3) rotations. |
| Availability | Source-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.
protocol fixture
Bloch/statevector round-trip viewer
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
- Michael A. Nielsen and Isaac L. Chuang. Quantum Computation and Quantum Information. Cambridge University Press. 2010textbook
- John Preskill. Lecture Notes for Physics 219: Quantum Computation. California Institute of Technology. 2018graduate lecture notes
- T. D. Ladd et al.. Quantum computers. Nature. 2010peer-reviewed review
- 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.