Advanced single-qubit gates

Another convenient representation of a single-qubit state is

\begin{split}|\psi\rangle = \cos(\theta/2)|0\rangle + \sin(\theta/2)e^{j\varphi}|1\rangle,\end{split}

where 0 \leq \phi <2\pi and 0\leq \theta \leq \pi . This can be related to the previous representation by:

\begin{split}x=\mathrm{Re}[e^{j\varphi}] ~~~~~ y=\mathrm{Im}[e^{j\varphi}] ~~~~~ p =\sin^2(\theta/2) = [1-\cos(\theta)]/2.\end{split}

Defining z = p_0-p_1 = 1-2p gives

\begin{split}z = \cos(\theta).\end{split}

That is, \{x, y, z\} are the Cartesian coordinates of a sphere of unit length 1 . Here you see a one-to-one correspondence between qubit states ( \mathbb{C}^2 ) and the points on the surface of a unit sphere ( \mathbb{R}^3 ). This is called the Bloch sphere representation of a qubit state.

image0

We caution the reader from thinking that qubits can always have this simple geometric representation, as you will see that it breaks down when you have more than one qubit. That being said, it is a convenient tool to develop intuition for single-qubit quantum gates.

As mentioned before, single-qubit gates are represented by a 2\times 2 unitary matrix U. The action of the quantum gate is found by multiplying the matrix representing the gate with the vector representing the quantum state:

\begin{split}|\psi'\rangle = U|\psi\rangle\end{split}

A general unitary must be able to take the |0\rangle state to the above general state while satisfying U^\dagger U = I . From this, you can derive

\begin{split}U_3(\theta, \phi, \lambda) = \begin{pmatrix} \cos(\theta/2) & -e^{j\lambda}\sin(\theta/2) \\ e^{j\phi}\sin(\theta/2) & e^{j\lambda+j\phi}\cos(\theta/2) \end{pmatrix},\end{split}

which is the most general form of a single-qubit unitary, and is implemented in Circuit Composer using the U_3 gate.

Setting \lambda=\pi/2 and \phi=-\pi/2 defines the x-axis rotation gate, Rx(\theta) :

\begin{split}R_x(\theta)= \begin{pmatrix} \cos(\theta/2) & -j\sin(\theta/2) \\ -j \sin(\theta/2) & \cos(\theta/2) \end{pmatrix}\end{split}

Setting \lambda and \phi to 0 defines the y-axis rotation gate, Ry(\theta) :

\begin{split}R_y(\theta)= \begin{pmatrix} \cos(\theta/2) & -\sin(\theta/2) \\ \sin(\theta/2) & \cos(\theta/2) \end{pmatrix}\end{split}

Setting \theta=0 and \lambda=0 and multiplying by a global phase \exp(-j\phi/2) gives the z-axis rotation gate, Rz(\phi) :

\begin{split}R_z(\phi)= \begin{pmatrix} e^{-j\phi/2} & 0 \\ 0 & e^{j\phi/2} \end{pmatrix}\end{split}

Now you have the tools to rotate the state anywhere in the Bloch sphere. Let’s conduct a simple experiment to prove what we did. We will use U_3(\theta = 0.88\pi, \phi = 1.41\pi,\lambda=0) to rotate the |0\rangle into the state parameterized by \theta = 0.88\pi and \phi = 1.41\pi . Like in the previous section, we can measure the x and y components by applying an H gate before measurement, and an S^\dagger followed by an H gate before measurement (see the X-measurement circuit and Y-measurement circuits below). To measure the z component, we simply use the quantum circuit (see the Z-measurement circuit below).

X-measurement circuit

image1

Open in Circuit Composer


Y-measurement Circuit

image2

Open in Circuit Composer


Z-measurement Circuit

image3

Open in Circuit Composer

Doing this on the IBM Q Vigo system for 8192 shots gives (as taken on July 30, 2020 @ 12:00 EST):

Experiment

p_0

p_1

value

x

0.48975

0.51025

-0.0206

y

0.36426

0.62574

-0.2615

z

0.05908

0.94092

-0.8818

Like before, due to noise we need to re-normalize the data (how to handle noise correctly is an entire research topic unto itself, and we suggest the interested reader seek out resources on ‘quantum state tomography’), but for now we will use:

\begin{split}\bar x = \frac{x}{\sqrt{x^2+y^2+z^2}} ~~~~~~ \bar y = \frac{y}{\sqrt{x^2+y^2+z^2}} ~~~~~~ \bar z = \frac{z}{\sqrt{x^2+y^2+z^2}}.\end{split}

Putting this into atan2(\bar y,\bar x) gives \phi=1.47\pi and acos(\bar z) gives \theta=0.91\pi , which is very close to the values we put into U_3 .

Try out the different rotations yourself! If you want to explore the effects of \lambda in U_3 , be sure to start the qubit in a superposition state.