The CNOT Gate
Every gate so far has acted on one qubit at a time — spin it, flip it, rotate its phase. But a
qubit alone can never become entangled with anything; for that you need a gate that lets one qubit
reach across and touch another. The simplest such gate is the
controlled-NOT, or CNOT. It reads a control qubit and, only
if that control is |1\rangle, flips a second target qubit — the
quantum cousin of the classical rule "if this switch is on, toggle that light." It sounds almost
boring. Yet run it on a qubit that is both on and off at once, and out comes the strangest
object in the theory: two qubits with a single, shared identity.
The rule: control decides, target flips
CNOT takes two qubits. We call the first the control and the second the
target. The rule is one sentence:
- if the control is |1\rangle, apply
the X (NOT) gate
to the target — i.e. flip it;
- if the control is |0\rangle, leave the target alone.
Either way the control itself is never changed. Taking the control as the first
(left) qubit, watch what happens to each of the four
basis states:
|00\rangle \to |00\rangle, \qquad |01\rangle \to |01\rangle, \qquad |10\rangle \to |11\rangle, \qquad |11\rangle \to |10\rangle.
The first two are untouched (control 0, nothing happens); the last two have
their second bit flipped (control 1, target toggles). Notice the
output target bit is exactly control XOR target,
c \oplus t — CNOT is the reversible quantum version of the classical XOR.
The circuit symbol
In a circuit diagram each qubit is a horizontal wire, read left to right in time. CNOT is drawn as a
filled dot on the control wire, a ⊕ (a NOT/target circle) on the
target wire, and a vertical line joining them. The control comes out unchanged; the target comes out as
c \oplus t.
As a matrix
Written in the ordered basis |00\rangle, |01\rangle, |10\rangle, |11\rangle,
CNOT is the 4\times 4 permutation matrix
\mathrm{CNOT} = \begin{pmatrix} 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 0 & 1 \\ 0 & 0 & 1 & 0 \end{pmatrix}.
The top-left 2\times 2 block is the identity (control 0:
leave the target), and the bottom-right block is the X gate
\begin{psmallmatrix} 0 & 1 \\ 1 & 0 \end{psmallmatrix} (control
1: flip the target). Because it merely permutes the basis states, it
is unitary, and swapping the same two rows back again shows it is
its own inverse: \mathrm{CNOT}^2 = I. Apply it twice and you
are exactly where you started.
Worked example 1: \mathrm{CNOT}\,|10\rangle
By the rule. The control (first qubit) is 1, so we flip the
target (second qubit) from 0 to 1. The control
stays 1. Result: |10\rangle \to |11\rangle.
By the matrix. In the ordered basis, |10\rangle is the third
basis vector (0,0,1,0)^{\mathsf T}. Multiplying picks out the third column of
CNOT:
\begin{pmatrix} 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 0 & 1 \\ 0 & 0 & 1 & 0 \end{pmatrix}\begin{pmatrix} 0 \\ 0 \\ 1 \\ 0 \end{pmatrix} = \begin{pmatrix} 0 \\ 0 \\ 0 \\ 1 \end{pmatrix} = |11\rangle.
Both routes agree: \mathrm{CNOT}\,|10\rangle = |11\rangle. On any single basis
state CNOT is this dull, entirely classical, look-up. The magic only appears when the control is a
superposition.
Worked example 2: two gates make entanglement
Start with both qubits in |0\rangle, the state
|00\rangle. First apply a
Hadamard
to the control (first) qubit, which sends
|0\rangle \to \tfrac{1}{\sqrt2}(|0\rangle + |1\rangle):
|00\rangle \;\xrightarrow{\;H\text{ on qubit 1}\;}\; \tfrac{1}{\sqrt2}\big(|0\rangle + |1\rangle\big)\otimes|0\rangle = \tfrac{1}{\sqrt2}\big(|00\rangle + |10\rangle\big).
Now the control is genuinely both 0 and
1. Apply CNOT. It acts on each piece of the superposition at once — leaving
|00\rangle alone and turning |10\rangle into
|11\rangle:
\tfrac{1}{\sqrt2}\big(|00\rangle + |10\rangle\big) \;\xrightarrow{\;\mathrm{CNOT}\;}\; \tfrac{1}{\sqrt2}\big(|00\rangle + |11\rangle\big).
That output is the Bell state |\Phi^+\rangle. Try to write it as a product
|\psi\rangle \otimes |\varphi\rangle and you will fail — there is no way to
split it into "the first qubit does this, the second does that." It is
entangled. This
"H then CNOT" circuit is the standard recipe for making a
Bell state.
Step through it below.
Correlate, do not copy
It is tempting to read the Bell result as "CNOT measured the control and copied it onto the
target." It did neither. Nothing was measured — the state is still a clean superposition, not a definite
0 or 1. And nothing was copied — the outcome
\tfrac{1}{\sqrt2}(|00\rangle + |11\rangle) is not two independent
copies of \tfrac{1}{\sqrt2}(|0\rangle + |1\rangle) (that would be
\tfrac{1}{2}(|00\rangle + |01\rangle + |10\rangle + |11\rangle), a product
state). What CNOT actually did was correlate: it wove the two qubits together so their
measurements must agree, without ever pinning either one down.
- CNOT is a two-qubit gate with a control and a
target: if the control is |1\rangle it applies
X (a flip) to the target; if |0\rangle it does
nothing. The control is unchanged;
- on the basis (control = first qubit):
|00\rangle\to|00\rangle, |01\rangle\to|01\rangle,
|10\rangle\to|11\rangle, |11\rangle\to|10\rangle
— the target becomes c\oplus t;
- its matrix is the 4\times 4 permutation
\begin{psmallmatrix}1&0&0&0\\0&1&0&0\\0&0&0&1\\0&0&1&0\end{psmallmatrix};
it is unitary and its own inverse
(\mathrm{CNOT}^2 = I);
- on a superposed control it entangles:
|00\rangle \xrightarrow{H,\ \mathrm{CNOT}} \tfrac{1}{\sqrt2}(|00\rangle + |11\rangle),
a Bell state. It correlates the qubits; it does not measure or clone them.
It is remarkable how little it takes. Entanglement — the resource behind teleportation, superdense
coding, and the speed-ups that make quantum computers interesting — is manufactured by exactly
two elementary gates. A Hadamard splits one qubit into an even blend of
0 and 1; a CNOT then ties a second qubit to that
undecided coin. Neither gate is exotic, and neither on its own does anything spooky. But composed in
this order they turn a plain |00\rangle into a state that Einstein could not
bring himself to accept. Almost every entangling circuit you will ever meet has this same little
H–CNOT motif hiding somewhere inside it.
On the four basis states CNOT looks completely classical — it just copies the control onto the target
when the control is 1 (|10\rangle \to |11\rangle),
exactly like a wire fanning out. That intuition is a trap. Feed it a superposed
control and it does not produce two independent copies; it produces
entanglement. There is no gate that clones an unknown qubit — the
no-cloning theorem forbids it — and CNOT is not a secret exception. The control's superposition survives
untouched only when it is a basis state; a genuine superposition gets braided into the target instead of
duplicated onto it.