QuantumSimulator
Interactive Course
Interactive chapters from intuition to mastery
Structured Lessons
Eight modules with formulas and self-checks
Quantum Brain
Navigate lessons, laws, gates, devices, and tools
Guided Experiments
Hands-on circuits that teach one idea each
Circuit Lab
Build circuits, run them, and see the results
Gate Reference
Quick reference for all quantum gates
Cryostat Studio
3D cryostat design and simulation
Component Catalog
Browse all cryostat components
System Checks
Check your design for errors
Menu
physics
Interactive Course
Interactive chapters from intuition to mastery
Structured Lessons
Eight modules with formulas and self-checks
Quantum Brain
Navigate lessons, laws, gates, devices, and tools
Guided Experiments
Hands-on circuits that teach one idea each
simulator
Circuit Lab
Build circuits, run them, and see the results
Gate Reference
Quick reference for all quantum gates
wiringStudio
Cryostat Studio
3D cryostat design and simulation
Component Catalog
Browse all cryostat components
System Checks
Check your design for errors
Home/Quantum Physics/Lessons/CNOT Gate (Controlled-X)
CX

CNOT Gate (Controlled-X)

Entanglement2-qubitentangle

Flips the target qubit if and only if the control qubit is ∣1⟩.

Intuition

CNOT connects two qubits: a control and a target. If the control is ∣1⟩, the target gets flipped (an X gate is applied). If the control is ∣0⟩, the target is left alone. This rule sounds classical, and on definite states it behaves classically. The quantum behavior emerges when the control is in superposition. Then CNOT does not pick one branch. Instead, it creates entanglement: a joint state of two qubits that cannot be described by specifying each qubit separately. Entanglement is the core resource that distinguishes quantum computing from classical computing.

Matrix representation
​1000​0100​0001​0010​​
Action on states
∣0x⟩→∣0x⟩,∣1x⟩→∣1xˉ⟩
Circuit
Open in simulator →
q0q1HCX
▶ Try it in the simulator
Full technical statement

CNOT is a two-qubit unitary (probability-preserving) operator. It applies X to the target qubit conditioned on the control qubit being ∣1⟩. In the computational basis, the four input-output mappings are: ∣00⟩ stays ∣00⟩,∣01⟩ stays ∣01⟩,∣10⟩ becomes ∣11⟩, and ∣11⟩ becomes ∣10⟩. The target bit is flipped exactly when the control bit is 1. When the control is in superposition, CNOT creates entanglement. For example, applying H to qubit 0 and then CNOT maps ∣00⟩ to the Bell state ∣Φ+⟩=(∣00⟩+∣11⟩)/2​. A Bell state is a maximally entangled two-qubit state. CNOT is universal for quantum computation when combined with single-qubit gates, meaning any quantum circuit can be built from CNOT plus single-qubit rotations.

What changes in measurements

The joint probability distribution over both qubits changes. Correlations appear between the measurement outcomes of the two qubits.

What stays hidden until later

When the control is in superposition, entanglement is created. Each qubit alone looks random, but their outcomes are perfectly correlated.

Bloch sphere

Conditionally rotates the target qubit on the Bloch sphere. When the control is in superposition, both qubits move inside the Bloch sphere, indicating they are entangled and individually in a mixed state.

Truth table
|00⟩→|00⟩
|01⟩→|01⟩
|10⟩→|11⟩
|11⟩→|10⟩
Step-by-step example

Creating a Bell state

  1. 1Start with ∣00⟩. Both qubits are in the ∣0⟩ state.
  2. 2Apply H to qubit 0. The state becomes (∣0⟩+∣1⟩)/2​⊗∣0⟩=(∣00⟩+∣10⟩)/2​.
  3. 3Apply CNOT with qubit 0 as control and qubit 1 as target.
  4. 4The ∣00⟩ branch: control is 0, so the target stays. Still ∣00⟩.
  5. 5The ∣10⟩ branch: control is 1, so the target flips. Becomes ∣11⟩.
  6. 6Final state: (∣00⟩+∣11⟩)/2​. This is the Bell state ∣Φ+⟩. Measuring always gives 00 or 11, never 01 or 10.
Where this gate appears
  • Creating Bell pairs and GHZ states, the standard entangled states
  • Quantum teleportation circuits
  • Syndrome extraction in quantum error correction
  • Oracle implementations in Deutsch’s algorithm and Grover’s search
  • Universal gate set: CNOT plus single-qubit gates can build any quantum circuit
Connected gates
  • CNOT = controlled-X. Replacing X with Z gives the CZ gate instead
  • (H⊗H) CNOT (H⊗H) = reversed CNOT, where control and target swap roles, because Hadamard interchanges bit-flip and phase-flip
  • Three CNOTs in sequence can build a SWAP gate
  • CNOT is its own inverse: applying it twice returns both qubits to their original state
Tempting but wrong

It is tempting to think CNOT works like a classical if-then: "if control is 1, flip target." That sounds right because it matches the truth table. What actually happens when the control is in superposition is that CNOT does not choose one branch. It processes both branches simultaneously and entangles the two qubits, creating correlations that have no classical analog.

Why this gate matters for what comes next

CNOT is the bridge between single-qubit operations and the full power of quantum computing. Without entanglement, qubits would be independent, and a quantum computer would be no more powerful than parallel coin flips. CNOT is what makes multi-qubit quantum computation non-trivial.

Test your understanding

You apply H to qubit 0 then CNOT(0,1) to |00⟩. What state results?

▶ Try it in the simulatorQuick reference →↗ Nielsen and Chuang, Quantum Computation and Quantum Information↗ MIT OCW 8.06: entanglement notes
←
Previous
Hadamard
Next
Toffoli
→
← Back to all lessons