Steven GellerQuantum Computing, End to End

Book contents

Current section

Part II. Mathematical Core

  1. Complex Numbers for Quantum Computing
  2. Vectors, Bases, and Amplitudes
  3. Inner Products, Orthogonality, and Projection
  4. Matrices as Gates
  5. Unitary Operations and Reversibility
  6. Tensor Products and State-Space Growth
  7. Observables, Eigenvectors, and Measurement
  8. Density Matrices and Mixed States

Part II. Mathematical Core · Chapter 14

Observables, Eigenvectors, and Measurement

An observable is a question you are permitted to ask a quantum state, and its eigenvalues are the only answers that can ever come back. This chapter connects that structure to the statistic everyone quotes: the expectation value.

Artifact
In this chapter 8 sections

Reader question. How does a Hermitian observable connect possible measurement outcomes, their probabilities, and an expectation value?

A Hermitian observable has real eigenvalues and orthogonal eigenspaces; measuring it samples an eigenvalue with probability set by the state's projection, while the expectation value is the repeated-trial average <ψ|A|ψ>, not a guaranteed single-shot result.

Scope and non-goals.
  • The full spectral theorem in arbitrary dimension and generalized measurements are outside scope.
  • Expectation values are kept distinct from the eigenvalue returned by one run.
Two possible outcomes and an average no shot can return Two possible outcomes, one impossible average p = 1/2 p = 1/2 −1 +1 ⟨Z⟩ = 0: the average; never an outcome state: |+⟩ = (|0⟩+|1⟩)/√2, observable: Z possible measured values of Z
Figure 14.1. Notice that every shot lands on a bar while the dashed average falls where no shot can ever land. The expectation value summarizes the distribution; no single measurement equals it.

A measurable quantity as an operator

Define Hermiticity and the eigenvalue equation.

An observable represents a measurable quantity. In the finite-dimensional circuit setting, observables are Hermitian matrices; equal to their own conjugate transpose. That single property buys two guarantees: the eigenvalues are real numbers, so they can serve as physical readings, and the eigenvectors form an orthonormal basis, so they can serve as a measurement basis. The eigenvectors define the measurement directions, and the eigenvalues are the only values a measurement of that observable can return.

For a state ψ\lvert\psi\rangle and an observable AA, the expectation value is:

A=ψAψ\langle A\rangle=\langle\psi\rvert A\lvert\psi\rangle(14.1)

Read that formula carefully. It is not the result of one shot. It is the average you would estimate by preparing the same state many times, measuring each copy, and averaging the outcomes. One number, three ideas; and the chapter hangs on keeping them separate.

Evidence boundary. Quantum observables are represented by Hermitian operators with real eigenvalues. [John Watrous] [Michael A. Nielsen]

Pauli Z supplies the smallest spectrum

Identify eigenvectors, outcomes, and projectors.

The canonical example:

Z=(1001)Z=\begin{pmatrix}1&0\\0&-1\end{pmatrix}(14.2)

Its eigenstructure answers the measurement question completely:

Z0=+0,Z1=1Z\lvert0\rangle=+\lvert0\rangle,\quad Z\lvert1\rangle=-\lvert1\rangle(14.3)

Measure Z and you can only ever get +1+1 or 1-1, landing the qubit on 0\lvert0\rangle or 1\lvert1\rangle respectively. So the three objects are: the expectation value (an average, possibly any real number in between), the individual outcome (always an eigenvalue), and the post-measurement state (the eigenvector you landed on). Merge any two and measurement talk turns to mush.

Evidence boundary. Projective measurement probabilities are projections onto an observable's eigenspaces. [Michael A. Nielsen] [John Preskill]

From state decomposition to outcome probabilities

Expand |+> in the observable's eigenbasis.

For the spectral decomposition A=aaPaA=\sum_a aP_a, the probability of outcome aa is ψPaψ\langle\psi\rvert P_a\lvert\psi\rangle, and the expectation is aaψPaψ\sum_a a\langle\psi\rvert P_a\lvert\psi\rangle. In a nondegenerate basis P_a is an outer product; under degeneracy it projects onto the whole eigenspace. This projector form avoids assigning physical meaning to an arbitrary eigenvector chosen inside a degenerate subspace.

Evidence boundary. The expectation value <ψ|A|ψ> is an ensemble average and need not equal any single outcome. [John Watrous] [Michael A. Nielsen]

A=A;Aai=aiai;Aψ=ψAψA=A^\dagger;\quad A\lvert a_i\rangle=a_i\lvert a_i\rangle;\quad \langle A\rangle_\psi=\langle\psi\rvert A\lvert\psi\rangle(14.4)

Notation contract: A=A†; eigenpairs A|a_i>=a_i|a_i>; projectors P_i; expectation <A>_ψ; eigenvalue units named when physical.

Expectation is an ensemble statistic

Compute <Z> and compare with finite-shot averages.

An observable is a query interface over a quantum state; one with physical rules. You never get the whole object back. You choose a measurement, collect samples, and estimate a statistic, and the statistic you get is tied to the observable you chose.

The working loop is: define the observable, prepare the state, measure many times in the appropriate basis (or a transformed one), then estimate. Everything in applied quantum computing runs this loop. A reported energy is usually a sum over many observable terms, each estimated separately. A device calibration metric may measure a convenient proxy rather than the final application target. When a number arrives, the professional reflex is: which quantity was actually estimated, and how many shots bought it?

The shot count is not a detail. Every estimate carries sampling noise that shrinks only like the inverse square root of the number of shots, so a claim of high precision is implicitly a claim about a large shot budget; which on real hardware means time, queue priority, and money. When two results look different, the first question is often not physics but statistics: were they estimated to the same precision?

Degeneracy and basis choice at the boundary

State what changes when eigenspaces have dimension greater than one.

Degenerate eigenvalues identify an outcome without identifying a unique post-measurement vector inside its eigenspace. The measurement instrument determines what additional disturbance occurs there. A bare Hermitian observable specifies outcome probabilities and ideal projectors, not every laboratory implementation. Claims about the final state therefore need the instrument or circuit, not only the observable's matrix.

Observable sampling notebook

Acceptance contract for Observable sampling notebook
FieldReader-visible record
FormatExact eigendecomposition plus seeded finite-shot estimator
VerificationTests Hermiticity, real eigenvalues, projector completeness, analytic probabilities, and estimator convergence.
AvailabilitySource-embedded acceptance record; no separate download is claimed
{
  "artifact": "Observable sampling notebook",
  "format": "Exact eigendecomposition plus seeded finite-shot estimator",
  "acceptance_test": "Tests Hermiticity, real eigenvalues, projector completeness, analytic probabilities, and estimator convergence.",
  "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 math
import random

def inner(left, right):
    return sum(a.conjugate() * b for a, b in zip(left, right))

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

def normalize(vector):
    norm = math.sqrt(inner(vector, vector).real)
    return tuple(value / norm for value in vector)

def eigh2(matrix):
    if abs(matrix[0][0].imag) > 1e-12 or abs(matrix[1][1].imag) > 1e-12 or abs(matrix[1][0] - matrix[0][1].conjugate()) > 1e-12:
        raise ValueError("observable must be Hermitian")
    a, d, off = matrix[0][0].real, matrix[1][1].real, matrix[0][1]
    center = (a + d) / 2
    radius = math.sqrt(((a - d) / 2) ** 2 + abs(off) ** 2)
    values = (center + radius, center - radius)
    if radius < 1e-15:
        vectors = ((1 + 0j, 0j), (0j, 1 + 0j))
    else:
        vectors = tuple(normalize((off, value - a)) if abs(off) > 1e-15
                        else ((1 + 0j, 0j) if abs(value - a) < 1e-12 else (0j, 1 + 0j))
                        for value in values)
    return values, vectors

def born_probabilities(state, eigenvectors):
    return tuple(abs(inner(vector, state)) ** 2 for vector in eigenvectors)

def seeded_estimate(values, probabilities, shots, seed):
    if shots < 1:
        raise ValueError("shots must be positive")
    rng = random.Random(seed)
    samples = [values[0] if rng.random() < probabilities[0] else values[1] for _ in range(shots)]
    mean = sum(samples) / shots
    variance = sum((sample - mean) ** 2 for sample in samples) / shots
    return mean, math.sqrt(variance / shots)

scale = math.sqrt(0.5)
observables = (
    ((1 + 0j, 0j), (0j, -1 + 0j)),
    ((0j, 1 + 0j), (1 + 0j, 0j)),
    ((1 + 0j, 1j), (-1j, -1 + 0j)),
    ((2 + 0j, 0j), (0j, 2 + 0j)),
)
states = ((1, 0), (scale, scale), (scale, 1j * scale), (0.6, 0.8j))
max_residual = 0.0
max_sampling_z = 0.0
measurement_cases = 0
for observable_index, observable in enumerate(observables):
    values, eigenvectors = eigh2(observable)
    assert all(isinstance(value, float) for value in values)
    assert abs(inner(eigenvectors[0], eigenvectors[1])) < 1e-12 or abs(values[0] - values[1]) < 1e-12
    for value, vector in zip(values, eigenvectors):
        residual = max(abs(actual - value * expected) for actual, expected in zip(matvec(observable, vector), vector))
        max_residual = max(max_residual, residual)
    for state_index, state in enumerate(states):
        probabilities = born_probabilities(state, eigenvectors)
        assert abs(sum(probabilities) - 1.0) < 1e-12
        analytic = inner(state, matvec(observable, state)).real
        spectral = sum(value * probability for value, probability in zip(values, probabilities))
        assert abs(analytic - spectral) < 1e-12
        estimate, stderr = seeded_estimate(values, probabilities, 30000, 1400 + 10 * observable_index + state_index)
        allowance = 6 * stderr + 1e-12
        assert abs(estimate - analytic) <= allowance
        max_sampling_z = max(max_sampling_z, abs(estimate - analytic) / max(stderr, 1e-12))
        measurement_cases += 1
assert max_residual < 1e-12

nonhermitian_rejected = False
try:
    eigh2(((0j, 1j), (1j, 0j)))
except ValueError:
    nonhermitian_rejected = True
assert nonhermitian_rejected
zero_shots_rejected = False
try:
    seeded_estimate((1, -1), (0.5, 0.5), 0, 1)
except ValueError:
    zero_shots_rejected = True
assert zero_shots_rejected
print(f"PASS: 14 observable notebook solves {len(observables)} Hermitian spectra and {measurement_cases} seeded estimates; last estimate={estimate:.4f}, max eigen-residual={max_residual:.2e}, max sampling z={max_sampling_z:.2f}")

Scope boundary

  • The full spectral theorem in arbitrary dimension and generalized measurements are outside scope.
  • Expectation values are kept distinct from the eigenvalue returned by one run.

Depth commitment. One Pauli example, one rotated observable, one estimator, and one boundary note.

Practice problem

For A=(X+Z)/2A=(X+Z)/\sqrt{2} and state 0\lvert0\rangle, find eigenvalues numerically, compute <A>, and compare with a seeded 20,000-shot estimate.

Deliverable
Operator matrix, eigenvalue/probability table, exact expectation, and sampled estimate.
Pass condition
The notebook checks Hermiticity, probabilities sum to one, exact expectation equals the probability-weighted eigenvalue sum, and the estimate lies within tolerance.

Verification record

Expected solution form. Spectral calculation plus reproducible sampling table.

Model answer. A has eigenvalues +1 and -1. In |0>, <A>=1/sqrt(2); outcome probabilities are (1+1/sqrt(2))/2 and (1-1/sqrt(2))/2. A 20,000-shot estimate should lie inside the published seeded sampling interval around 0.7071.

Model result and check. CI recomputes the eigensystem and estimator with the published seed.

Acceptance test. The notebook checks Hermiticity, probabilities sum to one, exact expectation equals the probability-weighted eigenvalue sum, and the estimate lies within tolerance.

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. 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