# What does fidelity mean?

I am learning qiskit software and this term keeps popping up and I am unable to get a grasp on the technical definition given by wikipedia. For example, the functions state fidelity and process fidelity.

Simply it is the distance (similarity measure) between two quantum states, for example the fidelity between $$|0\rangle$$ and $$|1\rangle$$ is less than the fidelity between $$|0\rangle$$ and $$\frac{1}{\sqrt{2}}\big(|0\rangle + |1\rangle\big)$$. or you can say it is the cosine of the smallest angle between two states, also called the cosine similarity

• Also Process fidelity is distance/ "closeness" between 2 unitary matrices – Eesh Starryn Jul 12 '19 at 19:47
• So fidelity is a real number in the closed interval [0,1]? Also, what is a good fidelity number in quantum computing? Also, how does fidelity relate to quantum error correcting (is the fidelity before error correction or after)? A recent paper said the theoretical fidelity for a two-qubit system is 0.40--why is that not 0? Why are there state errors even when no measurement has occurred? – David Spector Nov 25 '19 at 14:58

It might be worth mentioning the physical motivation for these definitions and the concept of fidelity itself.

Unlike the classical computers we all know and love, quantum computers are fundamentally analog machines. what that means practically is that the gates you apply when you run code on a real quantum computer are going to be parameterized by a real variable. For example, in superconducting qubits, applying a single-qubit gate means driving your qubit with a (typically microwave-range) pulse from an arbitrary waveform generator. The amplitude, frequency, and time-duration of that pulse are all real-valued parameters, and as such they're all subject to some amount of error. These so-called 'unitary' errors are a separate issue from the errors that result from your qubit interacting with the environment. You've applied a real quantum gate, and prepared a real, coherent quantum state, but neither the gate nor the state are ever going to be exactly the ones you intended.

That's where measures of fidelity come in, as a way of keeping track of just how close you can expect to come on your actual, physical quantum computer to the circuits you are producing in code.

In a way, fidelity forms the essential link between the neat digital niceties of your high level implementation and the messy realities of the quantum hardware itself.

That, at least, is how I understand it. I'd welcome any corrections.

The following video gives some more specific examples of the same idea https://www.youtube.com/watch?v=MtD1Z8MMrgY, while this article gives a pretty friendly, historically motivated explanation of the math involved.

• It's worth mentioning that you are describing gate fidelity, but the word "fidelity" used without qualification usually refers to state fidelity rather than gate fidelity. – tparker 2 days ago

Qualitatively, fidelity is the measure of the distance between two quantum states. Fidelity equal to 1, means that two states are equal. In the case of a density matrix, fidelity represents the overlap with a reference pure state. Fidelity equal to 1, means that the square of density matrix is equal to density matrix itself and equivalent to the pure reference state.

Like every distance in metric spaces, it is obtained by means of an inner product. The inner product of two states is the overlap. The square of that is the fidelity (in the same way that that distance is defined in Euclidean space). That is, $$|\langle \psi_1 | \psi_2 \rangle |^2$$, also known as spectroscopic factor in some physics context.

For mixed state is the equivalent operation, that is evaluation of the density matrix $$\langle \psi_1 | \rho_1 |\psi_1 \rangle$$.

This measure is particularly important because quantum devices are noisy devices, therefore the fidelity of a result respect to an exact solution represents the inverse of the noise.

• Could you please expand your answer a bit, by explaining in more detail? – Tejas Shetty Jul 25 '19 at 6:29