Quantum Computing - Lecture Notes, Lecture notes of Quantum Mechanics

These lecture notes are based on the book Quantum Computation and Quantum Information by Michael A. Nielsen and Isaac L. Chuang. They cover everything from quantum algorithms to error correction techniques and are for a math-based quantum computing course that is taught at the University of Washington to computer science graduate students. The material takes approximately 16 hours of lecture time to present.

Typology: Lecture notes

2022/2023

Uploaded on 05/11/2023

virgyn67
virgyn67 🇺🇸

4.3

(10)

227 documents

1 / 57

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Quantum Computing - Lecture Notes
Mark Oskin
Department of Computer Science and Engineering
University of Washington
Abstract
The following lecture notes are based on the book Quantum Computation and Quantum In-
formation by Michael A. Nielsen and Isaac L. Chuang. They are for a math-based quantum
computing course that I teach here at the University of Washington to computer science grad-
uate students (with advanced undergraduates admitted upon request). These notes start with a
brief linear algebra review and proceed quickly to cover everything from quantum algorithms
to error correction techniques. The material takes approximately 16 hours of lecture time to
present. As a service to educators, the L
A
TEXand Xfig source to these notes is available online
from my home page:
http://www.cs.washington.edu/homes/oskin
. In addition, under
the section “course material” from my web page, in the spring quarter/2002 590mo class you
will find a sequence of homework assignments geared to computer scientists. Please feel free to
adapt these notes and assignments to whatever classes your may be teaching. Corrections and
expanded material are welcome; please send them by email to
.
The following work is supported in part by NSF CAREER Award ACR-0133188.
1
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26
pf27
pf28
pf29
pf2a
pf2b
pf2c
pf2d
pf2e
pf2f
pf30
pf31
pf32
pf33
pf34
pf35
pf36
pf37
pf38
pf39

Partial preview of the text

Download Quantum Computing - Lecture Notes and more Lecture notes Quantum Mechanics in PDF only on Docsity!

Quantum Computing - Lecture Notes

Mark Oskin 

Department of Computer Science and Engineering

University of Washington

Abstract

The following lecture notes are based on the book Quantum Computation and Quantum In- formation by Michael A. Nielsen and Isaac L. Chuang. They are for a math-based quantum computing course that I teach here at the University of Washington to computer science grad- uate students (with advanced undergraduates admitted upon request). These notes start with a brief linear algebra review and proceed quickly to cover everything from quantum algorithms to error correction techniques. The material takes approximately 16 hours of lecture time to present. As a service to educators, the LATEXand Xfig source to these notes is available online from my home page: http://www.cs.washington.edu/homes/oskin. In addition, under the section “course material” from my web page, in the spring quarter/2002 590mo class you will find a sequence of homework assignments geared to computer scientists. Please feel free to adapt these notes and assignments to whatever classes your may be teaching. Corrections and expanded material are welcome; please send them by email to [email protected].

 The following work is supported in part by NSF CAREER Award ACR-0133188.

Contents

1 Linear Algebra (short review)

The following linear algebra terms will be used throughout these notes.

Z ^ - complex conjugate

if Z = a + b  i then Z ^ = a b  i

jψi - vector, “ket” i.e. 2

c 1 c 2 ::: cn

jψi - vector, “bra” i.e.

[ c  1 ; c  2 ; :::; c  n ]

hϕjψi - inner product between vectors jϕi and jψi.

Note for QC this is on C n^ space not R n!

Note hϕjψi = hψjϕi

Example: jϕi =

6 i

, jψi =

hϕjψi = [ 2 ; 6 i ]

= 6 24 i

jϕi jψi - tensor product of jϕi and jψi.

Also written as jϕijψi

Example: jϕijψi =

6 i

6 i  3

6 i  4

18 i 24 i

A ^ - complex conjugate of matrix A.

if A =

1 6 i 3 i 2 + 4 i

then A ^ =

1 6 i

3 i 2 4 i

A T^ - transpose of matrix A.

if A =

1 6 i 3 i 2 + 4 i

then A T^ =

1 3 i 6 i 2 + 4 i

A †^ - Hermitian conjugate (adjoint) of matrix A. Note A †^ =

A T^

if A =

1 6 i 3 i 2 + 4 i

then A †^ =

1 3 i

6 i 2 4 i

k jψi k - norm of vector jψi

k jψi k=

p

hψjψi

Important for normalization of jψi i.e. jψi= k jψi k

hϕj A jψi - inner product of jϕi and A jψi.

or inner product of A †jϕi and jψi

2 Postulates of Quantum Mechanics

An important distinction needs to be made between quantum mechanics, quantum physics and quantum computing. Quantum mechanics is a mathematical language, much like calculus. Just as classical physics uses calculus to explain nature, quantum physics uses quantum mechanics to explain nature. Just as classical computers can be thought of in boolean algebra terms, quantum computers are reasoned about with quantum mechanics. There are four postulates to quantum mechanics, which will form the basis of quantum computers:

 Postulate 1: Definition of a quantum bit, or qubit.

 Postulate 2: How qubit(s) transform (evolve).

 Postulate 3: The effect of measurement.

 Postulate 4: How qubits combine together into systems of qubits.

2.1 Postulate 1: A quantum bit

Postulate 1 (Nielsen and Chuang, page 80):

“Associated to any isolated physical system is a complex vector space with inner prod- uct (i.e. a Hilbert space) known as the state space of the system. The system is completely described by its state vector, which is a unit vector in the system’s state space.”

Consider a single qubit - a two-dimensional state space. Let jφ 0 i and jφ 1 i be orthonormal basis

for the space. Then a qubit jψi = a jφ 0 i + b jφ 1 i. In quantum computing we usually label the basis

with some boolean name but note carefully that this is only a name. For example, jφ 0 i = j 0 i and

jφ 1 i = j 1 i. Making this more concrete one might imagine that “j 0 i” is being represented by an

up-spin while “j 1 i” by a down-spin. The key is there is an abstraction between the technology

Important: U must be unitary, that is UU = I

Example:

U = p^12

then U †^ = p^1

U † U = p^12  p^1

= I

2.3 Postulate 3: Measurement

Postulate 3 (Nielsen and Chuang, page 84):

“Quantum measurements are described by a collection f M m g of measurement oper-

ators. These are operators acting on the state space of the system being measured. The index m refers to the measurement outcomes that may occur in the experiment. If

the state of the quantum system is jψi immediately before the measurement then the

probability that result m occurs is given by:

p ( m ) = hψj M † m M m jψi

and the state of the system after measurement is: q^ Mm jψi hψj Mm Mm jψi The measurement operators satisfy the completeness equation :

∑ m hψj M † m M^ m jψi^ =^ I

The completeness equation expresses the fact that probabilities sum to one:

1 = ∑ m p ( m ) = ∑ m hψj M † m M m jψi ”

Some important measurement operators are M 0 = j 0 ih 0 j and M 1 = j 1 ih 1 j

M 0 =

[ 1 ; 0 ] =

M 1 =

[ 0 ; 1 ] =

Observe that M † 0 M 0 + M † 1 M 1 = I and are thus complete.

Example:

jψi = a j 0 i + b j 1 i

p ( 0 ) = hψj M † 0 M 0 jψi

Note that M 0 † M 0 = M 0 , hence

p ( 0 ) = hψj M 0 jψi = [ a ^ ; b ^ ]

a b

= [ a ^ ; b ^ ]

a 0

= j a j^2

Hence the probability of measuring j 0 i is related to its probability amplitude a by way of j a j 2.

It important to note that the state after measurement is related to the outcome of the measurement.

For example, suppose j 0 i was measured, then the state of the system after this measurement is

re-normalized as: M 0 jψi j a j =^

a

j a j j^0 i

As a side note we are forced to wonder if Postulate 3 can be derived from Postulate 2. It seems natural given that measurement in the physical world is just interacting a qubit with other qubits. Thus it seems strange to have measurement be its own postulate. At this point though physicists don’t know how derive the measurement postulate from the other three, so we shall just have to be pragmatic and accept it.

2.4 Postulate 4: Multi-qubit systems

Postulate 4 (Nielsen and Chuang, page 94):

“The state space of a composite physical system is the tensor product of the state spaces of the component physical systems. [sic] e.g. suppose systems 1 through n

and system i is in state jψ i i, then the joint state of the total system is jψ 1 i jψ 2 i

: : : jψ n i.”

Example:

Suppose jψ 1 i = a j 0 i + b j 1 i and jψ 2 i = c j 0 i + d j 1 i, then:

jψ 1 i jψ 2 i = jψ 1 ψ 2 i = a  c j 0 ij 0 i + a  d j 0 ij 1 i + b  c j 1 ij 0 i + b  d j 1 ij 1 i =

ac j 00 i + ad j 01 i + bc j 10 i + bd j 11 i

Why the tensor product? This is not a proof, but one would expect some way to describe a com- posite system. Tensor product works for classical systems (except the restricted definition of the probability amplitudes makes it so that the result is a simple concatenation). For quantum systems

tensor product captures the essence of superposition, that is if system A is in state j A i and B in state

j B i then there should be some way to have a little of A and a little of B. Tensor product exposes

this.

M 02 =

5 and^ M^12 =

Recall that just prior to the CNot the system is in the state jψ^01 ψ 2 i = p^1 2 j 00 i + 0 j 01 i +

p^1

2 j^10 i^ +^0 j^11 i, hence the result of measuring the second qubit will clearly be^ j^0 i.^ Note that

M † 02 M 02 = M 02. Therefore:

p ( 0 ) = hψ^01 ψ 2 j M † 02 M 02 jψ^01 ψ 2 i = hψ^01 ψ 2 j M 02 jψ^01 ψ 2 i =

h

p^1 2 ;^0 ;^ p^1 2 ;^0

i

p^1 2 0 p^1 2 0

h

p^1 2 ;^0 ;^ p^1 2 ;^0

i

p^1 2 0 p^1 2 0

After measurement: q Mm jψi hψj Mm Mm jψi

2 (^66) (^66) (^66) 4

p^1 2 0 p^1 2 0

3 (^77) (^77) (^77) 5

1 =^ jψ

0

1 ψ^2 i

We can see that measurement had no effect on the first qubit. It remains in a superposition of j 0 i

and j 1 i. Now lets consider the same measurement but just after the CNot gate is applied. Here:

jψi = j (ψ^01 ψ 2 )^00 i = p^12 (j 00 i + j 11 i)

Now it is not clear whether the second qubit will return a j 0 i or a j 1 i, both outcomes are equally

likely. To see this, lets calculate the probability of obtaining j 0 i:

p ( 0 ) = hψj M † 02 M 02 jψi = hψj M 02 jψi =

h

p^1 2 ;^0 ;^0 ;^ p^1 2

i

p^1 2 0 0 p^1 2

h

p^1 2 ;^0 ;^0 ;^ p^1 2

i

p^1 2 0 0 0

5 =^

1 2

Hence, after the CNot gate is applied we have only a 1=2 chance of obtaining j 0 i. Of particular

interest to our discussion, however, is what happens to the state vector of the system:

After measurement: q Mm jψi hψj Mm Mm jψi

= p^1

1 = 2

p^1 2 0 0 p^1 2

p^1

1 = 2

p^1 2 0 0 0

5 =^ j^00 i

This is the remarkable thing about entanglement. By measuring one qubit we can affect the prob- ability amplitudes of the other qubits in a system! How to think about this process in an abstract way is an open challenge in quantum computing. The difficulty is the lack of any classical analog. One useful, but imprecise way to think about entanglement, superposition and measurement is that superposition “is” quantum information. Entanglement links that information across quantum bits, but does not create any more of it. Measurement “destroys” quantum information turning it into classical. Thus think of an EPR pair as having as much “superposition” as an unentangled set of qubits, one in a superposition between zero and one, and another in a pure state. The superposition in the EPR pair is simply linked across qubits instead of being isolated in one.

This, admittedly fuzzy way of thinking about these concepts is useful when we examine telepor- tation. There we insert an unknown quantum state (carrying a fixed amount of “quantum informa- tion”) into a system of qubits. We mix them about with additional superposition and entanglement and then measure out the superposition we just added. The net effect is the unknown quantum state remains in the joint system of qubits, albeit migrated through entanglement to another physi- cal qubit.

4 Teleportation

Contrary to its sci-fi counterpart, quantum teleportation is rather mundane. Quantum teleportation is a means to replace the state of one qubit with that of another. It gets its out-of-this-world name from the fact that the state is “transmitted” by setting up an entangled state-space of three qubits and then removing two qubits from the entanglement (via measurement). Since the information of the source qubit is preserved by these measurements that “information” (i.e. state) ends up in the final third, destination qubit. This occurs, however, without the source (first) and destination (third) qubit ever directly interacting. The interaction occurs via entanglement.

Suppose jψi = a j 0 i + b j 1 i and given an EPR pair p^12 (j 00 i + j 11 i) the state of the entire system is:

H |y>

H

|0> X Z

|0>

|y>

Figure 2: Quantum circuit depicting teleportation. Note that in this diagram single lines represent quantum data while double lines represent classical information.

H j 1 i = p^12

= p^12

Thus, applying H to our system we have:

jϕi = p^12

h

p^1

2 a^ (j^0 i^ +^ j^1 i)^ (j^00 i^ +^ j^11 i)^ +^

p^1

2 b^ (j^0 i^ ^ j^1 i)^ (j^10 i^ +^ j^01 i)

i

a b b a a

b

b

a

We can rewrite this expression as:

a b

b a

a

b

b

a

= 12 [j 00 i ( a j 0 i + b j 1 i) + j 01 i ( a j 1 i + b j 0 i) + j 10 i ( a j 0 i b j 1 i) + j 11 i ( a j 1 i b j 0 i)]

Which we can shorten to:

1 2

j 00 i

jψi + j 01 i

jψi + j 10 i

jψi + j 11 i i

0 i

i 0

jψi

These gates are the famous “Pauli” (I,X,Z,Y) operators and this is also written as:

1

2 [j^00 i I jψi^ +^ j^01 i X jψi^ +^ j^10 i Z jψi^ +^ j^11 i iY jψi]

And of interest to us with teleportation:

jϕi = 12 [j 00 i I jψi + j 01 i X jψi + j 10 i Z jψi + j 11 i XZ jψi]

This implies that we can measure the first and second qubit and obtain two classical bits. These two classical bits tell us what transform was applied to the third qubit. Thereby we can “fixup” the third qubit by knowing the classical outcome of the measurement of the first two qubits. This fixup is fairly straightforward, either applying nothing, X , Z or both X and Z. Lets work through an example:

M 10 =

P ( 10 ) = hϕj M 10 † M 10 jϕi = hϕj M 10 jϕi, since here M † 10 M 10. Thus:

M 10 jϕi = 12

a

b

Therefor: hϕj M 10 jϕi = 12 [ a ; b ; b ; a ; a ; b ; b ; a ] 12

a

b

= 14 [ a  a ^ + b  b ^ ]

Recall that by definition of a qubit we know that a  a ^ + b  b ^ = 1, hence the probability of mea-

suring 01 is 1=4. The same is true for the other outcomes.

 11 : i

0 i

i 0

p^1

2 (j^00 i^ +^ j^11 i)^ !^

p^1

2 (j^01 i^ ^ j^10 i)^ =^

p^1 2

These states are known as bell basis states. They key to super-dense coding is that they are or- thonormal from eachother and are hence distinguishable by a quantum measurement.

bit 1

H bit 0

Figure 4: To obtain the two bits of classical information a bell-basis measurement is performed.

Examining this process in more detail:

jψ 00 i = p^12 (j 00 i + j 11 i) = p^12 (j 0 ij 0 i + j 1 ij 1 i)

apply CNot gives us: p^1 2 (j 0 ij 0 i + j 1 ij 0 i)

apply H gives us: p^1 2 p^12 ((j 0 i + j 1 i) j 0 i + (j 0 i j 1 i) j 0 i) =

1

2 (j^00 i^ +^ j^10 i^ +^ j^00 i^ ^ j^10 i)^ =^ j^00 i

jψ 01 i = p^12 (j 00 i j 11 i) = p^12 (j 0 ij 0 i j 1 ij 1 i)

apply CNot gives us: p^1 2 (j 0 ij 0 i j 1 ij 0 i)

apply H gives us: p^1 2 p^12 ((j 0 i + j 1 i) j 0 i + (j 1 i j 0 i) j 0 i) =

1

2 (j^00 i^ +^ j^10 i^ +^ j^10 i^ ^ j^00 i)^ =^ j^10 i

jψ 01 i = p^12 (j 10 i + j 01 i) = p^12 (j 1 ij 0 i + j 0 ij 1 i)

apply CNot gives us: p^1 2 (j 1 ij 1 i + j 0 ij 1 i)

apply H gives us: p^1 2 p^12 ((j 0 i j 1 i) j 1 i + (j 0 i + j 1 i) j 1 i) =

1

2 (j^01 i^ ^ j^11 i^ +^ j^01 i^ +^ j^11 i)^ =^ j^01 i

! Leave the last one for homework.

6 Deutsch’s Algorithm

Deutsch’s algorithm is a perfect illustration of all that is miraculous, subtle, and disappointing about quantum computers. It calculates a solution to a problem faster than any classical computer

ever can. It illustrates the subtle interaction of superposition, phase-kick back, and interference. Finally, unfortunately, is solves a completely pointless problem.

Deutsch’s algorithm answers the following question: suppose f ( x ) is either constant or balanced, which one is it? If f ( x ) were constant then for all x the result is either 0 or 1. However, if f ( x ) were balanced then for one half of the inputs f ( x ) is 0 and for the other half it is 1 (which x’s correspond to 0 or 1 is completely arbitrary). To answer this question classically, we clearly need to query for both x = 0 and x = 1, hence two queries are required. Quantum mechanically though we will illustrate how this can be solved in just one query.

y f(x)

Uf

y

x x

Figure 5: Suppose U (^) f implements f , x is input as (j 0 i + j 1 i) =

p 2 and y as j 0 i, then the remarkable

aspect of quantum computing is the output is equal to (j 0 ; f ( 0 )i + j 1 ; f ( 1 )i) =

p

We begin by illustrating how superposition of quantum state creates quantum parallelism or the ability to compute on many states simultaneously.

Given a function f ( x ) : f 0 ; 1 g! f 0 ; 1 g using a quantum computer, use two qubits j x ; y i and trans- form them into j x ; y  f ( x )i (where  represents addition modular two). We use two qubits since we wish to leave the input x or the query register, “un-changed”. The second qubit, y , acts as a result register. Let U (^) f be the unitary transform that implements this. This is illustrated in Figure 5.

Suppose we wish to calculate f ( 0 ), then we could input x as j 0 i, and y , our output register, as j 0 i and apply the U (^) f transform.

The input is written as j 0 i j 0 i = j 0 ; 0 i.

The output is transformed by U (^) f to be j 0 ; 0  f ( 0 )i.

Suppose we wish to calculate f (^1 ), then we could input^ x^ as^ j^1 i, and^ y , our output register, as^ j^0 i and apply the U (^) f transform.

The input is written as j 1 i j 0 i = j 1 ; 0 i.

The output is transformed by U (^) f to be j 1 ; 0  f ( 1 )i.

But this is not a classical computer – we can actually query the results of 0 and 1 simultaneously using quantum parallelism. For this, let x equal (j 0 i + j 1 i) =

p 2 and y equal 0.

The input jψ 1 i = j^0 ;^0 ip+ 2 j^1 ;^0 i

Suppose f ( x ) = 0 then y  f ( x ) = y  0 = p^12 (j 0  0 i j 1  0 i) = p^12 (j 0 i j 1 i)

Suppose f ( x ) = 1 then y  f ( x ) = y  1 = p^12 (j 0  1 i j 1  1 i) = p^12 (j 0 i + j 1 i)

We can compactly describe this behavior in the following formula:

y  f ( x ) = ( 1 ) f^ ( x )^ p^12 (j 0 i j 1 i)

Thus, U f transforms j x i p^12 (j 0 i j 1 i) into:

( 1 ) f^ ( x )^ j x i p^12 (j 0 i j 1 i)

Or we can say that:

U (^) f

h

p^1

2 (j^0 i^ +^ j^1 i)^

p^1

2 (j^0 i^ ^ j^1 i)

i

h

( 1 ) f^ (^0 )^ j 0 i (j 0 i j 1 i) + ( 1 ) f^ (^1 )^ j 1 i (j 0 i j 1 i)

i

Suppose f is constant, that is f ( 0 ) = f ( 1 ), then:

1 2

h

( 1 ) f^ (^0 )^ j 0 i (j 0 i j 1 i) + ( 1 ) f^ (^1 )^ j 1 i (j 0 i j 1 i)

i

= 12 ( 1 ) f^ (^0 )^ [j 0 i (j 0 i j 1 i) + j 1 i (j 0 i j 1 i)]

=  12 [j 0 i (j 0 i j 1 i) + j 1 i (j 0 i j 1 i)]

=  p^12 (j 0 i + j 1 i) p^12 (j 0 i j 1 i)

Suppose instead that f is balanced, that is f ( 0 ) 6 = f ( 1 ), then:

1 2

h

( 1 ) f^ (^0 )^ j 0 i (j 0 i j 1 i) + ( 1 ) f^ (^1 )^ j 1 i (j 0 i j 1 i)

i

h

( 1 ) f^ (^0 )^ j 0 i (j 0 i j 1 i) + ( 1 )  ( 1 ) f^ (^0 )^ j 1 i (j 0 i j 1 i)

i

= 12 ( 1 ) f^ (^0 )^ [j 0 i (j 0 i j 1 i) j 1 i (j 0 i j 1 i)]

=  12 [j 0 i (j 0 i j 1 i) j 1 i (j 0 i j 1 i)]

=  p^12 (j 0 i j 1 i) p^12 (j 0 i j 1 i)

Now run the j x i qubit through an H gate to get jψ 3 i

jψ 3 i =

 p^1 2 j 0 i (j 0 i j 1 i) i f f ( 0 ) = f ( 1 )

 p^1 2 j 1 i (j 0 i j 1 i) i f f ( 0 ) 6 = f ( 1 )

Since in our case f ( 0 )  f ( 1 ) = 0 , f ( 0 ) = f ( 1 ) we can write this as

jψ 3 i = j f ( 0 )  f ( 1 )i

h

j 0 ip+ j 1 i 2

i

Hence it is possible to measure x to find f ( 0 )  f ( 1 ).

Key:

Note that f ( 0 )  f ( 1 ) is a global property of f ( x ). Classically it would require

two evaluations of f ( x ) to find this answer. Using a quantum computer we are able to evaluate both answers simultaneously and then interfere these answers to combine them together. Another more subtle point is that the phase of the result qubit transfers to the query qubit. This is a special case of phase kick back. In effect, the query qubit acts as a control of whether or not to flip the result qubit. While the result qubit is potentially flipped by the state of the query qubit, the phase of the query qubit is altered by the phase of the result (or target) qubit! We will explore this property in more detail later, since it is the key to Shor’s algorithm.

6.1 Deutsch-Jozsa Algorithm

The Deutsch-Jozsa algorithm is a generalization of Deutsch’s algorithm.

Suppose f ( x ) : f 2 n g! f 0 ; 1 g and that f is either constant or balanced. The goal is determine which

one it is. Classically it is trivial to see that this would require (in worst case) querying just over half the solution space, or 2 n = 2 + 1 queries. The Deutsch-Jozsa algorithm answers this question with just one query!

|00....0>

H

H n H n

Uf y

x x

|1> y f(x)

Figure 7: The Deutsch-Jozsa algorithm is simply a multi-qubit generalization of Deutsch’s algo- rithm

The starting state of the system jψ 0 i is fairly straightforward

jψ 0 i = j 0 i n j 1 i

The symbolic notation j 0 i n^ simply means n consecutive j 0 i qubits.