|q⟩ Bad Qubits

intermediate · Programming · Noise, Decoherence & Density-Matrix Simulation

Fidelity of Noisy States

After every noisy channel transforms a quantum state, there is a natural question: how close is the resulting degraded state to the ideal, noiseless state we wanted? The answer is given by the fidelity.

Fidelity between a pure state and a density matrix

When the target is a specific pure state ψ|\psi\rangle and the actual (possibly noisy) state is described by a density matrix ρ\rho, the fidelity is defined as

F(ψ,ρ)=ψρψ.F(|\psi\rangle, \rho) = \langle\psi|\rho|\psi\rangle.

This is a number between 0 and 1. When ρ=ψψ\rho = |\psi\rangle\langle\psi| (the ideal pure state with no noise) we get F=ψψψψ=1F = \langle\psi|\psi\rangle\langle\psi|\psi\rangle = 1. When ρ\rho is orthogonal to ψ|\psi\rangle we get F=0F = 0.

Fidelity after a phase-flip channel

The phase-flip channel with error probability pp transforms a density matrix ρ\rho as

E(ρ)=(1p)ρ+pZρZ.\mathcal{E}(\rho) = (1-p)\,\rho + p\,Z\rho Z.

Starting from the pure state +=12(0+1)|{+}\rangle = \tfrac{1}{\sqrt{2}}(|0\rangle + |1\rangle), whose density matrix is

++=12(1111),|{+}\rangle\langle{+}| = \frac{1}{2}\begin{pmatrix} 1 & 1 \\ 1 & 1 \end{pmatrix},

the channel produces

ρp=12(112p12p1).\rho_p = \frac{1}{2}\begin{pmatrix} 1 & 1-2p \\ 1-2p & 1 \end{pmatrix}.

The diagonal entries (populations) are untouched; only the off-diagonal coherences are damped by the factor (12p)(1-2p). At p=0p = 0 we recover the pure state; at p=12p = \tfrac{1}{2} the off-diagonal entries vanish and ρ1/2=12I\rho_{1/2} = \tfrac{1}{2}I, the maximally mixed state.

Computing FF

We evaluate F=+ρp+F = \langle{+}|\rho_p|{+}\rangle. Writing +=12[1,1]\langle{+}| = \tfrac{1}{\sqrt{2}}[1,\, 1] and +=12(11)|{+}\rangle = \tfrac{1}{\sqrt{2}}\binom{1}{1}:

\begin{bmatrix} 1 & 1 \end{bmatrix} \begin{pmatrix} 1 & 1-2p \\ 1-2p & 1 \end{pmatrix} \begin{bmatrix} 1 \\ 1 \end{bmatrix} = \frac{1}{4}\bigl[\,1 + (1-2p) + (1-2p) + 1\,\bigr] = 1 - p.$$ The result is elegant: **the fidelity of $|{+}\rangle$ after a phase-flip channel with error probability $p$ equals $1 - p$** (verified analytically from the Kraus-operator representation in Nielsen and Chuang, §9.2). For $p = 0.3$ this gives $F = 0.7$. ### Intuition Every time the $Z$ error fires (with probability $p$), the qubit ends up in the orthogonal state $|{-}\rangle\langle{-}|$, which has zero overlap with $|{+}\rangle$. Each such event erases a fraction $p$ of the fidelity. Only the $(1-p)$ fraction of trials in which no error occurs contributes to the fidelity, giving $F = 1 - p$ exactly. ## Fidelity as a quality metric Hardware engineers use fidelity to benchmark quantum gates and state-preparation routines. A single-qubit gate fidelity above 0.999 is considered high quality on modern superconducting processors. The complementary quantity, **infidelity** $1 - F$, quantifies the total probability weight lost to noise, and scales with the error rate $p$ of the dominant channel. ## Try it A qubit is prepared in $|{+}\rangle$ and then subjected to a phase-flip channel with $p = 0.3$. Compute and return the fidelity $F = \langle{+}|\rho_p|{+}\rangle$ of the resulting noisy state to the ideal target $|{+}\rangle$. <RunnableExample />

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