🏠 Home 📘 Track 1: Quantum Basics L20 — The Hadamard Gate L21 — The CNOT Gate L22 — Your First Circuit
L21 §4 · Build Something Real ~16 min

The CNOT Gate —
The Entanglement Maker

CNOT flips the target qubit only when the control qubit is $|1\rangle$. On definite inputs, the rule is completely classical. But when the control is in superposition, that simple conditional flip creates something neither qubit had before — entanglement.

✦ One Idea CNOT flips the target qubit if and only if the control is $|1\rangle$. When the control is in superposition, that conditional flip creates entanglement — a joint quantum state that cannot be described as two independent qubits. This is how Bell pairs are born.
CNOT gate controlled-NOT two-qubit gate entanglement Bell pair quantum XOR reversible gate
Section 01
① Hook

You Already Know CNOT — You Just Don't Know You Know It

🔗
Think before you read — what does CNOT actually do?
You have seen the Bell pair circuit. Now reason about what the CNOT step does.

The Bell pair circuit is: Hadamard on qubit 1, then CNOT with qubit 1 as control and qubit 2 as target. After H, qubit 1 is in state $(|0\rangle + |1\rangle)/\sqrt{2}$. Qubit 2 is still $|0\rangle$. When CNOT runs, what happens to the $|1\rangle$ branch of qubit 1's superposition?

In L13 you built a Bell pair — the most fundamental entangled state in quantum computing — using two gates: a Hadamard, then a CNOT. The Hadamard put the control qubit into superposition. The CNOT did something to the target qubit based on what the control was doing. And suddenly the two qubits were entangled. Measuring one instantly determined the other.

At the time, we called CNOT "the entanglement maker" and moved on. Now we go deeper. What exactly is the rule it follows? Why does applying a simple conditional flip to a superposed qubit produce something no classical gate ever can?

This lesson is the complete answer to those questions.

📐
Why CNOT is the most important two-qubit gate
Every quantum algorithm that achieves a speedup over classical computing requires entanglement between qubits. And the standard way to create that entanglement — in superconducting qubits, trapped ions, photonic chips, every platform — is the CNOT gate. Together with single-qubit gates like H, CNOT forms a universal gate set: any quantum computation can be built from these two types of gate alone. It is the workhorse of quantum computing.
Section 02
② Intuition

The Light Switch Analogy

Before any mathematics, here is the classical picture of what CNOT does.

💡 A Controlled Light Switch
Imagine two light switches. The first switch — call it the control — is a master switch. The second switch — the target — controls the lamp.

The rule is simple: if the master switch is ON, pressing the target switch flips it. If the master switch is OFF, pressing the target switch does absolutely nothing — the lamp stays exactly as it was.

That is the CNOT gate. Control is the master switch. Target is the lamp switch. The rule: "if control is $|1\rangle$, flip the target. If control is $|0\rangle$, do nothing to the target."

Now here is where the analogy breaks with something extraordinary. What if the master switch is not ON or OFF — but genuinely both at once? Superposition.

Then the lamp ends up in superposition too — but not just any superposition. It becomes entangled with the control. The two switches now share one quantum fate. That is what no classical switch can ever do.

The classical version of CNOT is completely ordinary — it is exactly the XOR gate you may have studied in a computer science class. CNOT XORs the target with the control. What makes CNOT quantum is not the rule itself. The rule is simple. What makes it quantum is that qubits can be in superposition — and when you apply a conditional rule to a superposed qubit, something fundamentally new emerges.

💡
CNOT is quantum XOR
In classical computing, XOR takes two bits A and B and outputs A⊕B — 0 when A and B are the same, 1 when they differ. CNOT does exactly the same to the target: Target → Target ⊕ Control. The control is passed through unchanged. In classical bits, this is entirely ordinary. In quantum bits with superposition, it generates entanglement.
Section 03
③ Framework

The Truth Table — All Four Cases

For definite input states, CNOT behaves entirely classically. There are four possible inputs — $|00\rangle$, $|01\rangle$, $|10\rangle$, $|11\rangle$ — and the output is completely predictable in every case.

Control inTarget inControl outTarget outWhat happened
$|0\rangle$$|0\rangle$ $|0\rangle$$|0\rangle$ Control is 0 — target unchanged
$|0\rangle$$|1\rangle$ $|0\rangle$$|1\rangle$ Control is 0 — target unchanged
$|1\rangle$$|0\rangle$ $|1\rangle$$|1\rangle$ ↑ Control is 1 — target flipped 0→1
$|1\rangle$$|1\rangle$ $|1\rangle$$|0\rangle$ ↑ Control is 1 — target flipped 1→0

Two things to notice immediately. First: the control qubit is never changed by the CNOT. Only the target changes. The control passes through exactly as it arrived. Second: this is reversible. Look at the last two rows — apply CNOT again to either result and you're back to where you started. CNOT is its own inverse. Apply it twice and you get the identity.

Key Pattern
Compact rule: CNOT $|c,t\rangle = |c,\; t \oplus c\rangle$, where $c$ is the control bit, $t$ is the target bit, and $\oplus$ is XOR (addition modulo 2). The control passes through unchanged; the target XORs with the control.
Section 04
③ Framework

What CNOT Looks Like in a Circuit

In a quantum circuit diagram, CNOT has a distinctive and unmistakable visual. Once you see it, you will never mistake it for anything else.

CNOT gate symbol — standard quantum circuit notation
Control (Q1) Target (Q2) |ψ₁⟩ |ψ₂⟩ ● control ⊕ target time →

The filled dot (●) on the top wire marks the control qubit. The circled plus symbol (⊕) on the bottom wire marks the target qubit. The vertical line shows these two qubits are involved in the same gate. You read it as: "if the ● wire is $|1\rangle$, apply an X gate (flip) to the ⊕ wire."

⚠️
The dot is always the control — even when it is on the bottom wire
In some circuits, the control qubit is on a lower wire than the target. The dot is still the control and the ⊕ is still the target, regardless of which wire is physically higher in the diagram. Always read the symbol, not the wire position.
Section 05
④ Theory

A Superposed Control — The Moment Everything Changes

Every row in the truth table above had a definite control qubit — either $|0\rangle$ or $|1\rangle$. The outputs were boring and predictable. Now put the control qubit in superposition.

Suppose the control is $\frac{1}{\sqrt{2}}(|0\rangle + |1\rangle)$ — exactly the state you get from a Hadamard on $|0\rangle$ — and the target starts in $|0\rangle$. The joint starting state of the two-qubit system is:

$$\frac{1}{\sqrt{2}}(|0\rangle + |1\rangle) \otimes |0\rangle = \frac{1}{\sqrt{2}}(|00\rangle + |10\rangle)$$

Now apply CNOT. Because quantum gates are linear, CNOT acts on each term in the superposition separately. This is the key mathematical fact. It is not a special property of CNOT — all quantum gates are linear. But the consequences here are extraordinary:

$$\text{CNOT}\,\frac{1}{\sqrt{2}}(|00\rangle + |10\rangle) = \frac{1}{\sqrt{2}}\bigl(\text{CNOT}|00\rangle + \text{CNOT}|10\rangle\bigr)$$ $$= \frac{1}{\sqrt{2}}\bigl(|00\rangle + |11\rangle\bigr) = |\Phi^+\rangle$$

The $|00\rangle$ term had control 0, so the target was left alone — stays $|00\rangle$. The $|10\rangle$ term had control 1, so the target was flipped from $|0\rangle$ to $|1\rangle$ — becomes $|11\rangle$. The result is the Bell state $|\Phi^+\rangle = \frac{1}{\sqrt{2}}(|00\rangle + |11\rangle)$.

This state cannot be written as a product of two independent qubit states. No matter how you try to factor it, you cannot. The qubits are entangled — they share one quantum fate.

Key Insight
Entanglement is not a special property CNOT has by magic. It emerges from applying a conditional operation to a qubit in superposition. The conditionality links the two qubits' outcomes — and that linking is entanglement. CNOT alone cannot create it. Superposition must exist first.
🚫
CNOT alone does not create entanglement
If you apply CNOT to two definite states — say $|10\rangle$ — you get $|11\rangle$. That is entirely classical. No entanglement. CNOT only creates entanglement when the control (or target) is already in superposition. The Hadamard creates the superposition. The CNOT spreads it across two qubits. Together, they create what neither can produce alone.
Section 06
⑤ Interactive

CNOT Explorer

Choose the state of the control and target qubits, then apply CNOT. Try all four classical inputs first — the outputs will be completely predictable. Then set the control to $|{+}\rangle$ (superposition) and watch what the output becomes. That is the moment entanglement appears.

🔗 CNOT Gate Explorer
Set inputs · apply CNOT · observe the output state
INTERACTIVE
Control qubit (Q1)
Target qubit (Q2)
Output after CNOT
Q1 (control)
?
Q2 (target)
?
Press Apply CNOT to compute the output.
Select input states above, then press Apply CNOT to see what the gate does. The key moment: set control to |+⟩.

The key moment to find: set control to |+⟩ and target to |0⟩, then apply CNOT. The output cannot be written as two separate qubit states — it is the entangled Bell state. Both qubits now share one quantum fate.

Section 07
∑ Mathematics

The Mathematics — Every Step Shown

CNOT is a 4×4 matrix, because it acts on a two-qubit system whose state lives in a four-dimensional space — spanned by $|00\rangle$, $|01\rangle$, $|10\rangle$, $|11\rangle$.

CNOT matrix — basis {|00⟩, |01⟩, |10⟩, |11⟩}
$$\text{CNOT} = \begin{pmatrix} 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 0 & 1 \\ 0 & 0 & 1 & 0 \end{pmatrix}$$
Read row by row. The first two rows leave $|00\rangle$ and $|01\rangle$ unchanged — control is 0 in both, so do nothing to target. The last two rows swap $|10\rangle \leftrightarrow |11\rangle$ — control is 1, so flip the target. The matrix is its own inverse: CNOT × CNOT = Identity. Source: Nielsen & Chuang §4.2.
CNOT action on each basis state
$$\text{CNOT}|00\rangle = |00\rangle \qquad \text{CNOT}|01\rangle = |01\rangle$$ $$\text{CNOT}|10\rangle = |11\rangle \qquad \text{CNOT}|11\rangle = |10\rangle$$
Compact rule: $\text{CNOT}|c,t\rangle = |c,\; t \oplus c\rangle$, where $c$ is the control bit, $t$ is the target bit, and $\oplus$ is addition modulo 2 (XOR). Control is always passed through unchanged. Target becomes $t \oplus c$.

The Bell state derivation — complete step by step

Bell pair from |00⟩ — every step shown
$$|\psi_0\rangle = |00\rangle \quad \text{(both qubits start at }|0\rangle\text{)}$$ $$|\psi_1\rangle = (H \otimes I)|00\rangle = \frac{1}{\sqrt{2}}(|0\rangle + |1\rangle) \otimes |0\rangle = \frac{1}{\sqrt{2}}(|00\rangle + |10\rangle)$$ $$|\psi_2\rangle = \text{CNOT}\,|\psi_1\rangle = \frac{1}{\sqrt{2}}\bigl(\text{CNOT}|00\rangle + \text{CNOT}|10\rangle\bigr) = \frac{1}{\sqrt{2}}\bigl(|00\rangle + |11\rangle\bigr) = |\Phi^+\rangle$$
Step 1: Hadamard on qubit 1, identity (do nothing) on qubit 2. The symbol $\otimes$ is the tensor product — the mathematical way of describing two independent systems together. Step 2: CNOT acts linearly — it hits each term in the superposition separately. $|00\rangle$ has control 0, target unchanged, stays $|00\rangle$. $|10\rangle$ has control 1, target flipped from 0 to 1, becomes $|11\rangle$. The result is the Bell state $|\Phi^+\rangle$ — which cannot be written as a product of two independent qubit states. The qubits are entangled. Source: Nielsen & Chuang §1.3.6.
Section 08
④ Theory

Why CNOT Is Reversible — And Why That Matters

Every quantum gate — except measurement — must be reversible. This is not a design choice. It is a physical necessity. Quantum mechanics is time-reversible: any valid quantum evolution can be run backwards. This means quantum gates must be reversible operations on quantum states.

CNOT achieves reversibility elegantly: it is its own inverse. Apply CNOT twice and you get the identity — the gate that does nothing. To undo a CNOT, you just apply another CNOT. The gate reverses itself.

Why? Because flipping a bit twice returns it to its original state. If control is $|1\rangle$, you flip the target twice — it comes back. If control is $|0\rangle$, the target was never changed, so two applications still give you the original. Either way: CNOT² = Identity.

🔄 The reversibility picture
XOR is its own inverse. Take any bit and XOR it with 1 twice — you get the original bit back. XOR it with 0 twice — unchanged. CNOT is quantum XOR, so CNOT is quantum-XOR-twice = identity. The self-inverse property is inherited directly from the mathematics of XOR.

This is completely unlike classical gates like AND and OR, which are irreversible — multiple inputs map to the same output, so you cannot infer the input from the output. CNOT never loses information. Every output maps back to exactly one input.
🔮
CNOT in the real world
In superconducting quantum computers (IBM, Google), a CNOT is achieved through a carefully timed microwave pulse that couples two physical qubits through a shared resonator — calibrated to nanosecond precision. In trapped-ion computers (IonQ, Quantinuum), it is implemented via a Mølmer-Sørensen gate: a laser interaction that exploits the shared motional modes of the ion chain. Different physics, same logical operation. In both cases, the CNOT is the most challenging and error-prone operation to perform — which is why reducing the CNOT count in a circuit is one of the main goals of quantum circuit optimisation.
Lesson Summary

What You Now Know About the CNOT Gate

  • 🔗
    CNOT flips the target qubit if and only if the control is $|1\rangle$
    Control $|0\rangle$ → target unchanged. Control $|1\rangle$ → target flipped. The control itself is never changed by the gate — it always passes through intact. On definite inputs, this is completely classical: quantum XOR.
  • 🌀
    On a superposed control, CNOT creates entanglement
    When the control is $(|0\rangle + |1\rangle)/\sqrt{2}$, CNOT produces $(|00\rangle + |11\rangle)/\sqrt{2}$ — the Bell state. This state cannot be written as two independent qubit states. The qubits are entangled: measuring one instantly determines the other. The simple conditional rule, applied to superposition, produces something qualitatively new.
  • 📐
    Circuit symbol: filled dot (●) on control wire, circled plus (⊕) on target wire
    This notation is universal across every quantum computing platform, textbook, and research paper. The dot is always the control, the ⊕ is always the target — regardless of which wire is on top. A vertical line connects them.
  • 🔄
    CNOT is its own inverse — CNOT² = Identity
    Apply CNOT twice and you get back to where you started. Reversibility is a physical requirement for all quantum gates, and CNOT satisfies it because XOR is self-inverse. Unlike classical AND or OR, CNOT never destroys information.
  • ⚛️
    CNOT + single-qubit gates form a universal gate set
    Any quantum computation can be decomposed into CNOT gates and single-qubit rotations (like H, X, Z, T). This is proved in Barenco et al. (1995). Every quantum algorithm you will encounter in this course — Bell pairs, Grover's search, quantum teleportation — is built from exactly these primitives.
Quick Check
How clearly does the CNOT gate click for you?

You understand H and CNOT separately.
Now combine them — one circuit, two gates —
and build the simplest entangled state in the universe.
The Bell pair. Your first real quantum circuit.

→ Your First Circuit — L22
Sources & Further Reading
← Previous
The Hadamard Gate
L20 — The superposition maker