I know for instance I can derive a cccX gate using 2 Toffoli gates on 5 qubit wire or ccccX with 3 Toffoli gates and 7 qubits and so on. you will notice the depth is increasing as the number of control qubits increase, that is for every additional c, there are 2 additional qubits. Is there a better way I can derive these multiple controlled x gate using fewer resources (gates and qubits)?


This Qiskit tutorial does what I think you're looking for; with the cnx() function. It uses this paper to decompose the CNOT gate without ancilla qubits.

Let me know, if this helps you.

  • $\begingroup$ Replaced the depreciated cu3 gates with cu gates and it worked perfectly. Thanks. $\endgroup$ Feb 27 '21 at 10:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.