controlled NOT (CNOT) qubit matrix ion bit
The mathematics of single qubit gates can be extended to operate on multi-qubit quantum memories in two important ways. One way is simply to select a qubit and apply that gate to the target qubit while leaving the remainder of the memory unaffected. Another way is to apply the gate to its target only if another part of the memory is in a desired state. These two choices can be illustrated using another example. The possible states of a two-qubit quantum memory are





|

00
⟩
:=


(



1




0




0




0



)


;


|

01
⟩
:=


(



0




1




0




0



)


;


|

10
⟩
:=


(



0




0




1




0



)


;


|

11
⟩
:=


(



0




0




0




1



)


.


{\displaystyle |00\rangle :={\begin{pmatrix}1\\0\\0\\0\end{pmatrix}};\quad |01\rangle :={\begin{pmatrix}0\\1\\0\\0\end{pmatrix}};\quad |10\rangle :={\begin{pmatrix}0\\0\\1\\0\end{pmatrix}};\quad |11\rangle :={\begin{pmatrix}0\\0\\0\\1\end{pmatrix}}.}


The controlled NOT (CNOT) gate can then be represented using the following matrix:




CNOT
:=


(



1


0


0


0




0


1


0


0




0


0


0


1




0


0


1


0



)


.


{\displaystyle \operatorname {CNOT} :={\begin{pmatrix}1&0&0&0\\0&1&0&0\\0&0&0&1\\0&0&1&0\end{pmatrix}}.}


As a mathematical consequence of this definition, 



CNOT
⁡

|

00
⟩
=

|

00
⟩


{\textstyle \operatorname {CNOT} |00\rangle =|00\rangle }

, 



CNOT
⁡

|

01
⟩
=

|

01
⟩


{\textstyle \operatorname {CNOT} |01\rangle =|01\rangle }

, 



CNOT
⁡

|

10
⟩
=

|

11
⟩


{\textstyle \operatorname {CNOT} |10\rangle =|11\rangle }

, and 



CNOT
⁡

|

11
⟩
=

|

10
⟩


{\textstyle \operatorname {CNOT} |11\rangle =|10\rangle }

. In other words, the CNOT applies a NOT gate (



X


{\textstyle X}

 from before) to the second qubit if and only if the first qubit is in the state 




|

1
⟩


{\textstyle |1\rangle }

. If the first qubit is 




|

0
⟩


{\textstyle |0\rangle }

, nothing is done to either qubit.
