|q⟩ Bad Qubits

advanced · Programming · Benchmarking, Noise Characterization & RB

Quantum State Tomography

A quantum state is described by a density matrix ρ\rho, but a single measurement returns only one classical bit per qubit. State tomography is the procedure for reconstructing the entire matrix ρ\rho from the statistics of many repeated measurements in carefully chosen bases.

Expanding ρ\rho in the Pauli basis

Any single-qubit density matrix can be written as a real combination of the identity and the three Pauli matrices:

ρ=12(I+rxX+ryY+rzZ),rk=tr(ρσk).\rho = \frac{1}{2}\left( I + r_x X + r_y Y + r_z Z \right), \qquad r_k = \operatorname{tr}(\rho\,\sigma_k).

The three numbers (rx,ry,rz)(r_x, r_y, r_z) are exactly the Bloch vector of the state. Reconstructing ρ\rho therefore reduces to measuring the three expectation values X\langle X\rangle, Y\langle Y\rangle, and Z\langle Z\rangle. Each is bounded in [1,1][-1, 1], and a valid pure state has rx2+ry2+rz2=1r_x^2 + r_y^2 + r_z^2 = 1.

Measuring in three bases

The simulator — like real hardware — only measures in the computational (ZZ) basis. To estimate the other two expectation values we rotate the desired axis onto the ZZ axis before measuring:

Running each rotated circuit for many shots gives an estimate of the corresponding expectation value, and from the three values you assemble ρ\rho. With finite shots the estimate has statistical error 1/N\sim 1/\sqrt{N}, and the raw reconstruction can even fall slightly outside the Bloch ball — which is why practitioners follow up with a maximum-likelihood fit that forces ρ\rho to be a valid (positive, unit-trace) density matrix.

The measurement-rotation primitive

The single most important mechanical step in tomography is the basis rotation. Consider the state +=12(0+1)|+\rangle = \tfrac{1}{\sqrt 2}(|0\rangle + |1\rangle). Measured directly in the ZZ basis it is maximally random (p0=p1=12p_0 = p_1 = \tfrac12), revealing only that Z=0\langle Z\rangle = 0. But +|+\rangle is the +1+1 eigenstate of XX, so if we first apply HH we get

H+=0,H|+\rangle = |0\rangle,

and the measurement is now deterministic: outcome 00 with probability 11, i.e. X=+1\langle X\rangle = +1. That single rotated circuit nails the XX component of the Bloch vector exactly.

Try it

Prepare +|+\rangle on one qubit, then perform an XX-basis measurement by rotating the XX axis onto ZZ before measuring. The grader checks the resulting computational-basis distribution: a correct XX-basis measurement of +|+\rangle yields outcome 00 with probability 11.

Run your code to see the quantum state.

After running, open the Probabilities tab: the bar for 0 should reach 1.01.0, confirming X=+1\langle X\rangle = +1.

Sign in on the full site to ask questions and join the discussion.