MULT20015 Prac Class 2 2021 v1
MULT20015 Practice Class-2, Ó L. Hollenberg et al 2020-2021 1
MULT20015 Elements of Quantum Computing
Practice Class 2
Welcome to Practice Class-2 of MULT20015 Elements of Quantum Computing, covering
exercises relevant to the material presented in lectures in Week 2.
The purpose of this week’s exercises is to:
• understand the representation of qubit states on the Bloch Sphere
• understand sequences of logic gates on single qubits
• program sequences of qubit logic gates in QUI
• understand the evolution of qubit states on the Bloch Sphere
The exercises in these notes are to assist your understanding of the subject and may
require time outside of the practice class to complete.
1. Qubit states on the Bloch sphere
In lectures we showed how a general qubit state |𝜓⟩ = 𝑎!|0⟩ + 𝑎”|1⟩ can be represented as
a point on the Bloch sphere. The conversion (ignoring the global phase) is given below:
Exercise 1.1 Consider the state |𝜓⟩ = “#$
%
|0⟩ + “&$
%
|1⟩. We’ll go through the whole conversion
from this form to the position on the Bloch sphere.
a) Show that the state is appropriately normalised, i.e. that the sum of the probabilities,
|𝑎!|% + |𝑎”|% is unity.
MULT20015 Practice Class-2, Ó L. Hollenberg et al 2020-2021 2
b) Convert the state to polar form, i.e. |𝜓⟩ = |𝑎!|𝑒$’!|0+ + |𝑎”|𝑒$'”|1⟩.
|𝑎!| = ________ 𝜃! = ________ |𝑎”| = ________ 𝜃” = ________
c) Convert the state into “pre-Bloch sphere” form, by pulling out the phase 𝑒$’!, i.e.
|𝜓⟩ = 𝑒$’!-|𝑎!||0⟩ + |𝑎”|𝑒$(‘”#’!)|1⟩..
|𝜓⟩ =
d) From the definition of the Bloch sphere form, |𝜓⟩ = cos ‘#
%
|0⟩ + sin ‘#
%
𝑒$*$|1⟩, determine
the Bloch sphere angles 𝜙+ = 𝜃” − 𝜃! and 𝜃,, and write out the state in this form:
𝜙+ = _________ 𝜃, = ____________ |𝜓⟩ = ________ |0⟩ + ________ |1⟩
e) Given the definitions of the Bloch angles in the schematic (right),
plot a point corresponding where this state resides on the Bloch
sphere. Compare with the figure on page 1.
Exercise 1.2 (out of practice class hours) Make up your own
(normalised) state, and repeat the steps a)-e) above.
2. Logical operations on qubits
In lectures, we introduced the notion of an operator U acting on a quantum state to
transform it into a new state, i.e.
In quantum computing these operations correspond to logic
operations, or gates, on qubits. The matrix representation gives us a
useful representation of these logic operations:
Here is some practice with the maths involving the entire QUI logic gate library for single
qubits, in both matrix and ket form.
| 0i = U | i
|0i
|1i
!B
“B
!”#
!$#
!”
!$
|&#⟩ = * |&⟩
= 2 x 2matrix
MULT20015 Practice Class-2, Ó L. Hollenberg et al 2020-2021 3
Exercise 2.1 Compute by hand the single gate operations H, X, Y, Z, S, and T on the state
|0⟩, and complete the table below. Compare with the QUI in each case.
Gate Operator
(matrix rep)
Operation
(matrix rep)
Operation
(ket rep)
Final state
|0⟩
amplitude
Final state
|1⟩
amplitude
Final state
probabilities
𝑝! and 𝑝”
H
1
√2
(
1
1
1
−1
+
1
√2
(
1
1
1
−1
+ (
1
0
+
=
1
√2
(
1
1
+
𝐻|0⟩
=
1
√2
|0⟩ +
1
√2
|1⟩
=|𝑎!|𝑒$’!|0⟩ + |𝑎”|𝑒$'”|1⟩
|𝑎!| =
1
√2
𝜃! = 0
|𝑎”| =
1
√2
𝜃” = 0
𝑝! = 0.5
𝑝” = 0.5
X
(
0
1
1
0
+
(
0
1
1
0
+ (
1
0
+
= (
0
1
+
𝑋|0⟩ = |1⟩
|𝑎!| = 0
𝜃! = 0
|𝑎”| = 1
𝜃” = 0
𝑝! = 0
𝑝” = 1
Y
(
0
𝑖
−𝑖
0
+
Z
(
1
0
0
−1
+
S
(
1
0
0
𝑖
+
T
(
1
0
0
𝑒#$/&
+
MULT20015 Practice Class-2, Ó L. Hollenberg et al 2020-2021 4
Exercise 2.2 Compute by hand the single gate operations H, X, Y, Z, S, and T on the
state |1⟩, and complete the table below. Compare with the QUI in each case.
Gate Operator
(matrix rep)
Operation
(matrix rep)
Operation
(ket rep)
Final state
|0⟩
amplitude
Final state
|1⟩
amplitude
Final state
probabilities
𝑝! and 𝑝”
H
1
√2
(
1
1
1
−1
+
1
√2
(
1
1
1
−1
+ (
0
1
+
=
1
√2
(
1
− 1
+
𝐻|1⟩
=
1
√2
|0⟩ −
1
√2
|1⟩
=|𝑎!|𝑒$’!|0⟩ + |𝑎”|𝑒$'”|1⟩
|𝑎!| =
1
√2
𝜃! = 0
|𝑎”| =
1
√2
𝜃” = 𝜋
𝑝! =
1
2
𝑝” =
1
2
X
(
0
1
1
0
+
(
0
1
1
0
+ (
0
1
+
= (
1
0
+
𝑋|1⟩ = |0⟩
|𝑎!| = 1
𝜃! = 0
|𝑎”| = 0
𝜃” = 0
𝑝! = 1
𝑝” = 0
Y
(
0
𝑖
−𝑖
0
+
Z
(
1
0
0
−1
+
S
(
1
0
0
𝑖
+
T
(
1
0
0
𝑒#$/&
+
MULT20015 Practice Class-2, Ó L. Hollenberg et al 2020-2021 5
3 Sequences of logic gates
In the following exercises we will look at the mathematics of the quantum state evolution
in more detail. In order to understand what is happening we will compute some examples
by hand and compare with the QUI output.
Exercise 3.1 Program the following sequence of single qubit gates H-T-H (shown below).
Compute by hand the states at each time step in the matrix representation, covert to ket
representation and fill out the table below. Now compare the amplitudes you obtained with
the QUI output at each time step and check they agree.
MULT20015 Practice Class-2, Ó L. Hollenberg et al 2020-2021 6
Exercise 3.2 Examine the QUI Bloch sphere animations by hovering the mouse over each
gate in the program circuit and complete the following representations of these gates in
the sequence H-T-H as per below (i.e. plot ⊙ and ⨂):
Exercise 3.3 Writing the above example as a string of operations on the initial state
would look like the following:
This looks exactly like the circuit ordering, but that’s because this example is palindromic
(looks the same from either direction) – see below.
Complete the same analysis for the circuit comprising the combination X-Y-Z:
The reversal of operator and time orderings is something to keep in mind.
| 3i = H | 2i = H T | 1i = H T H | 0i
MULT20015 Practice Class-2, Ó L. Hollenberg et al 2020-2021 7
Exercise 3.4 Add a measurement gate at the end of the HTH sequence. Hit the compute
button many times (say N = 100) and record the number of 0 and 1 outcomes and fill in
the table below. Compare the estimated probabilities with those expected.
components
Exact probability
Measurement
record
# outcomes, n
Estimated Prob
= n/N
|0⟩
|1⟩
4. Arbitrary rotation gate, R
Consider the R-gate in the QUI, with edit menu given below (right clock on the circuit
symbol to bring up this menu):
Exercise 4.1 Set QUI to 1-qubit, initialised in the default zero state. Add an R-gate in the
first time block. Setting the global phase to zero, explore the action of the R-gate for a
range of rotation axes and rotation angles. Hovering the mouse over the R-gate make sure
you understand how the qubit state evolves on the Bloch sphere. You can start the system
from states different from the default by adding gates prior to the R-gate. If you would
like to see the Bloch animations go crazy, try some very high rotation angles.
Exercise 4.2 Going back to the HTH example, can you determine R-gate parameters to
place the system, initially in the default zero state, into the same final state?
| i = HTH |0i
Cartesian cords for
axis of rotation n
Angle of rotation
!R about n
Global phase !g :
generally
set to zero unless
otherwise directed!
hXi
|0i
|1i
| i
| 0i
Rotation
axis n
!R
“Z” axis
“X” axis
“Y” axis
…
…