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)?


1 Answer 1


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, 2021 at 10:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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