On quantum circuits employing roots of the Pauli matrices

Mathias Soeken,1 D. Michael Miller,2 and Rolf Drechsler1 1Institute of Computer Science, University of Bremen, Germany 2Department of Computer Science, University of Victoria, BC, Canada The Pauli matrices are a set of three 2×2 complex Hermitian, unitary matrices. In this article, we investigate the relationships between certain roots of the Pauli matrices and how gates implementing those roots are used in quantum circuits. Techniques for simplifying such circuits are given. In particular, we show how those techniques can be used to find a circuit of Clifford+T gates starting from a circuit composed of gates from the well studied NCV library.

I. INTRODUCTION The NOT operation is described by the Pauli X ma- trix [10]. Note that the controlled NOT could be drawn The well-studied NCV quantum gate library [1] con- as a controlled X but we use the normal convention of a tains the gates: NOT (X), controlled NOT (CNOT), and ⊕ as shown in the figures above. The matrices for the V † both the single controlled square root of NOT as well as and V operations as used in (1) are square roots of the its adjoint, denoted V and V †, respectively. In their sem- Pauli X . Similarly, the T gate operation is given inal paper [2], Barenco et al. presented a general result by a matrix (2) that is the fourth root of the Pauli Z that as one instance shows how a classical reversible Tof- matrix. foli gate can be realized by five NCV gates as follows: The use of gates associated with different Pauli matri- ces and their roots within the same circuit, as illustrated in (3), motivated us to explore the relations between the = (1) Pauli matrices and their roots, and to investigate how the V V † V associated gates can be used in constructing quantum circuits. This article presents our findings and demon- This result has been used in several works on synthesis strates their applicability in deriving the optimal circuits and optimization of quantum circuits [3–5]. from [8] from known NCV circuits rather than using ex- Another quantum gate library called Clifford+T [1], haustive search techniques. which consists of the controlled NOT, the phase gate S and the Hadamard gate H, plus the T gate II. PRELIMINARIES  1 0  T = iπ , (2) 0 e 4 The three Pauli matrices [10] are given by and the adjoint gates S† and T † has also received consid-       erable attention. The Clifford+T library has the advan- 0 1 0 −i 1 0 σ1 = , σ2 = , σ3 = (4) tage over the NCV library with respect to fault-tolerant 1 0 i 0 0 −1 computing [6]. Recently different synthesis results based on the The alternate naming X = σ1, Y = σ2, and Z = σ3 is Clifford+T gate library have been presented [7–9]. One often used and we use it whenever we refer to a specific common aim in these works is to reduce the so-called Pauli matrix. T -depth, i.e. the number of T -stages where each stage Matrices describing around the three axes of consists of one or more T or T † gates that can operate the Bloch are given by simultaneously on separate . In [8] the authors de-

arXiv:1308.2493v1 [quant-ph] 12 Aug 2013 θ θ scribe a search-based algorithm that finds optimal circuit Ra(θ) = cos 2 I − i sin 2 σa (5) realizations with respect to their T -depth. One of their circuits that realizes a Toffoli gate is [8, Fig. 13]: where a ∈ {1, 2, 3} with θ being the angle and I the [1]. Each Pauli matrix specifies a T T † half turn (180◦) rotation around a particular axis up to = T T † T † (3) a global phase, i.e.

H T T H iπ σa = e 2 Ra(π). (6) This circuit has a T -depth of 3 and a total depth of 10. (Note that the gates surrounded by the dashed rectangle The conjugate transpose of Ra(θ) is found by negating together have a depth of 1 and are drawn in sequence only the angle θ or by multiplying it by another Pauli ma- for clarity.) The approach in [8] produces optimal circuits trix σb from both sides, i.e. but since the technique’s complexity is exponential, it is † only applicable to small circuits. Ra(θ) = Ra(−θ) = σbRa(θ)σb (7) 2 where a 6= b. Note that it does not matter which of the Given a unitary 2n × 2n matrix U, called the target two possible σb is used. Since σb is Hermitian, we also operation, we define four controlled operations † have Ra(θ) = σbRa(θ)σb. U U Rotation matrices are additive with respect to their , , , and (18) angle, i.e. R (θ )R (θ ) = R (θ + θ ), so one can de- a 1 a 2 a 1 2 U U rive the kth root of the Pauli matrices as well as their conjugate transpose from (6) as which are described by

√ iπ π √ † − iπ † π k 2k  k 2k  C (U) = |0ih0| ⊗ I n + |1ih1| ⊗ U, σa = e Ra k and σa = e Ra k . (8) 1 2 C2(U) = I2n ⊗ |0ih0| + U ⊗ |1ih1| , For brevity, we term these matrices the Pauli roots. − (19) Using (8) the rotation matrices can also be expressed C1 (U) = |0ih0| ⊗ U + |1ih1| ⊗ I2n , and − in terms of the roots of the Pauli matrices, i.e. C2 (U) = U ⊗ |0ih0| + I2n ⊗ |1ih1| ,

π  − iπ √ † π  iπ √ † respectively, where ⊗ denotes the , I n R = e 2k k σ and R = e 2k k σ . (9) 2 a k a a k a denotes the 2n × 2n identity matrix, and |·i and h·| is Consequently, we can derive Dirac’s bra-ket notation [11]. The latter two operations are referred to as negative controlled operations. As ex- √ (8) iπ π  (7) iπ † k σ = e 2k R = e 2k σ R (θ)σ amples, the CNOT gate is C1(X) and the Toffoli gate a a k b a b (10) (9) iπ √ † is C1(C1(X)). Notice that adjacent controlled operations = e k σb k σa σb with the same control preserve , i.e.

√ † − iπ √ and analogously k σ = e k σ k σ σ for a 6= b. This a b a b = and = (20) last equation will be a key element in showing how control U U U U U U U U lines can be removed from controlled gates by using roots 2 1 1 2 2 1 1 2 of higher degree. A number in brackets above an equal and gates with opposite control polarities commute, i.e. sign indicates the identity applied. Translation from one Pauli matrix to another is given = (21) by U2 U1 U1 U2 σ = ρ σ ρ (11) a ab b ab Finally, if the same target operation is controlled with where both polarities, the target operation does not need be controlled, i.e. 1 ρab = ρba = √ (σa + σb) 2 (12) iπ π  π  π  = = (22) = e 2 Ra Rb Ra 2 2 2 U U U U U with a 6= b are translation matrices. Further, we de- − fine ρaa = I. Eq. (11) can be extended to the Pauli roots The identities in (20)–(22) hold for C2 and C2 analo- giving gously. Eq. (21) describes a circuit which performs one √ √ of two different target operations depending on the value k k σa = ρab σbρab. (13) assigned to the control line. Let us consider the special case The well-known Hadamard is given by the − normalized 2 × 2 matrix C1 (U1)C1(U2) = |0ih0| ⊗ U1 + |1ih1| ⊗ U2 (23)

1  1 1  which performs U1 or U2 if the control line is negative H = √ (14) or positive, respectively. We call this matrix a case gate 2 1 −1 and employ a special gate representation shown on the which can also be expressed as left-hand side of: 1 H = √ (X + Z) (15) = (24) 2 U1 U2 U1 U2 or in terms of rotation matrices as Another interesting circuit equality applies to the iπ 2 π  π  π  Pauli Z gate and its roots. A positively controlled gate H = e R1 2 R3 2 R1 2 . (16) can be flipped without changing its functionality, i.e. In fact, H = ρ1 2 = ρ2 1 so the Hadamard operator can √ √ k √ be used to translate between X and Z, i.e. k Z k C1( Z) = √ = = C2( Z). (25) k Z = HXH and X = HZH (17) Z 3

Using the translation gates, a circuit identity for the Corollary 1. Analogously to Lemma 1 we can derive other Pauli roots can be derived: √ † k Z (13) = (30) √k √ = σa √ k √ √ k σ † σb σa σb k a k σa ρa3 Z ρa3 Lemma 1 can be used to prove the following theorem √ √ that shows how to remove a control line from a controlled k (25) Z (13) ρa3 k σa ρa3 = = (26) Pauli root operation. ρa3 ρa3 ρa3 ρa3 Theorem 1. If a 6= b, then the following circuit equality holds: where ρ = I. 3√ 3 √ k iπ 2k Since Z ⊗ I = C1(e k I) and Z = (31) iπ iπ iπ √ √ √ † k 2k σ 2k σ C1(U)C1(e k I) = C1(e k U) = C1(e k I)C1(U) σa σa b σa b a root of the Pauli Z gate can be moved across a positive Proof. We have control, i.e. √ √ √ 2k Z (29) k k = Z Z √ √ √ √ √ = (27) 2k 2k † 2k 2k † 2k σa σb σa σb σa σa σa U U

Lastly, in the remainder of the paper we will often (22) = √ √ √ make use of a circuit identity given in [12, Rule D7]: 2k 2k √ † 2k σa σa 2k σa σa

= (28) (20,21) = √ √ √ √ † 2k 2k 2k σa 2k σa σa σa

III. MAPPING SCHEMES FOR SYNTHESIS = √ = √ I k σa k σa Many of the mappings for translating a given quantum circuit into a circuit in terms of a restricted gate library which concludes the proof. in fact reduce the number of controls in a controlled gate, as shown for example in (1). We follow this approach and It follows from the proof that the first gate on the will provide generic rules in terms of general Pauli roots. right-hand side of (31) commutes with the other three √ First, we show how a single controlled Pauli root k σa gates treated as a single . Using Theorem 1 we can gate can be mapped to a circuit involving uncontrolled for example derive the identity shown in [8, Fig. 5(b)] √ √ Pauli root gates by doubling the index, i.e. 2k σa. We where S = Z: start by proving the following lemma. (25) (31) (27) = S = T † T = T † T Lemma 1. The following circuit equality holds for a 6= b: S T T √ k Z Note that a root of the Pauli Z gate can be moved across √ = (29) k † √ the control of a CNOT but not over the target. σa √ k † k σb σ σb σa a In [2, Lemma 6.1] the circuit identity of which (1) is √   a particular case is defined for an arbitrary unitary ma- k 1 0 Proof. Based on the special structure of Z = iπ , trix U on the left-hand side and its square root on the 0 e k right-hand side. Given that Lemma and the translation one obtains gate equality in (13) we can define a new generic mapping √ k Z (8) that involves the Pauli roots. = √ √ iπ √ k † k † k † Theorem 2. The following circuit equality holds: σb σa σb σb σa e k σa σb

(20,21) (10) = (32) = = √ iπ √ √ √ √ √ √ √ † † † k k 2k 2k † 2k k σa σbe k k σa σb k σa σa σa ρab σb σb σb ρab which proves (29). where ρab = I if a = b. 4

Proof. Considering the circuit one gets from [2, Lemma in the list of degrees of freedom) to enable the combina- 6.1], the Pauli roots are adjusted by inserting transla- tion of gates. tion gates around each of them. Since the translation gates are Hermitian they are involutory and therefore c c¯ two translation gates in sequence cancel. T T T a T b One obtains (1) by setting a = b = k = 1 in (32). H T a¯ T a T b T ¯b T c H Note that the circuit identities in both (31) and (32) can combine be extended by adding a control to the left-hand side and controls to particular gates on the right-hand side. A T gate can move over a control line without changing Repeating this process enables the mapping of multiple the function, but not over a target. In order to move controlled gates. As the above illustrates, one needs to CNOT gates over other controlled gates we are making a b double the degree of the root in order to remove one use of (28). The combined T T gate commutes with the control line when not using ancilla lines. As a result, block of three gates to the right to it. √n one needs operations 2 σa in order to represent an n- c c¯ controlled Toffoli gate if the only allowed controlled gate T T is a CNOT. T a T b By combining (32) with (31) a powerful mapping H T a¯ T ¯b T aT b T c H scheme can be obtained for Toffoli gates that is very flex- ible due to the number of degrees of freedom: This last step reduces the total depth by one.

1. In (31) we can move the first gate to the end of the T c T c¯ circuit. T a T b 2. In (31) the Pauli Z root can be moved over the H T a¯ T ¯b T aT b T c H controls on the upper line.

3. In (31) the C1(σb) operations can be replaced By setting a = c = 0 and b = 1 one obtains a circuit by C2(σb) operations, if b = 3. that realizes the Toffoli gate and has the same character- istics as the circuit in (3), i.e. a T -depth of 3 with a total 4. In (32) the first two lines can be swapped. depth of 10. The more complicated derivation of pre- 5. In (32) the functionality is preserved if all con- cisely the same circuit as in (3) is given in the appendix. trolled Pauli roots are replaced by their adjoint.. Depending on how a, b, and c are assigned values of 0 6. The last controlled Pauli root in (32) can be freely and 1, we can realize four different circuits as illustrated moved within the ρab gates. in the following table where the first row yields a circuit for the Toffoli gate. Note that each row represents two By exploiting these options, it is possible to derive a possible assignments, e.g. setting a = c = 1 and b = 0 T gate realization for a Toffoli gate of the same qual- also realizes a Toffoli gate. The two possibilities corre- ity as the one shown in (3) starting from the mapping spond to performing the required rotations in opposite in (1) instead of using expensive search techniques. We direction around the . will demonstrate this by deriving a realization for a more general gate Assignment Control function c = a and b 6= a f(x1, x2) = x1x2 x1 x1 f b = a and c 6= a f(x1, x2) = x1x¯2 x2 x2 (33) b = c and a 6= c f(x1, x2) =x ¯1x2

x3 x3 ⊕ f(x1, x2) a = b = c f(x1, x2) = x1 ∨ x2 The last entry in the table above can be used to realize in which the target line x3 is inverted with respect to a control function f of a particular type. The Toffoli x3 ⊕x¯1x¯2 by adding a NOT gate to the right of the right- hand H. gate in (3) is the special case where f = x1x2. Given a U, in this construction, we will use the Another example is given in Fig. 1 in which the full notation U p for p ∈ {0, 1} where U 0 = U and U 1 = U †. adder circuit in [8, Fig. 11] is derived starting from two To begin, applying a modified version of the mapping Peres gates, each shown as a Toffoli gate followed by in (1) yields a CNOT. After the NCV expansion has been applied two controlled V gates cancel and we can reorder the c (32,25) S gates before mapping them to controlled S gates. Af- = ter the controlled S gates have been mapped according V a V b V c H Sa Sb H to (31), the next steps aim to align the T gates into as few stages as possible by moving the blocking CNOT Next, the controlled S gates are replaced according gates using (28). In that way a T -depth of 2 is readily to (31) into circuits with uncontrolled T gates. We im- achieved. However, in order to get the same total depth plicitly make use of the commutation property (first item as [8, Fig. 11], one needs to perform the not so obvious 5

S (1) (13,25) (31) = = = S =

V V † V V V † V V V V V † H S S† H

T T † T T † † † T T = T T = T T † T T † H T † S T H H T † T S H

T T † T T † † † T T = T T T T † T T † H T † T S H H T † T S H

FIG. 1. Derivation of the full adder step of adding two CNOT gates into the circuit (as de- the Levi-Civita symbol and the anticommutation rela- picted in the dashed rectangle) followed by more CNOT tion {σa, σb} = 2δabI where δab = ha|I3|bi is the Kro- moves and reductions. necker delta. Exploiting these relations, the following It is very interesting that by applying (13) and (26) equation is obtained followed by the canceling of neighboring Hadamard gates, one can easily transform the resulting T gate circuit into [σa, σb] + {σa, σb} = (σaσb − σbσa) + (σaσb + σbσa) a W gate circuit 3 X = 2i εabcσc + 2δabI (34) H W W † H c=1 † H W W H leading to H W W † H 3 W † W V X σaσb = i εabcσc + δabI. (35) √ c=1 where W = 4 X. This translation is applicable in general and not specific to this example. Moreover, other Pauli Hence, an equation can be derived that expresses a Pauli roots can be used together with their respective transla- root σb in terms of a Pauli root σa and the square root tion matrices. As a result, the size of the circuit does not of σc for |{a, b, c}| = 3, i.e. depend on the underlying Pauli root quantum gate li- √ √ √ √  k k † brary. However, some optimization techniques may only σb = εabc σc σa σc . (36) be possible for certain Pauli matrices. Let

IV. CLIFFORD GROUPS Pn = {σj1 ⊗ · · · ⊗ σjn | {j1, . . . , jn} ⊆ {0, 1, 2, 3}} (37)

be the Pauli group where σ0 = I, i.e. the set of all n- The Clifford group is usually defined over C1(X), S, fold products of the identity and the Pauli ma- and H in the literature. In this section, we investigate trices [13]. Following the definition in [8], the Clifford how the Pauli roots relate to Clifford groups and can be group Cn is the normalizer [13] of Pn in the group of all utilized in order to express Clifford groups in a general unitary 2n × 2n matrices U(2n), i.e. manner. We first derive some useful equalities involving n † Pauli matrices and their roots. Cn = {U ∈ U(2 ) | ∀P ∈ Pn : UPU ∈ Pn}. (38) The Pauli matrices form an orthogonal for the real and therefore one Pauli matrix cannot √ The Clifford group can be generated by C1(X), S = be expressed as a linear combination of the others. How- Z, and H [13]. Other matrices can then be derived e.g. ever, the Pauli matrices obey the commutation relation P3 (a−b)(b−c)(c−a) (36) † [σa, σb] = 2i c=1 εabcσc where εabc = 2 is Z =SS, X =HSSH,Y = SXS =SHSSHSSS. (39) 6

Other choices are possible. For example, the Clifford Theorem 4. It holds, that group can be generated by e.g. C1(X), V , and H, since S = HVH. θ  iθ Na = e 2 Ra(θ). (42) √ 2 Theorem 3. The gates C1(σa), σa, and ρab generate √ iπ the Clifford group where a 6= b. k 2k π  Note that σa = e Ra k . Proof. According to (13) one can obtain a second Pauli √ √ − iθ θ square root σ from σ by multiplying it with ρ on 2  b a ab Proof. We rewrite (42) to Ra(θ) = e Na 2 and after both sides. The third square root can then be obtained θ expanding Na( ) we have from (36). 2

√ iθ  iθ  Corollary 2. The gates C (σ ), σ , and ρ generate − 2 θ 2 1 a b ab e I + i sin e (I − σa) the Clifford group. 2 − iθ θ θ θ θ = e 2 I + i sin I − i sin σa =cos I −i sin σa =Ra(θ) Based on the results of this section, circuits built us- 2 2 2 2 ing gates from the Clifford+T library can also be ex- pressed using a more general Clifford group together with which concludes the proof. a fourth root of a corresponding Pauli matrix.

Corollary 3. From Theorem 3 it can be seen V. NEGATOR OPERATIONS that C1(σa), Na(θ), and ρab generate the Clifford group. VI. CONCLUDING REMARKS In [14] the authors introduce a related gate called the NEGATOR N(θ) which they obtain by replacing π by 2k This paper has examined relationships between the an angle θ in the matrix representation for the root of Pauli matrices and their roots with an emphasis on cir- Pauli X, i.e. cuit synthesis and optimization. We have presented a N(θ) = I + i sin θ + eiθ (I − X) . (40) number of useful identities and techniques. We have also shown that by applying those methods it is possible to This gate can be generalized for all Pauli matrices as systematically derive circuits employing Clifford+T gates from NCV circuits without using expensive exhaustive iθ Na(θ) = I + i sin θ + e (I − σa) (41) search techniques. Our ongoing work is to incorporate the techniques discussed in this paper into a synthesis and it can be proven that the matrix is obtained from algorithm opening the way to the synthesis and optimiza- π the corresponding Pauli root by replacing 2k with θ. tion of larger Clifford+T gate circuits.

[1] M. A. Nielsen and I. L. Chuang, Quantum Computation [10] E. U. Condon and P. M. Morse, and (Cambridge University Press, (McGraw-Hill, 1929). 2000). [11] P. A. M. Dirac, Math. Proc. of the Cambridge Phil. Soc. [2] A. Barenco, C. H. Bennett, R. Cleve, D. P. DiVincenzo, 35, 416 (1939). N. Margolus, P. Shor, T. Sleator, J. A. Smolin, and [12] M. Soeken and M. K. Thomsen, in Reversible Compu- H. Weinfurter, Phys. Rev. A 52, 3457 (1995). tation, Lecture Notes in Computer Science, Vol. 7948 [3] W. N. N. Hung, X. Song, G. Yang, J. Yang, and M. A. (Springer, 2013) pp. 196–208. Perkowski, IEEE Trans. on CAD 25, 1652 (2006). [13] D. Gottesman, arXiv:quant-ph/9807006v1. [4] D. Große, R. Wille, G. W. Dueck, and R. Drech- [14] A. De Vos and S. De Baerdemacker, Open Syst. & Inform. sler, Multiple-Valued Logic and Soft Computing 15, 283 Dynam. 20, 1350004 (2013). (2009). [5] Z. Sasanian and D. M. Miller, Multiple-Valued Logic and Soft Computing 18, 83 (2012). [6] H. Buhrman, R. Cleve, M. Laurent, N. Linden, A. Schrij- ver, and F. Unger, in Foundations of Computer Science, Vol. 27 (IEEE Computer Society, 2006) pp. 411–419. [7] A. Bocharov and K. M. Svore, Phys. Rev. Lett. 109, 190501 (2012). [8] M. Amy, D. Maslov, M. Mosca, and M. Roetteler, IEEE Trans. on CAD 32, 818 (2013). [9] P. Selinger, Phys. Rev. A 87, 042302 (2013). 7

Appendix A: Deriving the circuit in (3) In this step we make use of the identity in (A1) which changes the position and orientation of the selected gates: Before we derive the circuit, we show one further iden- tity: T T † (31) (25) † = T † T = T = S T T T T T T T † T S T T H T T † H After again moving a CNOT to the left we have

(31) = T T † T = T (A1) † T T T T † † We start as before by mapping the controlled V and T T T V † gates to S and S† gates as follows. H T T † H

= = S† Moving the CNOT to the end of the circuit allows the T † V V † V H S S H gate on the top line to move into the third T -stage. It also leads to a sequence of three CNOTs that corresponds Replacing the controlled S and S† gates by cascades con- to swapping two lines. The two CNOTs right of the third sisting of uncontrolled T and T † gates yields T -stage can be extended to a line swapping sequence by adding two identical CNOTs. T † T T T T T † † † † H T T T T T H T T † T cancel H T T † H After moving T gates on the first and second line towards the left and canceling the T with the T † gate on the third line we have Consequently, we can replace the gates by uncontrolled Fredkin gates T T T † T T T † H T T † T † H T T † T † In this circuit we move a CNOT to the left by apply- H T T H ing (28) resulting in and then apply the line swapping locally which results in T the circuit from (3): T T † T H T T † T † H T T † After moving the selected gates to the left the circuit is T T † T † as follows: H T T H T T T † T H T T † T † H swap