Case Study: Reconstructing a Qubit from Measurement Counts

Executive Summary

A collaborator sends you three columns of numbers from a quantum processor and one sentence: "This is supposed to be $|+\rangle$ but the algorithm downstream is misbehaving. Can you tell me what state we're actually preparing?"

You cannot look at a quantum state. You can only measure it, one shot at a time, in one basis at a time, destroying it with each shot. This case study walks through single-qubit state tomography: turning measurement frequencies in three bases into a Bloch vector, and turning that Bloch vector into a diagnosis. It is the practical inverse of everything Chapter 2 taught — instead of writing down a state and predicting measurements, you observe measurements and reconstruct the state.

Skills applied

  • Converting measurement counts into expectation values (§2.5).
  • Assembling $\langle X\rangle, \langle Y\rangle, \langle Z\rangle$ into a Bloch vector (§2.7).
  • Reading $\theta$ and $\varphi$ off a Bloch vector (§2.7).
  • Distinguishing a rotation error from decoherence using the vector's length (§2.9).

Background

The data

Your collaborator ran 8,192 shots in each of three measurement bases:

Basis Outcome $+1$ Outcome $-1$
$Z$ 4,051 4,141
$X$ 7,102 1,090
$Y$ 5,905 2,287

For an ideal $|+\rangle$ you would expect $Z$: 50/50, $X$: all $+1$, $Y$: 50/50.

The reconstruction principle

Any single-qubit state — pure or mixed — is fully described by its Bloch vector $\vec{r} = (r_x, r_y, r_z)$, where each component is the expectation value of the corresponding Pauli operator:

$$r_x = \langle X\rangle, \qquad r_y = \langle Y\rangle, \qquad r_z = \langle Z\rangle$$

and the density matrix is $\rho = \frac{1}{2}(I + r_x X + r_y Y + r_z Z)$.

Three numbers, three measurement settings. That is the whole method.

Phase 1: Counts to expectation values

An expectation value of a $\pm 1$-valued observable is just the probability-weighted average:

$$\langle P\rangle = \frac{N_{+} - N_{-}}{N_{+} + N_{-}}$$

Applying this:

$$r_z = \frac{4051 - 4141}{8192} = \frac{-90}{8192} \approx -0.011$$ $$r_x = \frac{7102 - 1090}{8192} = \frac{6012}{8192} \approx 0.734$$ $$r_y = \frac{5905 - 2287}{8192} = \frac{3618}{8192} \approx 0.442$$

So $\vec{r} \approx (0.734,\ 0.442,\ -0.011)$.

The ideal $|+\rangle$ has $\vec{r} = (1, 0, 0)$. Two things are wrong: the vector has rotated toward $+y$, and it is short.

Phase 2: Is it a rotation, or is it decoherence?

This is the diagnostic question, and the Bloch vector's length answers it:

$$|\vec{r}| = \sqrt{0.734^2 + 0.442^2 + 0.011^2} = \sqrt{0.539 + 0.195 + 0.0001} \approx 0.857$$

Recall from §2.9:

  • $|\vec{r}| = 1$ — a pure state, on the sphere's surface. Any discrepancy from the target is a coherent error: a wrong rotation angle, a miscalibrated pulse. Fixable by recalibration.
  • $|\vec{r}| < 1$ — a mixed state, inside the sphere. The qubit has decohered or been entangled with its environment. Not fixable by rotating.

At $0.857$, we have both. The state has rotated away from $+x$ (coherent error) and lost purity (incoherent error). Diagnosing only one of these is the usual mistake.

Phase 3: Quantify the coherent part

Project onto the sphere by normalizing: $\hat{r} = \vec{r}/|\vec{r}| \approx (0.856,\ 0.516,\ -0.013)$.

Now read off the angles using $\hat{r} = (\sin\theta\cos\varphi,\ \sin\theta\sin\varphi,\ \cos\theta)$:

$$\theta = \arccos(r_z/|\vec r|) = \arccos(-0.013) \approx 90.7°$$ $$\varphi = \operatorname{atan2}(0.516,\ 0.856) \approx 31.1°$$

The target $|+\rangle$ is $\theta = 90°$, $\varphi = 0°$.

Diagnosis, part 1. $\theta$ is essentially correct — the state prep is putting the qubit on the equator as intended. The error is almost entirely in $\varphi$: a spurious 31° phase rotation about the $z$ axis.

A $z$-rotation of $\varphi$ is exactly what an uncompensated frame error, a detuned drive, or an unaccounted-for $R_z$ produces. Notice that this error is completely invisible in the $Z$-basis measurement — the $Z$ counts look like a perfect 50/50. A team checking only computational-basis statistics would have declared the state correct.

Phase 4: Quantify the incoherent part

The purity loss is $|\vec{r}| = 0.857$. Purity is

$$\operatorname{Tr}(\rho^2) = \frac{1 + |\vec{r}|^2}{2} = \frac{1 + 0.734}{2} \approx 0.867$$

against $1.0$ for a pure state. Equivalently, the state is a mixture of the ideal pure state with about 14% maximally mixed noise.

Is that consistent with the hardware? If the qubit's coherence time is $T_2 = 80\,\mu s$ and the state sat idle for $\tau$ before measurement, equatorial states decay as $e^{-\tau/T_2}$:

$$e^{-\tau/T_2} = 0.857 \implies \tau = -T_2\ln(0.857) \approx 80 \times 0.154 \approx 12\,\mu s$$

So a 12 μs idle time explains the purity loss entirely. If the circuit really does have ~12 μs of dead time between preparation and measurement, nothing is broken — that is physics, and the fix is scheduling, not calibration.

Phase 5: The report

What state are we preparing? Approximately $\cos(45.4°)|0\rangle + e^{i \cdot 31.1°}\sin(45.4°)|1\rangle$, degraded to 86% Bloch-vector length by dephasing.

Two independent problems:

  1. A 31° phase error — coherent, reproducible, and correctable by inserting $R_z(-31°)$ before measurement or by fixing the underlying frame tracking. This is almost certainly the cause of the downstream algorithm misbehaving, because any algorithm relying on interference is sensitive to exactly this.
  2. 14% dephasing — consistent with ~12 μs idle at $T_2 = 80\,\mu s$. Reduce by shortening the gap between preparation and measurement; not correctable by rotation.

Why $Z$-basis testing missed it: a $z$-rotation leaves $Z$ statistics untouched. Only the $X$ and $Y$ measurements revealed it. Single-basis verification cannot validate a superposition state — this is the practical lesson.

Discussion Questions

  1. Why does tomography require three bases for one qubit? What would you lose with only $Z$ and $X$?
  2. The $Z$ counts were 4,051 vs. 4,141 — not exactly equal. Is that evidence of an error? Estimate the shot-noise standard deviation for 8,192 samples and decide.
  3. If $|\vec r|$ had come out as $1.02$, what would you conclude?
  4. How many measurement settings would full tomography of a two-qubit state require, and why does this method become impractical quickly?

Your Turn: Extensions

  • Write the Qiskit code that produces these three columns: the same prepared state, measured with no basis change ($Z$), with $H$ applied first ($X$), and with $S^\dagger$ then $H$ ($Y$).
  • Reconstruct $\rho$ explicitly as a $2\times2$ matrix and verify it is Hermitian, unit-trace, and positive semidefinite.
  • Add binomial error bars to each expectation value and propagate them to an uncertainty on $\varphi$.

Key Takeaways

  • A single-qubit state is three numbers: $\langle X\rangle$, $\langle Y\rangle$, $\langle Z\rangle$. Measure them and you know everything.
  • The direction of the Bloch vector diagnoses coherent (rotation) errors; its length diagnoses incoherent (decoherence) errors. Always compute both.
  • Measuring only in the computational basis is blind to relative phase — the very thing quantum algorithms depend on.
  • Purity loss can often be predicted from $T_2$ and idle time; when it matches, the hardware is behaving and the schedule is at fault.