Lesson 7 20 min read

The CNOT Gate

Master the controlled-NOT gate—the fundamental two-qubit operation that enables entanglement and quantum power.

About This Lesson

  • Understand what controlled operations are
  • Learn the CNOT truth table and behavior
  • Explore CNOT with superposition states
  • Build circuits combining CNOT with H gates

Prerequisites: Lessons 1-6. Understanding of multiple qubits and quantum gates.

What is a Controlled Operation?

The CNOT (Controlled-NOT) is our first two-qubit gate. It flips the target qubit if and only if the control qubit is |1⟩.

Key Concept: CNOT Structure

Control qubit (●): The decision-maker. If |1⟩, action happens.
Target qubit (⊕): Gets flipped (X gate) if control is |1⟩.

CNOT|00⟩ = |00⟩ | CNOT|01⟩ = |01⟩ | CNOT|10⟩ = |11⟩ | CNOT|11⟩ = |10⟩

The CNOT Truth Table

Interactive: CNOT Truth Table Explorer

Try CNOT on different input states: |00⟩, |01⟩, |10⟩, |11⟩. Build the circuit and observe the results!

Result probabilities

CNOT with Superposition

When the control qubit is in superposition, CNOT creates entanglement! H + CNOT gives us the Bell state: (1/√2)(|00⟩ + |11⟩)

Interactive: H + CNOT Circuit (Bell State)

Live Probability Results:
Try modifying the circuit above! Drag gates and see real-time changes.

🔬 For Advanced Learners: CNOT Matrix and Universal Gate Sets

CNOT Matrix Representation

The CNOT gate acts on two qubits, so it's a 4×4 matrix:

CNOT = [1 0 0 0]
[0 1 0 0]
[0 0 0 1]
[0 0 1 0]

This matrix shows that:

  • |00⟩ → |00⟩ (control=0, target unchanged)
  • |01⟩ → |01⟩ (control=0, target unchanged)
  • |10⟩ → |11⟩ (control=1, target flipped)
  • |11⟩ → |10⟩ (control=1, target flipped)

Universal Gate Sets

A set of gates is universal if you can approximate any quantum operation using just those gates. The most famous universal sets are:

  • H + CNOT + T: The Clifford+T gate set (industry standard)
  • H + CNOT + Phase gates: Common in quantum algorithms
  • CNOT + Single-qubit rotations: Most general form

Why CNOT is Special

CNOT is the simplest entangling gate—it can create entanglement when combined with single-qubit gates like H. This makes it essential for:

  • Universal quantum computing: Any quantum circuit can be built with CNOT + single-qubit gates
  • Error correction: Quantum error correction codes rely heavily on CNOT gates
  • Quantum algorithms: Most algorithms use CNOT as a building block

Fun fact: Any quantum algorithm, no matter how complex, can be decomposed into a sequence of single-qubit rotations and CNOT gates. This is called the "universal gate set theorem" and it's why CNOT is so fundamental!

Building Circuits with CNOT

Interactive: CNOT Circuit Builder

Experiment with different gate combinations: CNOT, H+CNOT, X+CNOT, or H on both qubits+CNOT!

Result probabilities

Interactive Circuit Playground

Build and experiment with your own quantum circuits using the interactive Q.js circuit builder below. Drag gates from the palette onto the circuit board and see the results update in real-time!

Q.js Circuit Builder

Result probabilities

✓ Learning Checkpoint

Before moving on, can you:

  • Explain how the CNOT gate works?
  • Predict the output for |10⟩ after CNOT?
  • Understand how H + CNOT creates entanglement?

Ready for entanglement? Check all boxes first!

Common Misconception

❌ Wrong: "CNOT just copies the control qubit to the target"

✓ Correct: CNOT flips the target if control=|1⟩. It doesn't copy! CNOT(|10⟩) = |11⟩, not |11⟩ by copying, but by flipping 0→1.

📋 Quick Reference Card

CNOT Gate Cheat Sheet

CNOT Truth Table

Control Target (Before) Target (After)
|0⟩ |0⟩ |0⟩ (no change)
|0⟩ |1⟩ |1⟩ (no change)
|1⟩ |0⟩ |1⟩ (flipped)
|1⟩ |1⟩ |0⟩ (flipped)

Key Properties

  • Controlled operation: Target flips only if control is |1⟩
  • Self-inverse: CNOT·CNOT = I
  • Creates entanglement: H + CNOT = Bell states

💡 Key Insight: CNOT is the gateway to entanglement! Combine H + CNOT to create correlated qubits that are inseparable.

Glossary

CNOT Gate
Pronunciation: C-NOT or see-not
Definition: Controlled-NOT gate—a two-qubit gate that flips the target only if control is |1⟩
Control Qubit
Definition: The qubit that controls whether the operation happens (usually marked with a dot •)
Target Qubit
Definition: The qubit that gets flipped (if control is |1⟩), marked with ⊕
Controlled Operation
Definition: A quantum operation that only executes if a control qubit is in a specific state
Two-Qubit Gate
Definition: A gate that operates on two qubits simultaneously, can create entanglement
Universal Gate Set
Definition: A set of gates that can create any quantum circuit (e.g., H + CNOT + T gates)
Circuit Depth
Definition: The number of sequential gate layers in a quantum circuit

Test Your Understanding

Q1: What does CNOT do to |10⟩?

Q2: Which qubit is never changed by CNOT?

Q3: What does H + CNOT create from |00⟩?