# Demystifying Quantum Gate Fidelity for Electronics Engineers
## 3 The Fidelity of a Quantum Gate  
Quantum gate fidelity, as well as the fidelity for transmitted and received signals in Section 2, quantifies the difference between ideal and actual quantum gates as the average distance between ideal and actual quantum output states. A fidelity equal to 100% means that the quantum gates behave ideally. In practice, it is useful to introduce the error rate of a quantum gate as the complement to 100% of the quantum fidelity [37], so that an ideal quantum gate exhibits an error rate equal to zero. In quantum information theory, a quantum operation, such as a quantum gate, is an operator \(A\)[26; 38]. Following the considerations in Section 2, this paper assimilates a real quantum gate to a real channel, as depicted in Figure 1. The output quantum state \(\big{|}\psi_{OUT}^{R}\big{\rangle}=A\,\big{|}\psi_{IN}\big{\rangle}\) coincides with the ideal one \(\big{|}\psi_{OUT}^{I}\big{\rangle}\) only if the operator is ideal, exactly as the output signal \(m_{OUT}\) is identical to the input signal \(m_{IN}\) only if the channel behaves ideally. If the effect of the quantum gate in Figure 1 on the input state \(\big{|}\psi_{IN}\big{\rangle}\) does not introduce phase decoherence, the output state \(\left|\psi_{OUT}^{R}\right\rangle\) is a pure state as long as the input state is pure. Appendix A shortly reviews the definition of pure and mixed states, along with some further considerations. As observed for a deterministic transmission channel, a coherent quantum gate does not imply that it behaves ideally. When both input and output states are pure, the distance \(\delta\big{(}m_{OUT}^{l},m_{OUT}^{R}\big{)}\) is the state overlap probability \(\delta\big{(}\left|\psi_{OUT}^{l}\right\rangle,\left|\psi_{OUT}^{R}\right\rangle \big{)}=\left|\left\langle\psi_{OUT}^{l}\right|\psi_{OUT}^{R}\right\rangle \right|^{2}\), which is the probability that the actual output state \(\left|\psi_{OUT}^{R}\right\rangle\) coincides with the desired ideal \(\left|\psi_{OUT}^{U}\right\rangle\)[38]. It is worth emphasizing here that, in quantum mechanics, the quantity \(\left\langle\psi_{OUT}^{l}\right|\psi_{OUT}^{R}\right\rangle\) is dubbed the inner product, and it is a complex-valued scalar. By assuming that all input states are equally probable, the fidelity \(F\) of the quantum gate can be therefore introduced from Equation (7) as follows:  
\[F=\int_{BS}\!\!\left|\left\langle\psi_{OUT}^{l}\right|\psi_{OUT}^{R}\right\rangle \right|^{2}\!dV \tag{8}\]  
where \(dV\) is the infinitesimal volume of the Bloch sphere (BS), which is a geometrical figure useful for visualizing a quantum state [26; 38]. For a n-level quantum state (qudit), the Bloch sphere is a hypersphere in a (2n\(-\)1)-dimensional space \(S^{2n-1}\) and it can be described as a nested Bloch sphere [39]. A qubit is a qudit for n = 2. In this case, the Bloch hypersphere reduces to the usual three-dimensional sphere, because 2n\(-\)1 = 3. It is worth pointing out that, as Equation (7) is an average value on the message space \(S_{m}\), Equation (8) describes the fidelity \(F\) as the probability, averaged on the entire Bloch hypersphere, that \(\left|\psi_{OUT}^{l}\right\rangle\) and \(\left|\psi_{OUT}^{R}\right\rangle\) are identical. If \(A_{I}\) and \(A_{R}\) are the ideal and actual forms, respectively, of the operator \(A\), you can express \(\left|\psi_{OUT}^{l}\right\rangle=A_{I}\left|\psi_{IN}\right\rangle\) and \(\left|\psi_{OUT}^{R}\right\rangle=A_{R}\left|\psi_{IN}\right\rangle\). Thus:  
\[F=\int_{BS}\!\!\left|\left\langle\psi_{IN}\right|A_{I}^{\dagger}A_{R}\right| \!\!\left|\psi_{IN}\right\rangle\right|^{2}\!dV \tag{9}\]  
where \(A_{I}^{\dagger}\) is the conjugate transpose (adjoint) of \(A_{I}\).