ArticleslgStudy

physics

Toffoli gate

Toffoli gate is a physics topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Toffoli gate rather than just read about it. In short: In logic circuits, the Toffoli gate, also known as the CCNOT gate ("controlled-controlled-not"), invented by Tommaso Toffoli in 1980 is a CNOT gate with two control bits and one target bit. That is, the target bit (third bit) will be inverted if and only if the first and second bits are both 1.

Toffoli gate — main illustration
Toffoli gate — illustration

Key takeaways

  • Toffoli gate belongs to physics; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Toffoli gate to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Toffoli gate from memory before moving on to harder problems.

Reference excerpt

In logic circuits, the Toffoli gate, also known as the CCNOT gate ("controlled-controlled-not"), invented by Tommaso Toffoli in 1980 is a CNOT gate with two control bits and one target bit. That is, the target bit (third bit) will be inverted if and only if the first and second bits are both 1. It is a universal reversible logic gate, which means that any classical reversible circuit can be constructed from Toffoli gates. There is also a quantum-computing version where the bits are replaced by qubits.

Description The truth table and permutation matrix are as follows (the permutation can be written (7,8) in cycle notation):

Background An input-consuming logic gate L is reversible if it meets the following conditions: (1) L(x) = y is a gate where for any output y, there is a unique input x; (2) The gate L is reversible if there is a gate L´(y) = x which maps y to x, for all y. An example of a reversible logic gate is a NOT, which can be described from its truth table below:

The common AND gate is not reversible, because the inputs 00, 01 and 10 are all mapped to the output 0.

Reversible gates have been studied since the 1960s. The original motivation was that reversible gates dissipate less heat (or, in principle, no heat). More recent motivation comes from quantum computing. In quantum mechanics the quantum state can evolve in two ways: by the Schrödinger equation (unitary transformations), or by their collapse. Logic operations for quantum computers, of which the Toffoli gate is an example, are unitary transformations and therefore evolve reversibly.

Hardware description The classical Toffoli gate implemented in the hardware description language Verilog:

Universality and Toffoli gate Any reversible gate that consumes its inputs and allows all input computations must have no more input bits than output bits, by the pigeonhole principle. For one input bit, there are two possible reversible gates. One of them is NOT. The other is the identity gate, which maps its input to the output unchanged. For two input bits, the only non-trivial gate (up to symmetry) is the controlled NOT gate (CNOT), which XORs the first bit to the second bit and leaves the first bit unchanged.

Unfortunately, there are reversible functions that cannot be computed using just those gates. For example, AND cannot be achieved by those gates. In other words, the set consisting of NOT and XOR gates is not universal. To compute an arbitrary function using reversible gates, the Toffoli gate, proposed in 1980 by Toffoli, can indeed achieve the goal. It can be also described as mapping bits {a, b, c} to {a, b, c XOR (a AND b)}. This can also be understood as a modulo operation on bit c: {a, b, c} → {a, b, (c + ab) mod 2}, often written as {a, b, c} → {a, b, c ⨁ ab}. The Toffoli gate is universal; this means that for any Boolean function f(x1, x2, ..., xm), there is a circuit consisting of Toffoli gates that takes x1, x2, ..., xm and some extra bits set to 0 or 1 to outputs x1, x2, ..., xm, f(x1, x2, ..., xm), and some extra bits (called garbage). A NOT gate, for example, can be constructed from a Toffoli gate by setting the three input bits to {a, 1, 1}, making the third output bit (1 XOR (a AND 1)) = NOT a; (a AND b) is the third output bit from {a, b, 0}. Essentially, this means that one can use Toffoli gates to build systems that will perform any desired Boolean function computation in a reversible manner.

Related logic gates

The Fredkin gate is a universal reversible 3-bit gate that swaps the last two bits if the first bit is 1; a controlled-swap operation. The n-bit Toffoli gate is a generalization of the Toffoli gate. It takes n bits x1, x2, ..., xn as inputs and outputs n bits. The first n − 1 output bits are just x1, ..., xn−1. The last output bit is (x1 AND ... AND xn−1) XOR xn. The Toffoli gate can be realized by five two-qubit quantum gates, but it can be shown that it is not possible using fewer than five. Another universal gate, the Deutsch gate, can be realized by five optical pulses with neutral atoms. The Deutsch gate is a universal gate for quantum computing. The Margolus gate (named after Norman Margolus), also called simplified Toffoli, is very similar to a Toffoli gate but with a −1 in the diagonal: RCCX = diag(1, 1, 1, 1, 1, −1, X). The Margolus gate is also universal for reversible circuits and acts very similar to a Toffoli gate, with the advantage that it can be constructed with about half of the CNOTs compared to the Toffoli gate. The iToffoli gate was implemented in superconducting qubits with pair-wise coupling by simultaneously applying noncommuting operations. A generalized Toffoli gate, sometimes called a multiple-control Toffoli (MCT) gate, uses more than two control bits, flipping the target bit only when all control bits are set to 1.

Relation to quantum computing Any reversible gate can be implemented on a quantum computer, and hence the Toffoli gate is also a quantum operator. However, the Toffoli gate cannot be used for universal quantum computation, though it does mean that a quantum computer can implement all possible classical computations. The Toffoli gate has to be implemented along with some inherently quantum gate(s) in order to be universal for quantum computation. Specifically any single-qubit gate with real coefficients that can create a nontrivial quantum state suffices. A Toffoli gate based on quantum mechanics was successfully realized in January 2009 at the University of Innsbruck, Austria. While the implementation of an n-qubit Toffoli with circuit model requires 2 n {\displaystyle 2n} CNOT gates, the best known upper bound stands at 6 n − 12 {\displaystyle 6n-12} CNOT gates. It has been suggested that trapped Ion Quantum computers may be able to implement an n-qubit Toffoli gate directly. The application of many-body interaction could be used for direct operation of the gate in trapped ions, Rydberg atoms, and superconducting circuit implementations. Following the dark-state manifold, Khazali-Mølmer Cn-NOT gate operates with only three pulses, departing from the circuit model paradigm. The iToffoli gate was implemented in a single step using three superconducting qubits with pair-wise coupling.

See also Controlled NOT gate Fredkin gate Reversible computing Bijection Uncomputation Quantum computing Quantum logic gate Quantum programming Adiabatic logic

… excerpt ends here. Continue reading the full article.

Illustrations

Toffoli gate: The Toffoli gate can be constructed from single qubit T- and Hadamard-gates, and a minimum of six CNOTs.
The Toffoli gate can be constructed from single qubit T- and Hadamard-gates, and a minimum of six CNOTs.

Worked examples

Example 1 — a first encounter with Toffoli gate

Start with the simplest possible case. Write down what Toffoli gate claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In physics, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Toffoli gate before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Toffoli gate ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Toffoli gate

In research
Toffoli gate appears in physics research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Toffoli gate in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Toffoli gate is common in secondary-school and first-year university syllabi. It links to neighbouring topics Italian inventions, Quantum gates, Universal reversible logic gates, so understanding it makes those chapters shorter.
In everyday life
Look for Toffoli gate outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.

Affiliate

Preply — study more efficiently by working with a personal tutor. 50% off.

How to study Toffoli gate in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Toffoli gate means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Toffoli gate out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Toffoli gate in simple terms?

In logic circuits, the Toffoli gate, also known as the CCNOT gate ("controlled-controlled-not"), invented by Tommaso Toffoli in 1980 is a CNOT gate with two control bits and one target bit. That is, the target bit (third bit) will be inverted if and only if the first and second bits are both 1.

Why does Toffoli gate matter?

Because it connects several physics ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Toffoli gate?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Toffoli gate.

Tags

  • Italian inventions
  • Quantum gates
  • Universal reversible logic gates

Keep exploring