




























































































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
A set of lecture notes on quantum computing. It covers topics such as quantum mechanics, qubits and quantum memory, elementary gates, quantum circuits, quantum parallelism, and various quantum algorithms including the Deutsch-Jozsa algorithm, Simon's algorithm, the Fourier transform, and Shor's factoring algorithm. The notes also touch on the hidden subgroup problem and its efficient quantum algorithm if G is Abelian. dedicated to the memory of the author's father.
Typology: Lecture notes
1 / 218
This page cannot be seen from the preview
Don't miss anything!





























































































Dedicated to the memory of my father
Abraham de Wolf (1942–2019)
ii
Problem (Chapter 6; the above-mentioned chapter numbers are for the earlier version of the notes), and moved the hints about exercises to an Appendix for students who want to try the exercises first without hints. Thanks to Joran van Apeldoorn, Srinivasan Arunachalam, Rens Baardman, Alexander Belov, Koen de Boer, Daniel Chernowitz, Andr´as Gily´en, Ronald de Haan, Leon Ingelse, Stacey Jeffery, Rafael Kiesel, Jens Klooster, Sam Kuypers, Christian Nesenberend, and Christian Schaffner for useful comments.
January’19 : More corrections, clarifications and exercises, and new chapters about Hamiltonian simulation (Chapter 9) and the HHL algorithm (Chapter 10). These two chapters can be taught together in two lectures, with the longer Chapter 9 spilling over into the second lecture if necessary. I marked by ‘(H)’ the exercises having a hint in Appendix C, and removed citations from exer- cises to prevent students looking up the original papers when doing the exercises (which is neither necessary nor helpful). Those references are [49, 96, 103, 67, 102, 115, 75, 37, 50, 35, 118, 86, 19]. Thanks to Arjan Cornelissen, Sven Cornets de Groot, Gerrit Vos, and Harm de Vries for useful comments, and to Andr´as Gily´en for much help with Chapters 9 and 10. Thanks to my father and Mieke Beer for hosting me for two months while I was recovering from an ankle fracture in a wheelchair, from which much of these two chapters was written.
July’19 : More corrections, clarifications and exercises. Thanks to Joran van Apeldoorn, Andr´as Gily´en, Stephanie Gonzalez, Sander Gribling, Jaco ter Hoeve, Arnold Kole, Lotte Mertens, Stefano Pironio, Merel Schalkers, Jim Skulte, Iris Smit, Manuel Van, and Sebastian Zur for useful com- ments. Thanks to Barbara Terhal for suggesting the possibility of dedicating these notes.
January’21 : More corrections, clarifications and exercises, and a new chapter about QMA and the local Hamiltonian problem (Chapter 14). Thanks to Dorit Aharonov, Tomas Ehrencron, Alex Grilo, Joris Kattem¨olle, Stan de Lange, Noah Linden, Tessel Majtlis, Nikhil Mande, Andrea Mazzocco, Robert Modderman, Thomas Preu, Philip Verduyn Lunel, Baer Ververgaert, and Carel Wagenaar for useful comments.
January’22 : More corrections, clarifications and exercises. Thanks to Simon Apers, Christiaan van Asperen, Yanlin Chen, Lynn Engelberts, Sevag Gharibian, Andr´as Gily´en, Diego Gonz´alez- S´anchez, Bruno Jedynak, Joris Kattem¨olle, Julius Krebbekx, Zeph Landau, Noah Linden, Fr´ed´eric Magniez, Ryan Mann, and Yanelle Stolwijk for useful comments.
August’22 : More corrections, clarifications and exercises, and a new chapter about some aspects of quantum machine learning (Chapter 19). Thanks to Danish Alvi, Srinivasan Arunachalam, Nikolaos Chatzis, Li Chen, Yanlin Chen, Iordanis Kerenidis, Mikhail Kudinov, Casper Loman, Fr´ed´eric Magniez, Galina Pass, Benjamin Shaffrey, Mario Szegedy, and Michael Walter for useful comments.
January’23 : More corrections and clarifications, and a new chapter about the generalized ad- versary bound (Chapter 12). Thanks to Srinivasan Arunachalam, Martijn Brehm, Yanlin Chen, Lynn Engelberts, Noah Linden, Fr´ed´eric Magniez, Mehrdad Tahmasbi, Quinten Tupker, and Jordi Weggemans for useful comments.
© Ronald de Wolf, January 2023, Amsterdam
iv
to behave classically, but instead one might also try to work with them, enabling further miniaturization.
Before limiting ourselves to theory, let us say a few words about practice: to what extent will quantum computers ever be built? At this point in time, it is just too early to tell. The first small 2-qubit quantum computer was built in 1997 and in 2001 a 5-qubit quantum computer was used to successfully factor the number 15 [240]. Since then, experimental progress on a number of different technologies has been steady but slow. The most advanced implementations currently use superconducting qubits and ion-trap qubits. The largest quantum computation done at the time of writing is Google’s “quantum supremacy” experiment on 53 qubits [30], which performs a complicated (but rather useless) sampling task that appears to be no longer simulatable in a reasonable amount of the time on even the largest existing classical supercomputer. The practical problems facing physical realizations of quantum computers seem formidable. The problems of noise and decoherence have to some extent been solved in theory by the discovery of quantum error-correcting codes and fault-tolerant computing (see, e.g., Chapter 20 in these notes), but these problems are by no means solved in practice. On the other hand, we should realize that the field of physical realization of quantum computing is still in its infancy and that classical computing had to face and solve many formidable technical problems as well—interestingly, often these problems were even of the same nature as those now faced by quantum computing (e.g., noise-reduction and error-correction). Moreover, while the difficulties facing the implementation of a full quantum computer may seem daunting, more limited applications involving quantum communication have already been implemented with some success, for example teleportation (which is the process of sending qubits using entanglement and classical communication), and versions of BB84 quantum key distribution are nowadays even commercially available. Even if the theory of quantum computing never materializes to a real large-scale physical com- puter, quantum-mechanical computers are still an extremely interesting idea which will bear fruit in other areas than practical fast computing. On the physics side, it may improve our understand- ing of quantum mechanics. The emerging theories of entanglement and of Hamiltonian complexity have already done this to some extent. On the computer science side, the theory of quantum computation generalizes and enriches classical complexity theory and may help resolve some of its problems (see Section 15.3 for an example).
1.2 Quantum mechanics
Here we give a brief and abstract introduction to quantum mechanics. In short: a quantum state is a superposition of classical states, written as a vector of amplitudes, to which we can apply either a measurement or a unitary operation. For the required linear algebra we refer to Appendix A.
2
Consider some physical system that can be in N different, mutually exclusive classical states. Because we will typically start counting from 0 in these notes, we call these states | 0 〉, | 1 〉,... , |N − 1 〉. Roughly, by a “classical” state we mean a state in which the system can be found if we observe it. A pure quantum state (usually just called state) |φ〉 is a superposition of classical states, written
|φ〉 = α 0 | 0 〉 + α 1 | 1 〉 + · · · + αN − 1 |N − 1 〉.
Here αi is a complex number that is called the amplitude of |i〉 in |φ〉. Intuitively, a system in quantum state |φ〉 is “in all classical states at the same time,” each state having a certain amplitude. It is in state | 0 〉 with amplitude α 0 , in state | 1 〉 with amplitude α 1 , and so on. Mathematically, the states | 0 〉,... , |N − 1 〉 form an orthonormal basis of an N -dimensional Hilbert space (i.e., an N -dimensional vector space equipped with an inner product). A quantum state |φ〉 is a vector in this space, usually written as an N -dimensional column vector of its amplitudes:
|φ〉 =
α 0 .. . αN − 1
Such a vector is sometimes called a “ket.” It conjugate transpose is the following row vector, sometimes called a “bra”: 〈φ| =
α∗ 0 ,... , α∗ N − 1
The reason for this terminology (often called “Dirac notation” after Paul Dirac) is that an inner product 〈φ|ψ〉 between two states corresponds to the dot product between a bra and a ket vector (“bracket”): 〈φ|ψ〉 = 〈φ| · |ψ〉. We can combine different Hilbert spaces using tensor product: if | 0 〉,... , |N − 1 〉 are an or- thonormal basis of space HA and | 0 〉,... , |M − 1 〉 are an orthonormal basis of space HB , then the tensor product space H = HA ⊗ HB is an N M -dimensional space spanned by the set of states {|∑i〉 ⊗ |j〉 | i ∈ { 0 ,... , N − 1 }, j ∈ { 0 ,... , M − 1 }}. An arbitrary state in H is of the form N − 1 i=
j=0 αij^ |i〉 ⊗ |j〉.^ Such a state is called^ bipartite.^ Similarly we can have^ tripartite^ states that “live” in a Hilbert space that is the tensor product of three smaller Hilbert spaces, etc. There are two things we can do with a quantum state: measure it or let it evolve unitarily without measuring it. We will deal with measurement first.
Measurement in the computational basis
Suppose we measure state |φ〉. We cannot “see” a superposition itself, but only classical states. Accordingly, if we measure state |φ〉 we will see one and only one classical state |j〉. Which specific |j〉 will we see? This is not determined in advance; the only thing we can say is that we will see state |j〉 with probability |αj |^2 , which is the squared norm of the corresponding amplitude αj. This is known as “Born’s rule.” Accordingly, observing a quantum state induces a probability distribution on the classical states, given by the squared norms of the amplitudes.∑ This implies N − 1 j=0 |αj^ |
(^2) = 1, so the vector of amplitudes has (Euclidean) norm 1. If we measure |φ〉 and get
outcome j as a result^1 , then |φ〉 itself has “disappeared,” and all that is left is |j〉. In other words, (^1) Don’t use the ambiguous phrase “we measure j” in this case, since it’s not clear in that phrasing whether |j〉 is the state you’re applying the measurement to, or the outcome of the measurement.
3
with j < N/2 and |j〉 with j ≥ N/2 corresponds to the two projectors P 1 =
j<N/ 2 |j〉〈j|^ and P 2 =
j≥N/ 2 |j〉〈j|, each of rank^ N/2 (assume^ N^ is even). Applying this measurement to the state
|φ〉 = √^13 | 1 〉 +
2 3 |N^ 〉^ gives outcome 1 with probability^ ‖P^1 |φ〉‖
(^2) = 1/3, in which case the state
collapses to | 1 〉. It gives outcome 2 with probability ‖P 2 |φ〉‖^2 = 2/3, the state then collapses to |N 〉.
Observables
A projective measurement with projectors P 1 ,... , Pm and associated distinct outcomes λ 1 ,... , λm ∈ R, can be written as one matrix M =
∑m i=1 λiPi, which is called an^ observable. This is a succinct way of writing down the projective measurement in one matrix, and has the added advantage that the expected value of the outcome can be easily calculated: if we are measuring a state |φ〉, then the probability of outcome∑ λi is ‖Pi|φ〉‖^2 = Tr(Pi|φ〉〈φ|), so the expected value of the outcome is m i=1 λiTr(Pi|φ〉〈φ|) = Tr(
∑m i=1 λiPi|φ〉〈φ|) = Tr(M^ |φ〉〈φ|). Note that^ M^ is Hermitian:^ M^ =^ M^
Conversely, since every Hermitian M has a spectral decomposition M =
∑m i=1 λiPi, there is a direct correspondence between observables and Hermitian matrices. The Pauli matrices I, X, Y, Z (see Appendix A.9) are examples of 2-dimensional observables, with eigenvalues ±1. For example, Z = | 0 〉〈 0 | − | 1 〉〈 1 | corresponds to measurement in the compu- tational basis (with measurement outcomes +1 and −1 for | 0 〉 and | 1 〉, respectively). Suppose we have a bipartite state. An observable A on the first part of the state corresponds to an observable A ⊗ I on the bipartite state. Similarly, an observable B on the second part of the state corresponds to an observable I ⊗ B on the bipartite state. Separately measuring observables A and B on the two parts of a bipartite state is different from measuring the joint observable A ⊗ B: the separate measurements give one outcome each, while the joint measurement gives only one outcome, and the distribution on the post-measurement state may be different. What is true, however, is that the measurement statistics of the product of outcomes is the same as the measurement statistics of the outcome of the joint measurement. For example consider the case when A = B = Z (these correspond to measurement in the computational basis), and the bipartite state is |φ〉 = √^12 (| 0 〉 ⊗ | 0 〉 + | 1 〉 ⊗ | 1 〉). With the separate measurements, the outcomes will be ++ or −− (note that in both cases the product of the two outcomes is +1) and the state |φ〉 will collapse to either | 0 〉 ⊗ | 0 〉 or | 1 〉 ⊗ | 1 〉. Yet |φ〉 remains undisturbed by a joint measurement with ±1-valued observable Z ⊗ Z, because |φ〉 is a +1-eigenstate of Z ⊗ Z.
POVM measurement
If we only care about the final probability distribution on the m outcomes, not about the result- ing post-measurement state, then the most general type of measurement we can do is a so-called positive-operator-valued measure (POVM). This is specified by m positive semidefinite (psd) ma- trices E 1 ,... , Em that sum to identity. When measuring a state |φ〉, the probability of outcome i is given by Tr(Ei|φ〉〈φ|). A projective measurement is the special case of a POVM where the measurement elements Ei are projectors.^4 There are situations where a POVM can do things a projective measurement cannot do.^5 For (^4) Note that if Ei is a projector, then Tr(Ei|φ〉〈φ|) = Tr(E i (^2) |φ〉〈φ|) = Tr(Ei|φ〉〈φ|Ei) = ‖Ei|φ〉‖ (^2) , using the fact that Ei = E^2 i and the cyclic property of the trace. These inequalities can fail if Ei is psd but not a projector. (^5) Even though POVMs strictly generalize projective measurements, one can show that every POVM can be “sim- ulated” by a projective measurement on a slightly larger space that yields the exact same probability distribution over measurement outcomes (this follows from Neumark’s theorem).
5
example, suppose you have a state in a 2-dimensional space, and you know it is either in state | 0 〉 or in state |+〉 = √^12 (| 0 〉 + | 1 〉). These two states are not orthogonal, so there is no measurement that distinguishes them perfectly. However, there is a POVM measurement that never makes a mistake, but sometimes gives another outcome 2, meaning “I don’t know.” That is, you would like to do a measurement with three possible outcome: 0, 1, and 2, such that:
You cannot achieve this with a projective measurement on the qubit, but the following 3-outcome POVM does the job:
E 0 = 12 |−〉〈−| (where |−〉 = √^12 (| 0 〉 − | 1 〉), which is orthogonal to the |+〉 state); E 1 = 12 | 1 〉〈 1 | (note that this is orthogonal to the | 0 〉 state); E 2 = I − E 0 − E 1.
You can check that E 0 , E 1 , E 2 are psd and add up to identity, so they form a valid POVM. None of the 3 matrices is a projector. The success probability 1/4 can be improved further, see Exercise 9.
Instead of measuring |φ〉, we can also apply some operation to it, i.e., change the state to some
|ψ〉 = β 0 | 0 〉 + β 1 | 1 〉 + · · · + βN − 1 |N − 1 〉.
Quantum mechanics only allows linear operations to be applied to quantum states. What this means is: if we view a state like |φ〉 as an N -dimensional vector (α 0 ,... , αN − 1 )T^ , then applying an operation that changes |φ〉 to |ψ〉 corresponds to multiplying |φ〉 with an N × N complex-valued matrix U :
α 0 .. . αN − 1
β 0 .. . βN − 1
Note that by linearity we have |ψ〉 = U |φ〉 = U (
i αi|i〉) =^
i αiU^ |i〉.
∑Because measuring^ |ψ〉^ should also give a probability distribution, we have the constraint N − 1 j=0 |βj^ | (^2) = 1 on the new state. This implies that the operation U must preserve the norm
of vectors, and hence must be a unitary transformation (often just called “a unitary”). A matrix U is unitary if its inverse U −^1 equals its conjugate transpose U ∗. This is equivalent to saying that U always maps a vector of norm 1 to a vector of norm 1. Because a unitary transformation always has an inverse, it follows that any (non-measuring) operation on quantum states must be reversible: by applying U −^1 we can always “undo” the action of U , and nothing is lost in the process. On the other hand, a measurement is clearly non-reversible, because we cannot reconstruct |φ〉 from the observed classical state |j〉.
6
Such 2-qubit states are sometimes called EPR-pairs in honor of Einstein, Podolsky, and Rosen [106], who examined such states and their seemingly paradoxical properties. Initially neither of the two qubits has a classical value | 0 〉 or | 1 〉. However, if we measure the first qubit and observe, say, a | 0 〉, then the whole state collapses to | 00 〉. Thus observing the first qubit immediately fixes also the second, unobserved qubit to a classical value. Since the two qubits that make up the register may be far apart, this example illustrates some of the non-local effects that quantum systems can exhibit. In general, a bipartite state |φ〉 is called entangled if it cannot be written as a tensor product |φA〉 ⊗ |φB 〉 where |φA〉 lives in the first space and |φB 〉 lives in the second.^7 At this point, a comparison with classical probability distributions may be helpful. Suppose we have two probability spaces, A and B, the first with 2n^ possible outcomes, the second with 2m possible outcomes. A probability distribution on the first space can be described by 2n^ numbers (nonnegative reals summing to 1; actually there are only 2n^ − 1 degrees of freedom here) and a distribution on the second by 2m^ numbers. Accordingly, a product distribution on the joint space can be described by 2n^ + 2m^ numbers. However, an arbitrary (non-product) distribution on the joint space takes 2n+m^ real numbers, since there are 2n+m^ possible outcomes in total. Analogously, an n-qubit state |φA〉 can be described by 2n^ numbers (complex numbers whose squared moduli sum to 1), an m-qubit state |φB 〉 by 2m^ numbers, and their tensor product |φA〉 ⊗ |φB 〉 by 2n^ + 2m numbers. However, an arbitrary (possibly entangled) state in the joint space takes 2n+m^ numbers, since it lives in a 2n+m-dimensional space. We see that the number of parameters required to describe quantum states is the same as the number of parameters needed to describe probability distributions. Also note the analogy between statistical independence^8 of two random variables A and B and non-entanglement of the product state |φA〉 ⊗ |φB 〉. However, despite the similarities between probabilities and amplitudes, quantum states are much more powerful than distributions, because amplitudes may have negative (or even complex) parts which can lead to interference effects. Amplitudes only become probabilities when we square them. The art of quantum computing is to use these special properties for interesting computational purposes.
1.4 Elementary gates
A unitary that acts on a small number of qubits (say, at most 3) is often called a gate, in analogy to classical logic gates like AND, OR, and NOT; more about that in the next chapter. The Pauli matrices I, X, Y, Z (Appendix A.9) are examples of 1-qubit gates. For example, the bitflip gate X (a.k.a. NOT-gate) negates the bit in the computational basis, i.e., it swaps | 0 〉 and | 1 〉. The phaseflip gate Z puts a − in front of | 1 〉. Represented as 2 × 2 unitary matrices, these are
(^7) We often omit the tensor product symbol for such unentangled states, abbreviating |φA〉 ⊗ |φB 〉 to |φA〉|φB 〉 (you shouldn’t abbreviate this further to |φAφB 〉 though, unless both |φA〉 and |φB 〉 are computational basis states). Note that there cannot be ambiguity between tensor product and the usual matrix product in this abbreviation, because both |φA〉 and |φB 〉 are column vectors and hence their matrix product wouldn’t even be well-defined (the dimensions “don’t fit”). (^8) Two random variables A and B are independent if their joint probability distribution can be written as a product of individual distributions for A and for B: Pr[A = a ∧ B = b] = Pr[A = a] · Pr[B = b] for all possible values a, b.
8
Another important 1-qubit gate is the phase gate Rφ, which merely rotates the phase of the | 1 〉-state by an angle φ: Rφ| 0 〉 = | 0 〉 Rφ| 1 〉 = eiφ| 1 〉
This corresponds to the unitary matrix
Rφ =
0 eiφ
Note that Z is a special case of this: Z = Rπ, because eiπ^ = −1. The Rπ/ 4 -gate is often just called the T -gate. Possibly the most important 1-qubit gate is the Hadamard transform, specified by:
H| 0 〉 =
As a unitary matrix, this is represented as
H =
If we apply H to initial state | 0 〉 and then measure, we have equal probability of observing | 0 〉 or | 1 〉. Similarly, applying H to | 1 〉 and observing gives equal probability of | 0 〉 or | 1 〉. However, if we apply H to the superposition √^12 | 0 〉 + √^12 | 1 〉 then we obtain
The positive and negative amplitudes for | 1 〉 have canceled each other out! This effect is called interference, and is analogous to interference patterns between light or sound waves. An example of a 2-qubit gate is the controlled-not gate CNOT. It negates the second bit of its input if the first bit is 1, and does nothing if the first bit is 0:
CNOT| 0 〉|b〉 = | 0 〉|b〉 CNOT| 1 〉|b〉 = | 1 〉| 1 − b〉
The first qubit is called the control qubit, the second the target qubit. In matrix form, this is
More generally, if U is some n-qubit unitary matrix, then the controlled-U operation corresponds to the following 2n+1^ × 2 n+1^ unitary matrix: ( I 0 0 U
where I is the 2n-dimensional identity matrix and the two 0s denote 2n^ × 2 n^ all-0 matrices.
9
(a) They start with a shared EPR-pair, √^12 (| 00 〉 + | 11 〉). Alice has classical bits a and b. Suppose she does an X-gate on her half of the EPR-pair if a = 1, followed by a Z-gate if b = 1 (she does both if ab = 11, and neither if ab = 00). Write the resulting 2-qubit state for the four different cases that ab could take. (b) Suppose Alice sends her half of the state to Bob, who now has two qubits. Show that Bob can determine both a and b from his state, using Hadamard and CNOT gates, followed by a measurement in the computational basis.
(a) Let C be a 2 × 2 matrix. Show that Tr((C ⊗ I)|ψ〉〈ψ|) = 12 Tr(C). (b) (H) Alice could apply one of the 4 Pauli matrices (I, X, Y, Z) to her qubit. Use part (a) to show that the 4 resulting 2-qubit states form an orthonormal set. (^9) This is actually a deep statement, a special case of Holevo’s theorem. More about this may be found in Chapter 15.
(c) Suppose Alice applies one of the 4 Pauli matrices to her qubit and then sends that qubit to Bob. Give the 4 projectors of a 4-outcome projective measurement that Bob could do on his 2 qubits to find out which Pauli matrix Alice actually applied.
cos θ − sin θ sin θ cos θ
, |φ〉 = Uθ| 0 〉 and |φ⊥〉 = Uθ| 1 〉.
(a) Show that ZX|φ⊥〉 = |φ〉. (b) Show that an EPR-pair, √^12 (| 00 〉 + | 11 〉), can also be written as √^12 (|φ〉|φ〉 + |φ⊥〉|φ⊥〉). (c) Suppose Alice and Bob start with an EPR-pair. Alice applies U (^) θ− 1 to her qubit and then measures it in the computational basis. What pure state does Bob have if her outcome was 0, and what pure state does he have if her outcome was 1? (d) Suppose Alice knows the number θ but Bob does not. Give a protocol that uses one EPR-pair and 1 classical bit of communication where Bob ends up with the qubit |φ〉 (in contrast to general teleportation of an unknown qubit, which uses 1 EPR-pair and 2 bits of communication).