# Fidelity of quantum states

In quantum mechanics, notably in quantum information theory, fidelity quantifies the "closeness" between two density matrices. It expresses the probability that one state will pass a test to identify as the other. It is not a metric on the space of density matrices, but it can be used to define the Bures metric on this space.

## Definition

The fidelity between two quantum states $\rho$ and $\sigma$, expressed as density matrices, is commonly defined as:
    $F(\rho ,\sigma )=\left(\operatorname {tr} {\sqrt {{\sqrt {\rho }}\sigma {\sqrt {\rho }}}}\right)^{2}.$
The square roots in this expression are well-defined because both $\rho$ and ${\sqrt {\rho }}\sigma {\sqrt {\rho }}$ are positive semidefinite matrices, and the square root of a positive semidefinite matrix is defined via the spectral theorem. The Euclidean inner product from the classical definition is replaced by the Hilbert–Schmidt inner product.
As will be discussed in the following sections, this expression can be simplified in various cases of interest. In particular, for pure states, $\rho =|\psi _{\rho }\rangle \!\langle \psi _{\rho }|$ and $\sigma =|\psi _{\sigma }\rangle \!\langle \psi _{\sigma }|$, it equals:$F(\rho ,\sigma )=|\langle \psi _{\rho }|\psi _{\sigma }\rangle |^{2}.$This tells us that the fidelity between pure states has a straightforward interpretation in terms of probability of finding the state $|\psi _{\rho }\rangle$ when measuring $|\psi _{\sigma }\rangle$ in a basis containing $|\psi _{\rho }\rangle$.
Some authors use an alternative definition $F':={\sqrt {F}}$ and call this quantity fidelity. The definition of $F$ however is more common. To avoid confusion, $F'$ could be called "square root fidelity". In any case it is advisable to clarify the adopted definition whenever the fidelity is employed.

## Motivation from classical counterpart

Given two random variables $X,Y$ with values $(1,...,n)$ (categorical random variables) and probabilities $p=(p_{1},p_{2},\ldots ,p_{n})$ and $q=(q_{1},q_{2},\ldots ,q_{n})$, the fidelity of $X$ and $Y$ is defined to be the quantity
    $F(X,Y)=\left(\sum _{i}{\sqrt {p_{i}q_{i}}}\right)^{2}$.
The fidelity deals with the marginal distribution of the random variables. It says nothing about the joint distribution of those variables. In other words, the fidelity $F(X,Y)$ is the square of the inner product of $({\sqrt {p_{1}}},\ldots ,{\sqrt {p_{n}}})$ and $({\sqrt {q_{1}}},\ldots ,{\sqrt {q_{n}}})$ viewed as vectors in Euclidean space. Notice that $F(X,Y)=1$ if and only if $p=q$. In general, $0\leq F(X,Y)\leq 1$. The measure $\sum _{i}{\sqrt {p_{i}q_{i}}}$ is known as the Bhattacharyya coefficient.
Given a classical measure of the distinguishability of two probability distributions, one can motivate a measure of distinguishability of two quantum states as follows: if an experimenter is attempting to determine whether a quantum state is either of two possibilities $\rho$ or $\sigma$, the most general possible measurement they can make on the state is a POVM, which is described by a set of Hermitian positive semidefinite operators $\{F_{i}\}$. When measuring a state $\rho$ with this POVM, $i$-th outcome is found with probability $p_{i}=\operatorname {tr} (\rho F_{i})$, and likewise with probability $q_{i}=\operatorname {tr} (\sigma F_{i})$ for $\sigma$. The ability to distinguish between $\rho$ and $\sigma$ is then equivalent to their ability to distinguish between the classical probability distributions $p$ and $q$. A natural question is then to ask what is the POVM the makes the two distributions as distinguishable as possible, which in this context means to minimize the Bhattacharyya coefficient over the possible choices of POVM. Formally, we are thus led to define the fidelity between quantum states as:
    $F(\rho ,\sigma )=\min _{\{F_{i}\}}F(X,Y)=\min _{\{F_{i}\}}\left(\sum _{i}{\sqrt {\operatorname {tr} (\rho F_{i})\operatorname {tr} (\sigma F_{i})}}\right)^{2}.$
It was shown by Fuchs and Caves that the minimization in this expression can be computed explicitly, with solution the projective POVM corresponding to measuring in the eigenbasis of $\sigma ^{-1/2}|{\sqrt {\sigma }}{\sqrt {\rho }}|\sigma ^{-1/2}$, and results in the common explicit expression for the fidelity as$F(\rho ,\sigma )=\left(\operatorname {tr} {\sqrt {{\sqrt {\rho }}\sigma {\sqrt {\rho }}}}\right)^{2}.$

## Equivalent expressions
### Equivalent expression via trace norm

An equivalent expression for the fidelity between arbitrary states via the trace norm is:
    $F(\rho ,\sigma )=\lVert {\sqrt {\rho }}{\sqrt {\sigma }}\rVert _{\operatorname {tr} }^{2}=\left(\operatorname {tr} |{\sqrt {\rho }}{\sqrt {\sigma }}|\right)^{2},$
where the absolute value of an operator is here defined as $|A|\equiv {\sqrt {A^{\dagger }A}}$.

### Equivalent expression via characteristic polynomials

Since the trace of a matrix is equal to the sum of its eigenvalues
    $F(\rho ,\sigma )=\sum _{j}{\sqrt {\lambda _{j}}},$
where the $\lambda _{j}$ are the eigenvalues of ${\sqrt {\rho }}\sigma {\sqrt {\rho }}$, which is positive semidefinite by construction and so the square roots of the eigenvalues are well defined. Because the characteristic polynomial of a product of two matrices is independent of the order, the spectrum of a matrix product is invariant under cyclic permutation, and so these eigenvalues can instead be calculated from $\rho \sigma$. Reversing the trace property leads to
    $F(\rho ,\sigma )=\left(\operatorname {tr} {\sqrt {\rho \sigma }}\right)^{2}$.

### Expressions for pure states

If (at least) one of the two states is pure, for example $\rho =|\psi _{\rho }\rangle \!\langle \psi _{\rho }|$, the fidelity simplifies to$F(\rho ,\sigma )=\operatorname {tr} (\sigma \rho )=\langle \psi _{\rho }|\sigma |\psi _{\rho }\rangle .$This follows observing that if $\rho$ is pure then ${\sqrt {\rho }}=\rho$, and thus$F(\rho ,\sigma )=\left(\operatorname {tr} {\sqrt {|\psi _{\rho }\rangle \langle \psi _{\rho }|\sigma |\psi _{\rho }\rangle \langle \psi _{\rho }|}}\right)^{2}=\langle \psi _{\rho }|\sigma |\psi _{\rho }\rangle \left(\operatorname {tr} {\sqrt {|\psi _{\rho }\rangle \langle \psi _{\rho }|}}\right)^{2}=\langle \psi _{\rho }|\sigma |\psi _{\rho }\rangle .$
If both states are pure, $\rho =|\psi _{\rho }\rangle \!\langle \psi _{\rho }|$ and $\sigma =|\psi _{\sigma }\rangle \!\langle \psi _{\sigma }|$, then we get the even simpler expression:$F(\rho ,\sigma )=|\langle \psi _{\rho }|\psi _{\sigma }\rangle |^{2}.$

## Properties

Some of the important properties of the quantum state fidelity are:
* Symmetry. $F(\rho ,\sigma )=F(\sigma ,\rho )$.
* Bounded values. For any $\rho$ and $\sigma$, $0\leq F(\rho ,\sigma )\leq 1$, and $F(\rho ,\rho )=1$.
* Consistency with fidelity between probability distributions. If $\rho$ and $\sigma$ commute, the definition simplifies to $F(\rho ,\sigma )=\left[\operatorname {tr} {\sqrt {\rho \sigma }}\right]^{2}=\left(\sum _{k}{\sqrt {p_{k}q_{k}}}\right)^{2}=F({\boldsymbol {p}},{\boldsymbol {q}}),$where $p_{k},q_{k}$ are the eigenvalues of $\rho ,\sigma$, respectively. To see this, remember that if $[\rho ,\sigma ]=0$ then they can be diagonalized in the same basis: $\rho =\sum _{i}p_{i}|i\rangle \langle i|{\text{ and }}\sigma =\sum _{i}q_{i}|i\rangle \langle i|,$so that $\operatorname {tr} {\sqrt {\rho \sigma }}=\operatorname {tr} \left(\sum _{k}{\sqrt {p_{k}q_{k}}}|k\rangle \!\langle k|\right)=\sum _{k}{\sqrt {p_{k}q_{k}}}.$
* Explicit expression for qubits.
If $\rho$ and $\sigma$ are both qubit states, the fidelity can be computed as
    $F(\rho ,\sigma )=\operatorname {tr} (\rho \sigma )+2{\sqrt {\det(\rho )\det(\sigma )}}.$
Qubit state means that $\rho$ and $\sigma$ are represented by two-dimensional matrices. This result follows noticing that $M={\sqrt {\rho }}\sigma {\sqrt {\rho }}$ is a positive semidefinite operator, hence $\operatorname {tr} {\sqrt {M}}={\sqrt {\lambda _{1}}}+{\sqrt {\lambda _{2}}}$, where $\lambda _{1}$ and $\lambda _{2}$ are the (nonnegative) eigenvalues of $M$. If $\rho$ (or $\sigma$) is pure, this result is simplified further to $F(\rho ,\sigma )=\operatorname {tr} (\rho \sigma )$ since $\mathrm {Det} (\rho )=0$ for pure states.

### Unitary invariance

Direct calculation shows that the fidelity is preserved by unitary evolution, i.e.
    $\;F(\rho ,\sigma )=F(U\rho \;U^{*},U\sigma U^{*})$
for any unitary operator $U$.

### Relationship with the fidelity between the corresponding probability distributions

Let $\{E_{k}\}_{k}$ be an arbitrary positive operator-valued measure (POVM); that is, a set of positive semidefinite operators $E_{k}$ satisfying $\sum _{k}E_{k}=I$. Then, for any pair of states $\rho$ and $\sigma$, we have ${\sqrt {F(\rho ,\sigma )}}\leq \sum _{k}{\sqrt {\operatorname {tr} (E_{k}\rho )}}{\sqrt {\operatorname {tr} (E_{k}\sigma )}}\equiv \sum _{k}{\sqrt {p_{k}q_{k}}},$ where in the last step we denoted with $p_{k}\equiv \operatorname {tr} (E_{k}\rho )$ and $q_{k}\equiv \operatorname {tr} (E_{k}\sigma )$ the probability distributions obtained by measuring $\rho ,\ \sigma$ with the POVM $\{E_{k}\}_{k}$.
This shows that the square root of the fidelity between two quantum states is upper bounded by the Bhattacharyya coefficient between the corresponding probability distributions in any possible POVM. Indeed, it is more generally true that $F(\rho ,\sigma )=\min _{\{E_{k}\}}F({\boldsymbol {p}},{\boldsymbol {q}}),$ where $F({\boldsymbol {p}},{\boldsymbol {q}})\equiv \left(\sum _{k}{\sqrt {p_{k}q_{k}}}\right)^{2}$, and the minimum is taken over all possible POVMs. More specifically, one can prove that the minimum is achieved by the projective POVM corresponding to measuring in the eigenbasis of the operator $\sigma ^{-1/2}|{\sqrt {\sigma }}{\sqrt {\rho }}|\sigma ^{-1/2}$.

#### Proof of inequality

As was previously shown, the square root of the fidelity can be written as ${\sqrt {F(\rho ,\sigma )}}=\operatorname {tr} |{\sqrt {\rho }}{\sqrt {\sigma }}|,$which is equivalent to the existence of a unitary operator $U$ such that
${\sqrt {F(\rho ,\sigma )}}=\operatorname {tr} ({\sqrt {\rho }}{\sqrt {\sigma }}U).$Remembering that $\sum _{k}E_{k}=I$ holds true for any POVM, we can then write${\sqrt {F(\rho ,\sigma )}}=\operatorname {tr} ({\sqrt {\rho }}{\sqrt {\sigma }}U)=\sum _{k}\operatorname {tr} ({\sqrt {\rho }}E_{k}{\sqrt {\sigma }}U)=\sum _{k}\operatorname {tr} ({\sqrt {\rho }}{\sqrt {E_{k}}}{\sqrt {E_{k}}}{\sqrt {\sigma }}U)\leq \sum _{k}{\sqrt {\operatorname {tr} (E_{k}\rho )\operatorname {tr} (E_{k}\sigma )}},$where in the last step we used Cauchy-Schwarz inequality as in $|\operatorname {tr} (A^{\dagger }B)|^{2}\leq \operatorname {tr} (A^{\dagger }A)\operatorname {tr} (B^{\dagger }B)$.

### Behavior under quantum operations

The fidelity between two states can be shown to never decrease when a non-selective quantum operation ${\mathcal {E}}$ is applied to the states:$F({\mathcal {E}}(\rho ),{\mathcal {E}}(\sigma ))\geq F(\rho ,\sigma ),$ for any trace-preserving completely positive map ${\mathcal {E}}$.

### Relationship to trace distance

We can define the trace distance between two matrices A and B in terms of the trace norm by
    $D(A,B)={\frac {1}{2}}\|A-B\|_{\rm {tr}}\,.$
When A and B are both density operators, this is a quantum generalization of the statistical distance. This is relevant because the trace distance provides upper and lower bounds on the fidelity as quantified by the Fuchs–van de Graaf inequalities,
    $1-{\sqrt {F(\rho ,\sigma )}}\leq D(\rho ,\sigma )\leq {\sqrt {1-F(\rho ,\sigma )}}\,.$
Often the trace distance is easier to calculate or bound than the fidelity, so these relationships are quite useful. In the case that at least one of the states is a pure state Ψ, the lower bound can be tightened.
    $1-F(\psi ,\rho )\leq D(\psi ,\rho )\,.$

## Uhlmann's theorem

We saw that for two pure states, their fidelity coincides with the overlap. Uhlmann's theorem generalizes this statement to mixed states, in terms of their purifications:
Theorem Let ρ and σ be density matrices acting on C$^n$. Let ρ$^{1⁄2}$ be the unique positive square root of ρ and
$|\psi _{\rho }\rangle =\sum _{i=1}^{n}(\rho ^{{1}/{2}}|e_{i}\rangle )\otimes |e_{i}\rangle \in \mathbb {C} ^{n}\otimes \mathbb {C} ^{n}$
be a purification of ρ (therefore $\textstyle \{|e_{i}\rangle \}$ is an orthonormal basis), then the following equality holds:
    $F(\rho ,\sigma )=\max _{|\psi _{\sigma }\rangle }|\langle \psi _{\rho }|\psi _{\sigma }\rangle |^{2}$
where $|\psi _{\sigma }\rangle$ is a purification of σ. Therefore, in general, the fidelity is the maximum overlap between purifications.

### Sketch of proof

A simple proof can be sketched as follows. Let $\textstyle |\Omega \rangle$ denote the vector
    $|\Omega \rangle =\sum _{i=1}^{n}|e_{i}\rangle \otimes |e_{i}\rangle$
and σ$^{1⁄2}$ be the unique positive square root of σ. We see that, due to the unitary freedom in square root factorizations and choosing orthonormal bases, an arbitrary purification of σ is of the form
    $|\psi _{\sigma }\rangle =(\sigma ^{{1}/{2}}V_{1}\otimes V_{2})|\Omega \rangle$
where V$_i$'s are unitary operators. Now we directly calculate
    $|\langle \psi _{\rho }|\psi _{\sigma }\rangle |^{2}=|\langle \Omega |(\rho ^{{1}/{2}}\otimes I)(\sigma ^{{1}/{2}}V_{1}\otimes V_{2})|\Omega \rangle |^{2}=|\operatorname {tr} (\rho ^{{1}/{2}}\sigma ^{{1}/{2}}V_{1}V_{2}^{T})|^{2}.$
But in general, for any square matrix A and unitary U, it is true that |tr(AU)| ≤ tr((A$^*$A)$^{1⁄2}$). Furthermore, equality is achieved if U$^*$ is the unitary operator in the polar decomposition of A. From this follows directly Uhlmann's theorem.

### Proof with explicit decompositions

We will here provide an alternative, explicit way to prove Uhlmann's theorem.
Let $|\psi _{\rho }\rangle$ and $|\psi _{\sigma }\rangle$ be purifications of $\rho$ and $\sigma$, respectively. To start, let us show that $|\langle \psi _{\rho }|\psi _{\sigma }\rangle |\leq \operatorname {tr} |{\sqrt {\rho }}{\sqrt {\sigma }}|$.
The general form of the purifications of the states is:${\begin{aligned}|\psi _{\rho }\rangle &=\sum _{k}{\sqrt {\lambda _{k}}}|\lambda _{k}\rangle \otimes |u_{k}\rangle ,\\|\psi _{\sigma }\rangle &=\sum _{k}{\sqrt {\mu _{k}}}|\mu _{k}\rangle \otimes |v_{k}\rangle ,\end{aligned}}$were $|\lambda _{k}\rangle ,|\mu _{k}\rangle$ are the eigenvectors of $\rho ,\ \sigma$, and $\{u_{k}\}_{k},\{v_{k}\}_{k}$ are arbitrary orthonormal bases. The overlap between the purifications is$\langle \psi _{\rho }|\psi _{\sigma }\rangle =\sum _{jk}{\sqrt {\lambda _{j}\mu _{k}}}\langle \lambda _{j}|\mu _{k}\rangle \,\langle u_{j}|v_{k}\rangle =\operatorname {tr} \left({\sqrt {\rho }}{\sqrt {\sigma }}U\right),$where the unitary matrix $U$ is defined as$U=\left(\sum _{k}|\mu _{k}\rangle \!\langle u_{k}|\right)\,\left(\sum _{j}|v_{j}\rangle \!\langle \lambda _{j}|\right).$The conclusion is now reached via using the inequality $|\operatorname {tr} (AU)|\leq \operatorname {tr} ({\sqrt {A^{\dagger }A}})\equiv \operatorname {tr} |A|$: $|\langle \psi _{\rho }|\psi _{\sigma }\rangle |=|\operatorname {tr} ({\sqrt {\rho }}{\sqrt {\sigma }}U)|\leq \operatorname {tr} |{\sqrt {\rho }}{\sqrt {\sigma }}|.$Note that this inequality is the triangle inequality applied to the singular values of the matrix. Indeed, for a generic matrix $A\equiv \sum _{j}s_{j}(A)|a_{j}\rangle \!\langle b_{j}|$and unitary $U=\sum _{j}|b_{j}\rangle \!\langle w_{j}|$, we have${\begin{aligned}|\operatorname {tr} (AU)|&=\left|\operatorname {tr} \left(\sum _{j}s_{j}(A)|a_{j}\rangle \!\langle b_{j}|\,\,\sum _{k}|b_{k}\rangle \!\langle w_{k}|\right)\right|\\&=\left|\sum _{j}s_{j}(A)\langle w_{j}|a_{j}\rangle \right|\\&\leq \sum _{j}s_{j}(A)\,|\langle w_{j}|a_{j}\rangle |\\&\leq \sum _{j}s_{j}(A)\\&=\operatorname {tr} |A|,\end{aligned}}$where $s_{j}(A)\geq 0$ are the (always real and non-negative) singular values of $A$, as in the singular value decomposition. The inequality is saturated and becomes an equality when $\langle w_{j}|a_{j}\rangle =1$, that is, when $U=\sum _{k}|b_{k}\rangle \!\langle a_{k}|,$ and thus $AU={\sqrt {AA^{\dagger }}}\equiv |A|$. The above shows that $|\langle \psi _{\rho }|\psi _{\sigma }\rangle |=\operatorname {tr} |{\sqrt {\rho }}{\sqrt {\sigma }}|$ when the purifications $|\psi _{\rho }\rangle$ and $|\psi _{\sigma }\rangle$ are such that ${\sqrt {\rho }}{\sqrt {\sigma }}U=|{\sqrt {\rho }}{\sqrt {\sigma }}|$. Because this choice is possible regardless of the states, we can finally conclude that$\operatorname {tr} |{\sqrt {\rho }}{\sqrt {\sigma }}|=\max |\langle \psi _{\rho }|\psi _{\sigma }\rangle |.$

### Consequences

Some immediate consequences of Uhlmann's theorem are
* Fidelity is symmetric in its arguments, i.e. F (ρ,σ) = F (σ,ρ). Note that this is not obvious from the original definition.
* F (ρ,σ) lies in [0,1], by the Cauchy–Schwarz inequality.
* F (ρ,σ) = 1 if and only if ρ = σ, since Ψ$_ρ$ = Ψ$_σ$ implies ρ = σ.
So we can see that fidelity behaves almost like a metric. This can be formalized and made useful by defining
    $\cos ^{2}\theta _{\rho \sigma }=F(\rho ,\sigma )\,$
As the angle between the states $\rho$ and $\sigma$. It follows from the above properties that $\theta _{\rho \sigma }$ is non-negative, symmetric in its inputs, and is equal to zero if and only if $\rho =\sigma$. Furthermore, it can be proved that it obeys the triangle inequality, so this angle is a metric on the state space: the Fubini–Study metric.