Noise & error correction

Density matrices and dephasing

See how a random phase flip erases interference while preserving basis populations.

23 minAdvanced

Intuition

A density matrix represents both pure states and statistical ensembles. An equal mixture of |0⟩ and |1⟩ has the same Z-basis probabilities as |+⟩, yet only |+⟩ yields + with certainty in an X-basis measurement.

A random application of Z changes the relative sign. When the record of this random operation is unavailable, the state is a mixture. The off-diagonal terms can shrink or change sign while basis populations stay fixed.

Learning objectives

  • Read the entries of a qubit density matrix
  • Write a phase-flip channel
  • Connect coherence to X-basis measurements

Interactive exploration

Use the controls to change the state and see its calculated readout. You can return to this experiment as you work through the derivation.

Phase-flip channel

90°
0.25
ρ = [0.500, 0.250; 0.250, 0.500]

Purity Tr(ρ²) = 0.625

Measurement readout

Z basis · 050%
Z basis · 150%
X basis · +75%
X basis · −25%

The channel applies I with probability 1−p and Z with probability p. At p = ½ the off-diagonal terms vanish. For an equatorial input the resulting state is maximally mixed.

Mathematical foundation

For an ensemble with weights pk, add outer products. The trace is one. A pure state has purity one and a maximally mixed qubit has purity one half.

ρ=∑kpk∣ψk⟩⟨ψk∣,Tr⁡ρ=1\rho=\sum_k p_k|\psi_k\rangle\langle\psi_k|,\quad \operatorname{Tr}\rho=1

The phase-flip channel has Kraus operators √(1−p)I and √p Z. Off-diagonal terms are scaled by 1−2p. The diagonal terms are unchanged.

Ep(ρ)=(1−p)ρ+pZρZ\mathcal E_p(\rho)=(1-p)\rho+pZ\rho Z

Worked example

For |+⟩ and p = 1/4, the off-diagonal entry drops from 1/2 to 1/4. In the X basis, the output is a mixture with probabilities 3/4 for + and 1/4 for −. At p = 1 the flip is deterministic and purity returns to one.

ρout=(1/21/41/41/2),Tr⁡(ρout2)=5/8\rho_{\mathrm{out}}=\begin{pmatrix}1/2&1/4\\1/4&1/2\end{pmatrix},\qquad \operatorname{Tr}(\rho_{\mathrm{out}}^2)=5/8

Guided experiment

Start with |+⟩ and sweep the phase-flip probability from 0 through 0.5 to 1. Compare the Z and X readouts and the purity.

Go to the controls
Compare with the expected result

At p = 0.5 coherence disappears. At p = 1 a deterministic Z changes |+⟩ to |−⟩.

Understanding check

1. For input |+⟩ and p = 0.2, what is P(+) after the channel?
2. Which entries are preserved for any phase-flip probability?

Next steps

Want to keep your results? Start your learning journey

Open Noise Studio