# Demystifying Quantum Gate Fidelity for Electronics Engineers
## Appendix B  
The integrand quantities \(\ket{\alpha_{i}}^{4}\) and \(\ket{\alpha_{i}}^{2}\ket{\alpha_{j}}^{2}\) in Equation (24) can be read as generated by the same product of a sequence:  
\[ \begin{split}\ket{\alpha_{i}}^{4}&=\prod\limits_{h= 1}^{k}\ket{\alpha_{h}}^{2}\\ \ket{\alpha_{i}}^{2}&=\prod\limits_{h=1}^{k}\ket{ \alpha_{h}}^{2}\end{split}  \tag{11}\]  
with \(k=2\) and \(\alpha_{1}=\alpha_{2}=\alpha_{i}\) for \(\ket{\alpha_{i}}^{4}\), and \(\alpha_{1}=\alpha_{i}\), \(\alpha_{2}=\alpha_{j}\) for \(\ket{\alpha_{i}}^{2}\ket{\alpha_{j}}^{2}\). The two integrals in Equation (24) can therefore be traced back to one single integral:  
\[\int_{S^{2n-1}}\prod\limits_{h=1}^{k}\ket{\alpha_{h}}^{2}dV \tag{12}\]  
Because of the probability normalization condition on the component \(\alpha_{h}\):  
\[\sum\limits_{h=1}^{n}\ket{\alpha_{h}}^{2}=1 \tag{13}\]  
the integral in Equation (12) is carried out on a hypersphere of unitary radius. In addition, it should be also remarked that \(dV\) is the normalized infinitesimal Lebesgue measure on the hypersphere. For calculating this integral, it is useful to address the following general integral defined in a r-dimensional complex vector space \(\mathbb{C}^{r}\), whose generic vector \(z\) has components \(z_{i}\):  
\[\mathcal{I}=\int_{\mathbb{C}^{r}}e^{-|z|^{2}}\prod_{h=1}^{k}\lvert z_{h}\rvert^ {2}dV^{r} \tag{100}\]  
where \(dV^{r}\) is the infinitesimal Lebesgue measure in \(\mathbb{C}^{r}\). It is worth noticing that, as in Equation (101), Equation (102) contains the product of a sequence of \(k\) terms, which, in the present case, are \(k\) components of a generic vector \(z\) instead of a state vector. Figure 10 evidences that, in a two-dimensional vector space, the infinitesimal Lebesgue measure is the infinitesimal surface \(d\sigma\), whose mathematical expression in polar coordinates is:  
\[d\sigma=\rho d\rho d\varphi=\rho^{2-1}d\rho d\varphi_{1} \tag{101}\]  
with \(d\varphi_{1}=d\varphi\), while in a three-dimensional vector space, it is the infinitesimal volume \(d\tau\), whose mathematical expression in polar coordinates is:  
\[d\tau=\rho d\theta d\varphi d\rho=\rho^{2}d\rho d\theta d\varphi=\rho^{3-1}d \rho\ d\varphi_{1}d\varphi_{2} \tag{102}\]  
with \(d\varphi_{1}=d\varphi\) and \(d\varphi_{2}=d\theta\). Equations (101) and (102) lead, by induction, to the following mathematical expression of \(dV\):  
\[dV^{r}=\rho^{2r-1}d\rho\prod_{j=1}^{2r-1}d\varphi_{j} \tag{103}\]  
A r-dimensional complex vector space \(\mathbb{C}^{r}\) is indeed dimensionally equivalent to a 2r-dimensional real space. The substitution of Equation (103) into Equation (100) yields:  
\[\mathcal{I}=\int_{\mathbb{S}^{2r-1}}\int_{0}^{\infty}e^{-\rho^{2}}\prod_{h=1} ^{k}\lvert z_{h}\rvert^{2}\rho^{2r-1}d\rho\prod_{j=1}^{2r-1}d\varphi_{j} \tag{104}\]  
Inverting the integration order and separating the integration on \(\rho\) and \(\varphi_{i}\) yields:  
\[\mathcal{I}=\int_{0}^{\infty}e^{-\rho^{2}}\rho^{2r-1}d\rho\int_{\mathbb{S}^{2 r-1}}\prod_{h=1}^{k}\lvert z_{h}\rvert^{2}\prod_{j=1}^{2r-1}d\varphi_{j} \tag{105}\]since \(\rho^{2}=|z|^{2}\). The integral in \(d\varphi_{j}\) is calculated in a hypersphere of radius \(|z|\).