0% found this document useful (0 votes)
92 views37 pages

Notes PDF

Quantum computing uses quantum mechanical phenomena to perform computational tasks. It involves building quantum devices with specified behaviors and designing algorithms to utilize those behaviors. The field is promising because as devices get smaller, quantum effects become important, and quantum phenomena may enable new computational capabilities not possible with classical computers. This lecture provides an overview of quantum bits (qubits) and how they differ from classical bits, how qubit states are described mathematically, how measuring a qubit causes its state to collapse, and how qubits can exist in superpositions of states that classical bits cannot achieve.

Uploaded by

hameddaei
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
92 views37 pages

Notes PDF

Quantum computing uses quantum mechanical phenomena to perform computational tasks. It involves building quantum devices with specified behaviors and designing algorithms to utilize those behaviors. The field is promising because as devices get smaller, quantum effects become important, and quantum phenomena may enable new computational capabilities not possible with classical computers. This lecture provides an overview of quantum bits (qubits) and how they differ from classical bits, how qubit states are described mathematically, how measuring a qubit causes its state to collapse, and how qubits can exist in superpositions of states that classical bits cannot achieve.

Uploaded by

hameddaei
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 37

1 2

What is Quantum Computing?


Quantum Computing
Lecture 1 Aim to use quantum mechanical phenomena that have no classical
counterpart for computational purposes.

Anuj Dawar
Central research tasks include:
• Building devices — with a specified behaviour.

Bits and Qubits • Designing algorithms — to use the behaviour.

Mediating these two are models of computation.

3 4

Bird’s eye view Why look at Quantum Computing?

A computer scientist looks at Quantum Computing: • The world is quantum


– classical models of computation provide a level of
Algorithmic Languages
abstraction
– discrete state systems
Theory/complexity
• Devices are getting smaller
System Architecture – Moore’s law

Specified Behaviour – the only descriptions that work on the very small scale are
quantum
Physics
• Exploit quantum phenomena
– using quantum phenomena may allow us to perform
Dragons
computational tasks that are not otherwise possible/efficient
– understand capabilities/resources
5 6

Course Outline Useful Information

A total of eight lecturers. Some useful books:


1. Bits and Qubits (this lecture). • Nielsen, M.A. and Chuang, I.L. (2000). Quantum Computation
and Quantum Information. Cambridge University Press.
2. Linear Algebra
• Mermin, N.D. (2007). Quantum Computer Science. CUP.
3. Quantum Mechanics
• Kitaev, A.Y., Shen, A.H. and Vyalyi, M.N. (2002). Classical
4. Models of Computation
and Quantum Computation. AMS.
5. Some Applications
• Hirvensalo, M. (2004). Quantum Computing. Springer.
6. Search Algorithms
Course website:
7. Factorisation http://www.cl.cam.ac.uk/teaching/0910/QuantComp/
8. Complexity

7 8

Bits Qubits

A building block of classical computational devices is a two-state Quantum mechanics tells us that any such system can exist in a
system. superposition of states.

0 ←→ 1 In general, the state of a quantum bit (or qubit for short) is


described by:
α|0i + β|1i

Indeed, any system with a finite set of discrete, stable states, with where, α and β are complex numbers, satisfying
controlled transitions between them will do. |α|2 + |β|2 = 1
9 10

Qubits Measurement

Any attempt to measure the state


A qubit may be visu-
|1i α|0i + β|1i
alised as a unit vector
β α|0i + β|1i on the plane. results in |0i with probability |α|2 , and |1i with probability |β|2 .

In general, however, After the measurement, the system is in the measured state!
α |0i α and β are complex
numbers.
That is, further measurements will always yield the same value.

We can only extract one bit of information from the state of a


qubit.

11 12

Measurement Vectors

Formally, the state of a qubit is a unit vector in C2 —the


|1i 2-dimensional complex vector space.
 
α|0i + β|1i and α|0i − β|1i have β α|0i + β|1i
α
The vector   can be written as
the same probabilities for their β
measurement α |0i
α|0i + β|1i
However, they are distinct states    
α|0i − β|1i 1 0
which behave differently in terms where, |0i =   and |1i =  .
of how they evolve. 0 1

|φi— a ket, Dirac notation for vectors.


13 14

Basis Example
" #
Any pair of vectors |φi, |ψi ∈ C2 that are linearly independent √1
The vector 2
measured in the computational basis gives
could serve as a basis. √1
2
either outcome with probability 1/2.
α|0i + β|1i = α′ |φi + β ′ |ψi

Measured in the basis


   
√1 √1
The basis is determined by the measurement process or device.  2 , 2 
√1 −1

2 2

Most of the time, we assume a standard (orthonormal) basis |0i it gives the first outcome with probability 1.
and |1i is given.
This will be called the computational basis

15 16

Entanglement Entanglement

An n-qubit system can exist in any superposition of the 2n basis Compare the two (2-qubit) states:
states. 1 1
√ (|00i + |01i) and √ (|00i + |11i)
α0 |000000i + α1 |000001i + · · · + α2n −1 |111111i 2 2
P2n −1
with i=0 |αi |2 = 1
If we measure the first qubit in the first case, we see |0i with
probability 1 and the state remains unchanged.
Sometimes such a state can be decomposed into the states of
individual bits
In the second case (an EPR pair), measuring the first bit gives |0i
1 1 1
(|00i + |01i + |10i + |11i) = √ (|0i + |1i) ⊗ √ (|0i + |1i) or |1i with equal probability. After this, the second qubit is also
2 2 2
determined.
1 2

Linear Algebra
Quantum Computing
Lecture 2 The state space of a quantum system is described in terms of a
vector space.

Anuj Dawar
Vector spaces are the object of study in Linear Algebra.

In this lecture we review definitions from linear algebra that we


Review of Linear Algebra need in the rest of the course.

We are mainly interested in vector spaces over the complex number


field – C.

We use the Dirac notation—|vi, |φi (read as ket) for vectors.

3 4

Vector Spaces Cn
 
A vector space over C is a set V with α1
 .. 
• a commutative, associative addition operation + that has Cn is the vector space of n-tuples of complex numbers: 
 . .

– an identity 0: |vi + 0 = |vi αn


     
– inverses: |vi + (−|vi) = 0 α1 β1 α1 + β1
 .   ..   .. 
with addition  .  
• an operation of multiplication by a scalar α ∈ C such that:  . + . = .
  

– α(β|vi) = (αβ)|vi αn βn αn + βn
– (α + β)|vi = α|vi + β|vi and α(|ui + |vi) = α|ui + α|vi 
α1 zα1
  

– 1|vi = |vi.  .   . 
and scalar multiplication z  .   . 
 . = . 
αn zαn
5 6

Basis Bases for Cn


     
A basis of a vector space V is a minimal collection of vectors 1 0 0
     
|v1 i, . . . , |vn i such that every vector |vi ∈ V can be expressed as a  0   1   0 
The standard basis for Cn is  , ,...,
     
linear combination of these: .. .. .. 

 .  
  . 


 . 

|vi = α1 |v1 i + · · · + αn |vn i. 0 0 1
(written |0i, . . . , |n − 1i).
" # " #
3 4
n—the size of the basis—is uniquely determined by V and is called But other bases are possible: , is a basis for C2 .
2 −i
the dimension of V.

We’ll be interested in orthonormal bases. That is bases of vectors


Given a basis, every vector |vi can be represented as an n-tuple of
of unit length that are mutually orthogonal. Examples are |0i, |1i
scalars.
and √12 (|0i + |1i), √12 (|0i − |1i).

7 8

Linear Operators Matrices

A linear operator A from one vector space V to another W is a Given a choice of bases |v1 i, . . . , |vn i and |w1 i, . . . , |wm i, let
function such that: m
X
A|vj i = αij |wi i
A(α|ui + β|vi) = α(A|ui) + β(A|vi) i=1

Then, the matrix representation of A is given by the entries αij .


If V is of dimension n and W is of dimension m, then the operator
A can be represented as an m × n-matrix. Multiplying this matrix by the representation of a vector |vi in the
basis |v1 i, . . . , |vn i gives the representation of A|vi in the basis
|w1 i, . . . , |wm i.
The matrix representation depends on the choice of bases for V
and W.
9 10

Examples Inner Products


" # " #
1 1
√ An inner product on V is an operation that associates to each pair
A 45◦ rotation of the real plane that takes to 2
and
0 1
√ |ui, |vi of vectors a complex number
2
" # " #
0 − √12 hu|vi.
to 1
is represented, in the standard basis by the
1 √
2
matrix The operation satisfies
 
√1 − √12 • hu|αv + βwi = αhu|vi + βhu|wi
 2 
√1 √1
2 2 • hu|vi = hv|ui∗ where the ∗
denotes the complex conjugate.
  • hv|vi ≥ 0 (note: hv|vi is a real number) and hv|vi = 0 iff
0 −i
The operator   does not correspond to a transformation |vi = 0.
i 0
of the real plane.

11 12

Inner Product on Cn Norms

The standard inner product on Cn is obtained by taking, for The norm of a vector |vi (written || |vi||) is the non-negative, real
X X number:
|ui = ui |ii and |vi = vi |ii p
i i
|| |vi|| = hv|vi.

X A unit vector is a vector with norm 1.


hu|vi = u∗i vi
i
Two vectors |ui and |vi are orthogonal if hu|vi = 0.

Note: hu| is a bra, which together with |vi forms the bra-ket hu|vi. An orthonormal basis for an inner product space V is a basis made
up of pairwise orthogonal, unit vectors.

the term Hilbert space is also used for an inner product space
13 14

Outer Product Eigenvalues

With a pair of vectors |ui ∈ U, |vi ∈ V we associate a linear


An eigenvector of a linear operator A : V → V is a non-zero vector
operator |uihv| : V → U, known as the outer product of |ui and |vi.
|vi such that
A|vi = λ|vi
(|uihv|)|v ′ i = hv|v ′ i|ui
for some complex number λ
λ is the eigenvalue corresponding to the eigenvector v.
|vihv| is the projection on the one-dimensional space generated by
|vi. The eigenvalues of A are obtained as solutions of the characteristic
equation:
Any linear operator can be expressed as a linear combination of
det(A − λI) = 0
outer products:

X
A= Aij |iihj|. Each operator has at least one eigenvalue.
ij

15 16

Diagonal Representation Adjoints

A linear operator A is diagonalisable if Associated with any linear operator A is its adjoint A† which
X satisfies
A= λi |vi ihvi |
i
hv|Awi = hA† v|wi

where the |vi i are an orthonormal set of eigenvectors of A with


corresponding eigenvalues λi . In terms of matrices, A† = (A∗ )T
where ∗ denotes complex conjugation and T denotes transposition.
Equivalently, A can be written as a matrix
   †  
λ1 1+i 1−i 1 − i −1

..
   = 
.
 



 −1 1 1+i 1
λn

in the basis |v1 i, . . . , |vn i of its eigenvectors.


17 18

Normal and Hermitian Operators Unitary Operators

An operator A is said to be normal if A linear operator A is unitary if

AA† = A† A AA† = A† A = I

Fact: An operator is diagonalisable if, and only if, it is normal.


Unitary operators are normal and therefore diagonalisable.
A is said to be Hermitian if A = A†
Unitary operators are norm-preserving and invertible.
A normal operator is Hermitian if, and only if, it has real
eigenvalues. hAu|Avi = hu|vi

All eigenvalues of a unitary operator have modulus 1.

19 20

Tensor Products Tensor Products

If U is a vector space of dimension m and V one of dimension n In matrix terms,


then U ⊗ V is a space of dimension mn.
 
Writing |uvi for the vectors in U ⊗ V: A11 B A12 B ··· A1m B
 
 A21 B A22 B ··· A2m B 
 
• |(u + u′ )vi = |uvi + |u′ vi
A⊗B =
 .. .. ..


• |u(v + v ′ )i = |uvi + |uv ′ i 
 . . . 

• z|uvi = |(zu)vi = |u(zv)i Am1 B Am2 B · · · Amm B

Given linear operators A : U → U and B : V → V, we can define


an operator A ⊗ B on U ⊗ V by

(A ⊗ B)|uvi = |(Au), (Bv)i


1 2

What is Quantum Mechanics


Quantum Computing
Lecture 3 Quantum Mechanics is a framework for the development of physical
theories.

Anuj Dawar
It is not itself a physical theory.

It states four mathematical postulates that a physical theory must


Principles of Quantum Mechanics satisfy.

Actual physical theories, such as Quantum Electrodynamics are


built upon a foundation of quantum mechanics.

3 4

What are the Postulates About First Postulate

The four postulates specify a general framework for describing the Associated to any physical system is a complex inner product space
behaviour of a physical system. (or Hilbert space) known as the state space of the system.
1. How to describe the state of a closed system.—Statics or state The system is completely described at any given point in time by
space its state vector, which is a unit vector in its state space.

2. How to describe the evolution of a closed system.—Dynamics


Note: Quantum Mechanics does not prescribe what the state
3. How to describe the interactions of a system with external space is for any given physical system. That is specified by
systems.—Measurement individual physical theories.
4. How to describe the state of a composite system in terms of its
component parts.
5 6

Example: A Qubit Second Postulate

Any system whose state space can be described by C2 —the The time evolution of closed quantum system is described by the
two-dimensional complex vector space—can serve as an Schrödinger equation:
implementation of a qubit.
d|ψi
Example: An electron spin. i~ = H|ψi
dt

Some systems may require an infinite-dimensional state space.


where
We always assume, for the purposes of this course, that our systems
• ~ is Planck’s constant; and
have a finite dimensional state space.
• H is a fixed Hermitian operator known as the Hamiltonian of
the system.

7 8

Second Postulate—Simpler Form Why Unitary?

The state |ψi of a closed quantum system at time t1 is related to


Unitary operations are the only linear maps that preserve norm.
the state |ψ ′ i at time t2 by a unitary operator U that depends only
on t1 and t2 .
|ψ ′ i = U |ψi
|ψ ′ i = U |ψi implies

U is obtained from the Hamiltonian H by the equation: || |ψ ′ i|| = || U |ψi|| = || |ψi|| = 1


−iH(t2 − t1 )
U (t1 , t2 ) = exp[ ]
~
Exercise: Verify that unitary operations are norm-preserving.
This allows us to consider time as discrete and speak of
computational steps
Exercise: Check that if H is Hermitian, U is unitary.
9 10

Gates, Operators, Matrices Pauli Gates

In this course, most linear operators we will be interested in are A particularly useful set of 1-qubit gates are the Pauli Gates.
unitary. The X gate
They can be represented as matrices where each column is a unit
X
vector and columns are pairwise orthogonal.
 
0 1
Another useful representation of unitary operators we will use is as X|0i = |1i X|1i = |0i X= 
1 0
gates:
The Y gate
G
Y

A 2-qubit gate is a unitary operator on C4 .


 
0 −i
Y |0i = i|1i Y |1i = −i|0i Y = 
i 0

11 12

Pauli Gates–contd. Third Postulate

The Z gate A measurement on a quantum system has some set M of outcomes.


Quantum measurements are described by a collection
Z {Pm : m ∈ M } of measurement operators. These are linear (not
  unitary) operators acting on the state space of the system.
1 0
Z|0i = |0i Z|1i = −|1i Z=  If the state of the system is |ψi before the measurement, then the
0 −1 probability of outcome m is:

  p(m) = hψ|Pm Pm |ψi
1 0
Sometimes we include the identity I =   as a fourth Pauli
0 1
The state of the system after measurement is
gate.
Pm |ψi
q

hψ|Pm Pm |ψi
13 14

Third Postulate—contd. Measurement in the Computational Basis

The measurement operators satisfy the completeness equation. We are generally interested in the special case where the
X measurement operators are projections onto a particular

Pm Pm = I orthonormal basis of the state space (which we call the
m∈M
computational basis).

So, for a single qubit, we take measurement operators P0 = |0ih0|


This guarantees that the sum of the probabilities of all outcomes
and P1 = |1ih1|
adds up to 1.
X X
p(m) = hψ|Pm†
Pm |ψi = hψ|I|ψi = 1 This gives, for a qubit in state α|0i + β|1i:
m m

p(0) = |α|2 p(1) = |β|2

Exercise: Verify!

15 16

Global Phase Relative Phase

For any state |ψi, and any θ, we can form the vector eiθ |ψi. In contrast, consider the two states |ψ1 i = √1 (|0i + |1i) and
2
|ψ2 i = √1 (|0i − |1i).
2
Then, for any unitary operator U , Measured in the computational basis, they yield the same outcome
probabilities.
U eiθ |ψi = eiθ U |ψi

However, measured in a different orthonormal basis (say


√1 (|0i + |1i) and √1 (|0i − |1i), the results are different.
2 2
Moreover, for any measurement operator Pm
 
−iθ
hψ|e †
Pm Pm eiθ |ψi = †
hψ|Pm Pm |ψi 1 1
Also, if H = √1  , then
2
1 −1

Thus, such a global phase is unobservable and the states are H|ψ1 i = |0i H|ψ2 i = |1i
physically indistinguishable.
17 18

Fourth Postulate Separable States

The state space of a composite physical system is the tensor A state of a combined system is separable if it can be expressed as
product of the state spaces of the individual component physical the tensor product of states of the components.
systems. E.g.
1 1 1
If one component is in state |ψ1 i and a second component is in (|00i + |01i + |10i + |11i) = √ (|0i + |1i) ⊗ √ (|0i + |1i)
2 2 2
state |ψ2 i, the state of the combined system is

|ψ1 i ⊗ |ψ2 i If Alice has a system in state |ψ1 i and Bob has a system in
state |ψ1 i, the state of their combined system is |ψ1 i ⊗ |ψ1 i.
If Alice applies U to her state, this is equivalent to
Not all states of a combined system can be separated into the applying the operator U ⊗ I to the combined state.
tensor product of states of the individual components.

19 20

Entangled States Summary

The following states of a 2-qubit system cannot be separated into Postulate 1: A closed system is described by a unit vector in a
components parts. complex inner product space.
Postulate 2: The evolution of a closed system in a fixed time
1 1
√ (|10i + |01i) and √ (|00i + |11i) interval is described by a unitary transform.
2 2
Postulate 3: If we measure the state |ψi of a system in an
orthonormal basis |0i · · · |n − 1i, we get the result |ji with
Note: Physical separation does not imply separability. Two probability |hj|ψi|2 . After the measurement, the state of the
particles that are physically separated could still be entangled. system is the result of the measurement.
Postulate 4: The state space of a composite system is the tensor
product of the state spaces of the components.
1 2

Quantum Circuits
Quantum Computing
Lecture 4 A quantum circuit is a sequence of unitary operations and
measurements on an n-qubit state.

Anuj Dawar 



Input State U1 U2 U3




Models of Quantum Computation M

Note: each Ui is described by a 2n × 2n matrix.

3 4

Algorithms Model of Computation

A quantum algorithm specifies, for each n, a sequence As a model of computation, this is parasitic on classical models.

On = O1 . . . Ok what is computable is not independently determined

of n-qubit operations.
Purely quantum models can be defined. We will see more on this in
Lecture 8.
The map n → On must be computable.
i.e. the individual circuits must be generated from a What computations can be performed in the model as defined?
common pattern.
What functions can be computed?
What decision problems are decidable?
All measurements can be deferred to the end (possibly, at the
expense of increasing the number of qubits).
Can all such computations be performed with some fixed set of
unitary operations?
5 6

Simulating Boolean Gates Computing a Function

Could we find a quantum circuit to simulate a classical And gate? If f : {0, 1}n → {0, 1}m is a Boolean function, the map

|xi 7→ |f (x)i
a a∧b
And may not be unitary.
b

We will, instead seek to implement


This would require And : |00i 7→ |0xi, |01i 7→ |0yi
|xi ⊗ |0i 7→ |xi ⊗ |f (x)i
|10i 7→ |0zi, |11i 7→ |1wi
There is no unitary operation of this form.
Unitary operations are reversible. No information can be lost in the Exercise: Describe a unitary operation that implements the
process. Boolean And in this sense.

7 8

One-Qubit Gates Gates on a Multi-Qubit State

We have already seen the Pauli Gates: When we draw a circuit with a one-qubit gate, this must be read as
" # " # " # a unitary operation on the entire state.
0 1 0 −i 1 0
X= ,Y = ,Z =
1 0 i 0 0 −1
U

Another useful one-qubit gate is the Hadamard gate:


 
1 1 1
H=√  
2 1 −1
U ⊗I

H
This does not change measurement outcomes on the second qubit.
9 10

Controlled Not Controlled U

The Controlled Not is a 2-qubit gate: More generally, we can define, for any single qubit operation U , the
Controlled U gate:
|ai |ai The controlled not flips the sec-
ond qubit if the first qubit is |1i
|bi |a ⊕ bi and leaves it unchanged if it’s |0i |0xi 7→ |0xi
U
|1xi 7→ |1, U xi

  Particularly useful is the controlled-Z gate:


1 0 0 0
  Z
 0 1 0 0 
C=
 
Z

 0 0 0 1 
 
0 0 1 0

11 12

Toffoli Gate Classical Reversible Computation


|a1 i |a1 i The Toffoli Gate is a 3-qubit
A Boolean function f : {0, 1}n → {0, 1}n is reversible if it’s
gate.
|a2 i |a2 i described by a 2n × 2n permutation matrix.
It has a classical counterpart
which can be used to simulate
|bi |(a1 · a2 ) ⊕ bi standard Boolean operations For any function g : {0, 1}n → {0, 1}m , there is a reversible function
g ′ : {0, 1}m+n → {0, 1}m+n with

A permutation matrix is a unitary matrix where all entries are g ′ (x, 0) = (x, g(x)).
0 or 1.

Toffoli gates are universal for reversible computation.


Any 2n × 2n permutation matrix can be implemented using only
Toffoli gates.
The Toffoli gate cannot be implemented using 2-bit reversible
classical gates.
13 14

Quantum Toffoli Gate Universal Set of Gates

The Toffoli gate can be implemented using 2-qubit quantum gates. Fact: Any unitary operation on n qubits can be implemented by a
sequence of 2-qubit operations.

Q
Fact: Any unitary operation can be implemented by a combination
Q† Q† P of C-NOTs and single qubit operations.

H Q† Q Q† Q H Fact: Any unitary operation can be approximated to any required


degree of accuracy using only C-NOTs, H, P and Q.
" # " #
1 0 1 0
where, P = ,Q = . These can serve as our finite set of gates for quantum computation.
0 i 0 eiπ/4

15 16

Deutsch-Jozsa Problem replacemen Deutsch-Jozsa Algorithm

Given a function f : {0, 1} → {0, 1}, determine whether f is |0i H H


constant or balanced. Uf
√1 (|0i − |1i)
2

Classically, this requires two calls to the function f .


Uf with input |xi and |0i − |1i is just a phase shift.
But, if we are given the quantum black box: It changes phase by (−1)f (x) .
|ai |ai When |xi = H|0i, this gives (−1)f (0) |0i + (−1)f (1) |1i.
Uf
|bi |b ⊕ f (a)i
Final result is [(−1)f (0) + (−1)f (1) ]|0i + [(−1)f (0) − (−1)f (1) ]|1i

One use of the box suffices which is |0i if f is constant and |1i if f is balanced.
1 2

Some Applications
Quantum Computing
Lecture 5 We look at some applications of the encoding of information in
quantum states.

Anuj Dawar • Quantum Cryptography, or more accurately Quantum Key


Distribution.
• Superdense Coding.
Applications of Quantum Information • Quantum Teleportation

These do not rely on quantum computation as such, but the


properties of information encoded in quantum states: superposition
and entanglement.

3 4

Quantum Key Distribution Assumptions

A protocol for quantum key distribution was described by Bennett The BB84 protocol relies on the following assumptions:
and Brassard in 1984 (and is known as BB84).
• Alice has a source of random (classical) bits.
Eve • Alice can produce qubits in states |0i and |1i.
qubit channel The protocol does not pro-
• Alice can apply a Hadamard operator H to the qubits.
Alice Bob vide the means of transmit-
classical channel ting an arbitrary message. • Bob can measure incoming qubits
– either in the basis |0i, |1i;
At the end of the protocol, there is a random sequence of bits that – or in the basis √1 (|0i + |1i), √1 (|0i − |1i).
2 2
is shared between Alice and Bob but unknown to any third party.
These conditions are satisfied, for instance, by a system based on
polarised photons.
5 6

The Protocol The Protocol–contd.

Alice sends Bob a stream of qubits. • For each qubit, Bob randomly chooses either the basis |0i, |1i
or the basis H|0i, H|1i and measures the qubit in the chosen
For each qubit, before sending it, she basis.

• randomly chooses a bit |0i or |1i; • Bob announces (over the classical channel) which basis he used
for each measurement.
• randomly either applies H to the qubit or not; and
• Alice tells Bob which measurements were made in the correct
• sends it to Bob.
basis.

So, Bob receives a random sequence of qubits, each of which is in • The qubits which were measured in the wrong basis are
one of the four states: discarded, while the rest form a shared key.

|0i, |1i, H|0i, H|1i

7 8

Attacks Attack 2

Why not announce the bases for all qubits before transmission, What happens if Eve intercepts the qubits, measures each one
thus avoiding the loss of half the bits? randomly in either the basis |0i, |1i or the basis H|0i, H|1i and
This allows Eve to intercept, measure and re-transmit the then retransmits it?
bits.
Why not wait until Bob has received all the qubits, then have Alice For half of the bits that are shared between Alice and Bob, Eve will
announce the basis for each one before Bob measures them? have measured them in the wrong basis.
Moreover, these bits will have changed state, and so for approx. 14
• Requires Bob to store the qubits—currently technically
of the shared bits, the value measured by Bob will be different to
difficult.
the one encoded by Alice.
• If Bob can store the qubits, then Eve can too and then she can
Alice and Bob can choose a random sample of their shared bits and
retransmit after measurement.
publically check their values against each other and detect the
If we could fix the basis before hand, this could be used to transmit presence of an eavesdropper.
a fixed (rather than random) message.
9 10

Attack 3 Key Distribution

Could Eve intercept the qubits, make a copy without measuring Quantum key distribution relies on nothing more than
them and re-transmit to Bob and then wait for the basis to be
• linear superposition of states; and
announced?
• change of basis.

No Cloning Theorem:
There is no unitary operation U which for an arbitrary In particular, it does not rely on entanglement.
state ψ gives We next look at some applications of entanglement.
U |ψ0i = |ψψi.

Exercise: Prove the no-cloning theorem.

11 12

Bell States Generating Bell States

Entanglement based protocols generally rely on using the following We can generate the Bell states from the computational basis
four states of a two-qubit system, known as the Bell states. |00i, |01i, |10i, |11i using the following circuit:
1 1
√ (|00i + |11i), √ (|01i + |10i)
2 2 H

1 1
√ (|00i − |11i), √ (|01i − |10i)
2 2

These form an orthonormal basis for C4 , known as the Bell basis. |00i √1 (|00i + |11i)
2

√1 (|00i + |10i)
Note that, in each of the states, measuring either qubit in the 2

computational basis yields |0i or |1i with equal probability, but


after the measurement, the other bit is determined.
13 14

Superdense Coding Superdense Coding 2

In general, it is impossible to extract more than one classical bit of Generating Bell states from √1 (|00i + |11i) with only operations on
2
information from a single qubit. the first qubit.

However, if Alice and Bob is each in possession of one qubit of a 1 1


(X ⊗ I) √ (|00i + |11i) = √ (|01i + |10i)
pair in a known Bell state 2 2

1
√ (|00i + |11i)
2 1 1
(Z ⊗ I) √ (|00i + |11i) = √ (|00i − |11i)
2 2
Then Alice can perform an operation solely on her own qubit, and
then send it to Bob to convey two bits of information.
1 1
((XZ) ⊗ I) √ (|00i + |11i) = √ (|01i − |10i)
2 2

15 16

Superdense Coding 3 Quantum Teleportation

Once he has both qubits, Bob can convert back to the The superdense coding protocol allows Alice to send Bob two
computational basis using the circuit. classical bits by transmitting a single qubit, provided they already
share an entangled pair.
H

Conversely, the quantum teleportation protocol allows Alice to send


Bob a qubit, by sending just two classical bits along a classical
channel, provided they already share an entangled pair.
After this, a measurement in the computational basis yields the
two bits that Alice intended to convey. Contrast this with the no-cloning theorem, which tells us that we
cannot make a copy of a qubit.
17 18

Quantum Teleportation 2 Quantum Teleportation 3

Alice has a state |φi that she wishes to transmit to Bob. The two Alice conveys to Bob the result of her measurement. Say the qubit
already share a pair of qubits in state √12 (|00i + |11i). in Bob’s possession is in state |θi, then:
• If Alice measures |00i, then |φi = |θi.
• If Alice measures |01i, then |φi = X|θi.
|φi H • If Alice measures |10i, then |φi = Z|θi.
M
 • If Alice measures |11i, then |φi = XZ|θi.

Entangled Pair

Thus, Bob performs the appropriate operation and now has a qubit
whose state is exactly |φi.
1 2

Search Problems
Quantum Computing
Lecture 6 One of the two most important algorithms in quantum computing
is Grover’s search algorithm—first presented by Lov Grover in 1996.

Anuj Dawar This provides a means of searching for a particular value in an


unstructured search space.
Compare
Quantum Searching • searching for a name in a telephone directory
• searching for a phone number in a telephone directory

Given a black box which can take any of N inputs, and for each of
them gives a yes/no answer, Grover’s algorithm allows us to find

the unique value for which the answer is yes in O( N ) steps (with
high probability).

3 4

replacemen Deutsch-Jozsa Algorithm revisited Oracle

|0i Suppose we have f : N → {0, 1}, and that N = 2n , so we can think


H H
Uf of f as operating on n bits.
√1 (|0i − |1i)
2

We assume that we are provided a black box or oracle Uf for


When the lower input to Uf is |0i − |1i, we can regard this as computing f , in the following sense:
unchanged, and instead see Uf as shifting the phase of the upper
qubit by (−1)f (x) . 

|xi
 Uf

|bi |b ⊕ f (x)i
5 6

replacements
Grover’s Algorithm Grover’s Algorithm Schematic

O( N )
Suppose further that there is exactly one n-bit value a such that z }| {
|0i H
f (a) = 1
|0i H
Uf W ··· Uf W M
and for all other values x, |0i H
|0i H
f (x) = 0.
|0i−|1i

Grover’s algorithm gives us a way of using the black box Uf to The operator G = (W ⊗ I)Uf is known as the Grover Iterate (we

determine the value a with O( N ) = O(2n/2 ) calls to Uf . will see soon what W is).

The input to the last bit is √1 (|0i − |1i).


2

7 8

The Action of Uf Components of W

As the “output qubit” is |0i − |1i, it remains unaffected by the We write H ⊗n for the fol- And X ⊗n for the following
action of Uf , which we can think of instead as a conditional phase lowing operation: operation:
 
change on the n input qubits. 
 H 
 X

 

H X

 

|ai 7→ −|ai n inputs n inputs
H X
 
|xi 7→ |xi for any x 6= a

 


 

 
H X
We will ignore the output bit completely and instead talk of the
n-bit operator V above. Each of these can, of course, be implemented by a series of n
Note: V = I − 2|aiha|. 1-qubit operations.

We now analyse the Grover iterate W V .


9 10

More Components of W Defining W

We write cZ ⊗n for the n-bit controlled-Z gate: Now, we can define W by:
   W = (−1)H ⊗n (X ⊗n cZ ⊗n X ⊗n )H ⊗n .

 1 0 ··· 0
= (−1)H ⊗n (I − 2|0n ih0n |)H ⊗n

  

0 1 ··· 0
  
n inputs
 
cZ ⊗n = .. .. .. ..

.
  





 . . . 
 Write |Ψi for the state

Z 0 0 · · · −1 N −1
⊗n n 1 X
H |0 i = √ |ii.
N i=0
cZ ⊗n can be implemented using O(n) cZ and Toffoli gates, using
some workspace qubits (Exercise). So, W = (−1)(I − 2|ΨihΨ|), i.e.

W = 2|ΨihΨ| − I.

11 12

The Grover Iterate Geometric View

Since G = W V , we have We can picture the action of W and V in the two-dimensional real
plane spanned by the vectors |ai and |Ψi.
G = (2|ΨihΨ| − I)(I − 2|aiha|).
|ai
V is a reflection
W V |Ψi about the line per-
Consider the actions of W and V on the two states |Ψi and |ai.
pendicular to |ai.
2θ |Ψi W is a reflection
W |Ψi = |Ψi W |ai = √2 |Ψi − |ai.
N θ about |Ψi.
V |Ψi = |Ψi − √2 |ai V |ai = −|ai The composition of
N
V |Ψi two reflections of the
Thus, as we start the algorithm in state |Ψi, the result of repeated plane is always a ro-
applications of V and W will always give a real linear combination tation.
of |ai and |Ψi.
13 14

The Rotation Number of Iterations



It is clear from the picture that W V (the Grover iterate) is a After t ∼ π/2
2θ ∼ π
4 N iterations of the Grover iterate G = W V ,
rotation through an angle 2θ in the direction from |Ψi to |ai, where the state of the system
the angle between |Ψi and |ai is π2 − θ. Gt |Ψi
is within an angle θ of |ai.
|Ψi and |ai are nearly orthogonal, so θ is small (if N is large).
A measurement at this stage yields the state |ai with probability
π 1 1
sin θ = cos( − θ) = ha|Ψi = √ = n/2 . N −1
2 N 2 |hGt Ψ|ai|2 ≥ (cos θ)2 = 1 − (sin θ)2 = .
N
So,
1 1
θ ∼ √ = n/2
N 2 Note: Further iterations beyond t will reduce the probability of
for large enough values of N . finding |ai.

15 16

Multiple Solutions Lower Bound

Grover’s algorithm works even if the solution |ai is not unique. For classical algorithms, searching an unstructured space of
solutions (such as given by a black box for f ), it is easy to show a
Suppose there is a set of solutions S ⊆ {0, . . . , N − 1} and let Ω(N ) lower bound on the number of calls to the black box required
M = |S| be the number of solutions. to identify the unique solution.

The Grover iterate is then a rotation in the space spanned by the


two vectors Grover’s algorithm demonstrates that a quantum algorithm can
beat any classical algorithm for the problem.
N −1
1 X 1 X
|Ψi = √ |ii |Si = √ |ji √
N i=0 M j∈S It is possible to show a Ω( N ) lower bound for the number of calls
to Uf by any quantum algorithm that identifies a unique solution.

As the angle between these is smaller, the number of iterations Grover’s algorithm does not allow quantum computers to solve
drops, but so does the probability of success. NP-complete problems in polynomial time.
1 2

Quantum Factoring
Quantum Computing
Lecture 7 A polynomial time quantum algorithm for factoring numbers was
published by Peter Shor in 1994.

Anuj Dawar polynomial time here means that the number of gates is
bounded by a polynomial in the number of bits n of the
number being factored.

Quantum Factoring
The best known classical algorithms are exponential (in n1/3 ).

Fast factoring would undermine public-key cryptographic systems


such as RSA.

3 4

Period Finding Order Finding

Suppose we are given a function f : N → {0, . . . , N − 1} which we Suppose we are given an integer N and an a with a < N and
know is periodic, i.e.
gcd(a, N ) = 1.
f (x + r) = f (x) for some fixed r and all x.

Consider the function fa : N → {0, . . . , N − 1} given by


Can we find the least value of r?
fa (x) ≡ ax (mod N )

If we can find the period of a function efficiently, we can factor


integers quickly. Then, fa is periodic, and if we can find the period r, we can factor
N.
5 6

Factoring Factoring–contd.

Suppose (for simplicity) N = pq, where p and q are prime. And, for So, (x − 1)(x + 1) = kpq for some k.
some a < N , we know the period r of the function fa . Now, finding gcd(N, x − 1) and gcd(N, x + 1) will find p and q.
r+1 r
Then, a ≡ a (mod N ), so a ≡ 1 (mod N ).
If we randomly choose a < N
r/2 2 r
If r is even and a + 1 6≡ 0 (mod N ), then take x = a .
(and check that gcd(a, N ) = 1—if not, we’ve already found
x2 − 1 ≡ 0 (mod N ) a factor of N )
1
(x − 1)(x + 1) ≡ 0 (mod N ) then, there is a probability > 2 that

But, • the period of fa is even; and


x − 1 6≡ 0 (mod N ) (by minimality of r) • ar/2 + 1 6≡ 0 (mod N ).
x + 1 6≡ 0 (mod N ) (by assumption)

7 8

Using a Fourier Transform Discrete Fourier Transform

A fast period-finding algorithm allows us to factor numbers quickly. The discrete Fourier transform of a sequence of complex numbers

x0 , . . . , xM −1
The idea is to use a Fourier Transform to find the period of a
function f . is another sequence of numbers

y0 , . . . , yM −1
Note, classically, we can use the fast Fourier transform algorithm
for this purpose, but it can be shown that this would require time where
M −1
N log N , which is exponential in the number of bits of N . 1 X
yk = √ xj e2πijk/M
M j=0
or
M −1
1 X
yk = √ xj ω jk .
M j=0

where ω = e2πi/M .
9 10

DFT is Unitary Inverse DFT

The discrete Fourier transform is a unitary operation on CM .


The inverse of the discrete Fourier Transform is given by:
Writing ω for e2πi/M ,  
1 1 1 ··· 1
ω, ω 2 , . . . , ω M −1 , ω M = 1  
 1 ω −1 ω −2 ··· ω 
 
are the M th roots of 1.  −2 −4 2

1   1 ω ω ··· ω 
−1
D =√ 

3
−3 −6

  M  1 ω ω · · · ω 
1 1 1 ··· 1  . .. .. ..

 .. .. 
  . . . .
ω2


 1 ω · · · ω −1 
  

1 ω2 ω4 ··· ω

−2  1 ω 1−M ω 2−2M · · · ω M −1
1 
D= √ 
 
ω3 ω6

M 1 · · · ω −3 

 .. .. .. .. .. 

 . . . . . 
 Exercise: Verify that D is unitary. Verify that D −1 as given above
1 ω M −1 ω 2M −2 ··· ω is the inverse of D.

11 12

Quantum Fourier Transform Fourier Transform on Binary Strings

Computing the discrete Fourier transform classically takes time Suppose M = 2n , and let |xi be a computational basis state in CM
polynomial in M . with binary representation x1 · · · xn .
Let
Shor showed that D can be implemented using a number of one and ηj = e2πi(0·xj xj+1 ···xn ) .
two-qubit gates that is only polynomial in the number of qubits
O((log M )2 ).
Then
Note: This does not give a fast way to compute the DFT on a D|xi = (|0i + ηn |1i)(|0i + ηn−1 |1i) · · · (|0i + η1 |1i).
quantum computer.
There is no way to extract all the complex components from the
transformed state. Exercise: Verify.
13 14

Quantum Fourier Transform Circuit Conditional Phase Shifts

We can use this form to implement the quantum Fourier transform Here
using Hadamard gates and conditional phase-shift gates.      
1 0 1 0 1 0
P =  Q=  R= 
0 i 0 eiπ/4 0 eiπ/8
H

Two-qubit conditional phase shift gates are actually symmetric


H P
between the two bits, despite the asymmetry in the drawn circuit.
H P Q
It seems that for large n, an n-bit quantum Fourier transform
H P Q R circuit would require conditional phase shifts of arbitrary precision.
It can be shown that this can be avoided with some (but not
In the input, the least significant bit is at the top, in the output, it
significant) loss in the probability of success for the factoring
is at the bottom.
algorithm.

15 16

Preparing the State First Measurement

We are given an implementation of the function f as a unitary


We measure the second n qubits of the state Uf |Ψi|0n i and get a
operator Uf
value f0 . The state after measurement is:
Where, now, each of the two in- m−1
|xi |xi 1 X 
Uf put wires represents n distinct √ |x0 + kri |f0 i.
|0i |f (x)i m
k=0
qubits
where:
Writing |Ψi for the state
x0 is the least value such that f (x0 ) = f0
n
2X −1
1
H ⊗n |0n i = |xi. r is the period of the function f
2n/2 x=0 n
m = ⌊ 2r ⌋.
We have,
n
2X −1
n 1
Uf |Ψi|0 i = |xi|f (x)i.
2n/2 x=0
17 18

Applying the QFT Second Measurement

We apply the n-qubit quantum Fourier transform to the first n bits The probability of observing a given state |yi is:
of the transformed state. m−1 2
1 X kry
ω .
2n m

m−1
X k=0

√1

D m
|x0 + kri
k=0
n
2X −1 m−1
1 X (x0 +kr)y
= 1
2n/2
√ ω |yi This probability function has peaks when ry/2n is close to an
m
n
y=0 k=0 integer.
2X −1 m−1
1 X
x0 y kry
Indeed, if ry/2n is an integer, then the probability of measuring y

= ω √ ω |yi.
2n/2 m k=0
y=0 is 1.
2πi/2n
where ω = e .
Given an integer multiple of 2n /r, it is not difficult to find r.

19 20

Exponentiation Some Points to Note

To complete the factoring algorithm, we need to check that we can The two measurement steps can be combined at the end, with the
also implement the unitary transform Uf for the particular function Fourier transform applied before the measurement of f (x).

fa (x) = ax mod N. The probability of successfully finding the period in any run of the
with a number of quantum gates that is polynomial in log N . algorithm is only about 0.4.
However, this means a small number of repetitions will suffice to
This is achieved through repeated squaring. find the period with high probability.

Putting a lower bound on the conditional phase shift we are allowed


to perform affects the probability of success, but not the rest of the
algorithm.
1 2

Models of Computation
Quantum Computing
Lecture 8 Shor’s algorithm solves, in polynomial time, a problem for which no
classical, deterministic polynomial time algorithm is known.

Anuj Dawar
What class of problems are solvable by quantum machines in
polynomial time?

Quantum Automata and Complexity More generally, how does quantum parallelism compare with other
forms of parallelism and nondeterminism.

How does the quantum model of computation affect our


understanding of complexity classes?

3 4

Finite State Systems DFAs and Matrices

a a Each DFA is specified by a collection of n × n matrices, where n is


This automaton accepts the set of
b the number of states in the DFA, and there is one matrix for each
strings that contain at least one b.
letter.

Its operation can be described by a Each column of each matrix is a unit vector with 0, 1
b pair of matrices. entries.

   
1 0 0 0 More generally, we can form a matrix Mw for each word w.
Ma =   Mb =  
0 1 1 1 Multiplication of matrices corresponds to concatenation of
words.
Mb Mb Ma describes the operation on states performed by reading
Mw |ii = |ji if there is a path labelled w from state i to state j.
the string abb.
5 6

Nondeterministic Automata NFAs and Matrices

a a This automaton accepts the same


set of strings as the deterministic
 
b 1 0
one. Mbb =  
2 1
The columns of the corresponding
b b matrices are no longer unit vectors.
Mw (i, j) gives the number of paths labeled w from state i to state j.
   
1 0 1 0
X
Ma =   Mb =   Mw |ii = Mw (i, j)|ji
0 1 1 1 j

7 8

Probabilistic Automata Language Accepted

We obtain probabilistic automata if we allow fractional values in A probabilistic automaton A accepts a language L with certainty if
Mσ . 
 1 if w ∈ L
with the proviso that each column adds up to 1. P (A accepts w) =
 0 if w 6∈ L
   
0.5 0.0 0.8 0.2
E.g. Ma =   Mb =   A accepts a language L with bounded probability if there is an
0.5 1.0 0.2 0.8
ǫ < 1/2 such that:

   > 1 − ǫ if w ∈ L
0.4 0.1 gives, in position (i, j) the prob-
P (A accepts w) =
M a Mb =   ability that string ba takes you  <ǫ if w 6∈ L
0.6 0.9
from state i to state j.

The class of languages accepted by probabilistic automata (under


either definition) is the regular languages.
9 10

Quantum Automata Acceptance Probabilities

Quantum finite automata are obtained by letting the matrices Mσ If q is the starting state of the automaton,
have complex entries.
Mw |qi
We also require each of the matrices to be unitary.
is the state after reading w. If

  Mσ is unitary since the sum of αj = hj|Mw |qi


−1 0 the squares of the norms in each
E.g. Mσ =   then αj is the probability amplitude that the automaton reaches
0 i column adds up to 1 and the dot
state j.
product of any two columns is 0.
|αj |2 is the probability that a measurement will result in
NB: If all matrices only have 0 or 1 entries and the matrices are state qj .
unitary (i.e., the matrices are permutation matrices), then the P 2
j∈F |αj | is the probability that the automaton accepts
automaton is deterministic and reversible.
the string w.

11 12

Language Accepted Interference

Consider the automaton in a one letter alphabet defined as:


We can define language acceptance exactly or by bounded
√1 √1
probability. 2 2

− √12
 
√1 √1
Ma =  2 2
Because of the reversibility requirement, quantum automata are q1 q2 
−1
√ √1
quite a weak model. √1
2 2
2

There are regular languages that cannot be accepted by a QFA.   While there are two distinct paths la-
0 1 belled aa from q1 back to itself, and each
Maa =  
−1 0 has non-zero probability, the net proba-
However, QFAs may be much more succinct than their classical
bility of ending up in q1 is 0.
counterparts.
The automaton accepts a string of odd length with probability 0.5
and a string of even length with probability 1 if its length is not a
multiple of 4 and probability 0 otherwise.
13 14

Turing Machines Configurations and Computations

A Turing machine, in addition to the finite set of states in the If c0 is the configuration in the starting state, with w on the tape
automaton has an infinite read-write tape. and the tape head at the left end of the string, w is accepted if the
computation
A machine is determined by an alphabet Σ, a finite set of states Q c0 → c 1 → · · · → c f
and a transition function δ which gives, for each state and symbol: eventually reaches an accepting state.
a next state, a replacement symbol and a direction in which to
If the length of the computation is bounded by a polynomial in the
move the tape head.
length of w, the language accepted by the machine is in P.

A machine has infinitely many possible configurations (reserving


The action of the Turing machine can equivalently be described as
the word “state” for a member of Q).
a linear operator M on an infinite-dimensional space.
Each configuration c is determined by a state, the contents of the
The set of configurations form a basis for the space.
tape (a finite string) and the position of the head.

15 16

Nondeterministic Turing Machines Probabilistic Machines

In a nondeterministic machine, δ determines, for each state and With a probabilistic machine, δ defines, for each current state and
symbol, a set of next moves. symbol, a probability distribution over the possible next moves.
This gives rise to a tree of configurations:
c4 The action of the machine can be defined as an infinite matrix,
c1 where the rows and columns are configurations, and each column
c5 A configuration may occur in several
c6 places in the tree. adds up to 1.
c2
c0 c7
The initial string w is accepted by the ma- However, how much information can be encoded in a single entry?
c8 chine if there is some path through the We require the entries α to be feasibly computable. That is, there is
c3 c9 tree leading to an accepting state. a feasibly computable f such that:
c10
|f (n) − α| < 2−n
If the height of the tree is bounded by a polynomial in the length of
w, then the language is in NP
17 18

BPP Quantum Turing Machines

BPP is the collection of languages L for which there is a With a Quantum Turing machine, δ associates with each state and
probabilistic machine M , running in polynomial time with: symbol, and each possible next move, a complex probability

 > 2 if w ∈ L amplitude (which we require to be a feasible complex number).
3 The machine can be seen as progressing
P (M accepts w) =
 < 1 if w 6∈ L
3 c4 through a series of stages, each of which
c1 is a superposition of configurations.
The class of languages is unchanged if we replace 23 and 13 by 1 − ǫ c5
and ǫ, for any ǫ < 12 , or indeed the set of all feasibly computable α0 c6
c Note that the probability of c7 occurring
probabilities with {0, 12 , 1}. c0 α1 2
at time 2 may be less than the sum of the
α2 c7 probabilities along the two paths.
The only inclusion relations we know are P⊆NP and P⊆BPP. c8
c3
c9 We also require that the linear transfor-
Primality testing, long known to be in NP and in BPP was shown mation defined by the machine is unitary.
in 2002 to be in P.

19 20

BQP Complexity Classes

BQP is the collection of languages L recognised by a quantum


Turing machine, running in polynomial time, under the bounded factorisation
probability rule. NP − C PSPACE
NP

The class BQP is not changed if we restrict the set of possible BPP
amplitudes to {0, ± 35 , ± 54 , 1}. P BQP

BPP ⊆ BQP

Inclusion relations among the complexity classes as we know them.


Shor’s algorithm shows that the factorisation problem is in BQP.
It is not known to be in BPP.

You might also like