General structures of reversible and quantum gates
Abstract
The most general structure (in matrix form) of a singlequbit gate is presented. Subsequently, used that to obtain a set of conditions for testing (a) whether a given 2qubit gate is genuinely a 2qubit gate, i.e., not decomposable into two single qubit gates and (b) whether a given single qubit gate is selfinverse? Relevance of the results reported here is discussed in the context of optimization of reversible and quantum circuits, especially for the optimization of quantum cost. A systematic procedure is developed for the identification of the nondecomposable 2qubit gates. Such a nondecomposable 2qubit gate along with all possible single qubit gates form a universal quantum gate library. Further, some possible applications of the present work are also discussed.
Keywords: quantum gates, reversible gates, circuit optimization, nondecomposable 2qubit gates
1 Introduction
The use of quantum resources provides an enhancement in the performance of certain tasks in comparison to their classical counterparts. To be specific, a quantum computer can perform factorization [1] and unsorted database search [2] with a speed not achievable by its classical counterpart, and quantum cryptography can provide unconditional security [3], a desirable feature of secure communication that cannot be achieved by any classical protocol. These facts lead to a simple question, how are these tasks performed in the quantum world? A simple answer would be by exploiting quantum superposition through suitable quantum operations which may be viewed as quantum gates. It is also worth noting that all the operations, besides measurement and noise, are unitary in nature. Therefore, quantum operations (except quantum measurement and Kraus operators representing various noise models) are essentially reversible in nature. In what follows, we refer to these unitary quantum operators that actually describe evolution of a quantum state and map the initial states to final states as quantum gates and analyze their properties.
Before, we proceed further, we would like to note that all quantum gates are reversible, but they are usually referred to as quantum gates, whereas by a reversible gate we usually mean a classical reversible gate which is also described by a unitary operation (. This is so because unitarity ensures reversibility through the condition or in other words, unitarity ensures the existence of for every unitary operation and thus establishes reversibility. Consequently, the basic structure of classical reversible and quantum gates are the same, In fact, and many other gates work in both classical and quantum domain, they are described by the same matrices, but there is a small difference as far as the acceptable input states are concerned. A classical reversible gate cannot accept superposition states as input, whereas a quantum gate can. Specially, a reversible gate should not accept a superposition state as input at the controlled bit. For example, if a gate accepts a superposition state in the controlled bit/qubit then the output will be an entangled state, which has no classical analogue and which cannot exist in the classical world. Thus, a classical reversible gate and a quantum gate would have the same mathematical form (both being described by unitary matrices), whether the quantum gate will have a classical counterpart or not would depend on the inputoutput relation; specifically, on whether the gate produces classically acceptable outputs for valid classical inputs. As quantum gates are more general and classical reversible gates form only a subclass of them, in what follows our discussion will be focused on the quantum gates (unless otherwise stated) only, and we will mostly focus on the structure of the unitary operators (gates) without providing much attention to whether a particular gate has a classical counterpart or not. However, the analysis is valid in general for both quantum and reversible gates and may be useful in optimizing both quantum and reversible circuits.
We have already noted that quantum gates are more general and classical reversible gates are special cases of them. However, the notion of quantum computer in general and quantum Turing machine in particular [4] has originated from the idea of reversible Turing machine [5], which was proposed to perform computation in reversible manner so that heat loss due to erasure of information predicted by Landauer’s principle [6] can be circumvented. Heat loss is a major issue in today’s VLSI technology. This is so because in accordance with Moore’s law [7], the number of transistors per unit area is doubling in every 18 months, and proportionately length of interconnecting wires and energy losses through those wires are also increasing. In case, we can make a room temperature superconducting material, we will be able to avoid the type of loss that happens through these wires. However, in the traditional irreversible computing, some losses of energy would still happen as it is implemented with irreversible logic gates, like AND, NOR, NAND all of which map a 2bit input into a 1bit output and thus causes an energy loss amounting to at least . This advantage of reversible computing and the computational speed up achieved by the quantum computer have motivated scientists to design and optimize reversible and quantum circuits for various purposes [for a set of interesting reversible circuits see [8, 9], some interesting reversible circuits and their optimization are reported in [10, 11, 12], whereas a set of important quantum circuits can be found at [13, 14, 15, 16, 17, 18, 19]]. All these circuits are designed using gates represented by unitary operations, but the general structure of those unitary operations is not investigated until today. Motivated by this fact here we report some observations on the general structures of the unitary gates and also discuss how to exploit those observations to perform optimization of the reversible/quantum circuits. To be precise, we would first describe the general structure of single qubit gates and using that we will obtain a set of requirements to be satisfied by a 2qubit decomposable gate (i.e., a 2qubit gate which can be expressed as tensor product of two single qubit gates). Further, we would also formulate a method to obtain those two single qubit gates once it is ensured that the given 2qubit gate is decomposable. Finally, some applications of the decomposability tests designed in this paper are discussed with specific attention toward a physical problem involving different type of beamsplitters and the problems related to optimization of various types of cost metrics (such as gate count or circuit complexity, depth and width of a circuit, quantum cost) associated with quantum circuits.
The rest of the paper is organized as follows. In Sec. 2, we derive a general structure of single qubit gates. Using this general structure, in Sec. 3, we have obtained a general form to be possessed by the single qubit Hermitian unitary operations, which would represent selfinverse quantum gates. We further use the general structure to formulate the conditions to check whether a given 2qubit gate is decomposable or not in Sec. 4. In Sec. 5, a method to reconstruct the decomposed single qubit operations from the given decomposable 2qubit gate is designed. Finally, the paper is concluded in Sec. 7 after discussing some applications of the present results in Sec. 6.
2 General structure for single qubit gates
As we mentioned in the previous section, we are interested in obtaining the general structure of the unitary gates. To begin with, let us consider an arbitrary single qubit gate,
(1) 
which would satisfy being unitary. Here, the first condition (i.e., gives us
(2) 
while the second one (i.e., ) yields
(3) 
From Eq. (2) we can easily observe that
(4a)  
(4b)  
and  
(4c) 
Similarly, from Eq. (3) we obtain
(5a)  
(5b)  
and  
(5c) 
In Eq. (5a), we can substitute This substitution and the use of Eqs. (4a) and (5a) would yield Similarly, using Eq. (4b) in Eq. (5a), we obtain Using these values, we can rewrite the arbitrary single qubit unitary matrix described by (1) as
(6) 
where we have used the polar form of complex elements of the unitary matrix in Eq. (1). Further, using Eqs. (4c) and (5c) with values of different elements of matrix as given in Eq. (6), we obtain the same condition from both the equations, i.e.,
From which we can easily write
(7) 
with being an integer. We may consider an angle in such a way that and in Eq. (1) can be written as complex conjugates of each other, which means
(8) 
or
Interestingly, the same angle also makes and complex conjugates of each other as
(9) 
In fact, this equation can also be obtained by using Eq. (8) in Eq. (7). Finally, we may rewrite in Eq. (6) as
(10) 
where
and
It is noteworthy here that four equivalent general structures of single qubit unitary operation can be written by changing the position of negative sign among the four elements of the matrix in Eq. (10). Actually unitarity demands that one of the elements (expressed in the polar form) of the single qubit unitary operator has to have a sign opposite to that of the other three elements (say, negative sign, when the rest of the elements are with positive sign). Thus, the negative sign put in front of any of the 4 elements of the above structure of the unitary operator, would also provide a general structure of the single qubit unitary operator.
3 Hermiticity or self reversibility of single qubit gates
Hermitian matrices are the one satisfying . In case of unitary matrices, it turns out to be . Thus, if we find that a unitary matrix that represents a gate is also Hermitian, then we would be able to conclude that the gate is self inverse, too [20]. For obtaining the general structure of selfreversible unitary operations, if we write the adjoint of in Eq. (10) as
(11) 
then we can see that Hermiticity condition , would yield
and
By solving this set of conditions on the phase parameters, one can obtain and . Hence, the mathematical structure of a Hermitian unitary matrix (Hermitian single qubit quantum gate) is
It should be noted here that permutation of columns of unitary (10) will not change the mathematical structure of Hermitian quantum gate obtained here as the constraint equation will remain unchanged after such a permutation [20]. For convenience, we may describe this gate as and note that the well known single qubit gates can be expressed in this notation as and whereas a phase gate is not self inverse and cannot be expressed in the above form.
4 Decomposability of a two qubit gate using the general structure of single qubit gates
In this section, we wish to formulate a method to distinguish between a set of 2qubit gates decomposable in two single qubit gates from the genuine 2qubit gates or nondecomposable gates. For the same, we have used obtained in the last section, given in Eq. (10), as the most general form of single qubit gates and checked the decomposability of two qubit gates. To do so, let us consider two arbitrary single qubit gates and having the following form
(12a)  
and  
(12b) 
It is easy to write the tensor product of these two single qubit gates as
(13) 
We can also consider an arbitrary matrix (which is assumed to represent a 2qubit gate) as
(14) 
and compare the coefficients of with the matrix in Eq. (13) to find the condition of separability (decomposability), the satisfaction of which for a given 2qubit gate would mean that the given two qubit gate is not genuinely a 2qubit gate as it can be decomposed into two single qubit gates. By comparing the elements of (13) and (14) we can observe the following conditions:
 Test 1:

and
 Test 2:

 Test 3:

 Test 4:

 Test 5:

Failure of any of these tests would imply the inseparability of the 2qubit gate under consideration, which would mean that the investigated 2qubit gate is genuinely a 2qubit gate, i.e., the 2qubit gate cannot be decomposed into two single qubit gates operating on each qubit, and such a 2qubit gate may be used to construct a universal gate library in association with all the single qubit gates. This is so because it is well known that any genuine two qubit gate and set of all single qubit gates form a universal quantum gate library [21].
Note that to test the decomposability of a given 2qubit gate, the 2qubit gate is to be written in the form of matrix in Eq. (14), where to obtain we can again use the same method as was used in Eq. (8). Specifically, we may take the global phase in such a way that one of the conditions in Tests 15 is satisfied. In case of a decomposable 2qubit gate all the remaining conditions should also remain valid. Without loss of generality, considering the first condition in Test 1, we can obtain where and are the first and sixteenth elements of the arbitrary 2qubit unitary before taking a common phase out of the matrix . This global phase will be equivalent to in Eq. (13).
The present study also reveals that to check the inseparability of a given 2qubit gate one can perform an assessment of the unitary before writing the unitary in the form of matrix given in Eq. (14). Specifically, all the diagonal elements in a decomposable 2qubit unitary have the same modulus. Similarly, all the antidiagonal elements in a decomposable 2qubit unitary also have the same modulus, which is independent of the value for the diagonal elements.
Therefore, we may now summarize the conditions that ensure that a 2qubit gate is decomposable into two single qubit gates as follows:
 Condition 1:

All the diagonal elements have the same modulus value. Even the antidiagonal elements also have the same modulus, but not necessarily equal to the main diagonal elements. In other words, and , where are the elements of the given matrix before writing in the form of matrix of Eq. (14).
 Condition 2:

After writing the given matrix in the form of matrix of Eq. (14) all Tests 15 are satisfied.
Here, it is important to note that fulfillment of Condition 2 ensures that Condition 1 is also satisfied but not vice versa. Therefore, Condition 1 can be used as a primary check, while Condition 2 must be fulfilled by a decomposable 2qubit gate.
Example: Here, as an example, we can consider the case of the controlledunitary gate given as where in place of , we can use the general structure of unitary matrix given in Eq. (10), using which we obtain
(15) 
We can easily observe from Eq. (15) that the diagonal elements do not have same modulus values so the gate is a genuine 2qubit gate. Hence, we can easily observe that Condition 1 is violated, which gives the inseparability of the gate.
Here, we can also check that violation of Condition 1 makes sure Condition 2 is also not satisfied. Specifically, when we attempt to write this two qubit gate in the form of matrix of Eq. (14), we will have
(16) 
which certainly fails Tests 13. Therefore, it concludes that the controlledunitary gate cannot be decomposed into two single qubit gates. However, a special case, i.e., and becomes a decomposable operation.
5 Two single qubit gates from one tensor product gate
Once we have ensured that a 2qubit gate is decomposable into two single qubit gates, the important task in our hands would be to obtain those two single qubit gates. In this section, we formulate a technique to do so. From Eq. (13), if we consider only the elements of the first two rows and two columns or more precisely the first block of four elements, then we obtained
Similarly, we can obtain this form for the remaining three blocks of the matrix in (13) with four elements each. Specifically, those can be written as
Further, after comparing corresponding terms with the elements of , it can be easily obtained that
and
Using these relations we can formulate four conditions for decomposability, which can be listed as follows
(17a)  
(17b)  
(17c)  
and  
(17d) 
These set of conditions do not ensure the nondecomposibility of a 2qubit gate. For example, one may consider a 2qubit gate , which satisfies these set of conditions, but Test 2 (in Condition 2) fails concluding in the nondecomposibility of this gate. Therefore, we propose to use these results to obtain two single qubit gates once Conditions 12 mentioned in the previous section are fulfilled.
Therefore, to write a two qubit gate as a tensor product of two single qubit gates–if it is not a genuine two qubit gate–we can follow this prescription and obtain the two single qubits as
and
Note that all the terms in both these unitary operations contain squareroot, which can be exploited to put a negative sign before one of the terms in both the gates. As mentioned beforehand these provide equivalent operations. In fact, even in this case, we obtain a family of s such that , which are unitary in themselves, giving the same gate on their tensor product. In what follows, we will show an example of a 2qubit operation in optical implementation.
6 Applications
In this section, we aim to illustrate the possible applications of the results obtained in this work through some particular examples. To begin with we consider an example that shows that the decomposition of a polarizationdependent beamsplitter (PDBS) is not possible, but a polarizationindependent beamsplitter (PIDBS) can be decomposed. Further, we have shown with the help of an explicit example that the decomposability tests developed in the present work can be used to reduce the quantum cost and gate counts of a quantum circuit.
Application 1: A physical example
As an application of the present scheme, we would like to consider the unitary operation corresponding to a PDBS [22], i.e.,
(18) 
Here, () and () are the transmission and reflection coefficients of the PDBS for an incident photon in horizontal (vertical) polarization state, respectively. Also, and mentioned in the subscript correspond to the two input ports of the PDBS. Further, a phase change of is associated with the reflected mode. PDBS is frequently used in implementing the schemes of quantum communication and computation, and it may be viewed as the most general type of BS.
The PDBS can be checked with Conditions 1 and 2 to ensure that the PDBS is a unitary operation that corresponds to a genuine 2qubit gate. In fact, this optical element is often used to generate entanglement. Now, consider a special case an usual beamsplitter which is independent of polarization [22], i.e., and , we obtain
(19) 
It is important to note here that PIDBS satisfies all the requirements (Tests 15) of a 2qubit gate composed of two single qubit unitary operations. One can also reconstruct the single qubit unitary operations as follows
and
The relevance of the unitary operations can be understood from the input state of PDBS being , which can be viewed as , where polarization of the photon is an independent state acted upon by an Identity and the evolution of the spatial modes of input photons may be determined by a standard BS unitary operation ( here).
Application 2: Optimization of quantum circuits
The present result can be found useful in reducing quantum cost and gate counts (circuit cost) of a given quantum circuit by exploiting decomposability of 2qubit gates, wherever possible. The minimum number of elementary gates (1 qubit and 2qubit gates) required to accomplish a specific task is known as quantum cost [10, 23]. In fact, the use of single qubit gates in a qubit line that contains one of the qubit of a 2qubit gate does not increase the quantum cost as the single qubit can be absorbed in the 2qubit gate by creating a new 1qubit gate. Look at Fig. 1 (a), it contains two 2qubit gates and a singlequbit gate. So its gate count or circuit cost is three if we remain within the given gate library (before optimization). However, the linear quantum cost (quantum cost obtained without circuit optimization) would be two as for the determination of quantum cost no restriction on gate library is imposed and one can always construct a new 2bit gate . This shows that single qubit gates usually do not contribute to the quantum cost. Now, we assume that we apply the results of the previous section and test the decomposability of both the 2qubit gates present in the circuit shown in Fig. 1 (a), and our analysis revealed that the leftmost 2qubit gate is a genuine 2qubit gate, whereas can be decomposed as . The circuit after decomposition is shown in Fig. 1 (b). Clearly, and we may remove these gates and thus optimize the circuit as shown in Fig. 1 (c), which has a reduced circuit cost of two, and absorbing the single qubit gate in the 2qubit gate we would obtain the nonlinear quantum cost (quantum cost obtained after optimization) as 1. Further, since there is no operation in the third line, we can say that the width of the quantum circuit is also reduced from three to two. Thus, this simple example clearly illustrates the utility of the present work (decomposability test designed here) in the optimization of quantum cost, circuit cost and circuit width. In a similar manner, one can show that this technique will be of help in optimizing quantum circuits using template matching [24] and other methods described in [3, 25] and references therein.
7 Conclusion
A general mathematical structure of single qubit gates is obtained by exploiting their unitary nature. As the unitary nature of operations ensures reversibility, the obtained result is applicable to classical reversible gates, too. Further, unitarity of the operations only ensures the existence of an operation (not necessarily the same) which can transform the output state back into the input state. In other words, unitarity only ensures reversibility, does not ensure self reversibility. It is known that some of the quantum gates are selfinverse, whereas the others are not. Keeping this in mind, the mathematical form of the selfinverse unitary operations is also obtained from the general structure of the single qubit gates. The restrictive conditions obtained here, indicates that there are only a few selfinverse single qubit quantum gates.
The formulated general structure is subsequently used to obtain a set of conditions using which one can easily test whether a given arbitrary 2qubit gate is nondecomposable or decomposable into two single qubit gates. Once it is established that a given 2qubit gate is decomposable, the important task would be to obtain the decomposed single qubit gates. Here, we have not only proposed an easy prescription for reconstructing the decomposed single qubit operations, we have also provided an interesting example related to the optical realization of a quantum gate. Specifically, we have used a genuine entangled gate for 2qubits as PDBS, which is used frequently for entanglement generation in quantum optical implementations. Subsequently, we have shown mathematically that PDBS is not decomposable, but a polarizationindependent counterpart of it becomes decomposable.
Finally, we have shown applications of the present results in the optimization of quantum circuits. Specifically, we have shown that when a 2qubit quantum gate is decomposable, employing its decomposed single qubit counterparts can be used to reduce quantum cost, gate counts and circuit width. We conclude the paper with a hope that the present results would find wider scale applications in the synthesis and optimization of reversible and quantum circuits, and some of the circuits designed and/or optimized using the decomposability test developed here will be tested using IBM Quantum Experience, a quantum computer places in cloud [26] or other quantum hardwares capable of performing the task.
Acknowledgment: KT and AP thank Defense Research & Development Organization (DRDO), India for the support provided through the project number ERIP/ER/1403163/M/01/1603.
References
 [1] Shor, P. W.: Polynomialtime algorithms for prime factorization and discrete logarithms on a quantum com puter. In Proc. 35th Annual Symp. on Foundations of Computer Science, (1994) Santa Fe, IEEE Computer Society Press
 [2] Grover, L. K.: Quantum mechanics helps in searching for a needle in a haystack. Phys. Rev. Lett. 79, 325328 (1997)
 [3] Pathak, A.: Elements of quantum computation and quantum communication. CRC Press, Boca Raton, USA (2013)
 [4] Deutsch, D.: Quantum theory, the ChurchTuring principle and the universal quantum computer. Proc. Royal Society of London A: Mathematical, Physical and Engineering Sciences 400, 1818 (1985)
 [5] Bennett, C. H.: Logical reversibility of computation. IBM J. Res. Dev 17, 525532 (1973)
 [6] Landauer, R.: Irreversibility and heat generation in the computing process. IBM J. Res. Dev. 5, 183 (1961)
 [7] Moore, G. E.: Cramming more components onto integrated circuits. Electronics 38, 114 (1965)
 [8] Maslov, D.: Reversible logic synthesis benchmarks page, http://webhome.cs.uvic.ca/~dmaslov/ (2017)
 [9] Revlib: An online resource for reversible functions and circuits, http://www.informatik.unibremen.de/rev_lib/index.php (2017); Also see Wille, R., Große, D., Teuber, L., Dueck, G.W., Drechsler, R.: RevLib: An online resource for reversible functions and reversible circuits. In Multiple Valued Logic, 2008. ISMVL 2008. 38th International Symposium on, 220225 IEEE (2008)
 [10] Rahman, M. M., Banerjee, A., Dueck, G. W., Pathak, A.: Twoqubit quantum gates to reduce the quantum cost of reversible circuit. MultipleValued Logic (ISMVL), 2011 41st IEEE International Symposium. IEEE, 2011.
 [11] Banerjee, A., Pathak, A.: Reversible multiplier circuit. In Emerging Trends in Engineering and Technology (ICETET), 2010 3rd International Conference on, pp. 781786. IEEE (2010)
 [12] Haghparast, M., Mohammadi, M., Navi, K., Eshghi, M.: Optimized reversible multiplier circuit. Journal of Circuits, Systems, and Computers 18, 311323 (2009)
 [13] Shukla, C., Banerjee, A., Pathak, A.: Protocols and quantum circuits for implementing entanglement concentration in cat state, GHZlike state and nine families of 4qubit entangled states. Quantum Inf. Process. 14, 20772099 (2015)
 [14] Möttönen, M., Vartiainen, J.J., Bergholm, V., Salomaa, M.M.: Quantum circuits for general multiqubit gates. Phys. Rev. Lett. 93, 130502 (2004)
 [15] Bullock, S.S., O’Leary, D.P., Brennen, G.K.: Asymptotically optimal quantum circuits for dlevel systems. Phys. Rev. Lett. 94, 230502 (2005)
 [16] Vidal, G., Dawson, C.M.: Universal quantum circuit for twoqubit transformations with three controlledNOT gates. Phys. Rev. A 69, 010301 (2004)
 [17] Gupta, M., Pathak, A.: A scheme for distributed quantum search through simultaneous state transfer mechanism. Annalen der Physik 16, 791797 (2007)
 [18] Banerjee, A., Pathak, A.: Probabilistic model of fault detection in quantum circuits. In Quantum Quenching, Annealing and Computation 297304, Springer Berlin Heidelberg (2010)
 [19] Gupta, M., Pathak, A., Srikanth, R., Panigrahi, P.: General circuits for distributing measurement in quantum computation, Int. J. Quant. Info 5, 627 (2007)
 [20] Pathak, A.: NonHermitian quantum gates are more common than Hermitian quantum gates. arxiv:1309.4037 (2013)
 [21] DiVincenzo, D.P.: Twobit gates are universal for quantum computation. Phys. Rev. A 51, 1015 (1995)
 [22] Pathak, A., Banerjee, A.: Optical quantum information and quantum communication. SPIE Spotlight series (2016)
 [23] Banerjee, A., Pathak, A.: An algorithm for minimization of quantum cost. Appl. Math 6, 157165 (2012)
 [24] Maslov, D., Young, C., Miller, D.M., Dueck, G.W., Quantum circuit simplification using templates. In Design, Automation and Test in Europe, 2005, Proceedings, pp. 12081213 IEEE (2005)
 [25] Maslov, D., Dueck, G.W., Miller, D.M., Negrevergne, C.: Quantum circuit simplification and level compaction. IEEE Transactions on ComputerAided Design of Integrated Circuits and Systems 27, 436444 (2008)
 [26] IBM. The Quantum Experience. http://www. research.ibm.com/quantum/