Discover millions of ebooks, audiobooks, and so much more with a free trial

From $11.99/month after trial. Cancel anytime.

Introduction to Quantum Algorithms via Linear Algebra, second edition
Introduction to Quantum Algorithms via Linear Algebra, second edition
Introduction to Quantum Algorithms via Linear Algebra, second edition
Ebook483 pages5 hours

Introduction to Quantum Algorithms via Linear Algebra, second edition

Rating: 0 out of 5 stars

()

Read preview

About this ebook

Quantum computing explained in terms of elementary linear algebra, emphasizing computation and algorithms and requiring no background in physics.

This introduction to quantum algorithms is concise but comprehensive, covering many key algorithms. It is mathematically rigorous but requires minimal background and assumes no knowledge of quantum theory or quantum mechanics. The book explains quantum computation in terms of elementary linear algebra; it assumes the reader will have some familiarity with vectors, matrices, and their basic properties, but offers a review of the relevant material from linear algebra. By emphasizing computation and algorithms rather than physics, it makes quantum algorithms accessible to students and researchers in computer science who have not taken courses in quantum physics or delved into fine details of quantum effects, apparatus, circuits, or theory.
LanguageEnglish
PublisherThe MIT Press
Release dateApr 6, 2021
ISBN9780262362153
Introduction to Quantum Algorithms via Linear Algebra, second edition

Related to Introduction to Quantum Algorithms via Linear Algebra, second edition

Related ebooks

Physics For You

View More

Related articles

Reviews for Introduction to Quantum Algorithms via Linear Algebra, second edition

Rating: 0 out of 5 stars
0 ratings

0 ratings0 reviews

What did you think?

Tap to rate

Review must be at least 10 words

    Book preview

    Introduction to Quantum Algorithms via Linear Algebra, second edition - Richard J. Lipton

    I

    ESSENTIAL ALGORITHMS

    1

    Introduction

    One of the great scientific and engineering questions of our time is:

    Are quantum computers possible?

    We can build computers out of mechanical gears and levers, out of electric relays, out of vacuum tubes, out of discrete transistors, and finally today out of integrated circuits that contain billions of individual transistors. In the future, it may be possible to build computers out of other types of devices. Who knows?

    All of these computers, from mechanical to integrated-circuit-based ones, are called classical. They are all classical in that they implement the same type of computer, albeit as the technology gets more sophisticated the computers become faster, smaller, and more reliable. But they all behave in the same way, and they all operate in a nonquantum regime.

    What distinguishes these devices is that information is manipulated as bits, which already have determinate values of 0 or 1. Ironically, the key components of today’s computers are quantum devices. Both the transistor and its potential replacement, the Josephson junction, won a Nobel Prize for the quantum theory of their operation. So why is their regime nonquantum? The reason is that the regime reckons information as bits.

    By contrast, quantum computation operates on qubits, which are based on complex-number values, not just 0 and 1. They can be read only by measuring, and the readout is in classical bits. To skirt the commonly bandied notion of observers interfering with quantum systems and to postpone the discussion of measurement as an operation, we offer the metaphor that a bit is what you get by cooking a qubit. From this standpoint, doing a classical computation on bits is like cooking the ingredients of a pie individually before baking them together in the pie. The quantum argument is that it’s more expedient to let the filling bubble in its natural state while cooking everything at once. The engineering problem is whether the filling can stay coherent long enough for this to work.

    The central question is whether it is possible to build computers that are inherently quantum. Such computers would exploit the power and wonder of nature to create systems that can effectively be in multiple states at once. They open a world with apparent actions at a distance that the great Albert Einstein never believed but that actually happen—a world with other strange and counterintuitive effects. To be sure, this is the world we live in, so the question becomes how much of this world our computers can enact.

    This question is yet to be resolved. Many believe that such machines will be built one day. Some others have fundamental doubts and believe there are physical limits that make quantum computers impossible. It is currently unclear who is right, but whatever happens will be interesting: a world with quantum computers would allow us to solve hard problems, while a barrier to them might shed light on deep questions of physics and information.

    Happily this question does not pose a barrier to us. We plan to study quantum algorithms, which are interesting whether quantum computers are built soon, in the next ten years, in the next fifty years, or never. The area of quantum algorithms contains some beautiful ideas that everyone interested in computation should know.

    The rationale for this book is to supply a gentle introduction to quantum algorithms. We will say nothing more about quantum computers—about whether they will be built or how they may work—until the end. We will only discuss algorithms.

    Our goal is to explain quantum algorithms in a way that is accessible to almost anyone. Curiously, while quantum algorithms are quite different from classical ones, the mathematical tools needed to understand them are quite modest. The mathematics that is required to understand them is linear algebra: vectors, matrices, and their basic properties. That is all. So these are really linear-algebraic algorithms.

    1.1 The Model

    The universe is complex and filled with strange and wonderful things: from life-forms like viruses, bacteria, and people to inanimate objects like computers, airplanes, and bridges that span huge distances; from planets to whole galaxies. There is mystery and wonder in them all.

    The goal of science in general, and physics specifically, is to explore and understand the universe by discovering the simplest laws possible that explain the multitude of phenomena. The method used by physics is the discovery of models that predict the behavior of all from the smallest to the largest objects. In ancient times, the models were crude: the earliest models explained all by reducing everything to earth, water, wind, and fire. Today, the models are much more refined: they replace earth and water by hundreds of particles and wind and fire by the four fundamental forces. Mainly, the models are better at predicting, that is, in channeling reproducible knowledge. Yet the full theory, the long-desired theory of everything, still eludes us.

    Happily, in this introduction to quantum algorithms, we need only a simple model of how part of the universe works. We can avoid relativity, special and general; we can avoid the complexities of the Standard Model of particle physics, with its hundreds of particles; we can even avoid gravity and electromagnetism. We cannot quite go back to earth, water, wind, and fire, but we can avoid having to know and understand much of modern physics. This avowal of independence from physical qualities does not prevent us from imagining nature’s workings. Instead, it speaks to our belief that algorithmic considerations in information processing run deeper.

    1.2 The Space and the States

    So what do we need to know? We need to understand that the state of our quantum systems will always be described by a single unit vector a that lies in some fixed vector space of dimension N = 2n, for some n. That is, the state is always a vector

    where each entry ak is a real or complex number depending on whether the space is real or complex. Each entry is called an amplitude. We will not need to involve the full quantum theory of mixed states, which are formally the same as classical probability distributions over states like a, which are called pure states. Except in chapter 14, we need consider only pure states.

    We must distinguish between general states and basis states, which form a linear-algebra basis composed of configurations that we may observe. In the standard basis, the basis states are denoted by the vectors ek whose entries are 0 except for a 1 in place k. We identify ek with the index k itself in [0,N − 1] and then further identify k with the kth string x in a fixed total ordering of {0,1}n. That the basis states correspond to all the length-n binary strings is why we have N = 2n. The interplays among basis vectors, numerical indices, and binary strings encoding objects are drawn more formally beginning in chapter 2.

    Any vector that is not a basis state is a superposition. Two or more basis states have nonzero amplitude in any superposition, and only one of them can be observed individually in any measurement. The amplitude ak is not directly meaningful for what we may expect to observe but, rather, its squared absolute value, |ak|². This gives the measurement probability of the outcome k, that is, the probability of finding the system in the basis state ek. The import of a being a unit vector is that these probabilities sum to 1 (i.e., that ).

    For N = 2, the idea that the length of a diagonal line defined by the origin and a point in the plane involves the sum of two squares is older than Pythagoras. The length is 1 precisely when the point lies on the unit circle. We may regard the basis state e0 as lying on the x-axis, while e1 lies on the y-axis. Then measurement projects the state a either onto the "x leg" of the triangle it makes with the x-axis or the "y leg" of the triangle along the y-axis.

    It may still seem odd that the probabilities are proportional not to the lengths of the legs but to their squares. But we know that if the angle is θ from the near part of the x-axis (so 0 ≤ θ π/2), then the lengths are cos(θ) and sin(θ), respectively, and it is cos²(θ) + sin²(θ), not cos(θ) + sin(θ), that sums to 1. If we wanted to use points whose legs sum directly to 1, we’d have to use the diamond that is inscribed inside the circle. In N-dimensional space, we’d have to use the N-dimensional simplex rather than the sphere. Well, the simplex is spiky and was not really studied until the twentieth century, whereas the sphere is smooth and was appreciated by the ancients. Evidently nature agrees with ancient aesthetics. We may not know why the world works this way, but we can certainly say, why not?

    Once we agree, all we really need to know about the space is that it supports the picture of Pythagoras, that is, ordinary Euclidean space. Both the real vector spaces ℝN and the complex ones ℂN do so. That is, they agree on how many components their vectors have and how distances are measured by taking squares of values from the vector components. They differ only on what kind of numbers these component values v can be, but the idea of the norm or absolute value |v| quickly reconciles this difference. This aspect was first formalized by Euclid’s great rigorizer of the late nineteenth and early twentieth centuries, David Hilbert; in his honor, the common concept is called a Hilbert space. Hilbert’s concept retains its vigor even if N can be infinite, or if the vectors and their components are strange objects, but in this book we need not worry: N will always be finite, and the space ℍN will be ℝN or ℂN. Allowing the latter is the reason that we say Hilbert space and not ordinary Euclidean space.

    1.3 The Operations

    In fact, our model embraces the circle and the sphere even more tightly. It throws out—it disallows—all other points. Every state a must be a point on the unit sphere. If you have heard the term projective space, then that is what we are restricting to. But happily we need not worry about restricting the points as long as we restrict the operations in our model. The operations must map any point on the unit sphere to some (other) point on the unit sphere.

    We will also restrict the operations to be linear. Apart from measurements, operations must be onto the whole sphere—which makes them map all of ℍN onto all of ℍN. By the theory of vector subspaces, this means the operations must also be invertible. Operations with all these properties are called unitary.

    We will represent the operations by matrices, and we give several equivalent stipulations for unitary matrices in chapter 3, followed by examples in chapter 5 and tricks for working with them in chapter 6. But we can already understand that compositions of unitary operations are unitary, and their representations and actions can be figured by the familiar idea of multiplying matrices. Thus, our model’s programs will simply be compositions of unitary matrices. The one catch is that the matrices themselves will be huge, out of proportion to the actual simplicity of the operation as we believe nature meters it. Hence, we will devote time in chapters 4 and 5 to ensuring these operations are feasible according to standards already well accepted in classical computation.

    Thus, we can comply with the requirements for any computational model to convey (a) what state the computation starts in, (b) how it moves from one state to another, and (c) how we get information out of the computation.

    (a) Start: We will ultimately be able to assume that the start state is always the elementary vector

    of length N. Because the first binary string in our ordering of {0,1}n will be 0n, our usual start state will denote the binary string of n zeros.

    (b) Move: If the system is in some state a, then we can move it by applying a unitary transformation U. Thus, a will move to b where b = Ua. Not all unitary transformations are allowed, but we will get to that later. Note that if a is a unit vector, then so is b.

    (c) End: We get information out of the quantum computation by making a measurement. If the final state is c, then k is seen with probability |ck|². Note that the output is just the index k, not the probability of the index. Often we will have a distinguished set S of indices that stand for accept, with outcomes in [0,N − 1] ∖ S standing for reject.

    That is it.

    1.4 Where Is the Input?

    In any model of computation, we expect that there is some way to input information into the model’s devices. That seems, at first glance, to be missing from our model. The start state is fixed, and the output method is fixed, so where do we put the input? The answer is that the input can be encoded by the choice of the unitary transformation U, in particular by the first several unitary operations in U, so that for different inputs we will apply different transformations.

    This can easily be done in the case of classical computations. We can dispense with explicit input provided we are allowed to change the program each time we want to solve a different problem. Consider a program of this form:

    Clearly, if we can access the value of the variable x, then we can determine the factors of 21. If we wanted to factor a more interesting number, such as 35 or 1,001 or 11,234,143, then we can simply execute the same program with M set to that number.

    This integration of inputs with programs is more characteristic of quantum than classical computation. Think of the transformation U as the program, so varying U is exactly the same as varying the program in the classical case. We will show general ways of handling inputs in chapter 6, while for several famous algorithms, in chapters 8–10, the input is expressly given as a transformation that is dropped into a larger program. Not to worry: section 7.5 of chapter 7 provides support for giving any basis vector—that is, any binary string—as input, and probes the mechanism that distinguishes quantum algorithms from classical ones.

    1.5 What Exactly Is the Output?

    The problematic words in this section title are the two short ones. With apologies to President Bill Clinton, the question is not so much what the meaning of ‘is’ is, as what the meaning of the is. In a classical deterministic model of computation, every computation has one definite output. Even if the model is randomized, every random input still determines a single computation path, whose output is definite before its last step is executed.

    A quantum computation, however, presents the user at the end with a slot machine. Measuring is pulling the lever to see what output the wheels give you. Unlike in some old casinos where slot machines were rigged, you control how the machine is built, and ideally you’ve designed it to make the probabilities work in your favor. As with the input, however, the focus shifts from a given binary string to the machinery itself, and to the action of sampling a distribution that pulling the measurement lever gives you.

    In chapter 6, we will also finesse the issue of having measurements in the middle of computations that continue from states projected down to a lower-dimensional space. This could be analogized to having a slot machine still spinning after one wheel has fixed its value. We show why measurements may generally be postponed until the end, but the algorithms in this textbook already behave that way. This helps focus the idea that the goal of quantum computation is not to produce single targeted outputs but, rather, to produce devices that can generate samples from targeted distributions. Chapter 6 also lays groundwork for how those devices can be recycled to improve one’s chance of success. Chapter 7 lays out the format for how we present and analyze quantum algorithms and gives further attention to entanglement, interference, and measurement.

    All of this remains only philosophy, however, unless we can show how the results of the sampling help solve concrete problems efficiently in distinguished ways. These solutions are the ultimate outputs, as exemplified in chapters 8–10. In chapters 11 and 12, the outputs are factorizations of numbers, via the algorithm famously discovered by Peter Shor. In chapter 13 and chapters 15–17, they are objects that we seek in a big search space. In chapter 18, they are approximations to vectors that solve linear equations. Chapter 19 branches out to topics in quantum complexity theory, defining the class BQP formally and proving upper and lower bounds on it in terms of classical complexity. Chapter 20 summarizes the algorithms and discusses some further topics and readings. This completes the application of the model and the overview of this book.

    1.6 Summary and Notes

    In Platonic fashion, we have tried to idealize quantum computation by pure thought apart from physical properties of the world around us. Of course one can make errors that way, as Galileo exposed Aristotle’s errors about gravity by climbing a tower and dropping equal-sized balls of unequal weights. It is vain to think that Pythagoras or Euclid or Archimedes could have come up with such a computational model but maybe not so vain to estimate it of Hilbert. Linear algebra and geometry were both deepened by Hilbert. Meanwhile, the quantum theory emerged and ideas of computation were extensively discussed long before 1936, when Alan Turing gave his definitive classical answer (see Turing, 1937).

    The main stumbling block may have been probability. Quantum physicists were forced to embrace probability from the get-go, in a time when Newtonian determinism was dominant and Einstein said God—that is, nature—does not play dice. Some of our algorithms will be deterministic—that is, we will encounter cases where the final points on the unit sphere coincide with standard basis vectors, whereupon all the probabilities are 0 or 1. However, coping with probabilistic output appears necessary to realize the full power of quantum computation. Einstein joined those physicists comfortable with randomness in an undated letter written no later than November 1945, declaring in English, God tirelessly plays dice under laws which he has himself prescribed. Yet another block may have been the long time it took to realize the essence of computation. Turing’s proof reached full flower only with the emergence of computing machines during and after World War II.

    Even then, it took Richard Feynman, arguably the main visionary in our scope after the passing of John von Neumann in 1957, until his last decade in the 1980s to set his vision down (Feynman, 1982; 1985). That is when it came to the attention of David Deutsch (1985) and some others. The theory had several false starts—for instance, the second of us overlapped with Deutsch in 1984–1986 at Oxford’s Mathematical Institute and saw its fellows turn aside Deutsch’s initial claims to be able to compute classically uncomputable functions.

    It can take a long time for a great theory to mature, but a great theorem such as Peter Shor’s on quantum factoring can accelerate it a lot. We hope this book helps make the ascent to understanding it easier. We chose M = 21 in section 1.4 because it was for a long time the highest integer on which practical runs of Shor’s algorithm had been claimed, but even these were not definitively established according to Smolin, Smith, and Vargo (2013).

    2

    Numbers and Strings

    Before we can start to present quantum algorithms, we need to discuss the interchangeable roles of natural numbers and Boolean strings. The set ℕ of natural numbers consists as usual of

    A Boolean string is a string that consists solely of bits: a bit is either 0 or 1. In computer science, such strings play a critical role, as you probably already know, because our computational devices are all based on being either on or off, charged or uncharged, magnetized or unmagnetized, and so on.

    The operations we use on natural numbers are the usual ones. For example, x + y is the sum of x and y, and x · y is their product. There is nothing new or surprising here. The operations we use on Boolean strings are also quite simple: the length of a string is the number of bits in the string, and if x and y are Boolean strings, then xy is their concatenation. Thus, if x = 0101 and y = 111, then we have xy = 0101111. This is a kind of product operation on strings, but we find it convenient not to use an explicit operator symbol. If you see xy and both x and y are strings, then xy is the result of concatenating them.

    What we need to do is switch from numbers to Boolean strings and back. Sometimes it is best to use the number representation and other times the string representation. This kind of dual nature is basic in computer science and will be used often in describing the quantum algorithms. There are, however, some hitches we must account for to make it work properly. Let’s see why.

    If m is a natural number, then it can uniquely be written as a binary number. Let

    where each xi is a bit, and we insist that xn−1 is nonzero. Then we can use m to denote the Boolean string xn−1⋯ x1x0. For instance, 7 maps to the string 111. In the reverse direction, we can use the string

    to denote the natural number

    For example, the string 10010 is the number 16 + 2 = 18.

    Often we will be concerned with numbers in a fixed range 0… N − 1, where N = 2n. This range is denoted by [N]. Then it will be convenient to omit the leading 1 and use n bits for each number, so that zero is n-many 0s, one is 0n−11, and so on up to N − 1 = 1n, where 1n means n-many 1s. We call this the canonical numbering of {0,1}n. For example, with n = 3,

    The small but important issue is that, for the representation from numbers to strings to be unambiguous, we must know how long the strings are. Otherwise, what does the number 0 represent? Does it represent 0 or 00 or 000 and so on? This is why we said earlier that the mapping between numbers and strings is not exact. To make it precise, we need to know the length of the strings. A more technical way of saying this is that once we specify the mapping as being between the natural numbers 0,1,…,2n − 1 and the strings of length n (that is, {0,1}n), the mapping is one to one. Note that 0 as a number now corresponds to the unique string

    There is one more operation that we use on Boolean strings. If x and y are Boolean strings of length m, then x y is their Boolean inner product, which is defined as

    Here ⊕ means exclusive-or, which is the same as addition modulo 2. Hence, sometimes we may talk about Boolean strings as being members of an m-dimensional space with addition modulo 2. We must warn that the name inner product is also used when we talk about Hilbert spaces in chapter 3. Many sources use x·y to mean concatenation of strings, but we reserve the lighter dot for numerical multiplication. When x and y are single bits, x · y is the same as x y, but using the lighter dot still helps remind us that they are single bits. Sometimes this type of overloading occurs in mathematics—we try to make clear which is used when.

    A further neat property of Boolean strings is that they can represent subsets of a set. If the set is {1,2,3}, in that order, then 000 corresponds to the empty set, 011 to {2,3}, 100 to {1}, 111 to the whole set {1,2,3}, and so on.

    Here is an example of all these concepts. Consider the following set of four binary strings:

    As a set of numbers it is {0,3,5,6}, but the strings have properties apart from the numbers. A is the subset of S = {0,1}³ of strings with an even number of 1s. We can express this in an illuminating manner. Fix y = 111. Then

    We have written false as 0 in order to witness that A is the set of strings satisfying a linear equation. This makes it a linear subspace of S regarded as a vector space in which addition is modulo 2. The operation x y is the inner product in this space. Using ⊕ also to mean addition modulo 2 for binary vectors, we see, for instance, that 011 ⊕ 101 = 110, which also belongs to A. Finally, note that A singles out the subsets of {1,2,3} that have an even number of elements. The operation ⊕ then means taking the symmetric difference of the corresponding sets. The above reasoning tells us that if P and Q are sets with an even number of elements, then their symmetric difference

    likewise has an even number of elements. This is true not just within S but generally. Although we will be concerned mainly with vector spaces over real and complex numbers—those we will call Hilbert spaces—the modular kind will appear in several contexts, most notably for Simon’s algorithm in chapter 10.

    2.1 Asymptotic Notation

    Suppose we run an algorithm that, on problems of size n, works in n passes, where the ith pass takes i steps. How long does the whole algorithm take? If we want to be exact about the number s(n) of steps, then we can calculate

    If we view the process pictorially, then we see the passes are tracing out a triangular half of an n × n square along the main diagonal. This intuition says " n²" without worrying about whether the main diagonal is included

    Enjoying the preview?
    Page 1 of 1