CS计算机代考程序代写 MULT20015 Prac Class 1 2021 Solutions

MULT20015 Prac Class 1 2021 Solutions

MULT20015 Practice Class-1, Ó L. Hollenberg et al 2020- 1

MULT20015 Elements of Quantum Computing

Practice Class 1

Welcome to Practice Class-1 of MULT20015 Elements of Quantum Computing.

The purpose of this first tutorial class is to:
• refresh your knowledge of complex numbers for quantum state amplitudes
• start using the Quantum User Interface (QUI)
• understand state amplitudes as complex numbers and their representation in the QUI

system

1 Refresher on complex numbers

Consider complex numbers 𝑧 = 𝑥 + 𝑖𝑦 where 𝑥 and 𝑦 are ordinary real numbers, and 𝑖! =
−1. The real and imaginary parts of 𝑧 are Re[𝑧] = 𝑥 and Im[𝑧] = 𝑦, respectively.

Exercise 1.1 For the complex number 𝑧 = 3 + 2𝑖 determine the real and imaginary parts:

Re[𝑧] = 3 and Im[𝑧] = 2

Exercise 1.2 Plot the complex number 𝑧 = −1.5 + 𝑖 in the complex plane:

Exercise 1.3 Write out 𝑧 = 𝑥 + 𝑖𝑦 for the point
shown:

𝑧 = 1 + 𝑖 (-2)

Let’s say we have two complex numbers: 𝑧” = 𝑥” + 𝑖𝑦”, and 𝑧! = 𝑥! + 𝑖𝑦! where {𝑥”, 𝑦”,
𝑥! , 𝑦!} are ordinary real numbers. Addition and multiplication is as follows:

𝑧” + 𝑧! = (𝑥” + 𝑖𝑦”) + (𝑥! + 𝑖𝑦!) = (𝑥” + 𝑥!) + 𝑖(𝑦” + 𝑦!)

𝑧”𝑧! = (𝑥” + 𝑖𝑦”)(𝑥! + 𝑖𝑦!) = (𝑥”𝑥! − 𝑦”𝑦!) + 𝑖(𝑥”𝑦! + 𝑦”𝑥!)

Exercise 1.4 Given 𝑧” = −2 + 𝑖 and 𝑧! = 3 − 2𝑖 as shown, determine 𝑧 = 𝑧” + 𝑧! and plot:

𝑧 = 1 + 𝑖 (-1)

MULT20015 Practice Class-1, Ó L. Hollenberg et al 2020- 2

Exercise 1.5 Given 𝑧” = −1/2 + 𝑖 and 𝑧! = 1 − 2𝑖 as shown, determine
𝑧 = 𝑧”𝑧! and plot:

𝑧 = 3/2 + 𝑖 2

The “conjugate” 𝑧∗ of a complex number 𝑧 is formed by changing the sign of 𝑖, i.e. 𝑧 = 𝑥 +
𝑖𝑦 → 𝑧∗ = 𝑥 − 𝑖𝑦. The product is given by 𝑧 𝑧∗ = (𝑥 + 𝑖𝑦)(𝑥 − 𝑖𝑦) = 𝑥! − 𝑖𝑥𝑦 + 𝑖𝑦𝑥 + 𝑦! = 𝑥! +
𝑦!. The magnitude (modulus) of a complex number is denoted |𝑧| and is given by |𝑧|=
6𝑥! + 𝑦!. The magnitude squared of the complex number is given by: 𝑧 𝑧∗= 𝑥! + 𝑦! = |𝑧|!.

Exercise 1.6 For 𝑧 = −2 + 𝑖 determine the magnitude |𝑧| and |𝑧|!.

|𝑧| = √5 , |𝑧|! = 5

Exercise 1.7 Given 𝑧 = 3 − 2 𝑖 determine the magnitude |𝑧| and |𝑧|!.

|𝑧| = √13 , |𝑧|! = 13

In the QUI, we use “polar notation” (magnitude and angle) as a compact way to visualise
complex numbers (representing the quantum state amplitudes).

𝑧 = 𝑟 cos 𝜃 + 𝑖 𝑟 sin 𝜃 = 𝑟 (cos 𝜃 + 𝑖 sin 𝜃)

→ 𝑧 = 𝑟 𝑒$% , 𝑟 = |𝑧|= 6𝑥! + 𝑦!

Exercise 1.8 Plot 𝑧 = 1 + 𝑖 on the complex plane, convert to polar
notation, and label plot with magnitude and angle:

𝑧 = √2𝑒$&/(

In QC we often measure angles in radians rather than degrees.

Exercise 1.9 Use the conversions below to fill in the table.

𝜋/10

𝜋/6

60

−45

MULT20015 Practice Class-1, Ó L. Hollenberg et al 2020- 3

To understand the representation of quantum amplitudes, it’s very useful to know how to
compute sin and cos quickly around the unit circle (unit means radius 1):

2 The Quantum User Interface (QUI)

The QUI is a web-based graphical user interface (developed by the Hollenberg group at
the University of Melbourne) to program, simulate and analyse quantum circuits. The QUI
allows the users to specify qubit number, build quantum circuits, simulate and examine the
quantum state at every time step in the circuit/program. The latter feature is critical to
understanding QC, and distinguishes QUI from other on-line programming/simulation tools.

The QUI is accessed through a web-based interface (quispace.org – click on blue QUI logo).
See the notes “QUI Intro” on LMS for quick guide. If you haven’t signed up already please
let a demonstrator know and follow these steps.

Step 1: Open a web browser (preferably Google Chrome or Firefox), go to quispace.org.
Step 2: You will need to create an account to access QUI for the first time. In order to
access expanded capabilities of the QUI you must use your University of Melbourne
email address as your login name. Follow the steps to create your account.
Step 3: Once you have signed-up, start the QUI.

3 Quantum States, Amplitude, Probability and Phase

In general, a quantum superposition for a single qubit is written as |𝜓⟩ = 𝑎)|0⟩ + 𝑎”|1⟩ .
The “state amplitudes” 𝑎) and 𝑎” are complex numbers. In the QUI we use polar notation,
|𝑎|𝑒)*, to describe the magnitude (|𝑎|) and phase (𝜃) of the state amplitudes:

Re[a0]

Im[a0]

| i = a0 |0i+ a1 |1i =

a0
a1

Amplitude a0

!”
#”

!”

a0 = |a0| ei✓0 = |a0| cos ✓0 + i|a0| sin ✓0

a0 = |a0| ei✓0 = |a0| cos ✓0 + i|a0| sin ✓0

a0 = |a0| ei✓0 = |a0| cos ✓0 + i|a0| sin ✓0

Re[a1]

Im[a1]

Amplitude a1

!$
#$

!$

a1 = |a1| ei✓1 = |a1| cos ✓1 + i|a1| sin ✓1

a1 = |a1| ei✓1 = |a1| cos ✓1 + i|a1| sin ✓1

a1 = |a1| ei✓1 = |a1| cos ✓1 + i|a1| sin ✓1

Complex plane

Prob |0⟩ = |a0|2 Prob |1⟩ = |a1|2

MULT20015 Practice Class-1, Ó L. Hollenberg et al 2020- 4

For a given amplitude 𝑎 = |𝑎|𝑒)*, QUI uses a colour wheel for the phase angle q

As per lecture notes, the State Info Card (SIC) in the QUI gives the value of the complex
amplitude 𝑎$ of a given state component |𝑖⟩. It is given by 𝑎$ = |𝑎$|𝑒$%! where |𝑎$| is the
magnitude (modulus), and 𝜃$ is the phase angle (colour wheel scale). The probability of
measuring the state |𝑖⟩ is |𝑎$|!.

Exercise 3.1 Consider the computational states |0⟩ and |1⟩ in the QUI.

Select 1 qubit, and hit compute (nothing in the circuit as per the schematic below). The
system has been initialised in the |0⟩ state. Hover the mouse over the histogram in the
results panel (panel below the circuit) to bring up the State Info Cards (SICs) with the
amplitude phase and magnitude values:

What are the probabilities of measuring the result “0” and “1” respectively?

Prob[“0”] = 1 : Prob[“1”] = 0

Exercise 3.2 Now we will put the system into the |1⟩ state. Click on the X-gate in the gate
library on the right, and click it into the first time block as shown in the schematic below.
Hit compute. The X-gate flips the state of the qubit from |0⟩ (as per the above – QUI

!

!

0o

90o

180o

270o -90o

-180o
Re[a]

Im[a]

!

!|!| sin ”

|!| cos ”

a = Re a + . Im a = ! 234

degrees radians
0 0
90 5/2
180 5
360 25

|”⟩ = &0|0⟩ + &1|1⟩ → ini#alized in |0⟩

i.e. &+ = 1, &, = 0

&+ = &+ cosθ+ + 1 &+ sin θ+ = 1 → 4
θ+ = 0
&+ = 1

|5⟩

SIC info for 65
θ+ = 0
&+ = 1
&+ 7 = 1

|8⟩

SIC info for 68
θ, = 0
&, = 0
&, 7 = 0

&, = &, cosθ, + 1 &, sin θ, = 0 → 4
θ, = 0
&, = 0

MULT20015 Practice Class-1, Ó L. Hollenberg et al 2020- 5

qubits always initialised in |0⟩) so qubit has been put into the |1⟩ state. Hover the mouse
over the histogram in the results panel (panel below the circuit) to bring up the State Info
Cards (SICs) with the amplitude phase and magnitude values:

What are the probabilities of measuring the result “0” and “1” respectively?

Prob[“0”] = 0 : Prob[“1”] = 1

Now we will set up a non-trivial quantum superposition state in the QUI. Set to 1-qubit (if
not already) and clear any existing circuit.

Exercise 3.3 To construct our example state, start from a blank 1-qubit circuit and choose
the R-gate from the gate library (for now, don’t worry about what it is or how it works).
Click the R-gate into the first time block. Once placed in the circuit right click on the R-
gate in the circuit to bring up the editable gate menu:

Edit Parameters -> set axis to X, rotation angle to 𝜃* =
p

+
, and global phase to zero.

Hit compute and the QUI output will look like the following (bottom right):

|”⟩ = &’|0⟩ + &*|1⟩ → ini#alized in |1⟩

i.e. &’ = 0, &* = 1

&’ = &’ cosθ’ + 1 &’ sin θ’ = 0 → 4
θ’ = 0
&’ = 0

|5⟩

SIC info for 65
θ’ = 0
&’ = 0
&’ 7 = 0

|8⟩

SIC info for 68
θ* = 0
&* = 1
&* 7 = 1

&* = &* cosθ* + 1 &* sin θ* = 1 → 4
θ* = 0
&* = 1

MULT20015 Practice Class-1, Ó L. Hollenberg et al 2020- 6

Don’t worry how this gate works for now, we will just look at the final output state to
further illustrate the QUI notation for the individual complex amplitudes.

The overall quantum state at the end of this circuit is a superposition |𝜓⟩ = 𝑎)|0⟩ + 𝑎”|1⟩.
We will now inspect the individual state amplitudes in the SICs.

In the following, convert from the QUI polar notation for the complex amplitudes given in
the statue info cards (shown) to cartesian as indicated.

Verify that the state created is:

In above space provided above write the complex amplitudes in polar form, |𝑎)|𝑒$%”|0⟩ +
|𝑎”|𝑒$%#|1⟩.

What are the respective probabilities of measuring “0” and “1” states?

Prob[“0”] = +

(
: Prob[“1”] = ”

(

Exercise 3.4 Measurement on the QUI. On the same circuit in the above Exercise 3.3, add
a measurement from the gate library (“?” in the diamond symbol) in the time block after

|0i !
p
3

2
|0i+

�i
2

|1i = |0i+ |1i√3
2
𝑒$ )

1
2
𝑒-$ &/!

0
−1
2

√3
2

0

MULT20015 Practice Class-1, Ó L. Hollenberg et al 2020- 7

the R-gate. Hit compute and you will see the measurement symbol spin and settle on a
random outcome “0” or “1” according to the associated probabilities in the quantum state.
Every time you hit compute you will get a new measurement outcome. You can move the
vertical slider bar to inspect the quantum state before and after measurement.

Do you see how the state effectively collapses after any given measurement?

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.

Quantum

superposition
component

Probability

Measurement

record

# outcomes, n

Estimated Prob

= n/N

|0⟩

0.75

e.g. 77

77/100 = 0.77

|1⟩

0.25

e.g. 23

23/100 = 0.23

Exercise 3.5 To construct another example superposition state, right click on the R-gate
in the circuit to bring up the rotation gate menu again. Program some random parameters
for axis and rotation angle. Hit compute and repeat the above analyses of the amplitudes
and measurement outcome probabilities. Generate other superpositions to make sure you
understand the complex polar notation used in QUI, and the physical interpretation of the
quantum states produced in terms of measurement outcomes.

Next week we will look at how the qubit operations work, and the Bloch Sphere
representation (i.e. explain those little animations that keep popping up).