3.2.2 Local operations

If you have two qubits, a local operation acts only on one of them. Any single-qubit operation can be used as a local operation that acts on one out of two qubits, just like we did for probabilistic bits in Section 3.1.2. For example, if you recall the single-bit NOT operation in Eq. 1.17 and how we turned it into local NOT operations in Eqs. 3.6 and 3.7, we can do the exact same thing for the single-qubit NOT. The resulting local quantum NOT operations are very similar:

NOT1|00=|10,NOT1|01=|11,NOT1|10=|00,NOT1|11=|01,\displaystyle\mathrm{NOT}_{1}\,\left|00\right\rangle=\left|10\right\rangle,% \quad\mathrm{NOT}_{1}\,\left|01\right\rangle=\left|11\right\rangle,\quad% \mathrm{NOT}_{1}\,\left|10\right\rangle=\left|00\right\rangle,\quad\mathrm{NOT% }_{1}\,\left|11\right\rangle=\left|01\right\rangle,
NOT2|00=|01,NOT2|01=|00,NOT2|10=|11,NOT2|11=|10.\displaystyle\mathrm{NOT}_{2}\,\left|00\right\rangle=\left|01\right\rangle,% \quad\mathrm{NOT}_{2}\,\left|01\right\rangle=\left|00\right\rangle,\quad% \mathrm{NOT}_{2}\,\left|10\right\rangle=\left|11\right\rangle,\quad\mathrm{NOT% }_{2}\,\left|11\right\rangle=\left|10\right\rangle.

The only difference is that we have replaced the bit notation [ab][ab] with the qubit notation |ab\left|ab\right\rangle.

As an application of this, let’s say we want to build all four possible two-qubit basis states out of |00\left|00\right\rangle. This can always be done by some sequence of NOT operations:

|00=|00,|01=NOT2|00,|10=NOT1|00,|11=NOT2NOT1|00.\displaystyle\left|00\right\rangle=\left|00\right\rangle,\quad\left|01\right% \rangle=\mathrm{NOT}_{2}\,\left|00\right\rangle,\quad\left|10\right\rangle=% \mathrm{NOT}_{1}\,\left|00\right\rangle,\quad\left|11\right\rangle=\mathrm{NOT% }_{2}\;\mathrm{NOT}_{1}\,\left|00\right\rangle.

Note that in the last case we could have done the two NOT operations in the opposite order since either sequence corresponds to negating both bits. In other words, NOT2NOT1=NOT1NOT2\mathrm{NOT}_{2}\,\mathrm{NOT}_{1}=\mathrm{NOT}_{1}\,\mathrm{NOT}_{2}.

To apply a local operation in Quirky, we drop the corresponding box onto eiter the first or the second wire. For example, the following sequence prepares the |10\left|10\right\rangle state and shows the outcome probabilities when measuring both qubits:

[Uncaptioned image]

This makes sense since the bottom wire in Quirky corresponds to the first qubit.

This is most simple to state using the tensor product notation from Eq. 3.50 and linearity. If UU is an arbitrary single-qubit operation then we define U1U_{1} as the two-qubit operation that acts on any basis vector |a,b=|a|b\left|a,b\right\rangle=\left|a\right\rangle\otimes\left|b\right\rangle, where a,b{0,1}a,b\in\{0,1\}, as follows:

U1|a,b=U|a|b.\displaystyle U_{1}\left|a,b\right\rangle=U\!\left|a\right\rangle\otimes\left|% b\right\rangle. (3.52)

Just to be clear, the right-hand side means (U|a)|b(U\!\left|a\right\rangle)\otimes\left|b\right\rangle, i.e., the tensor product of the state U|aU\left|a\right\rangle and the state |b\left|b\right\rangle. This is intuitive, as it simply means that we apply UU to the first quantum bit and leave the second quantum bit alone.

To apply U1U_{1} to an arbitrary two-qubit state, we extend this prescription by linearity. As in the first week, this means that we first expand |ψ\left|\psi\right\rangle in the form of Eq. 3.31 and then apply the operation to each basis vector. That is,

U1|ψ=ψ00U1|00+ψ01U1|01+ψ10U1|10+ψ11U1|11\displaystyle U_{1}\left|\psi\right\rangle=\psi_{00}\,U_{1}\left|00\right% \rangle+\psi_{01}\,U_{1}\left|01\right\rangle+\psi_{10}\,U_{1}\left|10\right% \rangle+\psi_{11}\,U_{1}\left|11\right\rangle

and now we can use Eq. 3.52 for each of the four terms. We similarly define U2U_{2} by

U2|a,b=|aU|b\displaystyle U_{2}\left|a,b\right\rangle=\left|a\right\rangle\otimes U\left|b\right\rangle (3.53)

and extend it by linearity. This is analogous to the formulas in Eq. 3.27 for ordinary bits.

In addition to the NOT operation, two important quantum operations that we will use all the time are the ZZ operation from Eq. 2.26 and the Hadamard operation from Eq. 2.34. Since they are so important, we gave them their own boxes in Quirky, namely ZZ and HH. For example, the following sequence of operations applies a NOT\mathrm{NOT} on the second (!) qubit, then a Hadamard on the first qubit, and finally a ZZ, again on the first qubit:

[Uncaptioned image]
\href https://www.quantum-quest.org/quirky/QuirkyQuest3Q.html#circuit=%7B%22% cols%22%3A%5B%5B%22NOT%22%5D%2C%5B1%2C%22H%22%5D%2C%5B1%2C%22Z%22%5D%2C%5B%22% Measure%22%2C%22Measure%22%5D%2C%5B%22Chance2%22%5D%5D%7D
(3.54)

What is the state that we get in this way? The mathematical expression for this state is

Z1H1NOT2|00.Z_{1}H_{1}\mathrm{NOT}_{2}\left|00\right\rangle. (3.55)

Note that, in contrast to the graphical depiction (3.54), the input state |00\left|00\right\rangle in this expression is on the right-hand side. This causes the order of operations to appear reversed. However, both (3.54) and Eq. 3.55 describe the same process – the first operation applied to |00\left|00\right\rangle is NOT2\mathrm{NOT}_{2}, then H1H_{1}, and finally Z1Z_{1}. The only difference between (3.54) and Eq. 3.55 is the convention for depicting the direction of time: it goes from left to right in (3.54) and from right to left in Eq. 3.55. Unfortunately these two mismatching conventions are standard in quantum computing so there is nothing we can do about it. You simply have to be careful when translating Quirky pictures to equations and vice versa!

Exercise 3.8 (Is Quirky right?).

Compute the two-qubit state in Eq. 3.55 (that is, right before the measurement in (3.54)). Compute the probability of measurement outcomes and compare your result with Quirky.

Solution. We start with |00\left|00\right\rangle. After the NOT on the second qubit, we get |01\left|01\right\rangle. The Hadamard on the first qubit transforms this into |+|1=12|01+12|11\left|+\right\rangle\otimes\left|1\right\rangle=\frac{1}{\sqrt{2}}\left|01% \right\rangle+\frac{1}{\sqrt{2}}\left|11\right\rangle and with the final ZZ operation we obtain the following two-qubit state right before the measurement:
12|0112|11.\displaystyle\frac{1}{\sqrt{2}}\left|01\right\rangle-\frac{1}{\sqrt{2}}\left|1% 1\right\rangle.
Thus, we get either 0101 or 1111, with probability 50% each.

Last week, in Section 2.4.3, we dicussed that any operation on a single qubit is either a rotation U(θ)U(\theta) or a reflection V(θ)=NOTU(θ)V(\theta)=\mathrm{NOT}\,U(\theta). Since we can construct arbitrary rotations in Quirky (see Section 2.4.1 of last week’s lecture notes), we can therefore apply arbitrary local operations on either of the qubits using Quirky.

In fact, the rules of Eqs. 3.52 and 3.53 do not only work for basis vectors, but in fact for arbitrary product states. That is, if |α\left|\alpha\right\rangle and |β\left|\beta\right\rangle are arbitrary single-qubit states then

U1(|α|β)\displaystyle U_{1}\left(\left|\alpha\right\rangle\otimes\left|\beta\right% \rangle\right) =U|α|β,\displaystyle=U\left|\alpha\right\rangle\otimes\left|\beta\right\rangle, (3.56)
U2(|α|β)\displaystyle U_{2}\left(\left|\alpha\right\rangle\otimes\left|\beta\right% \rangle\right) =|αU|β.\displaystyle=\left|\alpha\right\rangle\otimes U\left|\beta\right\rangle. (3.57)
Exercise 3.9 (Local operations on product states (optional)).

Can you verify Eq. 3.56 or (3.57)?

Solution. We only show how to verify Eq. 3.56 (the other equation can be derived completely analogously). For this, let us write |α=α0|0+α1|1\left|\alpha\right\rangle=\alpha_{0}\left|0\right\rangle+\alpha_{1}\left|1\right\rangle and |β=β0|0+β1|1\left|\beta\right\rangle=\beta_{0}\left|0\right\rangle+\beta_{1}\left|1\right\rangle. Then,
U1(|α|β)\displaystyle U_{1}\left(\left|\alpha\right\rangle\otimes\left|\beta\right% \rangle\right) =U1(α0β0|00+α0β1|01+α1β0|10+α1β1|11)\displaystyle=U_{1}\left(\alpha_{0}\beta_{0}\left|00\right\rangle+\alpha_{0}% \beta_{1}\left|01\right\rangle+\alpha_{1}\beta_{0}\left|10\right\rangle+\alpha% _{1}\beta_{1}\left|11\right\rangle\right)
=α0β0U1|00+α0β1U1|01+α1β0U1|10+α1β1U1|11\displaystyle=\alpha_{0}\beta_{0}U_{1}\left|00\right\rangle+\alpha_{0}\beta_{1% }U_{1}\left|01\right\rangle+\alpha_{1}\beta_{0}U_{1}\left|10\right\rangle+% \alpha_{1}\beta_{1}U_{1}\left|11\right\rangle
=α0β0U|0|0+α0β1U|0|1+α1β0U|1|0+α1β1U|1|1\displaystyle=\alpha_{0}\beta_{0}U\left|0\right\rangle\otimes\left|0\right% \rangle+\alpha_{0}\beta_{1}U\left|0\right\rangle\otimes\left|1\right\rangle+% \alpha_{1}\beta_{0}U\left|1\right\rangle\otimes\left|0\right\rangle+\alpha_{1}% \beta_{1}U\left|1\right\rangle\otimes\left|1\right\rangle
=α0U|0(β0|0+β1|1)+α1U|1(β0|0+β1|1)\displaystyle=\alpha_{0}U\left|0\right\rangle\otimes(\beta_{0}\left|0\right% \rangle+\beta_{1}\left|1\right\rangle)+\alpha_{1}U\left|1\right\rangle\otimes(% \beta_{0}\left|0\right\rangle+\beta_{1}\left|1\right\rangle)
=α0U|0|β+α1U|1|β\displaystyle=\alpha_{0}U\left|0\right\rangle\otimes\left|\beta\right\rangle+% \alpha_{1}U\left|1\right\rangle\otimes\left|\beta\right\rangle
=(α0U|0+α1U|1)|β\displaystyle=(\alpha_{0}U\left|0\right\rangle+\alpha_{1}U\left|1\right\rangle% )\otimes\left|\beta\right\rangle
=U|α|β\displaystyle=U\left|\alpha\right\rangle\otimes\left|\beta\right\rangle
by Eq. 3.50, the definition of U1U_{1}, and linearity.