Measurement and Mixed States
Quantum computations that produce classical output end with measurement, which is not a unitary, reversible operation on the measured system. This page covers what measurement does to a state, how to measure along axes other than Z, how repeated runs estimate probabilities, and how density matrices describe noisy qubits and subsystems of entangled states.
The Quantum Simulator can reproduce the ideal-gate measurement and reduced-state exercises on this page. It reports probabilities, sampled counts and reduced-state Bloch vectors after each run. The later noise-channel equations are not adjustable QSim controls.
The Born rule
Measuring a single qubit in the computational basis returns 0 with probability and 1 with probability . For a register the rule is the same, applied to one qubit at a time. Measuring qubit of an ‑qubit state uses the projectors
Outcome occurs with probability , and the state afterwards is the projected vector, renormalised:
Conditioning on a particular outcome makes the normalized state-update rule nonlinear in the input state. The projection is noninvertible: amplitudes inconsistent with the observed outcome are removed from the conditional state and cannot be reconstructed by a later gate acting only on that state.
Measuring along other axes
Many quantum-computing platforms expose computational-basis, or Z-basis, measurement as the native operation. To measure along a different axis, rotate the desired eigenbasis onto the computational basis first. The common cases are:
| Basis | States | Rotate first with | Then read |
|---|---|---|---|
| Z | nothing | outcome is the Z result | |
| X | 0 means | ||
| Y | then | 0 means |
Here and . The probabilities obtained this way are the Born-rule probabilities in the chosen basis, such as . The pre-rotation physically changes the state so that a subsequent Z-basis measurement implements the desired measurement on the original state.
From amplitudes to statistics
A single run yields one outcome, while repeated runs estimate outcome probabilities. Estimating a Bernoulli probability from independent shots gives a sample-proportion standard deviation . Reducing this standard deviation by a factor of ten requires a hundred times as many shots. Sampling cost can therefore dominate some variational workloads.
Expectation values are the usual way to summarise a run. For an observable ,
and for the Pauli operators this reduces to counting: , with and obtained the same way after the rotations in the table above.
Density matrices
A state vector can describe a pure joint entangled state, but it generally cannot describe one subsystem alone or a statistical mixture. The general state description is the density matrix
a weighted mixture of pure states with and . Every density matrix is positive semi‑definite with . A pure state is the special case .
The purity equals 1 exactly when the state is pure. Its minimum is , attained by the maximally mixed state in dimension , so the minimum is for a single qubit. Purity measures mixedness, but a subsystem may be mixed because of entanglement rather than environmental decoherence.
Note that a mixture is not a superposition. The state has , while an equal mixture of |0⟩ and |1⟩ has . They give identical Z‑basis statistics and differ completely in X. A projective Z-basis measurement whose result is discarded converts the first state into the second: the off‑diagonal entries of , called coherences, are set to zero while the diagonal is unchanged.
The Bloch ball
For a single qubit, expanding in the Pauli basis gives
The vector is exactly the arrow drawn on the Bloch sphere, and the purity is . So pure states have and sit on the surface, mixed states have and sit strictly inside, and the maximally mixed state is the centre. The Bloch sphere of the earlier pages is really a solid ball once mixed states are allowed.
Why an entangled qubit looks mixed
Given a two‑qubit state , the description of qubit alone is the reduced density matrix obtained by tracing out :
For the Bell state , this gives , with purity and its Bloch vector at the origin. The joint state is pure, yet each half is maximally mixed. The correlations are properties of the joint state rather than either reduced state, which is why the simulator shows both local Bloch vectors at the origin after a Bell pair is built.
Noise as a channel
Real hardware evolves states by more than unitaries. The general operation is a quantum channel, written with a set of Kraus operators obeying :
The following three channels are common introductory models of single-qubit noise.
QSim’s circuit builder currently applies ideal gates and does not expose these channels as configurable operations. The equations below explain real-device noise and provide targets for analytical calculation; increasing QSim’s shot count changes sampling precision, not decoherence. Use a noise-aware simulator when an experiment requires adjustable , , readout error or gate-error parameters.
Depolarising noise replaces the state with the maximally mixed one with probability . With and ,
which simply shrinks the Bloch vector towards the centre: .
Amplitude damping models energy relaxation to the environment, including the idealized process in which |1⟩ decays to |0⟩. With
the Bloch vector transforms as and . Unlike depolarising noise this is not symmetric: it pulls every state towards the north pole, and at it maps everything to |0⟩.
Phase-flip dephasing leaves computational-basis populations unchanged. With and , the equatorial components transform as while is unchanged. This channel is one model of lost phase coherence. The experimental dephasing time includes relaxation and pure-dephasing contributions and obeys in the usual Markovian model, so it is not universally shorter than .
Fidelity
To say how close a noisy result is to the intended one, use the fidelity. Against a pure target it is just an overlap:
If a pure single-qubit state is depolarised by the channel defined above, its fidelity with the original state is . A fully depolarised output therefore has fidelity with any pure single-qubit target, which is a reminder that fidelity values need a stated baseline.
Next: Entanglement and Protocols puts these tools to work, and Quantum Error Correction shows how the damage described here can be undone.
Simulator Lab: Separate Probabilities, Samples and Reduced States
The Quantum Simulator displays exact or branch-averaged probabilities alongside sampled counts. Keeping those quantities separate makes measurement experiments much more useful.
Verify the Born rule without hiding sampling noise
Set one qubit to |0⟩, add RY with angle , and run. The state is approximately , so the probability table should report . The count need not equal exactly .
Run at 100, 1,000 and 10,000 shots. The probability remains fixed while the observed frequency generally becomes steadier. Do not rerun until a random count happens to match the theoretical value; reporting the chosen shot count and the observed count is part of an honest simulation experiment.
For a worst-case Bernoulli probability near , useful sampling scales are:
| Shots | Maximum one-standard-deviation uncertainty | Approximate 95% margin using |
|---|---|---|
| 100 | 0.0500 | 0.0980 |
| 1,000 | 0.0158 | 0.0310 |
| 10,000 | 0.0050 | 0.0098 |
| 1,000,000 | 0.0005 | 0.0010 |
These are planning approximations for independent samples, not guarantees that every observed frequency falls inside the stated margin. Use exact QSim probabilities when checking circuit algebra; use counts when studying how finite experimental sampling behaves.
Measure X and Y using available gates
The results table is in the computational basis. Implement another measurement basis by appending the inverse basis change before running:
- For X, append
H. A0result represents the original state’s component. - For Y, append
Sdagger and thenH. The builder hasRZ, so useRZwith angle in place of ; the difference is only a global phase. A0result then represents the original state’s component.
Keep a JSON export of the state-preparation circuit before appending measurement rotations. Reload that baseline for each basis. Otherwise, measurement-basis gates from an earlier experiment can accidentally become part of the next state preparation.
Read Bloch data correctly
For a single pure qubit, the displayed Bloch values summarize the full state. For one qubit of a larger register they summarize only its reduced density matrix. The reported radius satisfies for a pure reduced state and for a mixed one, while ez is .
QSim reports four useful numbers beside each rendered sphere:
| Display | Meaning | Efficient interpretation |
|---|---|---|
| Polar angle from the axis | For a pure state, | |
| Azimuthal angle in the XY plane | Tracks relative phase when the transverse component is nonzero | |
| Length of the reduced Bloch vector | Gives purity through | |
ez | Z component | Equals for that qubit |
The Angles selector switches the displayed angle values between radians and degrees without changing the circuit. When , the vector has no direction, so and do not carry physical information even if the interface displays numerical placeholders. When the vector lies on the Z axis, is likewise irrelevant.
Load Bell (2) and run. Both radii should be zero even though the full state is pure. Next load All-H on two qubits. Both radii should be one because the joint state is the product . These presets have uniform-looking Z-basis distributions, but their local purity and correlations are different.
Explore measurement and feed-forward
To see an actual measurement branch, build a two-qubit Bell circuit and add a conditional X on q1 with condition q0 = 1. The condition measures q0 and applies X to q1 only on the selected classical outcome. The simulator explains whether it enumerated every branch exactly or estimated many branches with shots.
After a branch-producing circuit, the CSV contains probabilities rather than one amplitude vector. That is mathematically necessary: averaging over measurement outcomes produces a density matrix, and there is generally no single state vector whose amplitudes describe the mixture.