Flips the target qubit only when both control qubits are .
The Toffoli gate is a three-qubit gate with two controls and one target. The target flips only when both controls are . On definite classical inputs, this computes a reversible AND: the target ends up holding the AND of the two controls. On quantum inputs, it acts on all eight three-qubit basis states simultaneously in superposition. Toffoli alone is universal for classical reversible computing. Combined with Hadamard, it becomes universal for quantum computing.
Toffoli (CCX) is a three-qubit gate. Its action is |ab, c⟩ → |ab, c XOR (a AND b)⟩. Here XOR (exclusive or) flips a bit when the other bit is 1, and AND is 1 only when both inputs are 1. So the target bit c flips if and only if both controls a and b are 1. The gate is its own inverse (applying it twice restores the original state) and unitary (it preserves total probability). It can simulate any classical logic circuit reversibly. On quantum states, it applies the controlled-controlled-NOT operation coherently (preserving all quantum phases and amplitudes) across all branches of a superposition, without collapsing any of them.
The target qubit’s measurement outcome changes according to the AND of the two control qubits’ values.
When controls are in superposition, Toffoli preserves all phases and amplitudes across all branches. The result is a quantum superposition, not a classical mixture.
Applies a conditional X rotation to the target qubit when both controls are . The individual Bloch vectors depend on the full three-qubit state.
It is tempting to think Toffoli is a purely classical gate because its truth table matches AND. That sounds right because AND is a classical operation. What actually happens is that when the controls are in superposition, Toffoli produces a quantum superposition (with phases preserved) rather than a probabilistic classical mixture. The quantum version processes all input combinations simultaneously through amplitudes.
Toffoli proves that quantum computing includes all of classical computing. Any classical algorithm can be embedded as a reversible quantum circuit using Toffoli gates. From there, quantum features like superposition and interference can be layered on top to achieve speedups.
What classical logic gate does Toffoli implement reversibly?