CX CNOT Gate (Controlled-X)
CNOT Gate (Controlled-X)
CNOT flips the target qubit when the control is |1⟩; with a Hadamard it creates Bell states and, with single-qubit gates, is universal.
The unitary matrix
Computed by the same engine that runs the circuits. Multi-qubit gates are shown in textbook order (control qubit first).
Its effect on the basis states
| Input | Output |
|---|---|
| $|0\rangle_c|0\rangle_t$ | $|0\rangle_c|0\rangle_t$ |
| $|0\rangle_c|1\rangle_t$ | $|0\rangle_c|1\rangle_t$ |
| $|1\rangle_c|0\rangle_t$ | $|1\rangle_c|1\rangle_t$ |
| $|1\rangle_c|1\rangle_t$ | $|1\rangle_c|0\rangle_t$ |
| $|+\rangle_c|0\rangle_t$ | $\tfrac{1}{\sqrt2}(|00\rangle+|11\rangle)$ |
Useful identities
- $CX^2=I$
- $(H\otimes H)\,CX_{0\to1}\,(H\otimes H)=CX_{1\to0}$
- $CX=(I\otimes H)\,CZ\,(I\otimes H)$
The Controlled-NOT gate, or CX, acts on two qubits: a Control and a Target. On the basis states: $|c,t\rangle\mapsto|c,\,t\oplus c\rangle$; if the control is $|0\rangle$ nothing changes, and if it is $|1\rangle$, $X$ is applied to the target. In Qiskit and in this lab it is written cx(control, target), and the Little-endian ordering means that cx(0,1) turns $|q_1q_0\rangle=|01\rangle$ into $|11\rangle$.
Its real power shows with superposition: $CX\,(|+\rangle\otimes|0\rangle)=\frac{1}{\sqrt2}(|00\rangle+|11\rangle)$, the entangled Bell state $|\Phi^+\rangle$, which cannot be written as a tensor productTensor Product: The tensor product ⊗ combines the spaces of subsystems into the space of the whole system, multiplying dimensions, and builds multi-qubit states and gates. of two separate states. That is why CNOT is regarded as the standard entangling gate.
Properties: $CX^2=I$; applying $H$ to both qubits before and after it swaps the roles of control and target: $(H\otimes H)\,CX_{0\to1}\,(H\otimes H)=CX_{1\to0}$. It also shows Phase KickbackPhase Kickback: Phase kickback is a phenomenon in which an eigenvalue phase moves from the target qubit to the control qubit of a controlled gate; it is a key mechanism in Deutsch–Jozsa…: if the target is in $|-\rangle$, the phase $-1$ passes to the control, which is the basis of the oracles in Deutsch–Jozsa and Bernstein–Vazirani.
Universality: single-qubit gates together with CNOT form a universal set for all quantum gates (Barenco et al., 1995). On hardware, two-qubit gates are much slower and more error-prone than single-qubit ones, so the CNOT count is a basic measure of a circuit's cost.
Example
Prepare a Bell state with h(0) then cx(0,1) from $|q_1q_0\rangle=|00\rangle$:
$$|00\rangle\xrightarrow{H_0}\tfrac{1}{\sqrt2}(|00\rangle+|01\rangle)\xrightarrow{CX_{0\to1}}\tfrac{1}{\sqrt2}(|00\rangle+|11\rangle).$$
In the term $|01\rangle$ (i.e. $q_0=1$), $q_1$ was flipped, giving $|11\rangle$. The measurement gives only 00 or 11, each with probability $\tfrac12$, and the two outcomes are perfectly correlated.
Live simulation
In code
qc.cx(0, 1)cx q[0],q[1];Related topics
References
- Michael A. Nielsen; Isaac L. Chuang (2010). Quantum Computation and Quantum Information (10th Anniversary Edition). Cambridge University Press doi:10.1017/CBO9780511976667The standard reference for quantum computing; the Crossref record gives 2012 for the Cambridge Core online edition.
- A. Barenco; C. H. Bennett; R. Cleve; D. P. DiVincenzo; N. Margolus; P. Shor; T. Sleator; J. A. Smolin; H. Weinfurter (1995). Elementary gates for quantum computation. Phys. Rev. A 52(5):3457–3467 doi:10.1103/PhysRevA.52.3457
- IBM Quantum (2025). Qiskit SDK API documentation. IBM Quantum Documentation quantum.cloud.ibm.com
