Steven GellerQuantum Computing, End to End

Book contents

Current section

Orientation Guides

  1. How to Use This Book
  2. Computation, Information, and Qubits
  3. Amplitudes, Measurement, and Gates
  4. Multi-Qubit Circuits, Entanglement, and No-Hype Protocols
  5. Quantum Algorithms and Speedups
  6. Noise, Error Correction, and Fault Tolerance
  7. Hardware Architecture and the Full Stack
  8. Applications, Evidence, and Strategy

Orientation guide

Amplitudes, Measurement, and Gates

One qubit, four gates, and a meter — that is all the machinery this guide uses, and it is enough to watch interference happen in arithmetic you can check by hand. You will normalize states, multiply matrices, and learn why the measurement basis is part of the answer.

In this chapter 11 sections

Reader question. How can a reader calculate a complete one-qubit experiment from preparation through gate application to measurement?

Represent the qubit as a normalized two-entry complex vector, multiply by the chosen unitary matrices in declared order, and square final magnitudes only after all amplitudes have combined; the measurement basis is part of the experiment.

Scope and non-goals.
  • This guide does not cover mixed states, tomography, or multi-qubit entanglement.
  • It does not treat a statevector simulator's private state as physically readable output.
Two Hadamard gates on one wire split and then cancel an amplitude Interference in one line: two Hadamards undo each other |0> H H M |0> every time splits the amplitude recombines it samples once the |1> amplitude created by the first H is cancelled exactly by the second; that cancellation is interference
Figure O2.1. Notice there is no randomness anywhere on this wire: the two H gates split and then exactly cancel the 1\lvert1\rangle amplitude, so even the meter reads a deterministic outcome. Randomness enters only when a circuit fails to arrange such cancellation.

Declare the vector before touching a gate

Fix basis order, normalization, and phase conventions.

A quantum state is not a list of probabilities; it is a vector of amplitudes. Gates transform the amplitudes. Measurement then converts the state into classical data, with probabilities computed from the squared magnitudes. Every quantum program, whatever its size, runs the same loop:

  1. Prepare an initial state.
  2. Apply gates that transform the amplitudes.
  3. Arrange interference so useful outcomes grow and useless ones cancel.
  4. Measure, producing one classical record.
  5. Interpret the samples, usually over many repeated shots.

Confuse amplitudes with probabilities and almost every quantum algorithm becomes mysterious. Track amplitudes carefully and the mystery turns into linear algebra.

Work in the computational basis, 0=(10)\lvert0\rangle=\begin{pmatrix}1\\0\end{pmatrix} and 1=(01)\lvert1\rangle=\begin{pmatrix}0\\1\end{pmatrix}. A general pure state is ψ=α0+β1=(αβ)\lvert\psi\rangle=\alpha\lvert0\rangle+\beta\lvert1\rangle=\begin{pmatrix}\alpha\\\beta\end{pmatrix}, subject to the normalization condition α2+β2=1\lvert\alpha\rvert^2+\lvert\beta\rvert^2=1. Measurement in this basis returns 0 with probability α2\lvert\alpha\rvert^2 and 1 with probability β2\lvert\beta\rvert^2.

Because amplitudes are complex, the squared magnitude deserves one line of care: for z=a+biz=a+bi, z2=a2+b2\lvert z\rvert^2=a^2+b^2, equivalently z2=zz\lvert z\rvert^2=z^\ast z where zz^\ast is the complex conjugate. Normalize wrong and every probability you compute afterwards is wrong too.

Evidence boundary. A pure one-qubit state is a normalized vector in a two-dimensional complex Hilbert space. [John Watrous] [Michael A. Nielsen]

Four matrices, one execution order

Derive X, Z, H, and S actions on the basis states.

X gate

X=(0110)X=\begin{pmatrix}0&1\\1&0\end{pmatrix}(O2.1)

It swaps the basis states: X0=1X\lvert0\rangle=\lvert1\rangle and X1=0X\lvert1\rangle=\lvert0\rangle. On the computational basis this is the quantum analogue of NOT.

Z gate

Z=(1001)Z=\begin{pmatrix}1&0\\0&-1\end{pmatrix}(O2.2)

It leaves 0\lvert0\rangle alone and flips the sign of 1\lvert1\rangle: Z1=1Z\lvert1\rangle=-\lvert1\rangle. Measure immediately and you see nothing; apply another gate and the flipped phase changes what interferes with what. Z is the purest phase gate in the set.

H gate

H=12(1111)H=\frac1{\sqrt2}\begin{pmatrix}1&1\\1&-1\end{pmatrix}(O2.3)

It maps 0\lvert0\rangle to (0+1)/2=+(\lvert0\rangle+\lvert1\rangle)/\sqrt2=\lvert+\rangle and 1\lvert1\rangle to (01)/2=(\lvert0\rangle-\lvert1\rangle)/\sqrt2=\lvert-\rangle. Hadamard is the simplest gate that creates superposition, which makes it the best gate for learning interference.

S gate

S=(100i)S=\begin{pmatrix}1&0\\0&i\end{pmatrix}(O2.4)

It leaves 0\lvert0\rangle alone and multiplies the 1\lvert1\rangle component by ii; a quarter-turn of phase where Z applies a half-turn. Four gates, and you can already build every phenomenon this guide discusses.

Take the state +=(0+1)/2\lvert+\rangle=(\lvert0\rangle+\lvert1\rangle)/\sqrt2. A computational-basis measurement gives 0 and 1 with equal probability. But apply HH first and then measure, and H+=0H\lvert+\rangle=\lvert0\rangle; the outcome is now 0 with certainty.

Same state, different statistics, because the effective measurement changed. This is why "the measurement probability" is never a complete description of a state: you must specify the basis, or equivalently the circuit that runs before the meter. A claim about a quantum state that does not say how it was measured is an incomplete claim.

Evidence boundary. X, Z, H, and phase gates are unitary matrices whose order of multiplication determines the result. [Michael A. Nielsen] [John Preskill]

The HZH phase detector

Trace an imaginary or negative phase into a measurable outcome.

Two states that differ only by an overall phase; ψ\lvert\psi\rangle versus ψ-\lvert\psi\rangle, or ψ\lvert\psi\rangle versus iψi\lvert\psi\rangle; make identical predictions for every possible measurement. Global phase is unphysical, a residue of the notation.

Relative phase is different. The states (0+1)/2(\lvert0\rangle+\lvert1\rangle)/\sqrt2 and (01)/2(\lvert0\rangle-\lvert1\rangle)/\sqrt2 differ by a sign on one component only, and as the Hadamard example showed, that sign decides whether a later gate produces 0\lvert0\rangle or 1\lvert1\rangle. The quick test: if you cannot factor the phase out in front of the whole state, it is relative, and it matters.

Interference is amplitude addition, nothing more. When two computational paths contribute amplitudes to the same outcome, those amplitudes add. Aligned, they reinforce; 1/2+1/2=21/\sqrt2+1/\sqrt2=\sqrt2 grows. Opposed, they cancel; 1/21/2=01/\sqrt2-1/\sqrt2=0.

A quantum algorithm earns its keep when its circuit steers amplitudes so that wrong or irrelevant outputs cancel and useful outputs survive or grow. Probability can never do this; probabilities only ever add upward. The ability to subtract is the whole game.

Evidence boundary. Measurement probabilities depend on the selected basis and are computed from squared amplitude magnitudes. [John Watrous] [Michael A. Nielsen]

B=(0,1),G2G1ψ applies G1 firstB=(\lvert0\rangle,\lvert1\rangle),\quad G_2G_1\lvert\psi\rangle\text{ applies }G_1\text{ first}(O2.5)

Notation contract: Basis order (|0>, |1>); column vectors; gates act right-to-left in products; global phase equivalence must be stated explicitly.

Changing the question changes the statistics

Express X-basis measurement as a basis rotation followed by Z measurement.

A small statevector simulator is the reference implementation of everything in this guide:

state: complex vector
gate: unitary matrix
operation: state <- gate * state
measurement: sample according to squared magnitudes

Four ideas, each one line. This approach will not scale; the vector doubles with every qubit; but it is the right way to build early correctness, and Part V has you write one from scratch.

On a real device there are no matrices; there are pulses, fields, voltages, lasers, and optical elements, each engineered to approximate a target unitary. A symbolic HH in your circuit becomes hardware-specific control, and the approximation is never exact. The questions that determine whether the math survives contact with the machine:

  • What gate set is native to the device?
  • How long does each gate take?
  • What is the measured error rate per gate?
  • How many extra gates does compilation add?
  • Does limited connectivity force swap operations?
  • Does calibration drift change behavior over hours or days?

A one-qubit calculation protocol

Turn the arithmetic into a reusable checklist and diagnostic.

  1. Normalize [2,0][\sqrt2,0], [1,1][1,-1], and [2,2i][\sqrt2,\sqrt2 i].
  2. Apply XX, ZZ, HH, and SS to both 0\lvert0\rangle and 1\lvert1\rangle.
  3. Compute HZH0HZH\lvert0\rangle and identify the familiar gate you just built.
  4. Show that X2=IX^2=I and Z2=IZ^2=I.
  5. Write down two states with identical computational-basis probabilities but different outcomes after a Hadamard.
  6. Write pseudocode for a one-qubit statevector simulator.
  7. Explain why a shot histogram is not the same thing as a quantum state.

Part II of the book turns this working session into a complete toolkit:

Then continue to Multi-Qubit Circuits, Entanglement, and No-Hype Protocols, where a second qubit changes the game entirely.

One-qubit calculation notebook

Acceptance contract for One-qubit calculation notebook
FieldReader-visible record
FormatTested Python notebook plus printable hand-calculation grid
VerificationTests verify normalization after every gate, H²=I, HZH=X, and exact probabilities for the guide's examples.
AvailabilitySource-embedded acceptance record; no separate download is claimed
{
  "artifact": "One-qubit calculation notebook",
  "format": "Tested Python notebook plus printable hand-calculation grid",
  "acceptance_test": "Tests verify normalization after every gate, H²=I, HZH=X, and exact probabilities for the guide's examples.",
  "publication_state": "source-embedded contract and worked fixture"
}

Scope boundary

  • This guide does not cover mixed states, tomography, or multi-qubit entanglement.
  • It does not treat a statevector simulator's private state as physically readable output.

Depth commitment. Two complete calculations, four gate definitions, and one reusable protocol.

Practice problem

Trace |0> through S, H, Z, and H in the stated order, checking normalization after each operation and predicting Z-basis outcomes.

Deliverable
A state-after-each-gate table with exact complex entries and final probabilities.
Pass condition
Each row equals the notebook fixture; norms equal one and probabilities sum to one.

Verification record

Expected solution form. Exact symbolic table followed by a numerical tolerance check.

Model answer. In circuit time order, |0> remains |0> after S, becomes |+> after H, becomes |-> after Z, and becomes |1> after the final H. Every intermediate norm is one; the final Z-basis result is 1 with certainty.

Model result and check. The notebook independently evaluates the matrix product and compares every row to the published solution.

Acceptance test. Each row equals the notebook fixture; norms equal one and probabilities sum to one.

Provenance

Sources and review

  1. John Watrous. The Theory of Quantum Information. Cambridge University Press / University of Waterloo. 2018textbook
  2. Michael A. Nielsen and Isaac L. Chuang. Quantum Computation and Quantum Information. Cambridge University Press. 2010textbook
  3. John Preskill. Lecture Notes for Physics 219: Quantum Computation. California Institute of Technology. 2018graduate lecture notes

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