CS计算机代考程序代写 algorithm MULT20015 Lecture 5 2021 FINAL

MULT20015 Lecture 5 2021 FINAL

MULT20015 Elements of Quantum Computing
Lecture 5

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 5

Week 3

Lecture 5
5.1 Two-qubit systems
5.2 Two qubit example – independent Alice and Bob
5.3 General two qubit states: measurement and operations

Lecture 6
6.1 Two-qubit logic operations
6.2 Entanglement

Practice class 3
Two qubit states and operations

MULT20015 Elements of Quantum Computing
Lecture 5

Recap: angles in context – abundant use of 𝜃

Angle specifying position on the Bloch sphere:

Phase angle of complex amplitudes in polar coordinates:

Re a

Im a

✓a

|a|

Angle of rotation of a qubit state on the Bloch sphere about a
specified axis (unit vector), n:

| i = a0 |0i+ a1 |a1i ! cos
✓B
2

|0i+ sin
✓B
2
ei�B |1i

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

a0
a1


! | i = |a0|ei✓0 |0i+ |a1|ei✓1 |1i

| 0i = Rn̂(✓R) | i

𝜃!

𝜙!

MULT20015 Elements of Quantum Computing
Lecture 5

Lecture 4 recap: X Gate (the X operator): 𝜋 around X-axis

X =


0 1
1 0


Circuit symbol:

Matrix representation:

Action on ket states:

QUI example:

Re

Im

i

-i

-1 +1

x

z

y

p
3

2
|0i+

�i
2

|1i complexamplitudes

↵|0i+ �|1i ! ↵|1i+ �|0i↵|0i+ �|1i ! ↵|1i+ �|0i↵|0i+ �|1i ! ↵|1i+ �|0i↵|0i+ �|1i ! ↵|1i+ �|0i

X (a0 |0i+ a1 |1i) =

0 1
1 0

� 
a0
a1


=


a1
a0

i.e. X (a0 |0i+ a1 |1i) = a1 |0i+ a0 |1i

a0 |0i+ a1 |1i ! a1 |0i+ a0 |1i

�i
2

|0i+
p
3

2
|1i

MULT20015 Elements of Quantum Computing
Lecture 5

Lecture 4 recap: H Gate (Hadamard): 𝜋 around X+Z-axis

Circuit symbol:

Matrix representation:

Action on ket states:

x

z

y

QUI example:

Re

Im

i

-i

-1 +1p
3

2
|0i+

�i
2

|1i complexamplitudes

H =
1
p
2


1 1
1 �1

|0i !
|0i+ |1i

p
2

|1i !
|0i � |1i

p
2

a0 |0i+ a1 |1i !
a0 + a1p

2
|0i+

a0 � a1p
2

|1i

|0i !
|0i+ |1i

p
2

|1i !
|0i � |1i

p
2

a0 |0i+ a1 |1i !
a0 + a1p

2
|0i+

a0 � a1p
2

|1i

↵|0i+ �|1i ! ↵|1i+ �|0i↵|0i+ �|1i ! ↵|1i+ �|0i↵|0i+ �|1i ! ↵|1i+ �|0i↵|0i+ �|1i ! ↵|1i+ �|0i

p
3� i
2
p
2

|0i+
p
3 + i

2
p
2

|1i

MULT20015 Elements of Quantum Computing
Lecture 5

Lecture 4 recap: the single qubit gate library

With the qubit maths background – complex amplitudes, Bloch sphere, Pauli operations etc
we covered all the single qubit gates in the QUI library…

MULT20015 Elements of Quantum Computing
Lecture 5

5.1 Two qubit systems

MULT20015
Lecture 5

MULT20015 Elements of Quantum Computing
Lecture 5

|0ñ “and” |1ñ

|0ñ

state collapse ® random
outcome

quantum superposition
measurement/observation

|1ñ

|0ñY|0i

|1i

Recap: quantum superposition/measurement

Bubble: Brocken commons.wikimedia.org
Bursting bubble: wallpaperswide.com

One electron in quantum
superposition.

For a single qubit :

MULT20015 Elements of Quantum Computing
Lecture 5

Recap: qubits and binary numbers

Computers represent digits as binary numbers. Similarly, we can think as the
state of several qubits as a binary digits.

|0i

|1i

|0i

|1i

|0i

|1i

For example, the number 5 can be represented in binary as
101, and this can be encoded directly in the state of three
individual atoms.

This lecture we will talk about how we describe and control two-qubit systems…

MULT20015 Elements of Quantum Computing
Lecture 5

Two qubits: tensor product

| i = a|0i+ b|1i |�i = c|0i+ d|1i

Then the joint state of both atoms is:

| i ⌦ |�i

Tensor product!

Two atoms, each with one
electron in a superposition of
the computational basis states:

MULT20015 Elements of Quantum Computing
Lecture 5

Tensor product -> binaries

For these two atoms in the states indicated:

| i ⌦ |�i = (a|0i+ b|1i)⌦ (c|0i+ d|1i)
= ac |0i ⌦ |0i+ ad |0i ⌦ |1i+ bc |1i ⌦ |0i+ bd |1i ⌦ |1i
= ac |00i+ ad |01i+ bc |10i+ bd |11i

| i = a|0i+ b|1i |�i = c|0i+ d|1i

multiplying them out

Note the simpler “consolidated” notation, e.g. ⟩|0 ⊗ ⟩|1 → ⟩|01 , with qubit ordering implied.

Two atoms, each with one
electron in a superposition of
the computational basis states:

MULT20015 Elements of Quantum Computing
Lecture 5

Tensor product -> binaries

So, for two general qubits in the states indicated:

| i ⌦ |�i = (a|0i+ b|1i)⌦ (c|0i+ d|1i)
= ac |0i ⌦ |0i+ ad |0i ⌦ |1i+ bc |1i ⌦ |0i+ bd |1i ⌦ |1i
= ac |00i+ ad |01i+ bc |10i+ bd |11i

| i = a|0i+ b|1i |�i = c|0i+ d|1i

The binary number representation {00, 01, 10, 11} now becomes more apparent…

i.e. Binary {00, 01, 10, 11} <-> Decimal {0, 1 , 2, 3}

| i ⌦ |�i = (a|0i+ b|1i)⌦ (c|0i+ d|1i)
= ac |0i ⌦ |0i+ ad |0i ⌦ |1i+ bc |1i ⌦ |0i+ bd |1i ⌦ |1i
= ac |00i+ ad |01i+ bc |10i+ bd |11i

The two-qubit state is usually written as:

“consolidated” notation, e.g. ⟩|0 ⊗ ⟩|1 → ⟩|01

qubit 1 qubit 2

MULT20015 Elements of Quantum Computing
Lecture 5

Tensor product of vectors


a
b



c
d


=

2

66
4

ac
ad
bc
bd

3

77
5

00 amplitude
01 amplitude
10 amplitude
11 amplitude

| i = a|0i+ b|1i |�i = c|0i+ d|1i

|0i =

1
0

|1i =

0
1

| i =

a0
a1

a0, a1 2 C

Recall matrix notation:

MULT20015 Elements of Quantum Computing
Lecture 5

Tensor product of operators

Similarly, we can define a Kronecker tensor product of qubit operators:


a b
c d



m n
p q


=

2

66
4

am an bm bn
ap aq bp bq
cm cn dm dn
cp cq dp dq

3

77
5

AAADx3icdVJNj9MwEHUTPpbw1YUjF4sKxKlKEBJ7QVppL3BbJLpdqYnKxJm2Vh0nsZ1loygH/h7/gB/A/8DpBrFNsyNZenoz89547DgXXBvf/z1y3Hv3Hzw8euQ9fvL02fPx8YsLnZWK4YxlIlOXMWgUXOLMcCPwMlcIaSxwHm/P2vz8CpXmmfxmqhyjFNaSrzgDY6nl8ehXKHBlFjSMcc1lDUpB1dSMNRToWxruHGqFSUNjGob/iFiU2FD2v6JCIbIfDU1oiDLpZGio+HpjIhpmhqeovTu9UqskW/3cgmJQ49Nd3W2/B60CyP7IaZ9oTTxoXaDo5/J9Ii7a2v0L39LrGDmwg3SAk4di+YFYMdCYD3CFN7Si5XjiT/1d0EMQdGBCujhfjv+EScbKFKVhArReBH5uIqtqOBPYeGGpMQe2hTUuLJRg3zCqd7M09I1lErrKlD3S0B17u6OGVOsqjW1lCmaj+7mWHMotSrM6iWou89KgZDdGq1JQk9H2B9OEK2RGVBYAU9zOStkGFDBj//meS6xgi6axewn6WzgEF++ngT8Nvn6YnJ50Gzoir8hr8o4E5CM5JZ/JOZkR5gTO3PnugPvFzdwr9/qm1Bl1PS/JXrg//wJuJzl4AAADx3icdVJNj9MwEHUTPpbw1YUjF4sKxKlKEBJ7QVppL3BbJLpdqYnKxJm2Vh0nsZ1loygH/h7/gB/A/8DpBrFNsyNZenoz89547DgXXBvf/z1y3Hv3Hzw8euQ9fvL02fPx8YsLnZWK4YxlIlOXMWgUXOLMcCPwMlcIaSxwHm/P2vz8CpXmmfxmqhyjFNaSrzgDY6nl8ehXKHBlFjSMcc1lDUpB1dSMNRToWxruHGqF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ppL3BbJLpdqYnKxJm2Vh0nsZ1loygH/h7/gB/A/8DpBrFNsyNZenoz89547DgXXBvf/z1y3Hv3Hzw8euQ9fvL02fPx8YsLnZWK4YxlIlOXMWgUXOLMcCPwMlcIaSxwHm/P2vz8CpXmmfxmqhyjFNaSrzgDY6nl8ehXKHBlFjSMcc1lDUpB1dSMNRToWxruHGqFSUNjGob/iFiU2FD2v6JCIbIfDU1oiDLpZGio+HpjIhpmhqeovTu9UqskW/3cgmJQ49Nd3W2/B60CyP7IaZ9oTTxoXaDo5/J9Ii7a2v0L39LrGDmwg3SAk4di+YFYMdCYD3CFN7Si5XjiT/1d0EMQdGBCujhfjv+EScbKFKVhArReBH5uIqtqOBPYeGGpMQe2hTUuLJRg3zCqd7M09I1lErrKlD3S0B17u6OGVOsqjW1lCmaj+7mWHMotSrM6iWou89KgZDdGq1JQk9H2B9OEK2RGVBYAU9zOStkGFDBj//meS6xgi6axewn6WzgEF++ngT8Nvn6YnJ50Gzoir8hr8o4E5CM5JZ/JOZkR5gTO3PnugPvFzdwr9/qm1Bl1PS/JXrg//wJuJzl4

!!”
!#”

!!
!#

|”!⟩ = & |”⟩
= 2 x 2matrix

Recall, single qubit operators -> 2×2 matrix

MULT20015 Elements of Quantum Computing
Lecture 5

5.2 Two qubit example – independent Alice and Bob

MULT20015
Lecture 5

MULT20015 Elements of Quantum Computing
Lecture 5

Two qubit independent superposition state, and measure

The combined quantum state (tensor product):

| alice&bobi = | alicei ⇥ | bobi

= (
1
p
2
|0i+

1
p
2
|1i)⇥ (

1
p
2
|0i+

1
p
2
|1i)

=
1

2
|0i |0i+

1

2
|0i |1i+

1

2
|1i |0i+

1

2
|1i |1i

=
1

2
|00i+

1

2
|01i+

1

2
|10i+

1

2
|11i

| alice&bobi = | alicei ⇥ | bobi

= (
1
p
2
|0i+

1
p
2
|1i)⇥ (

1
p
2
|0i+

1
p
2
|1i)

=
1

2
|0i |0i+

1

2
|0i |1i+

1

2
|1i |0i+

1

2
|1i |1i

=
1

2
|00i+

1

2
|01i+

1

2
|10i+

1

2
|11i

No gate linking the two qubits,
so Bob’s superposition unchanged…

|0ñ

|1ñ

Alice qubit

| alicei =
1
p
2
|0i+

1
p
2
|1i

| alicei = H |0i

Bob qubit

| bobi =
1
p
2
|0i+

1
p
2
|1i

| bobi = H |0i

|0ñ

|1ñ
Alice qubit Bob qubit

e.g. outcome = “0”

?

| alice&bobi ! |0i ⇥

1
p
2
|0i+

1
p
2
|1i

meas. no
meas.

| alice&bobi =

1
p
2
|0i+

1
p
2
|1i



1
p
2
|0i+

1
p
2
|1i


Alice qubit Bob qubit

Now, let’s make a measurement on e.g. Alice:

Let’s do an example in more detail…consider this code where we apply
a H-gate to each initialized qubit, but no “linking” gates (e.g. CNOT) yet
–> we’ll name the qubits for clarity…Top = “Alice”, bottom = “Bob”

“Alice”

“Bob”

MULT20015 Elements of Quantum Computing
Lecture 5

Summary of measurement scenarios

Measure Alice only| alice&bobi = | alicei ⇥ | bobi

= (
1
p
2
|0i+

1
p
2
|1i)⇥ (

1
p
2
|0i+

1
p
2
|1i)

=
1

2
|0i |0i+

1

2
|0i |1i+

1

2
|1i |0i+

1

2
|1i |1i

=
1

2
|00i+

1

2
|01i+

1

2
|10i+

1

2
|11i

0

| alice&bobi ! |0i ⇥

1
p
2
|0i+

1
p
2
|1i

| alice&bobi =

1
p
2
|0i+

1
p
2
|1i



1
p
2
|0i+

1
p
2
|1i


Alice qubit Bob qubit

| alice&bobi = | alicei ⇥ | bobi

= (
1
p
2
|0i+

1
p
2
|1i)⇥ (

1
p
2
|0i+

1
p
2
|1i)

=
1

2
|0i |0i+

1

2
|0i |1i+

1

2
|1i |0i+

1

2
|1i |1i

=
1

2
|00i+

1

2
|01i+

1

2
|10i+

1

2
|11i

1

!

1
p
2
|0i+

1
p
2
|1i


⇥ |0i

!

1
p
2
|0i+

1
p
2
|1i


⇥ |1i! |1i ⇥


1
p
2
|0i+

1
p
2
|1i

| alice&bobi = | alicei ⇥ | bobi

= (
1
p
2
|0i+

1
p
2
|1i)⇥ (

1
p
2
|0i+

1
p
2
|1i)

=
1

2
|0i |0i+

1

2
|0i |1i+

1

2
|1i |0i+

1

2
|1i |1i

=
1

2
|00i+

1

2
|01i+

1

2
|10i+

1

2
|11i

0

| alice&bobi = | alicei ⇥ | bobi

= (
1
p
2
|0i+

1
p
2
|1i)⇥ (

1
p
2
|0i+

1
p
2
|1i)

=
1

2
|0i |0i+

1

2
|0i |1i+

1

2
|1i |0i+

1

2
|1i |1i

=
1

2
|00i+

1

2
|01i+

1

2
|10i+

1

2
|11i

1

Measure Bob only
Measure “0” on Alice

Measure “1” on Alice

Measure “0” on Bob

Measure “1” on Bob

If we measure one of the qubits we get a partial collapse of the quantum state:

Bob will get “0” or “1” at random no matter Alice qubit result Alice will get “0” or “1” at random no matter Bob qubit result

“Alice”

“Bob”

⊗ ⊗

MULT20015 Elements of Quantum Computing
Lecture 5

Two qubits – binary and decimal representations

|0ñ

|1ñ

Alice qubit

| alicei =
1
p
2
|0i+

1
p
2
|1i

| alicei = H |0i

Bob qubit

| bobi =
1
p
2
|0i+

1
p
2
|1i

| bobi = H |0i

|0ñ

|1ñ

“Alice”

“Bob”

Binary representation:

| alice&bobi = | alicei ⇥ | bobi

= (
1
p
2
|0i+

1
p
2
|1i)⇥ (

1
p
2
|0i+

1
p
2
|1i)

=
1

2
|0i |0i+

1

2
|0i |1i+

1

2
|1i |0i+

1

2
|1i |1i

=
1

2
|00i+

1

2
|01i+

1

2
|10i+

1

2
|11i

| alice&bobi = | alicei ⇥ | bobi

= (
1
p
2
|0i+

1
p
2
|1i)⇥ (

1
p
2
|0i+

1
p
2
|1i)

=
1

2
|0i |0i+

1

2
|0i |1i+

1

2
|1i |0i+

1

2
|1i |1i

=
1

2
|00i+

1

2
|01i+

1

2
|10i+

1

2
|11i

Alice Bob

Decimal representation:

| alice&bobi

=
1

2
|00i+

1

2
|01i+

1

2
|10i+

1

2
|11i

=
1

2
|0i+

1

2
|1i+

1

2
|2i+

1

2
|3i

| alice&bobi = | alicei ⇥ | bobi

= (
1
p
2
|0i+

1
p
2
|1i)⇥ (

1
p
2
|0i+

1
p
2
|1i)

=
1

2
|0i |0i+

1

2
|0i |1i+

1

2
|1i |0i+

1

2
|1i |1i

=
1

2
|00i+

1

2
|01i+

1

2
|10i+

1

2
|11i

QUI:
“binary

notation”

QUI:
“decimal
notation”

etc

Measure both qubits: e.g. Prob “01” = 1/4 etc (all same)

Measure both qubits: e.g. Prob “3” = 1/4 etc (all same)

Binary ® decimal representation:

00 ® 0, 01 ® 1, 10 ® 2, 11 ® 3

MULT20015 Elements of Quantum Computing
Lecture 5

Binary and decimal in the QUI

| alice&bobi = | alicei ⇥ | bobi

= (
1
p
2
|0i+

1
p
2
|1i)⇥ (

1
p
2
|0i+

1
p
2
|1i)

=
1

2
|0i |0i+

1

2
|0i |1i+

1

2
|1i |0i+

1

2
|1i |1i

=
1

2
|00i+

1

2
|01i+

1

2
|10i+

1

2
|11i

| alice&bobi

=
1

2
|00i+

1

2
|01i+

1

2
|10i+

1

2
|11i

=
1

2
|0i+

1

2
|1i+

1

2
|2i+

1

2
|3i

| alice&bobi = | alicei ⇥ | bobi

= (
1
p
2
|0i+

1
p
2
|1i)⇥ (

1
p
2
|0i+

1
p
2
|1i)

=
1

2
|0i |0i+

1

2
|0i |1i+

1

2
|1i |0i+

1

2
|1i |1i

=
1

2
|00i+

1

2
|01i+

1

2
|10i+

1

2
|11i

binary: amplitude “𝑎!!” = 1/2

deci
mal:

“𝑎!”
= 1/

2

binary amplitude “𝑎””” = 1/2

decimal: “𝑎#” = 1/2

MULT20015 Elements of Quantum Computing
Lecture 5

Two-qubit example: measurement scenarios

| alice&bobi =

1
p
2
|0i+

1
p
2
|1i



1
p
2
|0i+

1
p
2
|1i

◆Alice qubit Bob qubit

Measure both of the qubits we get a total collapse of the quantum state over the register:

| alice&bobi = | alicei ⇥ | bobi

= (
1
p
2
|0i+

1
p
2
|1i)⇥ (

1
p
2
|0i+

1
p
2
|1i)

=
1

2
|0i |0i+

1

2
|0i |1i+

1

2
|1i |0i+

1

2
|1i |1i

=
1

2
|00i+

1

2
|01i+

1

2
|10i+

1

2
|11i

| alice&bobi = | alicei ⇥ | bobi

= (
1
p
2
|0i+

1
p
2
|1i)⇥ (

1
p
2
|0i+

1
p
2
|1i)

=
1

2
|0i |0i+

1

2
|0i |1i+

1

2
|1i |0i+

1

2
|1i |1i

=
1

2
|00i+

1

2
|01i+

1

2
|10i+

1

2
|11i

Alice qubit Bob qubit

Binary number
representation

Alice qubit

Bob qubit

outcome binary decimal

0 0 00 0

0 1 01 1

1 0 10 2

1 1 11 3

probability

0.25

0.25

0.25

0.25

a00 = 0.5

Prob[00] = a002= 0.25 etc

So far we have used a simple even (independent) superposition as our
example two-qubit state…we will consider it more generally now…

MULT20015 Elements of Quantum Computing
Lecture 5

5.3 General two qubit states: measurement and operations

MULT20015
Lecture 5

MULT20015 Elements of Quantum Computing
Lecture 5

Two-qubit measurement & collapse

Measurement on a two-qubit state:

(1) Apply collapse principle to the measured state
(2) Renormalize the state probabilities

For example, consider the
general two-qubit state:

If the first qubit were measured to be “0”, keep
only those states and renormalize to get the
new state:

| i = a |00i+ b |01i+ c |10i+ d |11i
AAACNXicbZDLSgMxFIYzXmu9jbp0EyyCIJSMCFZBKLhxWcGxhc5QMpm0Dc1cSDJCGeZdfAyfwK1u3bhSt76CmcvCtv4Q+PKfczjJ78WcSYXQu7G0vLK6tl7bqG9ube/smnv7DzJKBKE2iXgkeh6WlLOQ2oopTnuxoDjwOO16k5u83n2kQrIovFfTmLoBHoVsyAhW2hqYV86EqtSJJcvgNcTFDaEMnkKvZCtnUrBV+H7JVjYwG6iJCsFFsCpogEqdgfnl+BFJAhoqwrGUfQvFyk2xUIxwmtWdRNIYkwke0b7GEAdUumnxxwwea8eHw0joEypYuH8nUhxIOQ083RlgNZbztdz8r9ZP1LDlpiyME0VDUi4aJhyqCOaBQZ8JShSfasBEMP1WSMZYYKJ0rDNbPIF1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cXiDCukw==AAACO3icbZDLSgMxFIYz9X6vunQTLKIglJkiqAuh4MZlBWuFTi1n0kwbmrmYnBHKdF7Hx/AJ3Cq41424dW96WdjWAyE//38OJ/m8WAqNtv1u5ebmFxaXlldW19Y3Nrfy2zu3OkoU41UWyUjdeaC5FCGvokDJ72LFIfAkr3ndy0Fee+RKiyi8wV7MGwG0Q+ELBmisZr7sdjmmbqzFYUYvqOsrYCkMTdvO6DH1RtrJstTVDwrTPvTvSyboe+bOsma+YBftYdFZ4YxFgYyr0sx/uq2IJQEPkUnQuu7YMTZSUCiY5Nmqm2geA+tCm9eNDCHgupEOf5rRA+O0qB8pc0KkQ/fvRAqB1r3AM50BYEdPZwPzv6yeoH/WSEUYJ8hDNlrkJ5JiRAfYaEsozlD2jACmhHkrZR0wsNDAndjiKTDEBlycaQqzoloqnhft65NC+WwMaJnskX1yRBxySsrkilRIlTDyRF7IK3mznq0P68v6HrXmrPHMLpko6+cXiDCukw==

re-normalization

Later: this generalizes to measurements on multi-qubit states.

If the first qubit were measured to be “1”, keep
only those states and renormalize to get the
new state:

| 0i =
c |10i+ d |11i
p

|c|2 + |d|2

e.g. “c” is the
complex amplitude

for the ⟩|10 state etc

MULT20015 Elements of Quantum Computing
Lecture 5

Explicit example – QUI does all this for you

⟩|𝜓 = !

𝑒#$/& ⟩|00 + !


𝑒#$/( ⟩|01 + !


𝑒#$/& ⟩|10 + !


𝑒#$/( ⟩|11

Measure “0” on 1st qubit:

⟩|𝜓 →

1
6
𝑒
#$
& ⟩|00 + 1

3
𝑒
#$
( ⟩|01

|𝑒
#$
& / 6|&+|𝑒

#$
( / 3|&

=
1
3
𝑒
#$
& ⟩|00 +

2
3
𝑒
#$
( ⟩|01

Measure “1” on 1st qubit:

⟩|𝜓 →

1
6
𝑒
#$
& ⟩|10 + 1

3
𝑒
#$
( ⟩|11

|𝑒
#$
& / 6|&+|𝑒

#$
( / 3|&

=
1
3
𝑒
#$
& ⟩|10 +

2
3
𝑒
#$
( ⟩|11

NB. Scale has changed!

NB. Scale has changed!

MULT20015 Elements of Quantum Computing
Lecture 5

Single qubit gates on multi-qubit systems

We can apply single-qubit operators to multi-qubit systems:

To work out the operator we are applying in matrix representation, we use the
Kronecker (tensor) product with the identity matrix, e.g.:

X ⌦ I =

0 1
1 0



1 0
0 1

=

2

66
4

0 0 1 0
0 0 0 1
1 0 0 0
0 1 0 0

3

77
5

AAADznicdVJNi9swEFXsfmzdr2x77EU0tPQU5FJoLoWFvbS3FJrdQOQGWR47IvIHkrwlGLPX/r0e+wP6Pyo73tI4jsAwejPz3syzwkIKbQj5PXLce/cfPDx75D1+8vTZ8/H5iyudl4rDgucyV8uQaZAig4URRsKyUMDSUMJ1uL1s8tc3oLTIs29mV0CQsiQTseDMWGh9Pvq1xDQ3IgWNv+C3+BP2qITYrDANIRFZxZRiu7rivMbE5mkrWSmIauxjSu+AUJbQIP8qdiBl/qNpopBFHQ2mSiQbE9xJntZqmEjD34j6wxzUs/OeomhIPNKy9Kc+vDcqg4VD63qn1t0DZGj/IUt6RKRPNGjkMeQNGbMeT8iUtAcfB34XTFB35uvxHxrlvEwhM1wyrVc+KUxgWY3gEmqPlhoKxrcsgZUNM2b/XFC1o9T4jUUiHOfKfpnBLfp/R8VSrXdpaCtTZja6n2vAodyqNPEsqERWlAYyvheKS4lNjpuHjCOhgBu5swHjSthZMd8wxbixz/1AJVRsC6a2vvh9F46Dq/dTn0z9rx8mF7POoTP0Cr1G75CPPqIL9BnN0QJxZ+Z8dxJn487dG7d2b/elzqjreYkOjvvzL+8HM6s=AAADznicdVJNi9swEFXsfmzdr2x77EU0tPQU5FJoLoWFvbS3FJrdQOQGWR47IvIHkrwlGLPX/r0e+wP6Pyo73tI4jsAwejPz3syzwkIKbQj5PXLce/cfPDx75D1+8vTZ8/H5iyudl4rDgucyV8uQaZAig4URRsKyUMDSUMJ1uL1s8tc3oLTIs29mV0CQsiQTseDMWGh9Pvq1xDQ3IgWNv+C3+BP2qITYrDANIRFZxZRiu7r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LPX/r0e+wP6Pyo73tI4jsAwejPz3syzwkIKbQj5PXLce/cfPDx75D1+8vTZ8/H5iyudl4rDgucyV8uQaZAig4URRsKyUMDSUMJ1uL1s8tc3oLTIs29mV0CQsiQTseDMWGh9Pvq1xDQ3IgWNv+C3+BP2qITYrDANIRFZxZRiu7rivMbE5mkrWSmIauxjSu+AUJbQIP8qdiBl/qNpopBFHQ2mSiQbE9xJntZqmEjD34j6wxzUs/OeomhIPNKy9Kc+vDcqg4VD63qn1t0DZGj/IUt6RKRPNGjkMeQNGbMeT8iUtAcfB34XTFB35uvxHxrlvEwhM1wyrVc+KUxgWY3gEmqPlhoKxrcsgZUNM2b/XFC1o9T4jUUiHOfKfpnBLfp/R8VSrXdpaCtTZja6n2vAodyqNPEsqERWlAYyvheKS4lNjpuHjCOhgBu5swHjSthZMd8wxbixz/1AJVRsC6a2vvh9F46Dq/dTn0z9rx8mF7POoTP0Cr1G75CPPqIL9BnN0QJxZ+Z8dxJn487dG7d2b/elzqjreYkOjvvzL+8HM6s=

Simplest way to think of it: the
subscript represents which qubit
the operation is applied to.

Identity is
applied to
second qubit
where there’s
no operation

X1 |00i = |10i
X2 |00i = |01i

AAACLnicbZDLSgMxFIYz9VbrbdSlm2ARXJWkCHYjFNy4rGDbgc4wZNJMG5q5kGSEMsx7+Bg+gVt9AsGFuBJ8DNN2Frb1QODj/8/hnPxBKrjSCH1YlY3Nre2d6m5tb//g8Mg+PumpJJOUdWkiEukERDHBY9bVXAvmpJKRKBCsH0xuZ37/kUnFk/hBT1PmRWQU85BToo3k203Hx9CdMJ0jVMCbBWKDrltz/OaahXDh23XUQPOC64BLqIOyOr797Q4TmkUs1lQQpQYYpdrLidScClbU3EyxlNAJGbGBwZhETHn5/G8FvDDKEIaJNC/WcK7+nchJpNQ0CkxnRPRYrXoz8T9vkOmw5eU8TjPNYrpYFGYC6gTOgoJDLhnVYmqAUMnNrZCOiSRUmziXtgSSmGhmueDVFNah12xg1MD3V/V2q0yoCs7AObgEG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GDbgc4wZNJMG5q5kGSEMsx7+Bg+gVt9AsGFuBJ8DNN2Frb1QODj/8/hnPxBKrjSCH1YlY3Nre2d6m5tb//g8Mg+PumpJJOUdWkiEukERDHBY9bVXAvmpJKRKBCsH0xuZ37/kUnFk/hBT1PmRWQU85BToo3k203Hx9CdMJ0jVMCbBWKDrltz/OaahXDh23XUQPOC64BLqIOyOr797Q4TmkUs1lQQpQYYpdrLidScClbU3EyxlNAJGbGBwZhETHn5/G8FvDDKEIaJNC/WcK7+nchJpNQ0CkxnRPRYrXoz8T9vkOmw5eU8TjPNYrpYFGYC6gTOgoJDLhnVYmqAUMnNrZCOiSRUmziXtgSSmGhmueDVFNah12xg1MD3V/V2q0yoCs7AObgEGFyDNrgDHdAFFDyBF/AK3qxn6936tL4WrRWrnDkFS2X9/ALuz6a8

(X ⌦ I) |0i ⌦ |0i
(I ⌦X) |0i ⌦ |0i

MULT20015 Elements of Quantum Computing
Lecture 5

Shorthand notation for multi-qubit states/operations

We write as: ⟩|𝜓(𝑡 = 1) = 𝐻&𝐻! ⟩|00 where:

𝐻!applies a H-gate to qubit #1 in t=0->1

𝐻&applies a H-gate to qubit #2 in t=0->1

Note for operators on different qubits, order doesn’t matter:
i.e. we can write ⟩|𝜓(𝑡 = 1) = 𝐻!𝐻& ⟩|00

(but ordering for same qubit operators does!)

t=0 t=1

qubit 1

qubit 2

⟩|𝜓(𝑡 = 1)

Single qubit gates on two-qubit states – examples:

⟩|𝜓(𝑡 = 1) = 𝐻&𝐻! ⟩|00 ⟩|𝜓(𝑡 = 1) = 𝐻!𝐻& ⟩|00

Either ordering between operators for different qubits gives the same:

same as

MULT20015 Elements of Quantum Computing
Lecture 5

Shorthand notation for multi-qubit states/operations

We write as: ⟩|𝜓(𝑡 = 2) = 𝑌!𝐻!𝑋&𝐻& ⟩|00 where

𝐻!applies a H-gate to qubit #1 in t=0->1, then
𝑌! applies a Y-gate to qubit #1 in t=1->2

𝐻&applies a H-gate to qubit #2 in t=0->1, then
𝑋& applies a X-gate to qubit #2 in t=1->2

NB. Order for different qubit operators doesn’t matter

i.e. we can write ⟩|𝜓(𝑡 = 2) = 𝑋&𝐻&𝑌!𝐻! ⟩|00

qubit 1

qubit 2

t=0 t=1 t=2

⟩|𝜓(𝑡 = 2)

Single qubit gates on two-qubit states – examples:

Either ordering between operators for different qubits gives the same:

⟩|𝜓(𝑡 = 2) = 𝑌!𝐻!𝑋&𝐻& ⟩|00 ⟩|𝜓(𝑡 = 2) = 𝑋&𝐻&𝑌!𝐻! ⟩|00same as

MULT20015 Elements of Quantum Computing
Lecture 5

Week 3

Lecture 5
5.1 Two-qubit systems
5.2 Two qubit example – independent Alice and Bob
5.3 General two qubit states: measurement and operations

Lecture 6
6.1 Two-qubit logic operations
6.2 Entanglement

Practice class 3
Two qubit states and operations

MULT20015 Elements of Quantum Computing
Lecture 5

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