quantum gate directory

Gates Groups SDKs GitHub
$\mathrm{CC}X$

controlled· 3 qubits

Toffoli

Controlled-controlled-NOT gate that flips a target qubit when both controls are $|1\rangle$.

Open in Quirk ↗ hermitian

The Toffoli gate (Controlled-Controlled-NOT) flips a target qubit if and only if two control qubits are in the $|1\rangle$ state. It is universal for classical reversible computation and is widely used in quantum algorithms.

$$ \mathrm{CC}X = \begin{bmatrix} 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 1 & 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 1 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 1 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & 1 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & 0 & 0 & 1 \\ 0 & 0 & 0 & 0 & 0 & 0 & 1 & 0 \end{bmatrix} $$

Properties

  • Classical universality: implements any reversible Boolean computation with NOT gates.
  • Reversible: the Toffoli gate is its own inverse.
  • Decomposable into single- and two-qubit gates (e.g., $H$, $T$, and CNOT).

Usage

  • Classical reversible computation and arithmetic circuits.
  • Multi-controlled operations in quantum algorithms.

Also written

  • $\mathrm{CCX}$
  • $\mathrm{CCNOT}$
  • $\mathrm{TOFF}$
  • $C^2X$
  • $\Lambda^2(X)$
  • $\text{Toffoli}$

Related

  • Controlled version of Controlled Not
  • Controlled variant: Multi-Controlled X

Groups

  • orthogonal
  • permutation

Data

  • This gate as JSON
  • Edit this page on GitHub

The unitary, drawn

Every entry of the matrix as a disc. The area is the transition probability $|U_{jk}|^2$; the colour and the hand are the phase. Rows are outputs $\langle j|$, columns inputs $|k\rangle$, in the computational basis.

Phase

Disc area $= |U_{jk}|^2$. Hover an entry for its value, or take the JSON.

SDK support

How to call this gate in each framework. Hover a ⓘ for a note; the support matrix compares every gate at once.

SDKName
Qiskit qiskit.circuit.library.CCXGate
PennyLane pennylane.Toffoli
Cirq cirq.CCNOT ⓘ
Q# Std.Intrinsic.CCNOT
PyQuil pyquil.gates.CCNOT
Braket braket.circuits.gates.CCNot
BQSKit bqskit.ir.gates.ToffoliGate ⓘ
Qibo qibo.gates.TOFFOLI
pytket pytket.circuit.OpType.CCX
Stim —
OpenQASM stdgates.inc: ccx

← All gates

gate.directory made by nts $\oplus$ rdls