= CNOT gate
{c}
{wiki=Controlled_NOT_gate}
= Controlled NOT gate
{synonym}
{title2}
The <CNOT gate> is a <controlled quantum gate> that operates on two <qubits>, flipping the second (operand) <qubit> if the first (control) <qubit> is set.
This gate is the first example of a <controlled quantum gate> that you should study.
$$
\begin{bmatrix}
1 & 0 & 0 & 0 \\
0 & 1 & 0 & 0 \\
0 & 0 & 0 & 1 \\
0 & 0 & 1 & 0
\end{bmatrix}
$$
{title=<CNOT gate> <matrix>}
\Image[https://upload.wikimedia.org/wikipedia/commons/4/4e/CNOT_gate.svg]
{title=<CNOT gate> symbol}
{description=The symbol follow the generic symbol convention for <controlled quantum gates> shown at <image Generic controlled quantum gate symbol>, but replacing the generic "U" with the <image Quantum NOT gate symbol>.}
To understand why the gate is called a CNOT gate, you should think as follows.
First let's produce a generic <quantum state> vector where the control qubit is certain to be 0.
On the standard basis:
$$
\ket{00} \\
\ket{01} \\
\ket{10} \\
\ket{11} \\
$$
we see that this means that only $\ket{00}$ and $\ket{01}$ should be possible. Therefore, the state must be of the form:
$$
\begin{bmatrix}
x \\
y \\
0 \\
0
\end{bmatrix}
$$
where $x$ and $y$ are two <complex numbers> such that $|x| + |y| = 1.0$
If we operate the <CNOT gate> on that state, we obtain:
$$
\begin{bmatrix}
1 & 0 & 0 & 0 \\
0 & 1 & 0 & 0 \\
0 & 0 & 0 & 1 \\
0 & 0 & 1 & 0
\end{bmatrix}
\times
\begin{bmatrix}
x \\
y \\
0 \\
0
\end{bmatrix}
=
\begin{bmatrix}
x \\
y \\
0 \\
0
\end{bmatrix}
$$
and so the input is unchanged as desired, because the control qubit is 0.
If however we take only states where the control qubit is for sure 1:
$$
\begin{bmatrix}
1 & 0 & 0 & 0 \\
0 & 1 & 0 & 0 \\
0 & 0 & 0 & 1 \\
0 & 0 & 1 & 0
\end{bmatrix}
\times
\begin{bmatrix}
0 \\
0 \\
x \\
y
\end{bmatrix}
=
\begin{bmatrix}
0 \\
0 \\
y \\
x
\end{bmatrix}
$$
Therefore, in that case, what happened is that the probabilities of $\ket{10}$ and $\ket{11}$ were swapped from $x$ and $y$ to $y$ and $x$ respectively, which is exactly what the <quantum NOT gate> does.
So from this we understand more concretelly what "the gate only operates if the first <qubit> is set to one" means.
Now go and study the <Bell state> and understand intuitively how this gate is used to produce it.
Back to article page