# Demystifying Quantum Gate Fidelity for Electronics Engineers
## 7 Mixed States  
Equation (42) has been proven under the assumptions that the input state is pure and uniformly distributed and that quantum gates do not introduce phase decoherence, ensuring that the output state is also pure. In practice, the uniform distribution of the input states may not be considered a serious limitation, because the characterization of a quantumgate is typically intended to explore how the quantum gate behaves for all possible input states, as it occurs in the case of the quantum process tomography [55]. Several papers on average fidelity indeed assume a uniform distribution, such as, for instance, [34; 56]. On the other hand, the case of mixed states is more involved and it deserves a more comprehensive discussion for the sake of comparison with the literature. In cases where the input state \(\ket{\psi_{IN}}\) of the density matrix is pure and the output state is mixed \(\rho_{OUT}\), [PERSON] introduces the expected fidelity as an average distance \(\langle\delta\rangle\) between pure states [38]:  
\[\langle\delta\rangle=\sum_{X}p_{X}|\langle\psi_{IN}|\psi_{X}\rangle|^{2} \tag{74}\]  
where \(p_{X}\) is the probability used to describe the mixed state as a mixture of pure states in terms of a linear combination of the density matrix of pure states \(\ket{\psi_{X}}\) (see Appendix A):  
\[\rho_{OUT}=\sum_{X}p_{X}\ket{\psi_{X}}\langle\psi_{X}| \tag{75}\]  
Since, as observed in Appendix A, a pure state is an ensemble of identical pure states, in cases where the output state is pure, Equation (75) reduces to \(|\langle\psi_{IN}|\psi_{OUT}\rangle|^{2}\), being \(\ket{\psi_{X}}=\ket{\psi_{OUT}}\) and \(\sum_{X}p_{X}=1\) for the probability normalization. [PERSON] shows that a short algebraic manipulation leads to the following compact mathematical expression of Equation (75):  
\[\langle\delta\rangle=\langle\psi_{IN}|\rho_{OUT}|\psi_{IN}\rangle \tag{76}\]  
Equivalently, Equation (76) can be expressed by means of the trace _Tr_[57]:  
\[\langle\delta\rangle=\textit{Tr}\{\,|\psi_{IN}\rangle\langle\,\psi_{IN}|\rho_{ OUT}\,\}=\textit{Tr}\{\rho_{IN}\rho_{OUT}\} \tag{77}\]  
[PERSON] reports, as a root fidelity, a mathematical expression very close to Equation (76) [26]:  
\[F=\sqrt{\langle\psi_{IN}|\rho_{OUT}|\psi_{IN}\rangle} \tag{78}\]  
In the more involved case where, in addition to the output state, the input state is also mixed, [PERSON] invokes [PERSON]'s fidelity [38], which, after [58] and [59], is defined as the maximum probability that the purifications of the two mixed states are coincident. Appendix A reports short notes about the concept of purification. [PERSON]'s theorem allows the following compact mathematical expression for the fidelity [38]:  
\[F=\left\|\sqrt{\rho_{IN}}\sqrt{\rho_{OUT}}\right\|_{1} \tag{79}\]  
where \(\left\|\cdot\right\|_{1}\) is the Schatten 1-norm, defined as \(\textit{Tr}\Big{\{}\sqrt{M^{\dagger}M}\Big{\}}\) for a given operator \(M\). Note that \(\sqrt{\rho_{IN}}\sqrt{\rho_{OUT}}\) is indeed an operator, with the density matrix \(\rho_{IN}\) and \(\rho_{OUT}\) being operators. Moving from Equation (79), [PERSON] reports that it is possible to write [PERSON]'s fidelity in the following trace form:  
\[F=\left\{\textit{Tr}\sqrt{\sqrt{\rho_{IN}}\rho_{OUT}\sqrt{\rho_{IN}}}\right\} ^{2} \tag{80}\]  
Equation (80) reduces to Equation (76) when the input state is pure, because, for a pure state, it holds that \(\rho^{2}=\rho\) and \(\textit{Tr}\{\rho^{2}\}=1\)[43].