Quantum Computing
Advanced

Quantum Fidelity

Measures how close two quantum states are — 1 means identical, 0 means orthogonal.

Formula

F(ρ,σ)=(trρ σ ρ)2F(\rho, \sigma) = \left(\text{tr}\sqrt{\sqrt{\rho}\,\sigma\,\sqrt{\rho}}\right)^2

Variables

FFidelity
\rho, \sigmaDensity matrices of the two states
\text{tr}Trace

Example

Fidelity = 0.99 → 99 % match to the ideal state

How it works

Quantum fidelity quantifies how strongly two quantum states overlap, using the density-matrix form so it works for both pure states and mixed states. The square root and trace are there because the comparison must respect the geometry of quantum states: for pure states it reduces to the squared overlap, while for mixed states it measures the best possible similarity after accounting for statistical uncertainty. A value of 1 means the states are indistinguishable, and values near 0 mean they have almost no support in common.

When to use it

Use fidelity when checking how close an experimentally prepared state is to a target state, or when comparing the output of a quantum channel before and after noise. It is also standard in quantum error correction, benchmarking, and quantum process/state tomography.

Worked example, step by step

Let the target state be \rho = |0\rangle\langle 0| = [[1, 0], [0, 0]]. Let the prepared state be \sigma = [[0.81, 0.39], [0.39, 0.19]]. Since \rho is pure, \sqrt{\rho} = \rho, so F(\rho, \sigma) = (tr\sqrt{\rho\sigma\rho})^2. Compute \rho\sigma\rho = [[1, 0], [0, 0]] [[0.81, 0.39], [0.39, 0.19]] [[1, 0], [0, 0]] = [[0.81, 0], [0, 0]]. Now take the matrix square root: \sqrt{\rho\sigma\rho} = [[\sqrt{0.81}, 0], [0, 0]] = [[0.9, 0], [0, 0]]. Take the trace: tr(...) = 0.9. Square it: F = (0.9)^2 = 0.81. So the prepared state has fidelity 0.81 with the target state, meaning a reasonably close but not perfect match.

Common mistakes to avoid

  • Using state vectors directly without converting to density matrices when the state is mixed
  • Forgetting the outer square on the trace term
  • Assuming fidelity is just the absolute value of an inner product for all cases, even though that only holds for pure states

Did You Know?

Current leading quantum processors achieve single-gate fidelities above 99.9 % — but errors compound fast across thousands of gates.

Share this formula

Reviewed & maintained by the FormulaWon editorial teamLast reviewed September 2026