WOLFRAM|DEMONSTRATIONS PROJECT

CNOT and Toffoli Gates in Multi-Qubit Setting

​
gate
CNOT
Toffoli
number of qubits
n
2
3
4
5
first control bit
1
2
3
second control bit
1
2
3
target bit
1
2
3
view
array
matrix
The most commonly used two-qubit gate is the controlled-not (CNOT) gate. In two-qubit space, CNOT is a matrix of the form
1
0
0
0
0
1
0
0
0
0
0
1
0
0
1
0
. In general it is a
n
2
×
n
2
matrix. The most important three-qubit gate is the universal Toffoli gate, or controlled-controlled-not (CCNOT) gate with two control bits. For the Toffoli gate, both control bits are operative; for CNOT, only the first control bit.