MULT20015 Lecture 3 2021 FINAL v2
MULT20015 Elements of Quantum Computing
Lecture 3
Subject outline
Lecture topics (by week)
1 – Introduction to quantum computing and maths basics
2 – Single qubit representations and logic operations
3 – Two qubit states and logic gates
4 – Multi-qubit states and quantum arithmetic
5 – Basic quantum algorithms
6 – Period finding, cryptography and quantum factoring
7 – Shor’s algorithm, post-quantum crypto, quantum key distribution
8 – Quantum search algorithms
9 – Grover search applications, optimisation problems
10 – Solving optimisation problems on quantum computers
11 – Applications in quantum machine learning
12 – Real quantum computer devices
Assignment schedule:
#1: Hand out in Week 2
#2: Hand out in Week 8
MULT20015 Elements of Quantum Computing
Lecture 3
Week 2
Lecture 3
3.1 The Bloch Sphere representation for qubits
3.2 Quantum operations on qubits
3.3 Qubit gates in matrix form and the Pauli matrices
Lecture 4
4.1 The Pauli gates X, Y and Z and the QUI
4.2 Qubit operations around non-cartesian axes – H and R gates
4.3 Programming sequences over the qubit logic gate library
4.4 Note on the context and use of angles
Practice class 2
Bloch sphere and single qubit logic operations on the QUI
MULT20015 Elements of Quantum Computing
Lecture 3
Lecture 2 recap
! | i = |a0|ei✓0 |0i+ |a1|ei✓1 |1i
A qubit in “ket” notation:
| i = a0 |0i+ a1 |1i =
✓
a0
a1
◆ Prob[“0”] = |a0|2
Prob[“1”] = |a1|2measurement
Outcome probabilityPrepared state |𝜓ñ |𝜓ñ “collapsed” toOutcome
“0”
“1”
? or
| i ! |0i
| i ! |1i
Amplitudes in polar notation
|a0|2 + |a1|2 = 1
|0i =
1
0
�
|1i =
0
1
�
| i = a0 |0i+ a1 |1i =
a0
a1
�
“matrix” notation: | i =
a0
a1
�
a0, a1 2 Ch | = [ a
⇤
0 a
⇤
1 ]dual “bra” notation:
| i =
a
b
�
|�i =
c
d
�
h |�i ⌘ h ||�i
=
⇥
a⇤ b⇤
⇤ c
d
�
= a⇤c+ b⇤d
inner product “bra-ket”: h |�i ⌘ h ||�i
=
⇥
a⇤ b⇤
⇤ c
d
�
= a⇤c+ b⇤d
MULT20015 Elements of Quantum Computing
Lecture 3
3.1 The Bloch Sphere representation for qubits
MULT20015
Lecture 3
MULT20015 Elements of Quantum Computing
Lecture 3
Recap: amplitudes in the QUI
In the QUI, phase is represented using the phase wheel colour map, and probability by histogram, e.g. two
different states:
Quantum mechanics represents the wave function. Complex numbers represent
the amplitude and phase of this wave. For a qubit we have:
ei✓ = cos ✓ + i sin ✓
Re
Im
✓
Probability
Recall:
| i = a0 |0i+ a1 |1i =
✓
a0
a1
◆
! | i = |a0|ei✓0 |0i+ |a1|ei✓1 |1i
a = Re[a] + i Im[a] = |a|ei✓ !
|a| =
p
Re[a]2 + Im[a]2
✓ = tan�1 (Im[a]/Re[a])
! | i = |a0|ei✓0 |0i+ |a1|ei✓1 |1i
! | i = |a0|ei✓0 |0i+ |a1|ei✓1 |1i
|a0|2
|a1|2
! | i = |a0|ei✓0 |0i+ |a1|ei✓1 |1i
! | i = |a0|ei✓0 |0i+ |a1|ei✓1 |1i
|a0|2
|a1|2
✓0 = 0 ✓0 = ⇡/2✓1 = ⇡/4 ✓1 = 3⇡/4
MULT20015 Elements of Quantum Computing
Lecture 3
Re-writing the state…
Recall, arbitrary qubit state:
We can rearrange as:
| i = a0 |0i+ a1 |1i =
✓
a0
a1
◆
! | i = |a0|ei✓0 |0i+ |a1|ei✓1 |1i
| i = ei✓0
⇣
|a0| |0i+ |a1|ei(✓1�✓0) |1i
⌘
= ei✓global
✓
cos
✓B
2
|0i+ sin
✓B
2
ei�B |1i
◆
|a0|2 + |a1|2 = 1
|a0| ⌘ cos
✓B
2
|a1| ⌘ sin
✓B
2
Probability normalisation:
�B ⌘ ✓1 � ✓0Where:
|a0|2 + |a1|2 = 1
NB: cos “!
#
#
+ sin “!
#
#
= 1
For single qubit we ignore global phase 𝜃$%&'(% → state expressed via “Bloch” angles 𝜃) , 𝜙)
Suggests a representation on a sphere – the Bloch Sphere
i.e.
MULT20015 Elements of Quantum Computing
Lecture 3
Re-writing the state…
So, a qubit state (global phase set to zero) can be represented by two angles:
The real variables 𝜃B and 𝜙B dictate the position of this state on the Bloch sphere.
|a0|
|a1|
𝜃B/2
Definition of 𝜃B :
| i = a0 |0i+ a1 |1i =
✓
a0
a1
◆
| i = a0 |0i+ a1 |a1i
! cos
✓B
2
|0i+ sin
✓B
2
ei�B |1i
| i = a0 |0i+ a1 |a1i
! cos
✓B
2
|0i+ sin
✓B
2
ei�B |1i
p
|a0|2 + |a1|2 = 1
|a0| ⌘ cos
✓B
2
|a1| ⌘ sin
✓B
2
�B ⌘ ✓1 � ✓0
And the azimuthal angle 𝜙) runs from 0 to 2𝜋
NB. Bloch Sphere angles distinct from amplitude polar angles…
MULT20015 Elements of Quantum Computing
Lecture 3
Qubit states on the Bloch sphere
|0i
|1i
|0i � i|1i
p
2
|0i+ |1i
p
2
|0i � |1i
p
2
|0i+ i|1i
p
2
| i
𝜃B
𝜙B
𝜃B =𝜋/2, 𝜙B=0
𝜃B=𝜋/2, 𝜙B=𝜋/2
𝜃B=𝜋/2, 𝜙B=𝜋
𝜃B =𝜋/2, 𝜙B=3𝜋/2
𝜃B=0, 𝜙B=0
𝜃B =𝜋, 𝜙B=0
| i = a0 |0i+ a1 |a1i ! cos
✓B
2
|0i+ sin
✓B
2
ei�B |1i| i = a0 |0i+ a1 |1i =
✓
a0
a1
◆
|a0| ⌘ cos
✓B
2
|a1| ⌘ sin
✓B
2
�B ⌘ ✓1 � ✓0
MULT20015 Elements of Quantum Computing
Lecture 3
Qubit states on the Bloch sphere – explicit construction
| ⟩𝜓 = cos(0/2)| ⟩0 + sin 0/2 𝑒*(,)| ⟩1 = | ⟩0
1 0 1
| ⟩𝜓 = cos(𝜋/4)| ⟩0 + sin 𝜋/4 𝑒*(𝜋)| ⟩1
= .
#
| ⟩0 − .
#
| ⟩1 = |
⟩, 1| ⟩.
#
1/ 2 1/ 2 -1
| ⟩𝜓 = cos(𝜋/4)| ⟩0 + sin 𝜋/4 𝑒*(𝜋/2)| ⟩1
= .
#
| ⟩0 + *
#
| ⟩1 = |
⟩, 2*| ⟩.
#
1/ 2 1/ 2 +i
| ⟩𝜓 = cos(𝜋/2)| ⟩0 + sin 𝜋/2 𝑒*(,)| ⟩1 = | ⟩1
0 1 1
| ⟩𝜓 = cos(𝜋/4)| ⟩0 + sin 𝜋/4 𝑒*(,)| ⟩1
= .
#
| ⟩0 + .
#
| ⟩1 = |
⟩, 2| ⟩.
#
1/ 2 11/ 2| ⟩𝜓 = cos(𝜋/4)| ⟩0 + sin 𝜋/4 𝑒*(36/2)| ⟩1
= .
#
| ⟩0 − *
#
| ⟩1 = |
⟩, 1*| ⟩.
#
1/ 2 1/ 2 -i
| i = a0 |0i+ a1 |a1i ! cos
✓B
2
|0i+ sin
✓B
2
ei�B |1i| i = a0 |0i+ a1 |1i =
✓
a0
a1
◆
|0i
|1i
|0i � i|1i
p
2
|0i+ |1i
p
2
|0i � |1i
p
2
|0i+ i|1i
p
2
| i
!B
“B
!B =#/2, “B=0
!B=#/2, “B=#/2
!B=#/2, “B=#
!B =#/2, “B=3#/2
!B=0, “B=0
!B =#, “B=0
MULT20015 Elements of Quantum Computing
Lecture 3
hXi
hY i
|0i
|1i
|0i � i|1i
p
2
|0i+ |1i
p
2
|0i+ i|1i
p
2
|0i � |1i
p
2
“Z” axis
“X” axis
“Y” axis
Qubit states on the Bloch sphere – example (Prac Class 1)
Recall, in the prac class we produced the state:
| i = a0 |0i+ a1 |a1i ! cos
✓B
2
|0i+ sin
✓B
2
ei�B |1i| i = a0 |0i+ a1 |1i =
✓
a0
a1
◆
|0i !
p
3
2
|0i+
�i
2
|1i = |0i+ |1i| i = a0 |0i+ a1 |1i =
✓
a0
a1
◆
We want to express this on the Bloch Sphere…
cos
“”
#
= 3
#
⟶ 𝜃) = 2cos1.
3
#
= 604
a0 =
3
#
i.e. |a0| = 0.866, 𝜃, = 0
a1 =
1*
#
i.e. |a1| = 0.500, 𝜃. = – 𝜋/2
sin
“”
#
= sin 30 = .
#
⟶ 𝑒*5″ = −𝑖
⟶ 𝜙)= – 904
𝜙! = 𝜃”- 𝜃# = −
$
%
= −90&
𝜃B
𝜙B
|0i !
p
3
2
|0i+
�i
2
|1i = |0i+ |1i| i = a0 |0i+ a1 |1i =
✓
a0
a1
◆
MULT20015 Elements of Quantum Computing
Lecture 3
Qubit states on the Bloch sphere – example (Prac Class 1)
Recall, in the prac class we produced the state:
| i = a0 |0i+ a1 |a1i ! cos
✓B
2
|0i+ sin
✓B
2
ei�B |1i| i = a0 |0i+ a1 |1i =
✓
a0
a1
◆
|0i !
p
3
2
|0i+
�i
2
|1i = |0i+ |1i| i = a0 |0i+ a1 |1i =
✓
a0
a1
◆
We want to express this on the Bloch Sphere…
a0 =
3
#
i.e. |a0| = 0.866, 𝜃, = 0
a1 =
1*
#
i.e. |a1| = 0.500, 𝜃. = – 𝜋/2
𝜙! = 𝜃”- 𝜃# = −
$
%
= −90&
hXi
hY i
|0i
|1i
|0i � i|1i
p
2
|0i+ |1i
p
2
|0i+ i|1i
p
2
|0i � |1i
p
2
“Z” axis
“X” axis
“Y” axis
𝜃B
𝜙B
|0i !
p
3
2
|0i+
�i
2
|1i = |0i+ |1i| i = a0 |0i+ a1 |1i =
✓
a0
a1
◆
QUI Bloch spheres:
| ⟩𝜓 =| ⟩0 | ⟩𝜓6 =
3
2
| ⟩0 +
−𝑖
2
| ⟩1
MULT20015 Elements of Quantum Computing
Lecture 3
The Bloch Sphere – Cartesian Axes
hXi
hY i
|0i
|1i
|0i � i|1i
p
2
|0i+ |1i
p
2
| i
|0i+ i|1i
p
2
|0i � |1i
p
2
| i = a0 |0i+ a1 |a1i ! cos
✓B
2
|0i+ sin
✓B
2
ei�B |1i| i = a0 |0i+ a1 |1i =
✓
a0
a1
◆
x
z
y
C/f cartesian axes labelling:
“Z” axis
“X” axis
“Y” axis
These X, Y and Z axes are not our usual “real space” cartesian axes…these are a
representation of the space in which the single-qubit states live…
…but they are used a lot in describing quantum logic operations!
Bloch sphere representation:
MULT20015 Elements of Quantum Computing
Lecture 3
3.2 Quantum operations on qubits
MULT20015
Lecture 3
MULT20015 Elements of Quantum Computing
Lecture 3
Quantum operations in general
| 0i = U | i
A quantum operation “U ” takes a state | ⟩𝜓 and changes it to a new state | ⟩𝜓6
| ⟩𝜓 | ⟩𝜓| ⟩0 + 𝑎?| ⟩1
Circuit symbol:
x
z
y
On the computational states the X-gate operation
is a “bit flip”:
X| ⟩0 = | ⟩1
X| ⟩1 = | ⟩0
a0 |0i+ a1 |1i ! a1 |0i+ a0 |1i
X (a0 |0i+ a1 |1i) =
0 1
1 0
�
a0
a1
�
=
a1
a0
�
i.e. X (a0 |0i+ a1 |1i) = a1 |0i+ a0 |1i
Quantum mechanics is inherently linear, so the
X-gate acting on a linear superposition is:
X
Or we can write in “ket” notation:
hXi
hY i
|0i
|1i
“Z” axis
“X” axis
“Y” axis
|”!⟩
X-gate: rotate around X-axis by !
|”⟩
MULT20015 Elements of Quantum Computing
Lecture 3
3.3 Qubit gates in matrix form and the Pauli matrices
MULT20015
Lecture 3
MULT20015 Elements of Quantum Computing
Lecture 3
The X gate in matrix form
|0i =
1
0
�
|1i =
0
1
�
| i = a0 |0i+ a1 |1i =
a0
a1
�
Recall “matrix”
notation:
| i =
a0
a1
�
a0, a1 2 C
𝑎! ⟩0 + 𝑎” ⟩1 =
𝑎!
𝑎”
⟶ 𝑎” ⟩0 + 𝑎! ⟩1 =
𝑎”
𝑎!
a0 |0i+ a1 |1i ! a1 |0i+ a0 |1i
X
Action of X-gate in “ket” form:
What is the X-gate in “matrix” form?
𝑎,
𝑎.
⟶
𝑎.
𝑎,
X
𝑎,
6
𝑎.
6
𝑎,
𝑎.
| ⟩𝜓! = 𝑈 | ⟩𝜓
= 2 x 2matrix
Operations in matrix representation:
Action of X-gate in matrix form:
i.e.
In matrix notation, in general:
X
𝑎!
𝑎”
= 0 1
1 0
𝑎!
𝑎”
=
𝑎”
𝑎!𝑋 =
0 1
1 0
MULT20015 Elements of Quantum Computing
Lecture 3
The X gate in matrix form – the Pauli matrices
| ⟩𝜓! = 𝑋 | ⟩𝜓
𝑎,
6
𝑎.
6
𝑎,
𝑎.=
0 1
1 0
𝑋 = 0 1
1 0
This is the so-called
Pauli X matrix…one of
three Pauli matrices
representing X, Y and Z
operations…
Y= 0 −𝑖
𝑖 0
Z= 1 0
0 −1
𝑋 = 0 1
1 0
All cartesian axes – the Pauli matrices for X, Y and Z:
hXi
hY i
|0i
|1i
“Z” axis
“X” axis
“Y” axis
|”!⟩
X-gate: rotate around X-axis by !
|”⟩
hXi
hY i
|0i
|1i
“Z” axis
“X” axis
“Y” axis
Z-gate: rotate around Z-axis by !
|”!⟩
|”⟩
hXi
hY i
|0i
|1i
“Z” axis
“X” axis
“Y” axis
Y-gate: rotate around Y-axis by !
|”!⟩
|”⟩
MULT20015 Elements of Quantum Computing
Lecture 3
Week 2
Lecture 3
3.1 The Bloch Sphere representation for qubits
3.2 Quantum operations on qubits
3.3 Qubit gates in matrix form and the Pauli matrices
Lecture 4
4.1 The Pauli gates X, Y and Z and the QUI
4.2 Qubit operations around non-cartesian axes – H and R gates
4.3 Programming sequences over the qubit logic gate library
4.4 Note on the context and use of angles
Practice class 2
Bloch sphere and single qubit logic operations on the QUI
MULT20015 Elements of Quantum Computing
Lecture 3
Subject outline
Lecture topics (by week)
1 – Introduction to quantum computing and maths basics
2 – Single qubit representations and logic operations
3 – Two qubit states and logic gates
4 – Multi-qubit states and quantum arithmetic
5 – Basic quantum algorithms
6 – Period finding, cryptography and quantum factoring
7 – Shor’s algorithm, post-quantum crypto, quantum key distribution
8 – Quantum search algorithms
9 – Grover search applications, optimisation problems
10 – Solving optimisation problems on quantum computers
11 – Applications in quantum machine learning
12 – Real quantum computer devices
Assignment schedule:
#1: Hand out in Week 2
#2: Hand out in Week 8