3.2.4 Controlled operations

To go beyond product states, we need an operation that allows the two quantum bits to interact. As before (see Eq. 2.32 for probabilistic bits), we will use a controlled-NOT operation for this, which we define in complete analogy to Eqs. 3.19 and 3.20:

CNOT12|00\displaystyle\mathrm{CNOT}_{1\to 2}\,\left|00\right\rangle =|00,\displaystyle=\left|00\right\rangle, (3.63)
CNOT12|01\displaystyle\mathrm{CNOT}_{1\to 2}\,\left|01\right\rangle =|01,\displaystyle=\left|01\right\rangle,
CNOT12|10\displaystyle\mathrm{CNOT}_{1\to 2}\,\left|10\right\rangle =|11,\displaystyle=\left|11\right\rangle,
CNOT12|11\displaystyle\mathrm{CNOT}_{1\to 2}\,\left|11\right\rangle =|10,\displaystyle=\left|10\right\rangle,

or, more concisely,

CNOT12|a,b=|a,ab.\displaystyle\mathrm{CNOT}_{1\to 2}\,\left|a,b\right\rangle=\left|a,a\oplus b% \right\rangle. (3.64)

Thus, on basis states, the operation CNOT12\mathrm{CNOT}_{1\to 2} toggles the second qubit controlled on the value of the first qubit. We can also define an operation CNOT21\mathrm{CNOT}_{2\to 1} which uses the second qubit as the control and the first as the target, i.e.,

CNOT21|a,b=|ab,b.\displaystyle\mathrm{CNOT}_{2\to 1}\,\left|a,b\right\rangle=\left|a\oplus b,b% \right\rangle. (3.65)

As usual, we extend these formulas by linearity to arbitrary two-qubit states.

In Quirky, you can build a controlled-NOT operation for quantum bits in the same way as you learned for ordinary bits – see Section 3.1.6 in case you don’t remember. For example, the CNOT12\mathrm{CNOT}_{1\to 2} operation for quantum bits looks just like before:

[Uncaptioned image]

Many of the things that we proved for probabilistic bits are still true for quantum bits. E.g., your solution to 3.2 will just as well allow you to swap two quantum bits! Another example of this is the fact that doing the same controlled-NOT operation twice amounts to doing nothing. For example, for CNOT12\mathrm{CNOT}_{1\to 2} this is the case because

CNOT12CNOT12|a,b=CNOT12|a,ab=|a,aab=|a,b\mathrm{CNOT}_{1\to 2}\,\mathrm{CNOT}_{1\to 2}\left|a,b\right\rangle=\mathrm{% CNOT}_{1\to 2}\left|a,a\oplus b\right\rangle=\left|a,a\oplus a\oplus b\right% \rangle=\left|a,b\right\rangle

since aa=0a\oplus a=0 for any a{0,1}a\in\{0,1\}. As a consequence, the controlled-NOT operation is the inverse of itself:

CNOT121=CNOT12\mathrm{CNOT}_{1\to 2}^{{-1}}=\mathrm{CNOT}_{1\to 2} (3.66)

where M1M^{{-1}} denotes the inverse of operation MM (see Section 2.4.2).

If you play around a bit with Quirky, you may have noticed that you can combine the \bullet with arbitrary single-qubit operations, not just with the NOT operation. Indeed, we can define a controlled-UU operation for any single-qubit operation UU. They are denoted by CU12\mathrm{C}U_{1\to 2} and CU21\mathrm{C}U_{2\to 1}, depending on which qubit is the control and which is the target. For example, CU12\mathrm{C}U_{1\to 2} is defined as follows on the four basis states:

CU12|00\displaystyle\mathrm{C}U_{1\to 2}\left|00\right\rangle =|0|0,\displaystyle=\left|0\right\rangle\otimes\left|0\right\rangle,
CU12|01\displaystyle\mathrm{C}U_{1\to 2}\left|01\right\rangle =|0|1,\displaystyle=\left|0\right\rangle\otimes\left|1\right\rangle,
CU12|10\displaystyle\mathrm{C}U_{1\to 2}\left|10\right\rangle =|1U|0,\displaystyle=\left|1\right\rangle\otimes U\left|0\right\rangle,
CU12|11\displaystyle\mathrm{C}U_{1\to 2}\left|11\right\rangle =|1U|1.\displaystyle=\left|1\right\rangle\otimes U\left|1\right\rangle.

You can quickly verify that for U=NOTU=\mathrm{NOT} we recover our definition of CNOT12\mathrm{CNOT}_{1\to 2} from before.