• Fundamentals
  • Also: controlled-NOT gate
  • Also: CX gate

CNOT Gate

A two-qubit gate that flips the target qubit if and only if the control qubit is |1⟩, essential for creating entanglement and universal quantum computation.

The Controlled-NOT gate, usually written CNOT or CX, is the most important two-qubit gate in quantum computing. It operates on a pair of qubits: a control and a target. The rule is simple: if the control is 1|1\rangle, apply a Pauli-X (bit flip) to the target. If the control is 0|0\rangle, leave the target alone.

On its own, this sounds like a classical conditional operation. Its quantum significance comes from what happens when the control is in superposition, which is where entanglement is born.

The details

The CNOT acts on the four two-qubit basis states as follows:

0000010110111110|00\rangle \to |00\rangle \quad |01\rangle \to |01\rangle \quad |10\rangle \to |11\rangle \quad |11\rangle \to |10\rangle

The matrix representation in the {00,01,10,11}\{|00\rangle, |01\rangle, |10\rangle, |11\rangle\} basis is:

CNOT=(1000010000010010)\text{CNOT} = \begin{pmatrix} 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 0 & 1 \\ 0 & 0 & 1 & 0 \end{pmatrix}

The circuit notation places a filled dot on the control qubit wire and an \oplus (XOR symbol) on the target:

control ──●──

target  ──⊕──

To generate the Φ+|\Phi^+\rangle Bell state from 00|00\rangle:

|0⟩ ──[H]──●──    →    (|00⟩ + |11⟩) / √2

|0⟩ ────[⊕]──

The Hadamard puts the control into (0+1)/2(|0\rangle + |1\rangle)/\sqrt{2}. The CNOT then creates:

12(00+11)=00+112\frac{1}{\sqrt{2}}(|0\rangle|0\rangle + |1\rangle|1\rangle) = \frac{|00\rangle + |11\rangle}{\sqrt{2}}

This state cannot be written as a product of two independent qubit states. It is entangled.

In Qiskit:

from qiskit import QuantumCircuit

qc = QuantumCircuit(2)
qc.h(0)      # Hadamard on qubit 0
qc.cx(0, 1)  # CNOT: control=0, target=1
print(qc.draw())

The CNOT is its own inverse: applying it twice returns to the starting state.

Why it matters for learners

The CNOT is the workhorse of quantum entanglement. Every Bell state preparation, every teleportation circuit, every quantum error correction syndrome extraction uses CNOT or its relatives. Combined with single-qubit gates from the set {H,T}\{H, T\}, CNOT forms a universal gate set: any quantum computation can be approximated to arbitrary precision using only these gates.

Two-qubit gates like CNOT are also the primary source of error on real hardware. Vendors like IBM and Google report two-qubit gate error rates separately from single-qubit rates, because two-qubit gates are physically harder to execute at high fidelity. Circuit optimization is largely about minimizing CNOT count while preserving algorithmic correctness.

Common misconceptions

Misconception 1: CNOT is just a classical XOR gate. It is classically equivalent to XOR on the computational basis states, but quantum mechanically it is far richer. Acting on superposition inputs, CNOT creates entanglement. Classical XOR has no equivalent to this.

Misconception 2: CNOT always creates entanglement. CNOT only creates entanglement if the control qubit is in superposition when the gate is applied. Applying CNOT to 10|10\rangle gives 11|11\rangle, a product state with no entanglement.

Misconception 3: You can always apply CNOT between any two qubits. On most hardware, qubits have fixed connectivity. IBM and Google chips only allow CNOT between physically adjacent qubit pairs. Applying a logical CNOT between distant qubits requires SWAP gates to move the qubits next to each other, increasing circuit depth and error.

See also