# The Toffoli Gate

The name “Toffoli” remembers one very known politician in Brazil, but for quantum computing, it is the name of a logical gate.

It is a three-qubit gate, usually represented as:

The Toffoli gate can be interpreted as an evolution of simpler gates.

We have the NOT gate, of one qubit, which is also the Pauli’s X gate.

In qiskit, it is the gate x.

Ex. qc.x (0)

For two qubits, there is the CNOT, or controlled-not gate. If the control qubit is zero, nothing happens with the target qubit. If the control qubit is one, gate X is applied to the target qubit. This is one of the most useful gates in quantum computing.

In qiskit, it is the gate cx.
Eg qc.cx (0.1) # Qubit of control and target

The Toffoli gate is nothing more than a ccnot gate. Two control qubits, and one target qubit.

In qiskit, it is the ccx gate.

Eg qc.ccx (0,1,2) # Qubit of control 1, control 2 and target

It is also possible to think of a multiple Toffoli gate. A variable number of qubits as a control, and one as a target.

In qiskit, it is the mct gate.
Eg qc.mct ([control], [target], [auxiliary])

These auxiliary qubits are for implementing the mct gate. I didn’t find it explicitly in the documentation, but from what I realized the number of auxiliary is two qubits less than the control ones.

database = QuantumRegister (8)
oracle = QuantumRegister (1)
auxiliary = QuantumRegister (6)

qc.mct (database [:], oracle [0], auxiliary [:], mode = ‘basic’)

The Toffoli gate actually appeared in classical computing. It is an example of a reversible gate. It is also a universal gate, which generalizes other gates — eventually using auxiliary bits.

See more about the Toffoli gate here:

https://en.wikipedia.org/wiki/Toffoli_gate

Technical ideas with a bit of philosophy
https://ideiasesquecida.com/

Join the Quantum Computing study group: