2022 Developer Survey is open! Take survey.

# Tag Info

Accepted

### How to derive the CNOT matrix for a 3-qubit system where the control & target qubits are not adjacent?

For a presentation from first principles, I like Ryan O'Donnell's answer. But for a slightly higher-level algebraic treatment, here's how I would do it. The main feature of a controlled-$U$ operation,...
• 10.8k

### How do I build a gate from a matrix on Qiskit?

You can build your gate with Operator and unitary function e.g: ...
• 431
Accepted

### Given a decomposition for a unitary $U$, how do you decompose the corresponding controlled unitary gate $C(U)$?

The question may not be entirely well-defined, in the sense that to ask for a way to compute $C(U)$ from a decomposition of $U$ you need to specify the set of gates that you are willing to use. Indeed,...
• 18.2k
Accepted

### How do you implement the Toffoli gate using only single-qubit and CNOT gates?

is the decomposition (I took this from google images, originally on this website.) In order to understand how to decompose it, we can look at it's base structure. The idea is that we combine gates ...
• 1,676
Accepted

### What is the mathematical justification for the "universality" of the universal set of quantum gates (CNOT, H, Z, X and π/8)?

The answer you mention references Michael Nielsen and Isaac Chuang's book, Quantum Computation and Quantum Information (Cambridge University Press), which does contain a proof of the universality of ...

### How to derive the CNOT matrix for a 3-qubit system where the control & target qubits are not adjacent?

This is a good question; it's one that textbooks seem to sneak around. I reached this exact question when preparing a quantum computing lecture a couple days ago. As far as I can tell, there's no ...

• 4,998

### How do I build a gate from a matrix on Qiskit?

Here's the circuit for your specific case: I made it manually, by entering the matrix into Quirk, diagonalizing the matrix by adding operations, then simplifying the operations. It's not too hard to ...
• 21.8k
Accepted

### Is there any method of adding two operators in a circuit?

What you are trying to do is called Hamiltonian Simulation. If your exponential can be split in a sum of unitary matrices, @smapers' answer guide you to a good algorithm: the Linear Combination of ...
• 4,467

### Sampling random circuits vs Solovay-Kitaev compiler

The Solovay-Kitaev algorithm is not practical. It is very useful theoretically because it proves that once you have a "dense" set of quantum gates (i.e. a set with which you can approximate any other ...
• 4,467
Accepted

### Is it possible to make a Toffoli gate using only CNOTS and ancillas?

No this is not possible. One argument is the following: Toffoli + Hadamard are universal for quantum computation, so if you can make Toffoli from controlled-not then controlled-not + Hadamard would be ...
• 46.3k