4.1.2 Operations

What are the quantum operations that we can perform if we have multiple qubits? For one, we can apply any one-qubit or two-qubit operation discussed in Sections 2 and 3 to any chosen qubits of a many-qubit state. This works as in Section 3.2.2.

For example, if UU is a single-qubit operation, that is, a rotation or a reflection, then we can define a quantum operation, denoted U1U_{1}, that corresponds to applying UU to the first qubit of an nn-qubit state. It is defined as follows on the basis states:

U1|a1,,an=U|a1|a2,,an.\displaystyle U_{1}\left|a_{1},\dots,a_{n}\right\rangle=U\left|a_{1}\right% \rangle\otimes\left|a_{2},\dots,a_{n}\right\rangle.

Note that the tensor product combines the single-qubit state U|a1U\left|a_{1}\right\rangle with the (n1)(n-1)-qubit basis state |a2,,an\left|a_{2},\dots,a_{n}\right\rangle to form a state of nn qubits, as we desire. As usual, we extend U1U_{1} by linearity to general quantum states of nn qubits. We similarly define the quantum operations U2U_{2}, U3U_{3}, etc. that correspond to applying UU to the second, third, etc. qubit.

Exercise 4.2 (Applying a single-qubit operation).

Compute the result of applying the Hadamard operation on the second qubit of the three-qubit state |Φ+|1\left|\Phi^{+}\right\rangle\otimes\left|1\right\rangle. In other words, compute H2(|Φ+|1)H_{2}\left(\left|\Phi^{+}\right\rangle\otimes\left|1\right\rangle\right). Write your result in the form of Eq. 4.1.

Solution. Let us first expand the given product state in the form of Eq. 4.2:
|Φ+|1=12|001+12|111.\displaystyle\left|\Phi^{+}\right\rangle\otimes\left|1\right\rangle=\frac{1}{% \sqrt{2}}\left|001\right\rangle+\frac{1}{\sqrt{2}}\left|111\right\rangle.
Thus:
H2(|Φ+|1)=H2(12|001+12|111)=12H2|001+12H2|111\displaystyle\quad H_{2}\left(\left|\Phi^{+}\right\rangle\otimes\left|1\right% \rangle\right)=H_{2}\left(\frac{1}{\sqrt{2}}\left|001\right\rangle+\frac{1}{% \sqrt{2}}\left|111\right\rangle\right)=\frac{1}{\sqrt{2}}H_{2}\left|001\right% \rangle+\frac{1}{\sqrt{2}}H_{2}\left|111\right\rangle
=12|0H|0|1+12|1H|1|1\displaystyle=\frac{1}{\sqrt{2}}\left|0\right\rangle\otimes H\left|0\right% \rangle\otimes\left|1\right\rangle+\frac{1}{\sqrt{2}}\left|1\right\rangle% \otimes H\left|1\right\rangle\otimes\left|1\right\rangle
=12|0|+|1+12|1||1\displaystyle=\frac{1}{\sqrt{2}}\left|0\right\rangle\otimes\left|+\right% \rangle\otimes\left|1\right\rangle+\frac{1}{\sqrt{2}}\left|1\right\rangle% \otimes\left|-\right\rangle\otimes\left|1\right\rangle
=12|0(12|0+12|1)|1+12|1(12|012|1)|1\displaystyle=\frac{1}{\sqrt{2}}\left|0\right\rangle\otimes\left(\frac{1}{% \sqrt{2}}\left|0\right\rangle+\frac{1}{\sqrt{2}}\left|1\right\rangle\right)% \otimes\left|1\right\rangle\;+\;\frac{1}{\sqrt{2}}\left|1\right\rangle\otimes% \left(\frac{1}{\sqrt{2}}\left|0\right\rangle-\frac{1}{\sqrt{2}}\left|1\right% \rangle\right)\otimes\left|1\right\rangle
=12|001+12|011+12|10112|111,\displaystyle=\frac{1}{2}\left|001\right\rangle+\frac{1}{2}\left|011\right% \rangle+\frac{1}{2}\left|101\right\rangle-\frac{1}{2}\left|111\right\rangle,
where we used Eq. 2.34 to compute the action of HH on the basis states.

We can similarly figure out how a two-qubit operation can be applied to selected two qubits out of nn. We will mostly be interested in controlled-NOT operations: CNOTkl\mathrm{CNOT}_{k\to l} with klk\neq l is the operation that flips the ll-th qubit (the target qubit) depending on the value of the kk-th qubit (the control qubit). Mathematically, its action on basis states is as follows:

CNOTkl|a1,,al,,an=|a1,,alak,,an,\displaystyle\mathrm{CNOT}_{k\to l}\left|a_{1},\dots,a_{l},\dots,a_{n}\right% \rangle=\left|a_{1},\dots,a_{l}\oplus a_{k},\dots,a_{n}\right\rangle,

and we extend this prescription by linearity to arbitrary nn-qubit states. For example, the controlled-NOT operation CNOT13\mathrm{CNOT}_{1\to 3} is defined as follows for four-qubit basis states:

CNOT13|a1,a2,a3,a4=|a1,a2,a3a1,a4.\displaystyle\mathrm{CNOT}_{1\to 3}\left|a_{1},a_{2},a_{3},a_{4}\right\rangle=% \left|a_{1},a_{2},a_{3}\oplus a_{1},a_{4}\right\rangle.

What does all this look like in Quirky? Let’s go to

https://www.quantum-quest.org/quirky

and click on “Quest 4” to find out. Your web browser will look similarly to Fig. 4.1.

Refer to caption

Figure 4.1: Quirky for Quest 4.

Hold on, it seems like Quirky looks exactly the same as last week!? However, as soon as you pick up an operation in the toolbox, a new wire will appear at the bottom – allowing you to act on an additional qubit. (Of course, we have limited the number of qubits to some reasonable number that your classical computer is happy to simulate!) Why don’t you try this now and create a CNOT13\mathrm{CNOT}_{1\to 3} operation, as in the following picture?

[Uncaptioned image]

When quantum operations act on separate qubits, we can perform them in parallel. As in Section 3.2.3, we re-use the tensor product symbol for this. If UU is a quantum operation on nn qubits and VV a quantum operation on mm qubits then we can define a quantum operation UVU\otimes V on (n+m)(n+m) qubits which corresponds to performing both operations in parallel. On basis states,

(UV)|a1,,an,b1,,bm=U|a1,,anV|b1,,bm,\displaystyle(U\otimes V)\left|a_{1},\dots,a_{n},b_{1},\dots,b_{m}\right% \rangle=U\left|a_{1},\dots,a_{n}\right\rangle\otimes V\left|b_{1},\dots,b_{m}% \right\rangle, (4.5)

and we extend this by linearity to arbitrary states. It follows as a consequence of Eq. 4.5 that

(UV)(|α|β)=U|αV|β,\displaystyle(U\otimes V)(\left|\alpha\right\rangle\otimes\left|\beta\right% \rangle)=U\left|\alpha\right\rangle\otimes V\left|\beta\right\rangle,

but only if |α\left|\alpha\right\rangle is an nn-qubit state and |β\left|\beta\right\rangle and mm-qubit state! In the following exercise, the two tensor product symbols are not aligned in this way, so you cannot use this rule!

Exercise 4.3 (Misaligned tensor products).

Consider the three-qubit state (CNOT21I)(|0|Φ)(\mathrm{CNOT}_{2\to 1}\otimes I)(\left|0\right\rangle\otimes\left|\Phi^{-}% \right\rangle).

  1. 1.

    How can you build this state using Quirky?

  2. 2.

    Write out the state in the form of Eq. 4.1.

Solution.
  1. 1.

    We saw how to prepare |Φ\left|\Phi^{-}\right\rangle in 3.12. Thus, the following circuit does the job:

    [Uncaptioned image]

  2. 2.

    Here is the resulting state:

    (CNOT21I)(|0|Φ)\displaystyle(\mathrm{CNOT}_{2\to 1}\otimes I)(\left|0\right\rangle\otimes% \left|\Phi^{-}\right\rangle) =(CNOT21I)(12|00012|011)\displaystyle=(\mathrm{CNOT}_{2\to 1}\otimes I)\left(\frac{1}{\sqrt{2}}\left|0% 00\right\rangle-\frac{1}{\sqrt{2}}\left|011\right\rangle\right)
    =12|00012|111.\displaystyle=\frac{1}{\sqrt{2}}\left|000\right\rangle-\frac{1}{\sqrt{2}}\left% |111\right\rangle.

We can use tensor product several times to iteratively build up larger and larger quantum operations. Here are three examples for various numbers of qubits:

  1. 1.

    IIUII\otimes I\otimes U\otimes I is the same four-qubit operation as U3U_{3},

  2. 2.

    ICNOT12III\otimes\mathrm{CNOT}_{1\to 2}\otimes I\otimes I is the controlled-NOT operation CNOT23\mathrm{CNOT}_{2\to 3} for five qubits,

  3. 3.

    ZIXZ\otimes I\otimes X is the quantum operation that applies ZZ on the first qubit and, in parallel, XX on the third qubit (we could also write this as either Z1X3Z_{1}X_{3} or X3Z1X_{3}Z_{1}).