Back to Curriculum
HX
Circuits & Gates

Multi-Qubit Gates & Entangling Circuits

CNOT, CZ, SWAP, Toffoli — how gates create correlations between qubits

By the end of this topic you'll be able to

Explain how the CNOT gate works and use it (with H) to build a Bell state
Distinguish a controlled gate from an entangling gate — and explain why they usually coincide
Describe what the Toffoli (CCX) gate does and why it matters for classical reversible logic

Single-qubit gates can never create entanglement: a gate acting on qubit A alone, tensored with the identity on B, always keeps a product state a product state. Correlating two qubits requires a gate that acts on both of them at once — a controlled-U operator, in Binney and Skinner's terminology, one that changes the state of a data qubit in a way that depends on the state of a control qubit while leaving the control itself unchanged.

X

Binney and Skinner build their first example, addition modulo 2, directly from its matrix: in the computational basis, U₊ sends |x⟩|y⟩ to |x⟩|y+x⟩, incrementing the second qubit by the first. The now-standard name for this same operator is CNOT (or CX): it flips a target qubit if and only if the control qubit is |1⟩.

HX

Apply a Hadamard to qubit A, then CNOT from A to B, starting from |00⟩: the Hadamard gives (|00⟩+|10⟩)/√2, and the CNOT flips B whenever A reads 1, producing (|00⟩+|11⟩)/√2 — the Bell state from the previous track. This two-gate recipe, H followed by CNOT, is the standard way every entangled state in this curriculum ultimately gets built.

Binney and Skinner's second controlled operator is the controlled-phase gate Uφ, which leaves the first three computational basis states untouched and multiplies the fourth, |1⟩|1⟩, by e^{iφ}. The modern name CZ covers the special case φ=π, and because that phase factor is symmetric in the two qubits, CZ doesn't actually care which one you call the 'control.'

Conjugating CNOT by Hadamards on the target qubit, before and after, turns it into CZ — H·CNOT·H = CZ — precisely the same phase-flip-versus-bit-flip duality already seen among single-qubit gates, now showing up one level higher.

SWAP exchanges the states of two qubits entirely, which matters in practice whenever a chip's physical qubits aren't directly connected and information needs to move across it before it can interact locally.

Toffoli (CCX) flips its target only when both controls are |1⟩ — a reversible version of the classical AND gate. Because it's reversible, a circuit built from Toffoli gates can implement universal classical computation without erasing any information along the way, unlike an ordinary AND gate, which cannot be run backwards.

Try It Yourself

Worked Example

Trace CNOT (control=qubit 0, target=qubit 1) applied to the state |10⟩. Then do the same for |01⟩. Confirm both match the CNOT rule |c,t⟩ → |c, t⊕c⟩.

  1. 1For |10⟩: control = 1, target = 0. Since the control is 1, CNOT flips the target: 0⊕1 = 1. So CNOT|10⟩ = |11⟩.
  2. 2For |01⟩: control = 0, target = 1. Since the control is 0, CNOT leaves the target untouched: 1⊕0 = 1. So CNOT|01⟩ = |01⟩ — unchanged.
  3. 3Notice CNOT only ever acts on the target, and only when the control reads 1 — this is exactly why a single-qubit gate applied to just one wire, with identity on the other, can never reproduce what CNOT does: no single-qubit gate can make one qubit's evolution depend on another qubit's value.
Answer

CNOT|10⟩ = |11⟩ (target flips, since control = 1), and CNOT|01⟩ = |01⟩ (target unchanged, since control = 0) — both exactly matching |c,t⟩ → |c, t⊕c⟩.

Reference

CNOT (CX)Flips target iff control is |1⟩
CZPhases the state iff both control and target are |1⟩
SWAPExchanges two qubits' states
Toffoli (CCX)Reversible AND; flips target iff both controls are 1

Quick Check

Starting from |00⟩, what state do you get from H on qubit 0 followed by CNOT (0→1)?

Why can't single-qubit gates alone ever create entanglement?

Ready to move on?