Five Two-Qubit Gates Are Necessary for Implementing Toffoli Gate Nengkun Yu,∗ Runyao Duan, and Mingsheng Ying State Key Laboratory of Intelligent Technology and Systems, Tsinghua National Laboratory for Information Science and Technology, Department of Computer Science and Technology, Tsinghua University, Beijing 100084, China and Center for Quantum Computation and Intelligent Systems (QCIS), Faculty of Engineering and Information Technology, University of Technology, Sydney, NSW 2007, Australia In this paper, we settle the long-standing open problem of the minimum cost of two-qubit gates forsimulatingaToffoligate. Moreprecisely,weshowthatfivetwo-qubitgatesarenecessary. Before ourwork,itisknownthatfivegatesaresufficientandonlynumericalevidenceshavebeengathered, 3 indicatingthatthefive-gateimplementationisnecessary. Theideaintroducedherecanalsobeused 1 to solve the problem of optimal simulation of three-qubit control phase introduced by Deutsch in 0 1989. 2 n a Sincequantumcomputationprovidesthepossibilityof classicalreversible computation [12], as well as universal J solvingcertainproblemswhicharebelievedtobeinfeasi- quantum computation [13] with little extra help. It also 5 ble with a classicalcomputer [1–4], a huge amount of ef- plays a central role in quantum error-correction[11, 14– 1 forthasbeendevotedtobuildingfunctionalandscalable 17]. Recently,experimentalimplementationoftheToffoli quantum computers over the last two decades. Quan- gate has received considerable attention [8–10, 19, 20]. ] h tumlogicalcircuitisthemostpopularmodelofquantum However, it remains still unknown what is the optimal p computer hardwares. In order to be a general purpose simulationoftheToffoligatebyusingbipartitequantum - computational device, a quantum computer must imple- logicalgates,whichhasbeenanimportantopenproblem t n ment a small set of quantum logical gates [5], which can explicitly listed in the influential textbook on quantum a universallyserveasthe basicbuildingblocksofquantum computation[5]. Here, we settle this problemby showing u q circuits,in the samewayas classicallogicalgatesdid for that five two-qubit gates are necessary and sufficient for [ conventionaldigitalcircuits. Itisquitenaturaltochoose implementingtheToffoligate. Afivetwo-qubitgatesde- certain gates operating on a small number of qubits as compositionoftheToffoligatewasknownlongtime ago, 1 the basic gates. but before this work numerical evidences showing that v 2 Theoretically, any two-qubit gate that can create en- the five-gate implementation is optimal have been found 7 tanglement, like the controlled-NOT (CNOT) gate, to- [21–24]. Our result gives, for the first time, a theoretical 3 gether with all single-qubit gates is universal [6]. It has proof for the optimality beyond numerical evidences. 3 . also been experimentally demonstrated that two-qubit The function of Toffoli gate is simply a three-qubit 1 gates can be realized with high fidelity using the cur- controlledNOT gate and can be intuitively explained as 0 rent technology, for example, two-qubit gate with su- follows. TheToffoligateisactingonthreequantumbits, 3 1 perconducting quibts have been presented with fidelities namely A,B, and C. Here A and B are control qubits, : higher than 90% [7]. Finding more efficient ways to im- andC isthetargetqubit. Letusfixacomputationalba- v plement quantum gates may allow small-scale quantum sis 0 , 1 foreachqubit. Uponaninput abc ,thegate i {| i | i} | i X computing tasks to be demonstrated on a shorter time will output the states of A and B directly, and flip the r scale. More precisely, it would be quite helpful for de- system C only if both the states of A and B are 1. The a featingquantumdecoherencetorealizemulti-qubitgates Toffoli gate can be depicted by the following diagram, with the least number of possible basic gates. Thus an a a important problem is how to implement more-than-two- qubit gatesusing only two-qubitgates. Indeed, studying b T b the minimum cost of two-qubit gates for simulating a c c ab multi-qubit gate is not only of theoretical importance, ⊕ but also an experimental requirement: to accomplish a It can also been written as the following version by con- quantum algorithm, even in a small size, one has to im- sidering the output over the computational basis: plement a relatively high level of control over the multi- qubit quantum system. A lot of experimental effort has TABC =I−|110ih110|−|111ih111|+|110ih111|+|111ih110|. been devoted to demonstrating multi-qubit controlled- It is well known that the Toffoli gate is universal for the NOT gates in ion traps [8], linear optics [9], supercon- classical computation in the sense that all conventional ductors [10] and atoms [11]. boolean circuits can be built upon it in a reversible way. The Toffoli gate is perhaps one of the most impor- Itwasalsoprovedto beuniversalforquantumcomputa- tant quantum logical gates as it can universally realize tion if the one-qubit Hadamard gate is provided as free 2 resource[13]. Furthermore,aseriesofworksshowedthat canbe simply classified into three types: AB - the gate K theToffoligateisanindispensableingredientinrealizing acting on the systems A and B, and likewise, BC, and K fault tolerant quantum computation [11, 14–18]. Re- AC. Clearly, it is impossible that all two-qubit gates − K cently, a rapid progress has been made on implementing used to simulate VABC belong to the same type. Fur- the Toffoli gate experimentally. The first experimental thermore, we can verify that only two two-qubit gates realization of the quantum Toffoli gate is presented in arenotsufficientforthesimulationofVABC. Toseethis, an ion trap quantum computer, in January 2009 at the one only needs to notice that UABUBC = VABC implies UniversityofInnsbruck,Austria[8]. Anewapproachus- thatUBC isalsoacontrolledgatewithcontrolsystemC. ing higher-dimensional Hilbert spaces was proposed [25] This leads us to contradiction by a routine calculation. thatenablesustosimplifytheimplementationoftheTof- Three observations are quite helpful during our proof: foli gate in linear optics [9] and superconducting circuits i). Any two-dimensional two-qubit subspace contains [10, 19, 20]. some product state; ii). A two-qubit unitary UAB can Duetoitssignificanceinquantumcomputing,thethe- be regarded as a controlled gate with control system A oretical pursuit of efficient implementation of the Toffoli if the state of qubit A in UAB 0 A y B is always 0 A | i | i | i gate using a sequence of single- and two-qubit gates has for any state y B of system B; iii) Let UABUAC be | i quite long history. It was well known that six CNOT a three-qubit unitary which can be regarded as a con- gates are optimal when single-qubit unitary is provided trolled gate between the bipartition A-BC with control as free resources [21, 26–28]. Then an interesting ques- systemA. ThenthereexistvB1,vB2 andwC1,wC2 being tion naturally arises: how many general two-qubit gates one-qubit gates on B and C such that UABUAC = H H rather than the CNOT are required to implement the 0 0 vB1 wC1+ 1 1 vB2 wC2. | ih |⊗ ⊗ | ih |⊗ ⊗ Toffoli gate? This question has attracted many different Observationsi) andii) are obvious. To see iii), we can researchersinthelasttwodecades. Inparticular,Nielsen assume UAC 0 A γ C = 0 A ψ C by moving the local | i | i | i | i and Chuang explicitly listed it as an unsolved problem unitarytotheleftofUAB. ThenUABUAC 0 A y B γ C = | i | i | i in their standard textbook on quantum computation [5] UAB 0 A y B ψ C. Note that the state of A’s part of | i | i | i (see page213,Problem4.4). What we knowuntil now is UAB 0 A y B is always 0 , which means that UAC is a | i | i | i thatthe Toffoligatecanbe decomposedasa circuitcon- controlledgate with controlonA. Similarly, UAB is also sisting of five two-qubit gates, and numerical evidences a controlled gate with control on A. Hence the result have been gathered, indicating that the five-gate imple- follows. mentation is optimal [21–23]. Here, we finally settle this Now we show that three two-qubit gates are not suf- problemandpresentatheoreticalproofoftheoptimality. ficient to implement VABC. We will achieve this goal LetVABC =IABC 2111 111 withIABC theidentity by analysing all possible circuits consisting of three two- − | ih | operator on Hilbert space A B C. It is evident qubit gates. Due to the highly symmetric properties of H ⊗H ⊗H that VABC = (IAB HC)TABC(IAB HC), where H is VABC, we only need to consider the following two cases: ⊗ ⊗ the Hadamard gate given by Case1: Thesethreegatesbelongtojusttwotypes. With- outanylossofgenerality(wlog),wecanassumethattwo 1 1 1 H = . gatesareofthetype AB andthethirdoneisofthetype √2(cid:18)1 1(cid:19) K − BC,andthecircuitis(notethatthetimegoesfromleft K In other words, VABC and the Toffoli gate TABC are to right) equivalent up to local unitary HC. By absorbing HC into any two-qubit gates acting on AC or BC, we can A easily conclude that VABC and TABC require the same B UAB2 UAB1 number of two-qubit gates to realize. Thus in the fol- UBC C lowing discussions, we will focus on the minimal cost of simulating VABC using two-qubit gates. Weonlyneedtoshowthereisnosolutionofthefollowing The gate VABC is a real Hermitian matrix that is equation invariant under any permutation of subsystems A,B, and C. Thus it can be regarded as a controlled-gate UAB1UBCUAB2 =VABC, with control on each qubit. Note that any bipartite unitary UAB acting on a qubit system A and a gen- where UAB1 and UAB2 are of type AB, and UBC of K eral system B is said to be a controlled-gate with con- type BC. Then UBC must be a controlled gate with trol on A if it can be decomposed into the form of controKl on C by noticing that UBC = UA†B1VABCUA†B2, UAB = 0A 0A U0+ 1A 1A U1. Thissimpleobser- where†standsfortheHermitianconjugate. Wecanwrite | ih |⊗ | ih |⊗ vation is helpful to reduce the number of cases we need UBC = 0 0 IB+ 0 0 wB. Adirectcalculationleads | ih |⊗ | ih |⊗ to consider. ustotheconclusionthatIA wB andI 211 11 share ⊗ − | ih | Since VABC is regarded as a three-qubit gate acting thesamesetofeigenvalues(countingmultiplicity). That on ABC, any two-qubit gate used to implement VABC is impossible. 3 Case 2: Three gates belong to different types. Wlog, we gateshas a positive distance to the Toffoligate since the can assume the circuit is setofthree-qubitgatesthatcanbeimplementedbyusing up to four two-qubit gates form a compact set; in other UABUBCUAC =VABC. words, the Toffoli gate cannot be well approximated by We know that UBCUAC is a controlledgate with control such circuits. bit C. As just discussed, we can obtain that UBC is a Thisaboveargumentcanalsobeusedtoshowthatthe controlledgatewithcontrolsystemC,sodoesUAC. Con- following two-qubit controlled phase gate (three-qubit sequently,wecanassertthatI 211 11 islocalunitary quantum gates with two control systems and one tar- − | ih | byfiguringdirectlyouttheformofcontrolunitary. That get qubit) introduced by Deutsch [29] can not be imple- is again impossible. mented by four two-qubit gates: Wecangeneralizethistechniquetoshowthatthegate iθ VABC cannot implemented by any circuit consisting of Vθ =I −(1−e )|111ih111|. fournonlocaltwo-qubitgateswedonotcountthenumber of one-qubit gates as they can be easily absorbed into where 0 < θ < 2π. Note that VABC is the special case relevant two-qubit gates. Again the symmetric property of θ = π. Together with the result in [23], we conclude of VABC enables us to consider only the following two that five two-qubit gates are optimal for simulating the cases: the two-qubit controlled phase gate. Case 1: Four gates belong to only two types, say AB In this paper, we study the problem of implementing and BC. Due to the symmetry of VABC, we onlyKneed multi-qubit gate using two-qubit unitaries. It is demon- to shKow the following circuit cannot be VABC, strated that four two-qubit unitaries is not enough for constructing a three-qubit Toffoli gate, thus, five two- A qubit gates is optimal. More precisely, our idea can UAB2 UAB1 B be directly used to prove that in order to implement a UBC2 UBC1 three-qubitcontrolphasegate,fivetwo-qubitgatesisalso C needed. We hopethisworkwillbehelpfulforfurtherde- that is to show the following equation has no solution: termining minimal cost of implementing larger quantum logicalgates,e.g. themulti-qubitcontrolledgate,andfor UAB1UBC1UAB2UBC2 =VABC. studying optimizationof quantum logicalcircuits, a cru- The proof detail of this case is given in appendix. cial issue in the design and implementation of quantum Case 2: Each of three types contains least one of computer hardware and architecture. the four two-qubit gates. Again due to the symmetry Thisworkwaspartlysupportedbythe AustralianRe- of VABC, we only need to deal with the following two searchCouncil(GrantNo: DP110103473)andthe Over- subcases: seasTeamProgramofAcademyofMathematicsandSys- Case 2.1: The circuit is represented by tems Science, Chinese Academy of Sciences. UACUAB1UBCUAB2 = VABC. We can reduce this circuit to the circuit considered in Case 1 by observing that SABVABCSAB =VABC and (SABUACSAB)(SABUAB1)UBC(UAB2SAB)=VABC, ∗ Electronic address: [email protected] [1] Shor, P. SIAMJ. Comp. 26, 1484 (1997). where SAB is the swap gate on system A B given [2] Feynman, R.P. Inter.J. Theo. Phys. 21, 467 (1982). H ⊗H by S xA yB = yA xB for any two states x and y . [3] Hallgren, S. Journal of the ACM, Volume 54 Issue 1, | i| i | i| i | i | i Here we have employed the fact that SABUACSAB a March 2007. two-qubit gate acting on BC, SABUAB1 and UAB2SAB [4] Freedman,M.H.,Kitaev,A.andWang,Z.Comm.Math. are two-qubit gates acting on AB. Phys. 227, 587 (2002). [5] Nielsen,M.A.andChuang,I.L.QuantumComputation Case 2.2: The circuit is represented by and QuantumInformation, First Edition (2000). UAB1UBCUACUAB2 = VABC. We know that UBCUAC [6] Bremner, M. J., Dawson, C. M., Dodd, J. L., Gilchrist, is a controlled gate with control system C. Directly, A., Harrow, A. W., Mortimer, D., Nielsen, M. A. and we can obtain UBC and UAC are controlled-gates with Osborne, T. J. Phys. Rev.Lett. 89, 247902 (2002). with control on C. This leads us to the conclusion that [7] DiCarlo, L., Chow, J. M., Gambetta, J. M., Bishop, L. I 211 11 shares eigenvalues counting multiplicity S., Johnson, B. R., Schuster, D. I., Majer, J., Blais, A., wi−th a| loichal|unitary, which means that the product of Frunzio, L., Girvin, S. M. and Schoelkopf, R. J. Nature 460, 240 (2009). two eigenvalues of I 211 11 equals to the product of − | ih | [8] Monz, T., Kim,K.,Hansel, W.,Riebe,M., Villar, A.S., the other two. Impossible. Schindler, P., Chwalla, M., Hennrich, M. and Blatt, R. We have shown that four two-qubit gates are not suf- Phys. Rev.Lett. 102, 040501 (2009). ficient for simulating the Toffoli gate, which further im- [9] Lanyon, B. P., Barbieri, M., Almeida, M. P., Jennewein, pliesthatanycircuitconsistingoflessthanfivetwo-qubit T., Ralph, T. C., Resch, K. J., Pryde, G. J., O’Brien, 4 J. L., Gilchrist, A. and White, A. G. Nature Phys. 5, consider three subcases according to different forms of 134-140 (2009). the state UBC1 0 B y C: [10] FWeadlolrraoffv,, AA..,NSatteuffreen4,8L1.,, B17a0ur(,20M12.,).da Silva, M. P. and Case 1.1: Ther|eiis|soime |z0iC such that UBC1|0iB|z0iC is entangled. Assume that there is 0<λ<1 such that [11] Cory, D. G., Mass, W., Price, M., Knill, E., Laflamme, RR.e,vZ.uLreetkt,.W81.,H21.,5H2-a2v1e5l5,T(1.9F9.8)a.ndSomaroo, S.S.Phys. UBC1|0iB|z0iC =√λ|0iB|αiC +√1−λ|1iB α⊥ C, [12] Toffoli, T. in Automata, Languages and Programming, (cid:12)(cid:12) (cid:11) where wehave absorbeda localunitary acting onB into 7th Colloq. (eds de Bakker, J. W. van and Leeuwen, J.) 632-644 (Springer, 1980). UAB1. Let Φ =UAB1 00 and Ψ =UAB1 01 ,weknow | i | i | i | i [13] Shi,Y. QuantumInf. Comput. 3, 84-92 (2003). that [14] Knill, E., Laflamme, R., Martinez, R. and Negrevergne, C. Phys. Rev.Lett. 86, 5811-5814 (2001). χ ABC = UABUBC 0 A 0 B z0 C | i | i | i | i [15] Chiaverini, J., Leibfried, D., Schaetz, T., Barrett, M. = √λΦ α +√1 λΨ α⊥ , D., Blakestad, R. B., Britton, J., Itano, W. M., Jost, J. | iAB| iC − | iAB C D., Knill, E., Langer, C., Ozeri, R. and Wineland, D. J. (cid:12) (cid:11) (cid:12) Nature432, 602-605 (2004). we can readily obtain [16] Pittman, T. B., Jacobs, B. C. and Franson, J. D. Phys. Rev.A 71, 052332 (2005). χA = 0 0 =λΦA+(1 λ)ΨA ΦA =ΨA = 0 0. | ih | − ⇒ | ih | [17] Aoki, T., Takahashi, G., Kajiya, T., Yoshikawa, J., Braunstein,S.,Loock,P.andFurusawa,A.NaturePhys. Therefore, UAB1 is a controlledgate with controlsystem [18] 5D,e5n4n1is-,54E6.(P2h0y0s9.).Rev.A 63, 052314 (2001). Aa,cothnetnroollnede kgnaotewwthitahtcUoAnBtr2ol=AU.B†ACs1sUuA+mBe1VthAaBtCUUAB†BC12=is [19] Mariantoni, M., Wang, H., Yamamoto, T., Neeley, M., 0 0 IB+ 1 1 uB andUAB2 = 0 0 IB+ 1 1 Bialczak, R. C., Chen, Y., Lenander, M., Lucero, E., | ih |⊗ | ih |⊗ | ih |⊗ | ih |⊗ OConnell,A.D.,Sank,D.,Weides,M.,Wenner,J.,Yin, vB. We conclude that UBC1vBUB†C1 = u†B ⊗ |0ih0| + Y., Zhao, J., Korotkov, A. N., Cleland, A. N. and Mar- u†BZB 1 1, where Z is the Pauli matrix given by tinis, J. M. Science 334, 61 (2011). Z 0 =⊗0| aihnd|Z 1 = 1 . [20] RL.e,eGd,irMvi.n,DS.,.MDi.CaanrdloS,cLh.o,eNlkigogp,f,SR..EJ.,.NSuantu,rLe.,48F2ru,n3z8i2o-, tip|Tliihcietys|eitisofeeiθi1g,ee|nivθia1,lueei−θs2|,oeifiθU2B,C1wvhBicUhB†Cis1aclsoountthiengeimgeunl-- 385 (2012). { } [21] DiVincenzo, D.P. Proc. R. Soc. Lond. A, 454:261-276, values counting multiplicity of the right hand side of the (1998). aboveequality. Notethatu†B shouldnotequaltoidentity [22] DiVincenzo, D.P. and Smolin, J. A. Proc. of the Work- upto aglobalphase. Thenu†B andu†BZB havethe same shop on Physics and Computation (1994). set of eigenvalues. Thus their determinants are equal, [23] Sleator,T.andWeinfurter,H.Phys.Rev.Lett.74,4087 say (1995). [24] BMaarregnoclou,s,AN.,.B,eSnhnoert,t,PC.,.SHl.e,aCtolerv,eT,.R,.S,DmioVliinn,ceJn.zAo,.,Da.Pnd., det(u†B)=det(u†BZB)=det(u†B)det(ZB)=−det(u†B), Weinfurter,H. Phys. Rev.A 52, 3457 (1995). [25] Ralph, T. C., Resch, K. J., and Gilchrist, A. Phys. Rev. and det(u†B) = 0. This contradicts the fact that u†B is A 75, 022313 (2007). unitary. [26] Margolus, N. Unpublishedmanuscript (circa 1994). Thus UBC1 0 B z C is always product for any z C. [27] Song, G. and Klappenecker, A. Quantum Inf. Comp. 4, This leads us t|oico|nisider the following two subcases|.i 361-372 (2004). [28] Shende,V.V.andMarkov,I.L.QuantumInf.Comp.9, Case 1.2: There is a |γiC and a local unitary wB on 461 (2009). system B such that UBC1|0iB|ziC =wB|ziB|γiC. Then [29] Deutsch,D.Proc. Roy.Soc. Lond. A. 425 (1989). UAB1 maps 0 A B to itself, hence UAB1 is a con- {| i }⊗H Technical appendix: Inthisappendix,weshowthat trolled gate with control system A. Similarly UAB2 is there is no unitaries UAB1,UAB2 and UBC1,UBC2 such also a controlled gate with the same control bit. The that rest proof is the same as Case 1.1. Case 1.3: There is a state on system B, wlog, says UAB1UBC1UAB2UBC2 =VABC. 0 B, and a local unitary wC on system C such that | i Notice that UAB1UBC1UAB2 is a controlled gate on the UBC1|0iB|ziC =|0iBwC|ziC. Then UBC1 is acontrolled bipartitionA BC withcontrolonA. Moreover,theA’s gate with control system B. By moving this wC into partstateoft−heoutputstateUAB1UBC1UAB2 i A ψ BC UBC2, we canassume that UBC1 =|0ih0|⊗IC+|1ih1|⊗ is still i for any input state i ψ with| ii =| 0i,1. uC. Note that for any z C, part C’s state of the out- A A BC | i Since U|AiB2 maps some state 0|Aiξ|Bito product state, put state |χiABC = UAB1UBC1UAB2 |0iA|0iB|ziC = we can assume that UAB2 0|Ai0|Bi= 0 A 0 B by ab- UAB1 |0iA|0iB|ziC is still |ziC. Recall that |χiABC = sorbing one-qubit gates int|oiU|BCi1 and| iUA|Bi1. Then VABC|0iA(UB†C2|0iB|ziC) = |0iA(UB†C2|0iB|ziC). Thus the state of A’s part of UAB1UBC1UAB2 |0iA|0iB|ziC = part C’s state of UB†C2|0iB|ziC is |ziC for all |ziC ∈ UAB1UBC1 0 A 0 B z C is still 0 A. We now need to C, which means that there is β B such that | i | i | i | i H | i 5 UBC2 β B z C = 0 B z C.Therefore,onecanfindauni- part C’s state of UAB1UBC1UAB2UBC2 0 A 0 B z C = | i | i | i | i | i | i | i tary vC such that UBC2 = 0 β IC + 1 β⊥ vC. In 0 A 0 B z C, we see that β B defined in UBC2 equals | ih |⊗ | ih |⊗ | i | i | i | i ordertosimplifythe structureofthetwo-qubitgates,we to 0 or 1 , up to some global phase. Otherwise, as- B B observe that UB†C2UA†B2UB†C1UA†B1 = VABC, i.e., hence sum|eithat||0iiB = a|βiB +b β⊥ B for ab 6= 0. Then the alsoprovidesasimulationofVABC. Nowweconsiderthe state of part C becomes a m(cid:12)ixe(cid:11)d state for general input (cid:12) state 0 A 0 B z C since uC is not identity up to some global | i | i | i phaseandUBC1isnonlocal. Forthecase β B = 0 B,we UB†C2UA†B2UB†C1|0iC|0iB|xiA =UB†C2UA†B2|0iC|0iB|xiA knowthatallthefourtwo-qubitgatesare|cointrol|leidgate withcontrolsystemB,whichimpliesthatI 211 11 is forany x . Theargumentofcases1.1and1.2excludes − | ih | | iA alocalunitary,acontradiction. Forthecase β B = 1 B, thefollowingpossibilities: (i)thereissome x suchthat | i | i | iA let XB be the NOT (flip) gate such that X 0 = 1 and UloA†caBl2u|0niiBta|xryiAwBisoenntsaynsgtleemd,Borsu(icih) tthhaetreUiA†sBa2||0δiiBA|xainAd=a X|1i=|0i, then one can verify that | i | i wB x B δ A. Sotheonlypossibilityisthatthereisastate (UAB1XB)(XBUBC1XB)(XBUAB2XB)(XBUBC2)=VABC. | i | i φ B on system B, and a local unitary wA on system | i A such that UA†B2|0iB|xiA = |φiBwA|xiA. According Then UAB1XB,XBUBC1XB,XBUAB2XB and XBUBC2 to UAB2 0 A 0 B = 0 A 0 B, we can choose φ = 0 . are all controlled gate with control system B. This also | i | i | i | i | i | i Thus UAB2 is a controlled gate with control system B, leads us to the impossible conclusion that I 211 11 − | ih | i.e., UAB2 = 0 0 wA + 1 1 vA. By studying is local. | ih | ⊗ | ih | ⊗