Quantum State Tomography Tutorial: Reconstruct and Validate Small Quantum States
quantum tomographyquantum statesQiskitmeasurementstate fidelityquantum experiments

Quantum State Tomography Tutorial: Reconstruct and Validate Small Quantum States

QQbit Vision Editorial
2026-11-18
8 min read

Learn how to reconstruct small quantum states from measurement data, validate density matrices, estimate fidelity, and plan tomography shots.

A quantum state tomography experiment turns measurement data into an estimated density matrix. This tutorial presents a repeatable workflow for choosing measurement bases, allocating shots, reconstructing and validating small quantum states, calculating fidelity, and comparing hardware results with an ideal simulation.

Overview

Quantum state tomography is the process of inferring an unknown quantum state from repeated measurements. A single measurement reveals only one outcome from one basis, so tomography combines results from several measurement settings. The output is usually a density matrix, written as ρ, that describes the state supported by the collected data.

For a one-qubit state, the density matrix can be written using the Pauli operators:

ρ = 1/2 (I + xX + yY + zZ)

Here, x, y, and z are expectation values obtained by measuring in the X, Y, and Z bases. A useful tomography workflow therefore has five stages:

  1. Define the state and the question you want to validate.
  2. Choose measurement bases and a shot budget.
  3. Collect counts for every basis, keeping circuit and backend settings fixed where possible.
  4. Reconstruct a candidate density matrix and check whether it is physical.
  5. Compare the reconstruction with an ideal or reference state using fidelity and uncertainty estimates.

Tomography is most practical for small circuits. The number of measurements grows quickly as the number of qubits increases, so it should not automatically be treated as a debugging step for a large algorithm. For larger systems, reduced tomography, classical shadows, observable-specific measurements, or subsystem characterization may provide a more manageable alternative.

Tomography methods at a glance

MethodBest fitStrengthLimitation
Pauli-basis tomographyOne or a few qubitsEasy to explain, implement, and auditMeasurement settings grow exponentially with qubit count
Maximum-likelihood estimationExperiments that produce noisy or imperfect estimatesCan enforce a valid positive semidefinite density matrixRequires an optimizer and introduces modeling choices
Bayesian tomographyExperiments that need posterior uncertaintyRepresents uncertainty over possible statesCan be computationally heavier and prior-sensitive
Classical shadowsEstimating selected properties of larger statesCan reuse randomized measurements for many observablesNot always the simplest route to a full density matrix
Reduced or local tomographySubsystem checks and local noise studiesLower measurement cost than full reconstructionDoes not describe all multi-qubit correlations

How to estimate

The most useful estimate in a tomography experiment is usually the measurement cost: how many circuits and shots are needed before the result is precise enough to support a decision?

1. Count the measurement settings

For one qubit, measuring the X, Y, and Z bases requires three settings. For an n-qubit product-Pauli experiment, a straightforward full-tomography design uses up to 3ⁿ tensor-product settings. Each setting produces a distribution over computational-basis bit strings after basis rotations.

The approximate shot count is:

total shots = number of settings × shots per setting

If you use 3 settings with 2,000 shots each, the experiment consumes 6,000 shots. If you use 27 settings for three qubits with the same allocation, it consumes 54,000 shots. This simple estimate should be made before running hardware jobs, because basis count often dominates the experiment design.

2. Translate counts into expectation values

After rotating the requested basis into the computational basis, assign an eigenvalue to each outcome. For a one-qubit Z measurement, outcome 0 contributes +1 and outcome 1 contributes -1:

⟨Z⟩ = (N₀ - N₁) / (N₀ + N₁)

The same pattern applies to X and Y after their respective basis rotations. For a multi-qubit Pauli string, multiply the individual eigenvalues. For example, the value assigned to a two-qubit ZZ outcome is positive for 00 and 11, and negative for 01 and 10.

3. Reconstruct the matrix

For one qubit, substitute the three estimated expectations into the Bloch-vector expression. For multiple qubits, expand the state in a Pauli basis:

ρ = 1/2ⁿ Σᵢ rᵢ Pᵢ

where Pᵢ ranges over tensor products of I, X, Y, and Z, and rᵢ = Tr(ρPᵢ). In practice, the identity coefficient is known, while the non-identity coefficients come from measured expectation values.

4. Check physicality before interpreting the result

A valid density matrix must be Hermitian, have trace one, and be positive semidefinite. Finite-shot noise can produce a matrix with a small negative eigenvalue even when the experiment is otherwise sound. That matrix is not a physically valid state, so do not calculate a headline fidelity from it without documenting how it was handled.

For a quick diagnostic, compute:

  • Hermiticity error: the size of ρ - ρ†.
  • Trace error: the difference between Tr(ρ) and one.
  • Minimum eigenvalue: a negative value indicates nonphysicality.
  • Purity: Tr(ρ²), which is one for an ideal pure state and lower for a mixed state.

You can use a maximum-likelihood or constrained optimization reconstruction to enforce physicality. Record that choice separately from the raw linear-inversion result; otherwise, a corrected matrix can conceal useful information about sampling noise or calibration problems.

Inputs and assumptions

Tomography results are only as reproducible as the inputs recorded with them. At minimum, save the following:

  • Target circuit: circuit diagram, gate parameters, qubit order, and whether measurements were added before or after transpilation.
  • Reference state: ideal statevector, ideal density matrix, or another experimentally prepared state.
  • Measurement settings: basis string for each circuit, such as XX, XY, or ZZ.
  • Shots per setting: keep the allocation explicit rather than reporting only a total.
  • Backend conditions: simulator or hardware label, noise model if used, transpilation configuration, and relevant calibration context.
  • Mitigation status: raw counts, readout-corrected counts, zero-noise-extrapolated results, or another processing path.
  • Reconstruction method: linear inversion, maximum likelihood, Bayesian estimation, or another method.

Basis rotations must be applied consistently. A common implementation pattern is to rotate X measurements into Z with a Hadamard gate and rotate Y measurements with a gate sequence that maps the Y eigenbasis to the computational basis. The exact code differs between Qiskit, PennyLane, Cirq, and provider primitives, so verify the current measurement API rather than copying an old example unchanged.

When using a simulator, distinguish between an exact statevector calculation and a shot-based simulation. The former supplies an ideal reference; the latter reproduces sampling fluctuations and, if configured, noise. A useful validation ladder is to test reconstruction first against exact probabilities, then against finite-shot ideal data, and finally against noisy hardware data. For broader simulator decisions, see Quantum Simulator Benchmarking.

Worked examples

Example 1: Reconstructing a one-qubit state

Suppose a circuit prepares a nominal state whose measurements produce these illustrative counts, with 1,000 shots per basis:

BasisOutcome 0Outcome 1Estimated expectation
X9001000.80
Y5005000.00
Z6503500.30

Linear inversion gives the candidate matrix:

ρ = 1/2 [[1 + 0.30, 0.80 - i·0.00], [0.80 + i·0.00, 1 - 0.30]]

Before comparing it with an ideal state, calculate its trace and eigenvalues. The Bloch-vector length here is approximately 0.85, so the reconstructed state is mixed rather than a perfectly pure state. That can reflect genuine noise, finite-shot uncertainty, state-preparation error, or a combination of these effects. Repeat the experiment with a larger shot budget or bootstrap the counts to estimate how stable the matrix entries are.

Example 2: Fidelity against an ideal reference

If the reference is a pure state |ψ⟩, a convenient fidelity expression is:

F = ⟨ψ|ρ|ψ⟩

For two mixed density matrices, use the chosen mixed-state fidelity convention consistently. One common convention is the squared Uhlmann fidelity:

F(ρ,σ) = [Tr(√(√ρ σ √ρ))]²

State clearly which convention your software uses, because unsquared and squared forms can both appear in libraries and research code. Fidelity is also not a substitute for inspecting observables: two states can have similar fidelity while differing in a property important to the application.

Example 3: A repeatable results record

Use a record like the following for each experiment:

Experiment ID: bell-state-check-01
Circuit revision: commit-or-notebook-cell
Qubits: 2
Reference: ideal density matrix
Measurement bases: XX, XY, XZ, YX, YY, YZ, ZX, ZY, ZZ
Shots per basis: 2000
Backend: simulator or hardware label
Mitigation: none / readout correction / other
Reconstruction: linear inversion, then constrained fit
Minimum eigenvalue: ...
Trace: ...
Purity: ...
Fidelity convention: pure-state overlap or mixed-state definition
Fidelity: ...
Uncertainty method: bootstrap or repeated runs
Notes: calibration and transpilation details

This record makes it possible to compare a new circuit revision, shot budget, backend, or mitigation method without confusing a change in the experiment with a change in the state-preparation circuit. For software-level regression checks, pair tomography with assertions on probabilities, conserved quantities, and circuit outputs as described in How to Test Quantum Programs.

When to recalculate

Recalculate the tomography whenever an input that affects the measurement distribution changes. That includes the circuit, qubit mapping, transpilation, basis-rotation implementation, shot allocation, simulator noise model, hardware backend, readout calibration, or mitigation pipeline.

It is also worth repeating the analysis when the original result is close to a decision threshold. A single fidelity value without an uncertainty estimate can be misleading when counts are limited. Use repeated runs or bootstrap resampling to report a range, and distinguish variation caused by finite shots from variation caused by changing hardware conditions.

For an efficient maintenance routine:

  1. Run an ideal, exact reference test after changing reconstruction code.
  2. Run a shot-based simulator test to check sampling behavior.
  3. Repeat the same basis list and shot budget on the selected backend.
  4. Compare raw and mitigated reconstructions separately.
  5. Log matrix validity, purity, fidelity, and uncertainty rather than fidelity alone.
  6. Increase shots or reduce the tomography scope if the result is too noisy for the intended decision.

Tomography is most valuable when treated as an auditable experiment rather than a single visualization. Start with one qubit or a small entangled state, validate the reconstruction against a simulator, preserve the raw counts, and only then add mitigation or hardware comparisons. As your circuit changes, rerun the same measurement plan and update the results record so that state fidelity remains a comparable engineering metric rather than an isolated number.

Related Topics

#quantum tomography#quantum states#Qiskit#measurement#state fidelity#quantum experiments
Q

Qbit Vision Editorial

Quantum Computing Editor

Senior editor and content strategist. Writing about technology, design, and the future of digital media. Follow along for deep dives into the industry's moving parts.