Quantum Computing
Intermediate

CNOT Gate

Two-qubit gate that flips the target qubit only when the control qubit is |1⟩.

Formula

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

Variables

CNOTControlled-NOT matrix

Example

CNOT|10⟩ = |11⟩; CNOT|00⟩ = |00⟩

How it works

The CNOT gate is a 4×4 matrix that acts on two qubits by leaving the control qubit unchanged while conditionally flipping the target qubit. In the computational basis, the first two basis states (where the control is 0) are unchanged, and the last two basis states are swapped, which is why the matrix has 1s on the diagonal for |00⟩ and |01⟩, and off-diagonal 1s that exchange |10⟩ and |11⟩. This matrix form comes from writing the rule "if control = 1, apply NOT to the target" as a linear transformation on the basis states, then extending it to all superpositions by linearity.

When to use it

Use CNOT whenever you need to model or build controlled two-qubit behavior, especially in quantum circuit design, entanglement generation, and Bell-state preparation. It is also a standard gate when analyzing how multi-qubit states evolve in the computational basis.

Worked example, step by step

Take the input state |01⟩. Write it as a basis vector: |01⟩ = (0, 1, 0, 0)^T. Apply the CNOT matrix: CNOT |01⟩ = \begin{pmatrix} 1&0&0&0 \\ 0&1&0&0 \\ 0&0&0&1 \\ 0&0&1&0 \end{pmatrix} \begin{pmatrix} 0 \\ 1 \\ 0 \\ 0 \end{pmatrix} = \begin{pmatrix} 0 \\ 1 \\ 0 \\ 0 \end{pmatrix}. So the output is |01⟩, because the control qubit is 0 and the target qubit is not flipped.

Common mistakes to avoid

  • Thinking the target flips whenever the second qubit is 1, instead of when the control qubit is 1
  • Forgetting that CNOT is a linear operator, so it also acts on superpositions by distribution
  • Mixing up the basis order and reading the matrix as if the qubits were ordered differently

Did You Know?

The Hadamard + CNOT combo is the standard recipe for creating entangled Bell states.

Share this formula

Reviewed & maintained by the FormulaWon editorial teamLast reviewed September 2026