Controlled-NOT gate (source code)

= Controlled-NOT gate
{wiki}

= CNOT gate
{c}
{synonym}

The <controlled-NOT gate> is a two-<qubit> <unitary operator> that flips a target <qubit> when its control is in $|1\rangle$. In the ordered labels below, $a$ denotes the control, $b$ the target, and $\oplus$ is addition modulo two.

The <controlled-NOT gate> maps $|a,b\rangle$ to $|a,b\mathbin\oplus a\rangle$.

The basis rule extends linearly to <quantum superpositions>. For example, it sends $|+\rangle|0\rangle$ to $(|00\rangle+|11\rangle)/\sqrt2$, a <Bell state>. The control is not first measured: its <quantum coherence> can become <entanglement> between the two <qubits>. Applying the <controlled-NOT gate> twice returns the original state. <Qiskit quantum gate documentation by IBM>[IBM Quantum, CXGate: controlled-X action and basis-order convention]{ref}