2.4.1 Rotations

So far, we only know how to create the |0\left|0\right\rangle and |1\left|1\right\rangle states using Quirky. Quantum computing would not be much fun if those were our only options! To create more interesting states, we need to come up with other quantum operations.

One natural such operation is to rotate the circle by some fixed angle. Let us denote the rotation by an angle θ\theta by U(θ)U(\theta). You can always assume that the angle is in [0,2π)[0,2\pi). Since |0=|ψ(0)\left|0\right\rangle=\left|\psi(0)\right\rangle and |1=|ψ(π2)\left|1\right\rangle=\left|\psi(\frac{\pi}{2})\right\rangle, this operation acts on the basis vectors as follows (see Fig. 2.5):

U(θ)|0=|ψ(θ),U(θ)|1=|ψ(θ+π2).U(\theta)\left|0\right\rangle=\left|\psi(\theta)\right\rangle,\qquad U(\theta)% \left|1\right\rangle=\left|\psi(\theta+\tfrac{\pi}{2})\right\rangle. (2.27)

We can also write out this definition explicitly in the vector notation:

U(θ)(10)=(cosθsinθ),U(θ)(01)=(sinθcosθ),U(\theta)\begin{pmatrix}1\\ 0\end{pmatrix}=\begin{pmatrix}\cos\theta\\ \sin\theta\end{pmatrix},\qquad U(\theta)\begin{pmatrix}0\\ 1\end{pmatrix}=\begin{pmatrix}-\sin\theta\\ \cos\theta\end{pmatrix}, (2.28)

where we used cos(θ+π2)=sinθ\cos(\theta+\frac{\pi}{2})=-\sin\theta and sin(θ+π2)=cosθ\sin(\theta+\frac{\pi}{2})=\cos\theta.

Figure 2.5: States |0\left|0\right\rangle and |1\left|1\right\rangle rotated by angle θ\theta, see Eq. 2.27.

As before, we will use linearity to extend U(θ)U(\theta) from the basis vectors to arbitrary qubit states. In the following exercise, you will show that the resulting operation U(θ)U(\theta) indeed acts as a rotation on qubit states. In particular, this means that it sends qubit states to qubit states, so U(θ)U(\theta) is an allowed operation on qubits!

Exercise 2.3 (Qubit rotation).
  1. 1.

    Compute U(α)(ψ0ψ1)U(\alpha)\begin{pmatrix}\psi_{0}\\ \psi_{1}\end{pmatrix} by using Eqs. 2.8 and 2.27.

  2. 2.

    Use the definition of |ψ(θ)\left|\psi(\theta)\right\rangle in Eq. 2.5 to verify that, for all angles α\alpha and β\beta,

    U(α)|ψ(β)=|ψ(α+β).U(\alpha)\left|\psi(\beta)\right\rangle=\left|\psi(\alpha+\beta)\right\rangle. (2.29)

    This means that U(θ)U(\theta) acts as a rotation on arbitrary qubit states |ψ(β)\left|\psi(\beta)\right\rangle.

Hint: The trigonometric angle sum and difference formulas might be useful:

sin(α±β)=sinαcosβ±cosαsinβ,cos(α±β)=cosαcosβsinαsinβ.\sin(\alpha\pm\beta)=\sin\alpha\cos\beta\pm\cos\alpha\sin\beta,\qquad\cos(% \alpha\pm\beta)=\cos\alpha\cos\beta\mp\sin\alpha\sin\beta. (2.30)
Solution.
  1. 1.

    U(α)U(\alpha) acts on an arbitrary state as follows:

    U(α)(ψ0ψ1)\displaystyle U(\alpha)\begin{pmatrix}\psi_{0}\\ \psi_{1}\end{pmatrix} =U(α)(ψ0(10)+ψ1(01))=ψ0(cosαsinα)+ψ1(sinαcosα)\displaystyle=U(\alpha)\left\lparen\psi_{0}\begin{pmatrix}1\\ 0\end{pmatrix}+\psi_{1}\begin{pmatrix}0\\ 1\end{pmatrix}\right\rparen=\psi_{0}\begin{pmatrix}\cos\alpha\\ \sin\alpha\end{pmatrix}+\psi_{1}\begin{pmatrix}-\sin\alpha\\ \cos\alpha\end{pmatrix}
    =(ψ0cosαψ1sinαψ0sinα+ψ1cosα).\displaystyle=\begin{pmatrix}\psi_{0}\cos\alpha-\psi_{1}\sin\alpha\\ \psi_{0}\sin\alpha+\psi_{1}\cos\alpha\end{pmatrix}.
  2. 2.

    Since |ψ(β)=(cosβsinβ)\left|\psi(\beta)\right\rangle=\begin{pmatrix}\cos\beta\\ \sin\beta\end{pmatrix},

    U(α)|ψ(β)\displaystyle U(\alpha)\left|\psi(\beta)\right\rangle =U(α)(cosβsinβ)=(cosβcosαsinβsinαcosβsinα+sinβcosα)=(cos(α+β)sin(α+β))\displaystyle=U(\alpha)\begin{pmatrix}\cos\beta\\ \sin\beta\end{pmatrix}=\begin{pmatrix}\cos\beta\cos\alpha-\sin\beta\sin\alpha% \\ \cos\beta\sin\alpha+\sin\beta\cos\alpha\end{pmatrix}=\begin{pmatrix}\cos(% \alpha+\beta)\\ \sin(\alpha+\beta)\end{pmatrix}
    =|ψ(α+β).\displaystyle=\left|\psi(\alpha+\beta)\right\rangle.

Note that a rotation by 90 degrees (i.e., π/2\pi/2) is not the same as a reflection. Indeed, while both the NOT\mathrm{NOT} operation and the U(π/2)U(\pi/2) rotation send |0\left|0\right\rangle to |1\left|1\right\rangle, they act differently on |1\left|1\right\rangle:

NOT|1=|0,U(π/2)|1=|0.\mathrm{NOT}\left|1\right\rangle=\left|0\right\rangle,\qquad U(\pi/2)\left|1% \right\rangle=-\left|0\right\rangle.

How can we rotate a quantum bit in Quirky? Since there are infinitely many rotations operations U(θ)U(\theta), we could not add them all to the toolbox. Instead, you can add your own rotations to the toolbox! Let’s practice by adding a rotation by 30{}^{\circ}. To start, select ‘Make U(θ)U(\theta)’ in the menu bar. A new window appears where you can input an angle:

[Uncaptioned image]

Enter pi/6, which corresponds to 30{}^{\circ}, and confirm by pressing the button. Congratulations! You have successfully added the U(π/6)U(\pi/6) rotation to the toolbox, which now looks as follows:

[Uncaptioned image]

To test our new rotation, let us build the following computation in Quirky:

[Uncaptioned image]

Let’s quickly see that this outcome makes sense. We started with the |0=(10)\left|0\right\rangle=\bigl{(}\begin{smallmatrix}1\\ 0\end{smallmatrix}\bigr{)} state. By Eq. 2.28, any rotation U(θ)U(\theta) sends |0\left|0\right\rangle to |ψ(θ)=(cos(θ)sin(θ))\left|\psi(\theta)\right\rangle=\bigl{(}\begin{smallmatrix}\cos(\theta)\\ \sin(\theta)\end{smallmatrix}\bigr{)}. In our case θ=π/6\theta=\pi/6, and

|ψ(π/6)=(cos(π/6)sin(π/6))=(3/21/2).\displaystyle\left|\psi(\pi/6)\right\rangle=\begin{pmatrix}\cos(\pi/6)\\ \sin(\pi/6)\end{pmatrix}=\begin{pmatrix}\sqrt{3}/2\\ 1/2\end{pmatrix}.

Using the quantum measurement rule in Eq. 2.7, we conclude that the probability of obtaining outcome 11 is

p1=(12)2=14=25%,\displaystyle p_{1}=\left\lparen\frac{1}{2}\right\rparen^{2}=\frac{1}{4}=25\%,

which is exactly what Quirky told us. In the following exercise you will use Quirky to similarly test the effect of the rotation U(θ)U(\theta) on the other basis vector, |1\left|1\right\rangle.

Homework 2.3 (Testing the 30{}^{\circ} rotation).
  1. 1.

    Build the following sequence of operations using Quirky: First prepare the qubit state |1\left|1\right\rangle, then rotate by the same angle π/6\pi/6, and finally measure the qubit.

  2. 2.

    Use the probability display in Quirky to determine the probability of the measurement outcomes. Argue that the answer given by Quirky is correct.

  3. 3.

    Modify your solution to the first question such that the probability of measurement outcome 1 is 42 percent.

Hack.
  1. 1.

    The resulting circuit in Quirky should look like this:

    [Uncaptioned image]

  2. 2.

    We start in the state |0\left|0\right\rangle, as shown in the circuit above. After applying the NOT operation, the state of the qubit is |1\left|1\right\rangle. We now use Eq. 2.28, which tells us that the rotation sends |1\left|1\right\rangle to

    U(π/6)|1=(sinπ6cosπ6)=(1/23/2).\displaystyle U(\pi/6)\left|1\right\rangle=\begin{pmatrix}-\sin\frac{\pi}{6}\\ \cos\frac{\pi}{6}\end{pmatrix}=\begin{pmatrix}-1/2\\ \sqrt{3}/2\end{pmatrix}.

    Using Eq. 2.6, we verify that p1=3/4=75%p_{1}=3/4=75\%, which agrees with Quirky’s output.

  3. 3.

    We will replace the operation U(π/6)U(\pi/6) by another rotation U(ϕ)U(\phi), such that the probability of measuring 11 becomes 42%42\%. To that end, observe that after applying a rotation by an angle of ϕ\phi, the resulting state is:

    U(ϕ)|1=(sinϕcosϕ).U(\phi)\left|1\right\rangle=\begin{pmatrix}-\sin\phi\\ \cos\phi\end{pmatrix}.

    Hence the probability of measuring 11 is cos2ϕ\cos^{2}\phi. Equating this to 42%42\% allows us to solve for the angle of rotation ϕ\phi:

    cos2(ϕ)=0.42,implyingcos(ϕ)=0.42orϕ=arccos(0.42)0.866.\cos^{2}(\phi)=0.42,\quad\text{implying}\quad\cos(\phi)=\sqrt{0.42}\quad\text{% or}\quad\phi=\arccos(\sqrt{0.42})\approx 0.866.

    Hence, the resulting circuit looks like this:

    [Uncaptioned image]