An Introduction To Quantum Computing For Non-Physicists
An Introduction To Quantum Computing For Non-Physicists
Non-Physicists
Eleanor Rieffel
FX Palo Alto Labratory
and
Wolfgang Polak
arXiv:quant-ph/9809016v2 19 Jan 2000
Consultant
Richard Feynman’s observation that certain quantum mechanical effects cannot be simulated efficiently on a
computer led to speculation that computation in general could be done more efficiently if it used these quantum
effects. This speculation proved justified when Peter Shor described a polynomial time quantum algorithm for
factoring integers.
In quantum systems, the computational space increases exponentially with the size of the system which enables
exponential parallelism. This parallelism could lead to exponentially faster quantum algorithms than possible
classically. The catch is that accessing the results, which requires measurement, proves tricky and requires new
non-traditional programming techniques.
The aim of this paper is to guide computer scientists through the barriers that separate quantum computing
from conventional computing. We introduce basic principles of quantum mechanics to explain where the power
of quantum computers comes from and why it is difficult to harness. We describe quantum cryptography, tele-
portation, and dense coding. Various approaches to exploiting the power of quantum parallelism are explained.
We conclude with a discussion of quantum error correction.
Permission to make digital or hard copies of part or all of this work for personal or classroom use is granted with-
out fee provided that copies are not made or distributed for profit or direct commercial advantage and that copies
show this notice on the first page or initial screen of a display along with the full citation. Copyrights for com-
ponents of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy
otherwise, to republish, to post on servers, to redistribute to lists, or to use any component of this work in other
works, requires prior specific permission and/or a fee. Permissions may be requested from Publications Dept,
ACM Inc., 1515 Broadway, New York, NY 10036 USA, fax +1 (212) 869-0481, or [email protected].
2 · E. Rieffel and W. Polak
1. INTRODUCTION
Richard Feynman observed in the early 1980’s [Feynman 1982] that certain quantum me-
chanical effects cannot be simulated efficiently on a classical computer. This observation
led to speculation that perhaps computation in general could be done more efficiently if it
made use of these quantum effects. But building quantum computers, computational ma-
chines that use such quantum effects, proved tricky, and as no one was sure how to use the
quantum effects to speed up computation, the field developed slowly. It wasn’t until 1994,
when Peter Shor surprised the world by describing a polynomial time quantum algorithm
for factoring integers [Shor 1994; Shor 1997], that the field of quantum computing came
into its own. This discovery prompted a flurry of activity, both among experimentalists try-
ing to build quantum computers and theoreticians trying to find other quantum algorithms.
Additional interest in the subject has been created by the invention of quantum key distri-
bution and, more recently, popular press accounts of experimental successes in quantum
teleportation and the demonstration of a three-bit quantum computer.
The aim of this paper is to guide computer scientists and other non-physicists through
the conceptual and notational barriers that separate quantum computing from conventional
computing and to acquaint them with this new and exciting field. It is important for the
computer science community to understand these new developments since they may radi-
cally change the way we have to think about computation, programming, and complexity.
Classically, the time it takes to do certain computations can be decreased by using paral-
lel processors. To achieve an exponential decrease in time requires an exponential increase
in the number of processors, and hence an exponential increase in the amount of physical
space needed. However, in quantum systems the amount of parallelism increases expo-
nentially with the size of the system. Thus, an exponential increase in parallelism requires
only a linear increase in the amount of physical space needed. This effect is called quantum
parallelism [Deutsch and Jozsa 1992].
There is a catch, and a big catch at that. While a quantum system can perform massive
parallel computation, access to the results of the computation is restricted. Accessing the
results is equivalent to making a measurement, which disturbs the quantum state. This
problem makes the situation, on the face of it, seem even worse than the classical situation;
we can only read the result of one parallel thread, and because measurement is probabilis-
tic, we cannot even choose which one we get.
But in the past few years, various people have found clever ways of finessing the mea-
surement problem to exploit the power of quantum parallelism. This sort of manipulation
has no classical analog, and requires non-traditional programming techniques. One tech-
nique manipulates the quantum state so that a common property of all of the output values
such as the symmetry or period of a function can be read off. This technique is used in
Shor’s factorization algorithm. Another technique transforms the quantum state to increase
the likelihood that output of interest will be read. Grover’s search algorithm makes use of
such an amplification technique. This paper describes quantum parallelism in detail, and
the techniques currently known for harnessing its power.
Section 2, following this introduction, explains of the basic concepts of quantum me-
chanics that are important for quantum computation. This section cannot give a compre-
hensive view of quantum mechanics. Our aim is to provide the reader with tools in the form
of mathematics and notation with which to work with the quantum mechanics involved in
quantum computation. We hope that this paper will equip readers well enough that they
Introduction to Quantum Computing · 3
known classical factoring algorithm requires exponential time and it is generally believed
that there is no classical polynomial time factoring algorithm. Shor’s is a beautiful al-
gorithm that takes advantage of quantum parallelism by using a quantum analog of the
Fourier transform.
√ Grover developed a technique for searching an unstructured list of n items in
Lov
O( n) steps on a quantum computer. Classical computers can do no better than O(n),
so unstructured search on a quantum computer is provably more efficient than search on a
classical computer. However, the speed-up is only polynomial, not exponential, and it has
been shown that Grover’s algorithm is optimal for quantum computers. It seems likely that
search algorithms that could take advantage of some problem structure could do better. Tad
Hogg, among others, has explored such possibilities. We describe various quantum search
techniques in section 7.
It is as yet unknown whether the power of quantum parallelism can be harnessed for a
wide variety of applications. One tantalizing open question is whether quantum computers
can solve NP complete problems in polynomial time.
Perhaps the biggest open question is whether useful quantum computers can be built.
There are a number of proposals for building quantum computers using ion traps, nuclear
magnetic resonance (NMR), optical and solid state techniques. All of the current proposals
have scaling problems, so that a breakthrough will be needed to go beyond tens of qubits
to hundreds of qubits. While both optical and solid state techniques show promise, NMR
and ion trap technologies are the most advanced so far.
In an ion trap quantum computer [Cirac and Zoller 1995; Steane 1996] a linear sequence
of ions representing the qubits are confined by electric fields. Lasers are directed at indi-
vidual ions to perform single bit quantum gates. Two-bit operations are realized by using
a laser on one qubit to create an impulse that ripples through a chain of ions to the second
qubit where another laser pulse stops the rippling and performs the two-bit operation. The
approach requires that the ions be kept in extreme vacuum and at extremely low tempera-
tures.
The NMR approach has the advantage that it will work at room temperature, and that
NMR technology in general is already fairly advanced. The idea is to use macroscopic
amounts of matter and encode a quantum bit in the average spin state of a large number of
nuclei. The spin states can be manipulated by magnetic fields and the average spin state can
be measured with NMR techniques. The main problem with the technique is that it doesn’t
scale well; the measured signal scales as 1/2n with the number of qubits n. However,
a recent proposal [Schulman and Vazirani 1998] has been made that may overcome this
problem. NMR computers with three qubits have been built successfully [Cory et al. 1998;
Vandersypen et al. 1999; Gershenfeld and Chuang 1997; Laflamme et al. 1997]. This
paper will not discuss further the physical and engineering problems of building quantum
computers.
The greatest problem for building quantum computers is decoherence, the distortion of
the quantum state due to interaction with the environment. For some time it was feared
that quantum computers could not be built because it would be impossible to isolate them
sufficiently from the external environment. The breakthrough came from the algorithmic
rather than the physical side, through the invention of quantum error correction techniques.
Initially people thought quantum error correction might be impossible because of the im-
possibility of reliably copying unknown quantum states, but it turns out that it is possible
to design quantum error correcting codes that detect certain kinds of errors and enable the
Introduction to Quantum Computing · 5
reconstruction of the exact error-free quantum state. Quantum error correction is discussed
in section 8.
Appendices provide background information on tensor products and continued fractions.
2. QUANTUM MECHANICS
Quantum mechanical phenomena are difficult to understand since most of our everyday
experiences are not applicable. This paper cannot provide a deep understanding of quantum
mechanics (see [Feynman et al. 1965; Liboff 1997; Greenstein and Zajonc 1997] for
expositions of quantum mechanics). Instead, we will give some feeling as to the nature
of quantum mechanics and some of the mathematical formalisms needed to work with
quantum mechanics to the extent needed for quantum computing.
Quantum mechanics is a theory in the mathematical sense: it is governed by a set of
axioms. The consequences of the axioms describe the behavior of quantum systems. The
axioms lead to several apparent paradoxes: in the Compton effect it appears as if an action
precedes its cause; the EPR experiment makes it appear as if action over a distance faster
than the speed of light is possible. We will discuss the EPR experiment in detail in section
3.4. Verification of most predictions is indirect, and requires careful experimental design
and specialized equipment. We will begin, however, with an experiment that requires only
readily available equipment and that will illustrate some of the key aspects of quantum
mechanics needed for quantum computation.
The function of filter A cannot be explained as a “sieve” that only lets those photons pass
that happen to be already horizontally polarized. If that were the case, few of the randomly
polarized incoming electrons would be horizontally polarized, so we would expect a much
larger attenuation of the light as it passes through the filter.
Next, when filter C is inserted the intensity of the output drops to zero. None of the
horizontally polarized photons can pass through the vertical filter. A sieve model could
explain this behavior.
6 · E. Rieffel and W. Polak
A C
Finally, after filter B is inserted between A and C, a small amount of light will be visible
on the screen, exactly one eighth of the original amount of light.
A B C
Here we have a nonintuitive effect. Classical experience suggests that adding a filter should
only be able to decrease the number of photons getting through. How can it increase it?
2.1.2 The Explanation. A photon’s polarization state can be modelled by a unit vector
pointing in the appropriate direction. Any arbitrary polarization can be expressed as a
linear combination a|↑i + b|→i of the two basis vectors2 |→i (horizontal polarization) and
|↑i (vertical polarization).
Since we are only interested in the direction of the polarization (the notion of “magni-
tude” is not meaningful), the state vector will be a unit vector, i.e., |a|2 + |b|2 = 1. In
general, the polarization of a photon can be expressed as a|↑i + b|→i where a and b are
complex numbers3 such that |a|2 + |b|2 = 1. Note, the choice of basis for this representa-
tion is completely arbitrary: any two orthogonal unit vectors will do (e.g. {|տi, |րi}).
The measurement postulate of quantum mechanics states that any device measuring a 2-
dimensional system has an associated orthonormal basis with respect to which the quantum
measurement takes place. Measurement of a state transforms the state into one of the
measuring device’s associated basis vectors. The probability that the state is measured as
basis vector |ui is the square of the norm of the amplitude of the component of the original
state in the direction of the basis vector |ui. For example, given a device for measuring
the polarization of photons with associated basis {|↑i, |toi}, the state ψ = a|↑i + b|→i is
measured as |↑i with probability |a|2 and as |→i with probability |b|2 (see Figure 1). Note
that different measuring devices with have different associated basis, and measurements
using these devices will have different outcomes. As measurements are always made with
respect to an orthonormal basis, throughout the rest of this paper all bases will be assumed
to be orthonormal.
Furthermore, measurement of the quantum state will change the state to the result of the
measurement. That is, if measurement of ψ = a|↑i + b|→i results in |↑i, then the state
ψ changes to |↑i and a second measurement with respect to the same basis will return |↑i
with probability 1. Thus, unless the original state happened to be one of the basis vectors,
measurement will change that state, and it is not possible to determine what the original
state was.
2 The notation |→i is explained in section 2.2.
3 Imaginary coefficients correspond to circular polarization.
Introduction to Quantum Computing · 7
|↑i b |ψi
a
|→i
1958]. Kets like |xi denote column vectors and are typically used to describe quantum
states. The matching bra, hx|, denotes the conjugate transpose of |xi. For example, the
orthonormal basis {|0i, |1i} can be expressed as {(1, 0)T , (0, 1)T }. Any complex linear
combination of |0i and |1i, a|0i + b|1i, can be written (a, b)T . Note that the choice of the
order of the basis vectors is arbitrary. For example, representing |0i as (0, 1)T and |1i as
(1, 0)T would be fine as long as this is done consistently.
Combining hx| and |yi as in hx||yi, also written as hx|yi, denotes the inner product of
the two vectors. For instance, since |0i is a unit vector we have h0|0i = 1 and since |0i
and |1i are orthogonal we have h0|1i = 0.
The notation |xihy| is the outer product of |xi and hy|. For example, |0ih1| is the trans-
formation that maps |1i to |0i and |0i to (0, 0)T since
|0ih1||1i = |0ih1|1i = |0i
0
|0ih1||0i = |0ih1|0i = 0|0i = .
0
Equivalently, |0ih1| can be written in matrix form where |0i = (1, 0)T , h0| = (1, 0),
|1i = (0, 1)T , and h1| = (0, 1). Then
1 0 1
|0ih1| = (0, 1) = .
0 0 0
This notation gives us a convenient way of specifying transformations on quantum states
in terms of what happens to the basis vectors (see section 4). For example, the transforma-
tion that exchanges |0i and |1i is given by the matrix
X = |0ih1| + |1ih0|.
In this paper we will prefer the slightly more intuitive notation
X : |0i → |1i
|1i → |0i
that explicitly specifies the result of a transformation on the basis vectors.
3. QUANTUM BITS
A quantum bit, or qubit, is a unit vector in a two dimensional complex vector space for
which a particular basis, denoted by {|0i, |1i}, has been fixed. The orthonormal basis |0i
and |1i may correspond to the |↑i and |→i polarizations of a photon respectively, or to the
polarizations |րi and |տi. Or |0i and |1i could correspond to the spin-up and spin-down
states of an electron. When talking about qubits, and quantum computations in general, a
fixed basis with respect to which all statements are made has been chosen in advance. In
particular, unless otherwise specified, all measurements will be made with respect to the
standard basis for quantum computation, {|0i, |1i}.
For the purposes of quantum computation, the basis states |0i and |1i are taken to repre-
sent the classical bit values 0 and 1 respectively. Unlike classical bits however, qubits can
be in a superposition of |0i and |1i such as a|0i + b|1i where a and b are complex numbers
such that |a|2 + |b|2 = 1. Just as in the photon polarization case, if such a superposition is
measured with respect to the basis {|0i, |1i}, the probability that the measured value is |0i
is |a|2 and the probability that the measured value is |1i is |b|2 .
Introduction to Quantum Computing · 9
Even though a quantum bit can be put in infinitely many superposition states, it is only
possible to extract a single classical bit’s worth of information from a single quantum bit.
The reason that no more information can be gained from a qubit than in a classical bit is
that information can only be obtained by measurement. When a qubit is measured, the
measurement changes the state to one of the basis states in the way seen in the photon
polarization experiment. As every measurement can result in only one of two states, one of
the basis vectors associated to the given measuring device, so, just as in the classical case,
there are only two possible results. As measurement changes the state, one cannot measure
the state of a qubit in two different bases. Furthermore, as we shall see in the section 4.1.2,
quantum states cannot be cloned so it is not possible to measure a qubit in two ways, even
indirectly by, say, copying the qubit and measuring the copy in a different basis from the
original.
classical channel
Alice Bob
quantum channel
Eve
To begin the process of establishing a secret key, Alice sends a sequence of bits to Bob
by encoding each bit in the quantum state of a photon as follows. For each bit, Alice
randomly uses one of the following two bases for encoding each bit:
0 → |↑i
1 → |→i
10 · E. Rieffel and W. Polak
or
0 → |տi
1 → |րi.
Bob measures the state of the photons he receives by randomly picking either basis. After
the bits have been transmitted, Bob and Alice communicate the basis they used for en-
coding and decoding of each bit over the open channel. With this information both can
determine which bits have been transmitted correctly, by identifying those bits for which
the sending and receiving bases agree. They will use these bits as the key and discard all
the others. On average, Alice and Bob will agree on 50% of all bits transmitted.
Suppose that Eve measures the state of the photons transmitted by Alice and resends new
photons with the measured state. In this process she will use the wrong basis approximately
50% of the time, in which case she will resend the bit with the wrong basis. So when
Bob measures a resent qubit with the correct basis there will be a 25% probability that he
measures the wrong value. Thus any eavesdropper on the quantum channel is bound to
introduce a high error rate that Alice and Bob can detect by communicating a sufficient
number of parity bits of their keys over the open channel. So, not only is it likely that
Eve’s version of the key is 25% incorrect, but the fact that someone is eavesdropping will
be apparent to Alice and Bob.
Other techniques for exploiting quantum effects for key distribution have been proposed.
See, for example, Ekert [Ekert et al. 1992], Bennett [Bennett 1992] and Lo and Chau [Lo
and Chau 1999]. But none of the quantum key distribution techniques are substitutes for
public key encryption schemes. Attacks by eavesdroppers other than the one described
here are possible. Security against all such schemes are discussed in both Mayers [Mayers
1998] and Lo and Chau [Lo and Chau 1999].
Quantum key distribution has been realized over a distance of 24 km using standard fiber
optical cables [Hughes et al. 1997] and over 0.5 km through the atmosphere [Hughes et al.
1999].
3.2 Multiple Qubits
Imagine a macroscopic physical object breaking apart and multiple pieces flying off in
different directions. The state of this system can be described completely by describing the
state of each of its component pieces separately. A surprising and unintuitive aspect of the
state space of an n particle quantum system is that the state of the system cannot always
be described in terms of the state of its component pieces. It is when examining systems
of more than one qubit that one first gets a glimpse of where the computational power of
quantum computers could come from.
As we saw, the state of a qubit can be represented by a vector in the two dimensional
complex vector space spanned by |0i and |1i. In classical physics, the possible states of
a system of n particles, whose individual states can be described by a vector in a two
dimensional vector space, form a vector space of 2n dimensions. However, in a quantum
system the resulting state space is much larger; a system of n qubits has a state space of 2n
dimensions.4 It is this exponential growth of the state space with the number of particles
that suggests a possible exponential speed-up of computation on quantum computers over
classical computers.
4 Actually, as we shall see, the state space is the set of normalized vectors in this 2n dimensional space, just as
the state a|0i + b|1i of a qubit is normalized so that |a|2 + |b|2 = 1.
Introduction to Quantum Computing · 11
Individual state spaces of n particles combine classically through the cartesian product.
Quantum states, however, combine through the tensor product. Details on properties of
tensor products and their expression in terms of vectors and matrices is given in Appendix
A. Let us look briefly at distinctions between the cartesian product and the tensor product
that will be crucial to understanding quantum computation.
Let V and W be two 2-dimensional complex vector spaces with bases {v1 , v2 } and
{w1 , w2 } respectively. The cartesian product of these two spaces can take as its basis the
union of the bases of its component spaces {v1 , v2 , w1 , w2 }. Note that the order of the basis
was chosen arbitrarily. In particular, the dimension of the state space of multiple classical
particles grows linearly with the number of particles, since dim(X × Y ) = dim(X) +
dim(Y ). The tensor product of V and W has basis {v1 ⊗ w1 , v1 ⊗ w2 , v2 ⊗ w1 , v2 ⊗ w2 }.
Note that the order of the basis, again, is arbitrary5. So the state space for two qubits,
each with basis {|0i, |1i}, has basis {|0i ⊗ |0i, |0i ⊗ |1i, |1i ⊗ |0i, |1i ⊗ |1i} which can be
written more compactly as {|00i, |01i, |10i, |11i}. More generally, we write |xi to mean
|bn bn−1 . . . b0 i where bi are the binary digits of the number x.
A basis for a three qubit system is
and in general an n qubit system has 2n basis vectors. We can now see the exponential
growth of the state space with the number of quantum particles. The tensor product X ⊗ Y
has dimension dim(X) × dim(Y ).
The state |00i + |11i is an example of a quantum state that cannot be described in terms
of the state of each of its components (qubits) separately. In other words, we cannot find
a1 , a2 , b1 , b2 such that (a1 |0i + b1 |1i) ⊗ (a2 |0i + b2 |1i) = |00i + |11i since
(a1 |0i + b1 |1i) ⊗ (a2 |0i + b2 |1i) = a1 a2 |00i + a1 b2 |01i + b1 a2 |10i + b1 b2 |11i
3.3 Measurement
The experiment in section 2.1.2 illustrates how measurement of a single qubit projects the
quantum state on to one of the basis states associated with the measuring device. The result
of a measurement is probabilistic and the process of measurement changes the state to that
measured.
Let us look at an example of measurement in a two qubit system. Any two qubit state can
be expressed as a|00i+b|01i+c|10i+d|11i, where a, b, c and d are complex numbers such
that |a|2 + |b|2 + |c|2 + |d|2 = 1. Suppose we wish to measure the first qubit with respect
5 Itis only when we use matrix notation to describe state transformations that the order of basis vectors becomes
relevant.
12 · E. Rieffel and W. Polak
to the standard basis {|0i, |1i}. For convenience we will rewrite the state as follows:
a|00i + b|01i + c|10i + d|11i
= |0i ⊗ (a|0i + b|1i) + |1i ⊗ (c|0i + d|1i)
= u|0i ⊗ (a/u|0i + b/u|1i) +
v|1i ⊗ (c/v|0i + d/v|1i).
p p
For u = |a|2 + |b|2 and v = |c|2 + |d|2 the vectors a/u|0i + b/u|1i and c/v|0i +
d/v|1i are of unit length. Once the state has been rewritten as above, as a tensor prod-
uct of the bit being measured and a second vector of unit length, the probabalistic result
of a measurement is easy to read off. Measurement of the first bit will with probabil-
ity u2 = |a|2 + |b|2 return |0i projecting the state to |0i ⊗ (a/u|0i + b/u|1i) or with
probability v = |c|2 + |d|2 yield |1i projecting the state to |1i ⊗ (c/v|0i + d/v|1i). As
|0i ⊗ (a/u|0i + b/u|1i) and |1i ⊗ (c/v|0i + d/v|1i) are both unit vectors, no scaling is
necessary. Measuring the second bit works similarly.
For the purposes of quantum computation, multi-bit measurement can be treated as a
series of single-bit measurements in the standard basis. Other sorts of measurements are
possible, like measuring whether two qubits have the same value without learning the
actual value of the two qubits. But such measurements are equivalent to unitary transfor-
mations followed by a standard measurement of individual qubits, and so it suffices to look
only at standard measurements.
In the two qubit example, the state space is a cartesian product of the subspace consisting
of all states whose first qubit is in the state |0i and the orthogonal subspace of states whose
first qubit is in the state |1i. Any quantum state can be written as the sum of two vectors,
one in each of the subspaces. A measurement of k qubits in the standard basis has 2k
possible outcomes mi . Any device measuring k qubits of an n-qubit system splits of the
2n -dimensional state space H into a cartesian product of orthogonal subspaces S1 , . . . , S2k
with H = S1 × . . . × S2k , such that the value of the k qubits being measured is mi and
the state after measurement is in space the space Si for some i. The device randomly
chooses one of the Si ’s with probability the square of the amplitude of the component of
ψ in Si , and projects the state into that component, scaling to give length 1. Equivalently,
the probability that the result of the measurement is a given value is the sum of the squares
of the the absolute values of the amplitudes of all basis vectors compatible with that value
of the measurement.
Measurement gives another way of thinking about entangled particles. Particles are not
entangled if the measurement of one has no effect on the other. For instance, the state
√1 (|00i + |11i) is entangled since the probability that the first bit is measured to be |0i
2
is 1/2 if the second bit has not been measured. However, if the second bit had been
measured, the probability that the first bit is measured as |0i is either 1 or 0, depending on
whether the second bit was measured as |0i or |1i respectively. Thus the probable result
of measuring the first bit is changed by a measurement of the second bit. On the other
hand, the state √12 (|00i + |01i) is not entangled: since √12 (|00i + |01i) = |0i ⊗ √12 (|0i +
|1i), any measurement of the first bit will yield |0i regardless of whether the second bit
was measured. Similarly, the second bit has a fifty-fifty chance of being measured as |0i
regardless of whether the first bit was measured or not. Note that entanglement, in the
sense that measurement of one particle has an effect on measurements of another particle,
Introduction to Quantum Computing · 13
is equivalent to our previous definition of entangled states as states that cannot be written
as a tensor product of individual states.
EPR
Alice source Bob
Alice and Bob can be arbitrarily far apart. Suppose that Alice measures her particle and
observes state |0i. This means that the combined state will now be |00i and if now Bob
measures his particle he will also observe |0i. Similarly, if Alice measures |1i, so will Bob.
Note that the change of the combined quantum state occurs instantaneously even though
the two particles may be arbitrarily far apart. It appears that this would enable Alice and
Bob to communicate faster than the speed of light. Further analysis, as we shall see, shows
that even though there is a coupling between the two particles, there is no way for Alice or
Bob to use this mechanism to communicate.
There are two standard ways that people use to describe entangled states and their mea-
surement. Both have their positive aspects, but both are incorrect and can lead to misun-
derstandings. Let us examine both in turn.
Einstein, Podolsky and Rosen proposed that each particle has some internal state that
completely determines what the result of any given measurement will be. This state is,
for the moment, hidden from us, and therefore the best we can currently do is to give
probabilistic predictions. Such a theory is known as a local hidden variable theory. The
simplest hidden variable theory for an EPR pair is that the particles are either both in
state |0i or both in state |1i, we just don’t happen to know which. In such a theory no
communication between possibly distant particles is necessary to explain the correlated
measurements. However, this point of view cannot explain the results of measurements
with respect to a different basis. In fact, Bell showed that any local hidden variable theory
predicts that certain measurements will satisfy an inequality, known as Bell’s inequality.
However, the result of actual experiments performing these measurements show that Bell’s
inequality is violated. Thus quantum mechanics cannot be explained by any local hidden
variable theory. See [Greenstein and Zajonc 1997] for a highly readable account of Bell’s
theorem and related experiments.
The second standard description is in terms of cause and effect. For example, we said
earlier that a measurement performed by Alice affects a measurement performed by Bob.
However, this view is incorrect also, and results, as Einstein, Podolsky and Rosen recog-
nized, in deep inconsistencies when combined with relativity theory. It is possible to set
up the EPR scenario so that one observer sees Alice measure first, then Bob, while another
14 · E. Rieffel and W. Polak
observer sees Bob measure first, then Alice. According to relativity, physics must equally
well explain the observations of the first observer as the second. While our terminology of
cause and effect cannot be compatible with both observers, the actual experimental values
are invariant under change of observer. The experimental results can be explained equally
well by Bob’s measuring first and causing a change in the state of Alice’s particle, as the
other way around. This symmetry shows that Alice and Bob cannot, in fact, use their EPR
pair to communicate faster than the speed of light, and thus resolves the apparent paradox.
All that can be said is that Alice and Bob will observe the same random behavior.
As we will see in the section on dense coding and teleportation, EPR pairs can be used
to aid communication, albeit communication slower than the speed of light.
4. QUANTUM GATES
So far we have looked at static quantum systems which change only when measured. The
dynamics of a quantum system, when not being measured, are governed by Schrödinger’s
equation; the dynamics must take states to states in a way that preserves orthogonality.
For a complex vector space, linear transformations that preserve orthogonality are unitary
transformations, defined as follows. Any linear transformation on a complex vector space
can be described by a matrix. Let M ∗ denote the conjugate transpose of the matrix M .
A matrix M is unitary (describes a unitary transformation) if M M ∗ = I. Any unitary
transformation of a quantum state space is a legitimate quantum transformation, and vice
versa. One can think of unitary transformations as being rotations of a complex vector
space.
One important consequence of the fact that quantum transformations are unitary is that
they are reversible. Thus quantum gates must be reversible. Bennett, Fredkin, and Toffoli
had already looked at reversible versions of standard computing models showing that all
classical computations can be done reversibly. See Feynman’s Lectures on Computation
[Feynman 1996] for an account of reversible computation and its relation to the energy of
computation and information.
The controlled-NOT gate, Cnot , operates on two qubits as follows: it changes the second
bit if the first bit is 1 and leaves this bit unchanged otherwise. The vectors |00i, |01i,
|10i, and |11i form an orthonormal basis for the state space of a two-qubit system, a 4-
dimensional complex vector space. In order to represent transformations of this space in
matrix notation we need to choose an isomorphism between this space and the space of
complex four tuples. There is no reason, other than convention, to pick one isomorphism
over another. The one we use here associates |00i, |01i, |10i, and |11i to the standard 4-
tuple basis (1, 0, 0, 0)T , (0, 1, 0, 0)T , (0, 0, 1, 0)T and (0, 0, 0, 1)T , in that order. The Cnot
transformation has representations
Cnot : |00i → |00i 1 0 0 0
|01i → |01i 0 1 0 0 .
|10i → |11i 0 0 0 1
|11i → |10i 0 0 1 0
∗
The transformation Cnot is unitary since Cnot = Cnot and Cnot Cnot = I. The Cnot gate
cannot be decomposed into a tensor product of two single-bit transformations.
It is useful to have graphical representations of quantum state transformations, especially
when several transformations are combined. The controlled-NOT gate Cnot is typically
represented by a circuit of the form
b
.
×
The open circle indicates the control bit, and the × indicates the conditional negation of the
subject bit. In general there can be multiple control bits. Some authors use a solid circle to
indicate negative control, in which the subject bit is toggled when the control bit is 0.
Similarly, the controlled-controlled-NOT, which negates the last bit of three if and only
if the first two are both 1, has the following graphical representation.
b
b
Z
16 · E. Rieffel and W. Polak
(H ⊗ H ⊗ . . . ⊗ H)|00 . . . 0i
1
= √ ((|0i + |1i) ⊗ (|0i + |1i) ⊗ . . . ⊗ (|0i + |1i))
2n
2n −1
1 X
= √ |xi.
2n x=0
The transformation that applies H to n bits is called the Walsh, or Walsh-Hadamard, trans-
formation W . It can be defined as a recursive decomposition of the form
W1 = H, Wn+1 = H ⊗ Wn .
4.1.2 No Cloning. The unitary property implies that quantum states cannot be copied or
cloned. The no cloning proof given here, originally due to Wootters and Zurek [Wootters
and Zurek 1982], is a simple application of the linearity of unitary transformations.
Assume that U is a unitary transformation that clones, in that U (|a0i) = |aai for all
quantum states |ai. Let |ai and |bi be two
√ orthogonal quantum states. Say U (|a0i) = |aai
and U (|b0i) = |bbi. Consider |ci = (1/ 2)(|ai + |bi). By linearity,
4.2 Examples
The use of simple quantum gates can be studied with two simple examples: dense coding
and teleportation.
Dense coding uses one quantum bit together with an EPR pair to encode and transmit
two classical bits. Since EPR pairs can be distributed ahead of time, only one qubit (parti-
cle) needs to be physically transmitted to communicate two bits of information. This result
is surprising since, as was discussed in section 3, only one classical bit’s worth of informa-
tion can be extracted from a qubit. Teleportation is the opposite of dense coding, in that
it uses two classical bits to transmit a single qubit. Teleportation is surprising in light of
the no cloning principle of quantum mechanics, in that it enables the transmission of an
unknown quantum state.
The key to both dense coding and teleportation is the use of entangled particles. The
initial set up is the same for both processes. Alice and Bob wish to communicate. Each is
sent one of the entangled particles making up an EPR pair,
1
ψ0 = √ (|00i + |11i).
2
Say Alice is sent the first particle, and Bob the second. So until a particle is transmit-
ted, only Alice can perform transformations on her particle, and only Bob can perform
transformations on his.
4.2.1 Dense Coding
Alice Bob
Encoder Decoder
EPR
source
Alice. Alice receives two classical bits, encoding the numbers 0 through 3. Depending
on this number Alice performs one of the transformations {I, X, Y, Z} on her qubit of the
entangled pair ψ0 . Transforming just one bit of an entangled pair means performing the
identity transformation on the other bit. The resulting state is shown in the table.
Value Transformation New state
0 ψ0 = (I ⊗ I)ψ0 √1 (|00i + |11i)
2
1 ψ1 = (X ⊗ I)ψ0 √1 (|10i + |01i)
2
2 ψ2 = (Y ⊗ I)ψ0 √1 (−|10i + |01i)
2
3 ψ3 = (Z ⊗ I)ψ0 √1 (|00i − |11i)
2
Note that Bob can now measure the second qubit without disturbing the quantum state.
If the measurement returns |0i then the encoded value was either 0 or 3, if the measurement
returns |1i then the encoded value was either 1 or 2.
Bob now applies H to the first bit:
Initial state First bit H(First bit)
√1 (|0i + |1i) √1 √1 (|0i + |1i) + √1 (|0i − |1i) = |0i
ψ0 2 2 2 2
√1 (|1i + |0i) √1 √1 (|0i − |1i) + √1 (|0i + |1i) = |0i
ψ1 2 2 2 2
√1 (−|1i + |0i) √1 − √1 (|0i − |1i) + √1 (|0i + |1i) = |1i
ψ2 2 2 2 2
√1 (|0i − |1i) √1 √1 (|0i + |1i) − √1 (|0i − |1i) = |1i
ψ3 2 2 2 2
Finally, Bob measures the resulting bit which allows him to distinguish between 0 and
3, and 1 and 2.
4.2.2 Teleportation. The objective is to transmit the quantum state of a particle using
classical bits and reconstruct the exact quantum state at the receiver. Since quantum state
cannot be copied, the quantum state of the given particle will necessarily be destroyed. Sin-
gle bit teleportation has been realized experimentally [Bouwmeester et al. 1997; Nielsen
et al. 1998; Boschi et al. 1998].
Alice Bob
Decoder Encoder
EPR
source
Alice. Alice has a qubit whose state she doesn’t know. She wants to send the state of ths
qubit
φ = a|0i + b|1i
to Bob through classical channels. As with dense coding, Alice and Bob each possess one
qubit of an entangled pair
1
ψ0 = √ (|00i + |11i).
2
Introduction to Quantum Computing · 19
Alice applies the decoding step of dense coding to the qubit φ to be transmitted and her
half of the entangled pair. The starting state is quantum state
1
φ ⊗ ψ0 = √ a|0i ⊗ (|00i + |11i) + b|1i ⊗ (|00i + |11i)
2
1
= √ a|000i + a|011i + b|100i + b|111i ,
2
of which Alice controls the first two bits and Bob controls the last one. Alice now applies
Cnot ⊗ I and H ⊗ I ⊗ I to this state:
(H ⊗ I ⊗ I)(Cnot ⊗ I)(φ ⊗ ψ0 )
1
= (H ⊗ I ⊗ I)(Cnot ⊗ I) √ a|000i + a|011i + b|100i + b|111i
2
1
= (H ⊗ I ⊗ I) √ a|000i + a|011i + b|110i + b|101i
2
1
= a(|000i + |011i + |100i + |111i) + b(|010i + |001i − |110i − |101i)
2
1
= |00i(a|0i + b|1i) + |01i(a|1i + b|0i) + |10i(a|0i − b|1i) + |11i(a|1i − b|0i)
2
Alice measures the first two qubits to get one of |00i, |01i, |10i, or |11i with equal prob-
ability. Depending on the result of the measurement, the quantum state of Bob’s qubit is
projected to a|0i + b|1i, a|1i + b|0i, a|0i − b|1i, or a|1i − b|0i respectively. Alice sends
the result of her measurement as two classical bits to Bob.
Note that when she measured it, Alice irretrievably altered the state of her original qubit
φ, whose state she is in the process of sending to Bob. This loss of the original state is the
reason teleportation does not violate the no cloning principle.
Bob. When Bob receives the two classical bits from Alice he knows how the state of his
half of the entangled pair compares to the original state of Alice’s qubit.
bits received state decoding
00 a|0i + b|1i I
01 a|1i + b|0i X
10 a|0i − b|1i Z
11 a|1i − b|0i Y
Bob can reconstruct the original state of Alice’s qubit, φ, by applying the appropriate
decoding transformation to his part of the entangled pair. Note that this is the encoding
step of dense coding.
5. QUANTUM COMPUTERS
This section discusses how quantum mechanics can be used to perform computations and
how these computations are qualitatively different from those performed by a conventional
computer. Recall from section 4 that all quantum state transformations have to be re-
versible. While the classical NOT gate is reversible, AND, OR and NAND gates are not.
Thus it is not obvious that quantum transformations can carry out all classical computa-
tions. The first subsection describes complete sets of reversible gates that can perform any
20 · E. Rieffel and W. Polak
|ci b b b |ci
|xi b b b |xi
|yi b b b |yi
|0i × × × |si
|0i × × × |c′ i
where x and y are the data bits, s is their sum (modulo 2), c is the incoming carry bit, and
c′ is the new carry bit. Vedral, Barenco and Ekert [Vedral et al. 1996] define more complex
circuits that include in-place addition and modular addition.
The Fredkin gate is a “controlled swap” and can be defined as
F = |0ih0| ⊗ I ⊗ I + |1ih1| ⊗ S
where S is the swap operation
S = |00ih00| + |01ih10| + |10ih01| + |11ih11|.
The reader can verify that F , like T , is complete for combinatorial circuits.
Introduction to Quantum Computing · 21
Deutsch has shown [Deutsch 1985] that it is possible to construct reversible quantum
gates for any classically computable function. In fact, it is possible to conceive of a univer-
sal quantum Turing machine [Bernstein and Vazirani 1997]. In this construction we must
assume a sufficient supply of bits that correspond to the tape of a Turing machine.
Knowing that an arbitrary classical function f with m input and k output bits can be im-
plemented on quantum computer, we assume the existence of a quantum gatearray Uf that
implements f . Uf is a m + k bit transformation of the form Uf : |x, yi → |x, y ⊕ f (x)i
where ⊕ denotes the bitwise exclusive-OR6. Quantum gate arrays Uf , defined in this way,
are unitary for any function f . To compute f (x) we apply Uf to |xi tensored with k
zores |x, 0i. Since f (x) ⊕ f (x) = 0 we have Uf Uf = I. Graphically the transformation
Uf : |x, yi → |x, y ⊕ f (x)i is depicted as
|xi |xi
Uf
|yi |y ⊕ f (x)i.
While the T and F gates are complete for combinatorial circuits, they cannot achieve ar-
bitrary quantum state transformations. In order to realize arbitrary unitary transformations7,
single bit rotations need to be included. Barenco et. al. [Barenco et al. 1995] show that
Cnot together with all 1-bit quantum gates is a universal gate set. It suffices to include the
following one-bit transformations
iα
cos α sin α e 0
,
− sin α cos α 0 e−iα
for all 0 ≤ α ≤ 2π together with the Cnot to obtain a universal set of gates. As we shall
see, such non-classical transformations are crucial for exploiting the power of quantum
computers.
where f (x) is the function of interest. Note that since n qubits enable working simultane-
ously with 2n states, quantum parallelism circumvents the time/space trade-off of classical
parallelism through its ability to provide an exponential amount of computational space in
a linear amount of physical space.
Consider the trivial example of a controlled-controlled-NOT (Toffoli) gate, T , that com-
putes the conjunction of two values:
|xi b |xi
|yi b |yi
|0i × |x ∧ yi
Now take as input a superposition of all possible bit combinations of x and y together
with the necessary 0:
1 1
H|0i ⊗ H|0i ⊗ |0i = √ (|0i + |1i) ⊗ √ (|0i + |1i) ⊗ |0i
2 2
1
= (|000i + |010i + |100i + |110i).
2
Measuring at this point gives no advantage over classical parallelism as only one result
is obtained, and worse still one cannot even choice which result one gets. The heart of
any quantum algorithm is the way in which it manipulates quantum parallelism so that
desired results will be measured with high probability. This sort of manipulation has no
classical analog, and requires non-traditional programming techniques. We list a couple of
the techniques currently known.
—Amplify output values of interest. The general idea is to transform the state in such a way
that values of interest have a larger amplitude and therefore have a higher probability of
being measured. Examples of this approach will be described in section 7.
—Find common properties of all the values of f (x). This idea is exploited in Shor’s
algorithm which uses a quantum Fourier transformation to obtain the period of f .
6. SHOR’S ALGORITHM
In 1994, inspired by work of Daniel Simon (later published in [Simon 1997]), Peter Shor
found a bounded probability polynomial time algorithm for factoring n-digit numbers on
a quantum computer. Since the 1970’s people have searched for efficient algorithms for
factoring integers. The most efficient classical algorithm known today is that of Lenstra and
Lenstra [Lenstra and Lenstra 1993] which is exponential in the size of the input. The input
is the list of digits of M , which has size n ∼ log M . People were confident enough that
no efficient algorithm existed, that the security of cryptographic systems, like the widely
used RSA algorithm, depend on the difficulty of this problem. Shor’s result surprised the
community at large, prompting widespread interest in quantum computing.
Most factoring algorithms, including Shor’s, use a standard reduction of the factoring
problem to the problem of finding the period of a function. Shor uses quantum parallelism
in the standard way to obtain a superposition of all the values of the function in one step. He
then computes the quantum Fourier transform of the function, which like classical Fourier
transforms, puts all the amplitude of the function into multiples of the reciprocal of the
period. With high probability, measuring the state yields the period, which in turn is used
to factor the integer M .
The above description captures the essence of the quantum algorithm, but is something
of an oversimplification. The biggest complication is that the quantum Fourier transform is
based on the fast Fourier transform and thus gives only approximate results in most cases.
Thus extracting the period is trickier than outlined above, but the techniques for extracting
the period are classical.
We will first describe the quantum Fourier transform and then give a detailed outline of
Shor’s algorithm.
multiples of Nr .
The Fast Fourier transform (FFT) is a version of DFT where N is a power of 2. The
quantum Fourier transform (QFT) is a variant of the discrete Fourier transform which, like
FFT, uses powers of 2. The quantum Fourier transform operates on the amplitude of the
quantum state, by sending
X X
g(x)|xi → G(c)|ci
x c
where G(c) is the discrete Fourier transform of g(x), and x and c both range over the
binary representations for the integers between 0 and N − 1. If the state were measured
after the Fourier transform was performed, the probability that the result was |ci would be
|G(c)|2 . Note that the quantum Fourier transform does not output a function the way the
Uf transformation does; no output appears in an extra register.
Applying the quantum FourierP transform to a periodic function g(x) with period r, we
would expect to end up with c G(c)|ci, where G(c) is zero except at multiples of Nr .
Thus, when the state is measured, the result would be a multiple of Nr , say j Nr . But as
described above, the quantum Fourier transform only gives approximate results for periods
which are not a power of two, i.e. do not divide N . However the larger the power of
two used as a base for the transform, the better the approximation. The quantum Fourier
transform UQF T with base N = 2m is defined by
m
2 −1
1 X 2πicx
UQF T : |xi → √ e 2m |ci.
2m c=0
In order for Shor’s algorithm to be a polynomial algorithm, the quantum Fourier trans-
form must be efficiently computable. Shor shows that the quantum Fourier transform with
base 2m can be constructed using only m(m+1)2 gates. The construction makes use of two
types of gates. One is a gate to perform the familiar Hadamard transformation H. We will
denote by Hj the Hadamard transformation applied to the jth bit. The other type of gate
performs two-bit transformations of the form
1 0 0 0
0 1 0 0
Sj,k =
0 0 1 0
0 0 0 eiθk−j
where θk−j = π/2k−j . This transformation acts on the kth and jth bits of a larger register.
The quantum Fourier transform is given by
H0 S0,1 . . . S0,m−1 H1 . . . Hm−3 Sm−3,m−2 Sm−3,m−1 Hm−2 Sm−2,m−1 Hm−1
followed by a bit reversal transformation. If FFT is followed by measurement, as in Shor’s
algorithm, the bit reversal can be performed classically. See [Shor 1997] for more details.
6.2 A Detailed Outline of Shor’s algorithm
The detailed steps of Shor’s algorithm are illustrated with a running example where we
factor M = 21.
Step 1. Quantum parallelism. Choose an integer a arbitrarily. If a is not relatively prime
to M , we have found a factor of M . Otherwise apply the rest of the algorithm.
Introduction to Quantum Computing · 25
Let m be such that M 2 ≤ 2m < 2M 2 . [This choice is made so that the approximation
used in Step 3 for functions whose period is not a power of 2 will be good enough for the
rest of the algorithm to work.] Use quantum parallelism as described in 5.2 to compute
f (x) = ax mod M for all integers from 0 to 2m − 1. The function is thus encoded in the
quantum state
m
2 −1
1 X
√ |x, f (x)i. (1)
2m x=0
Example. Suppose a = 11 were randomly chosen. Since M 2 = 441 ≤ 29 < 882 =
2M 2 we find m = 9. Thus, a total of 14 quantum bits, 9 for x and 5 for f (x) are required
to compute the superposition of equation 1.
Step 2. A state whose amplitude has the same period as f . The quantum Fourier trans-
form acts on the amplitude function associated with the input state. In order to use the
quantum Fourier transform to obtain the period of f , a state is constructed whose ampli-
tude function has the same period as f .
To construct such a state, measure the last ⌈log2 M ⌉ qubits of the state of equation 1 that
encode f (x). A random value u is obtained. The value u is not of interest in itself; only the
effect the measurement has on our set of superpositions is of interest. This measurement
projects the state space onto the subspace compatible with the measured value, so the state
after measurement is
X
C g(x)|x, ui,
x
Standard Fourier analysis tells us that when the period r of the function g(x) defined in
Step 2 is a power of two, the result of the quantum Fourier transform is
X 2m
cj |j i,
j
r
8 Only the 9 bits of x are shown in Figure 2; the bits of f (x) are known from the measurement.
26 · E. Rieffel and W. Polak
0.012
0.0108
0.0096
0.0084
0.0072
0.006
0.0048
0.0036
0.0024
0.0012
0.0
0 64 128 192 256 320 384 448 512
P
Fig. 2. Probabilities for measuring x when measuring the state C x∈X
|x, 8i obtained in Step 2, where
X = {x|211x mod 21 = 8}}
0.17
0.153
0.136
0.119
0.102
0.085
0.068
0.051
0.034
0.017
0.0
0 64 128 192 256 320 384 448 512
where the amplitude is 0 except at multiples of 2m /r. When the period r does not divide
2m , the transform approximates the exact case so most of the amplitude is attached to
m
integers close to multiples of 2r .
Example. Figure 3 shows the result of applying the quantum Fourier Transform to the
state obtained in Step 2. Note that Figure 3 is the graph of the fast Fourier transform of the
function shown in Figure 2. In this particular example the period of f does not divide 2m .
Step 4. Extracting the period. Measure the state in the standard basis for quantum com-
putation, and call the result v. In the case where the period happens to be a power of 2,
so that the quantum Fourier transform gives exactly multiples of 2m /r, the period is easy
m
to extract. In this case, v = j 2r for some j. Most of the time j and r will be relatively
Introduction to Quantum Computing · 27
prime, in which case reducing the fraction 2vm (= rj ) to its lowest terms will yield a frac-
tion whose denominator q is the period r. The fact that in general the quantum Fourier
transform only approximately gives multiples of the scaled frequency complicates the ex-
traction of the period from the measurement. When the period is not a power of 2, a good
guess for the period can be obtained using the continued fraction expansion of 2vm . This
classical technique is described in Appendix B.
Example. Say that measurement of the state returns v = 427. Since v and 2m are rela-
tive prime the period r will most likely not divide 2m and the continued fraction expansion
described in Appendix B needs to be applied. The following is a trace of the algorithm
described in Appendix B:
i ai pi qi ǫi
0 0 0 1 0.8339844
1 1 1 1 0.1990632
2 5 5 6 0.02352941
3 42 211 253 0.5
which terminates with 6 = q2 < M ≤ q3 . Thus, q = 6 is likely to be the period of f .
Step 5. Finding a factor of M . When our guess for the period, q, is even, use the Eu-
clidean algorithm to efficiently check whether either aq/2 + 1 or aq/2 − 1 has a non-trivial
common factor with M .
The reason why aq/2 + 1 or aq/2 − 1 is likely to have a non-trivial common factor with
M is as follows. If q is indeed the period of f (x) = ax mod M , then aq = 1 mod M since
aq ax = ax mod M for all x. If q is even, we can write
(aq/2 + 1)(aq/2 − 1) = 0 mod M.
Thus, so long as neither aq/2 + 1 nor aq/2 − 1 is a multiple of M , either aq/2 + 1 or aq/2 − 1
has a non-trivial common factor with M .
Example. Since 6 is even either a6/2 − 1 = 113 − 1 = 1330 or a6/2 + 1 = 113 + 1 =
1332 will have a common factor with M . In this particular example we find two factors
gcd(21, 1330) = 7 and gcd(21, 1332) = 3.
Step 6. Repeating the algorithm, if necessary. Various things could have gone wrong so
that this process does not yield a factor of M :
m
(1) The value v was not close enough to a multiple of 2r .
(2) The period r and the multiplier j could have had a common factor so that the denom-
inator q was actually a factor of the period not the period itself.
(3) Step 5 yields M as M ’s factor.
(4) The period of f (x) = ax mod M is odd.
Shor shows that few repetitions of this algorithm yields a factor of M with high probability.
6.2.1 A Comment on Step 2 of Shor’s Algorithm. The measurement in Step 2 can be
skipped entirely. More generally Bernstein and Vazirani [Bernstein and Vazirani 1997]
show that measurements in the middle of an algorithm can always be avoided. If the
measurement in Step 2 is omitted, the state consists of a superpositions of several periodic
functions all of which have the same period. By the linearity of quantum algorithms, apply-
ing the quantum Fourier transformation leads to a superposition of the Fourier transforms
of these functions, each of which is entangled with the corresponding u and therefore do
28 · E. Rieffel and W. Polak
not interfere with each other. Measurement gives a value from one of these Fourier trans-
forms. Seeing how this argument can be formalized illustrates some of the subtleties of
working with quantum superpostions. Apply the quantum Fourier transform tensored with
P2n −1
the identity, UQF T ⊗ I, to C x=0 |x, f (x)i to get
n m
2X −1 2X −1
2πixc
′
C e 2m |c, f (x)i,
x=0 c=0
which is equal to
2πixc
X X X
C′ e 2m |c, ui
u x|f (x)=u c
for u in the range of f (x). What results is a superposition of the results of Step 3 for
all possible u’s. The quantum Fourier transform is being applied to a family of separate
functions gu indexed by u where
1 if f (x) = u
gu =
0 otherwise,
all with the same period. Note that the amplitudes in states with different u’s never interfere
(add or cancel) with each other. The transform UQF T ⊗ I as applied above can be written
n n n
X 2X
−1 X 2X
−1 2X
−1
′
UQF T ⊗ I : C gu (x)|x, f (x)i → C Gu (c)|c, ui,
u∈R x=0 u∈R x=0 c=0
where Gu (c) is the discrete Fourier transform of gu (x) and R is the range of f (x).
Measure c and run Steps 4 and 5 as before.
7. SEARCH PROBLEMS
A large class of problems can be specified as search problems of the form “find some x in
a set of possible solutions such that statement P (x) is true.” Such problems range from
database search to sorting to graph coloring. For example, the graph coloring problem can
be viewed as a search for an assignment of colors to vertices so that the statement “all
adjacent vertices have different colors” is true. Similarly, a sorting problem can be viewed
as a search for a permutation for which the statement “the permutation x takes the initial
state to the desired sorted state” is true.
An unstructured search problem is one where nothing is know (or no assumption are
used) about the structure of the solution space and the statement P . For example, deter-
mining P (x0 ) provides no information about the possible value of P (x1 ) for x0 6= x1 . A
structured search problem is one where information about the search space and statement
P can be exploited.
For instance, searching an alphabetized list is a structured search problem and the struc-
ture can be exploited to construct efficient algorithms. In other cases, like constraint sat-
isfaction problems such as 3-SAT or graph colorability, the problem structure can be ex-
ploited for heuristic algorithms that yield efficient solution for some problem instances.
But in the general case of an unstructured problem, randomly testing the truth of state-
ments P (xi ) one by one is the best that can be done classically. For a search space of
size N , the general unstructured search problem requires O(N ) evaluations of P . On a
quantum computer, however, Grover showed that the unstructured search problem can be
Introduction to Quantum Computing · 29
√
solved with bounded probability within O( N ) evaluations of P . Thus Grover’s search
algorithm [Grover 1996] is provably more efficient than any algorithm that could run on a
classical computer.
While Grover’s algorithm is optimal [Bennett et al. 1997; Boyer et al. 1996; Zalka 1997]
for completely unstructured searches, most search problems involve searching a structured
solution space. Just as there are classical heuristic algorithms that exploit problem struc-
ture, one would expect that there are more efficient quantum algorithms for certain struc-
tured problem instances. Grover et.al. [Cerf et al. 1998] uses Grover’s search algorithm
in place of classical searches within a heuristic algorithm to show that a quadratic speed-
up is possible over a particularly simple classical heuristic for solving NP-hard problems.
Brassard et.al. [Brassard et al. 1998], using the techniques of Grover’s search algorithm
in a less obvious way, show that general heuristic searches have quantum analogs with
quadratic speed-up.
There is hope that for certain structured problems a speed-up greater than quadratic is
possible. Such algorithms will likely require new approaches that are not merely quantum
implementations of classical algorithms. Shor’s algorithm, when viewed as a search for
factors, is an example of an algorithm that achieves exponential speed-up by using problem
structure (number theory) in new ways unique to quantum computation.
Tad Hogg has developed heuristic quantum search algorithms that exploit problem struc-
ture. His approach is distincly non-classical and uses unique properties of quantum com-
putation. One problem with this approach is that, like most heuristic algorithms, the use
of problem structure is complicated enough that it is hard to determine the probability that
a single iteration of an algorithm will give a correct answer. Therefore it is unknown how
efficient Hogg’s algorithms are. Classically the efficiency of heuristic algorithms is esti-
mated by empirically testing the algorithm. But as there is an exponential slow down when
simulating a quantum computer on a classical one, empirical testing of quantum algorithms
is currently infeasible except in small cases. Small cases indicate that Hogg’s algorithms
are more efficient than Grover’s algorithm applied to structured search problems, but that
the speed-up is likely to be only polynomial. While less interesting theoretically, even a
small polynomial speed-up on average for these computational difficult problems is of sig-
nificant practical interest. Until sufficiently large quantum computers are built, or better
techniques for analyzing such algorithms are found, the efficiency cannot be determined
for sure.
(4) Apply inversion about the average to increase amplitude of xj with P (xj ) = 1. The
quantum algorithm to efficiently perform inversion about the average is given in sec-
tion 7.1.1. The resulting amplitudes look as shown, where the amplitude of all the xi ’s
with P (xi ) = 0 have been diminished imperceptibly.
average
π
√
(5) Repeat steps 2 through 4 4 2n times.
(6) Read the result.
Boyer et.al. [Boyer et al. 1996] provide a detailed analysis of the performance of Grover’s
algorithm. They prove that Grover’s algorithm is optimal up to a constant factor; no quan-
tum algorithm can perform an unstructured search √ faster. They also show that if there is
only a single x0 such that P (x0 ) is true, then after π8 2n iterations of steps 2 through 4 the
√
failure rate is 0.5. After iterating π4 2n times the failure rate drops to 2−n . Interestingly,
√
additional iterations will increase the failure rate. For example, after π2 2n iterations the
failure rate is close to 1.
There are many classical algorithms in which a procedure is repeated over and over again
for ever better results. Repeating quantum procedures may improve results for a while, but
Introduction to Quantum Computing · 31
after a sufficient number of repetitions the results will get worse again. Quantum proce-
dures are unitary transformations, which are rotations of complex space, and thus while a
repeated applications of a quantum transform may rotate the state closer and closer to the
desired state for a while, eventually it will rotate past the desired state to get farther and
farther from the desired state. Thus to obtain useful results from a repeated application of
a quantum transformation, one must know when to stop. Brassard et.al. [Brassard et al.
1998] describe an extension of Grover’s algorithm that uses Fourier Transforms to deter-
mine the number of solutions and the optimal number of iterations. The extension does not
increase the overall complexity of the algorithm.
Grover has extended his algorithm to achieve quadratic speed-up for other non-search
problems such as computing the mean and median of a function [Grover 1998]. Using
similar techniques grover has also shown that certain search problems that classically run
in O(log N ) can be solved in O(1) on a quantum computer. Grover’s search can used as
a subroutine in other quantum computations since Biron et.al. [Biron et al. 1998] show
how the technique√ can be used with arbitrary initial amplitude distributions, while still
maintaining O( N ) complexity.
7.1.1 Inversion about the Average. To perform inversion about the average on a quan-
tum computer the inversion must be a unitary transformation.
√ Furthermore, in order for
the algorithm as a whole to solve the problem in O( N ) time, the inversion must be able
to be performed efficiently. As will be shown shortly, the inversion can be accomplished
with O(n) = O(log(N )) quantum gates.
It is easy to see that the transformation
N
X −1 N
X −1
ai |xi i → (2A − ai )|xi i,
i=0 i=0
0 . . . 0 −1
To see that D = W RW , consider R = R′ − I where I is the identity and
2 0 ... 0
0 0 0 ...
R′ = 0 ... ... 0 .
0 ... 0 0
32 · E. Rieffel and W. Polak
P
@PPP
PP
@ PP
@ P
( ) ( ) ( ) ( )
v1 = 1 v1 = 0 v1 = 0 v1 = 0
v2 = 0 v2 = 0 v1 = 1 v1 = 1
v2 = 1 v2 = 1 v2 = 1 v2 = 0
XXXXXXX
XXXX HH
XX X
XXX XX
XXX XXX H
X
X XXH
XH
X
X XX X
X
H
v2 = 0 v1 = 1 v1 = 0 v1 = 1 v1 = 0 v1 = 0
v2 = 1 v2 = 1 v2 = 1 v2 = 0 v2 = 0 v1 = 1
X
HX XXX X
HXXX X XXX
HH XXX XXXX XX
XX
HHXXXX X
XX X
XXXX
{v1 = 0} {v1 = 1} {v2 = 0} {v2 = 1}
PP
PP @
PP @
PP
P
@
∅
1
= √ (|0i + (−1)rn−1 |1i) ⊗ . . . ⊗ (|0i + (−1)r0 |1i)
2n
2n −1
1 X
= √ (−1)sn−1 rn−1 |sn−1 i ⊗ . . . ⊗ (−1)s0 r0 |s0 i
2n s=0
n
2 −1
1 X
= √ (−1)s·r |si.
2n s=0
|1111i
P
@PPP
PP
@ PP
@ P
|1110i |1101i |1011i |0111i
XXXXXXX
XXXX HH
XX X
X X XX XXX H
X
XX XX
X XXH
XH
XX XX XH
X
|1100i |1010i |1001i |0110i |0101i |0011i
X
HX XXX X
HXXX XXXX
XX
HH XXX XXX X X X
HHXXXX X X X
X XXXX
|1000i |0100i |0010i |0001i
PP
PP @
PP @
PP
P
@
|0000i
Hogg takes in designing quantum algorithms for constraint satisfaction problems is to be-
gin with all the amplitude concentrated in the |0 . . . 0i state and to iteratively move ampli-
tude up the lattice from sets to supersets and away from sets that violate the constraints.
Note that this algorithm begins differently than Shor’s algorithm and Grover’s algorithm,
which both begin by computing a function on a superposition of all the input values at
once.
Hogg gives two ways [Hogg 1996; Hogg 1998] of constructing a unitary matrix for
moving amplitude up the lattice. We will describe both methods, and then describe how he
moves amplitude away from bad sets.
Moving amplitude up: Method 1. There is an obvious transformation that moves
amplitude from sets to supersets. Any amplitude associated to the empty set is evenly
distributed among all sets with a single element. Any amplitude associated to a set with a
single element is evenly distributed among all two element sets which contain that element
and so on. For the lattice of a three element set
|111i
HH
HH
|011i |101i |110i
H H
H
H H
H
H H
|001i |010i |100i
HH
HH
|000i
We want to transform
√
|000i → 1/ 3(|001i + |010i + |100i
Introduction to Quantum Computing · 35
√
|001i → 1/ 3(|011i + |110i + |101i
...
The complete matrix for this transformation looks like (as usual the basis vectors are or-
dered according to their binary representation)
0 0 0 0 0 0 0 1
√1 0 0 0 0 0 0 0
3
√1 0 0 0 0 0 0 0
3
0 √1 √1 0 0 0 0 0
1 2 2
√ 0 0 0 0 0 0 0
3
0 √1 0 0 √1 0 0 0
2 2
0 0 √12 0 √12 0 0 0
0 0 0 1 0 1 1 0
Unfortunately this transformation is not unitary. Hogg [Hogg 1996] uses the fact that
the closest (in a suitable metric) unitary matrix UM to an arbitrary matrix M can be found
using M ’s singular value decomposition M = U DV T where D is a diagonal matrix, and
U and V are unitary matrices. The product UM = U V T gives the closest unitary matrix
to M . Provided that UM is sufficiently close to M , UM will behave in a similar way to M
and will therefore do a reasonably job of moving amplitude from sets to their supersets.
Moving amplitude up: Method 2.The second approach [Hogg 1998] uses the Walsh-
Hadamard transformation. Hogg assumes that the desired matrix has form W DW where
W is the Walsh-Hadamard transformation and D is a diagonal matrix whose entries de-
pend only on the size of the sets. Hogg calculates the entries for D which maximize the
movement of amplitude from a set to its supersets. This calculation exploits the property
1 1
Wrs = √ (−1)|r·s| = √ (−1)|r∩s|
N N
shown in section 7.2.1.
Moving amplitude away from bad sets. To effect moving amplitude away from sets
that violate the constraints, Hogg suggests adjusting the phases of the sets, depending on
the extent to which they violate the constraints, in such a way that amplitude distributed
to sets that have bad subsets cancels, where as the amplitude distributed to sets from all
good subsets adds. Different choices here will work more or less effectively depending
on the particular problem. One choice he suggests is inverting the phase of all bad sets
which will result in some cancelation in the amplitude of supersets between the amplitude
coming from good subsets and bad subsets. This phase inversion can be done as in Grover’s
algorithm (7.1.2) with a P that tests whether a given state satisfies all of the constraints or
not. Another suggestion is to give random phases to the bad sets so that on average the
contribution to the amplitude of a superset from bad subsets is zero. Other choices are
possible.
Because the canceling resulting from the phase changes varies from problem to prob-
lem, the probability of obtaining a solution is difficult to analyse. A few small experiments
have been done and the guess is that the cost of the search still grows exponentially, but
considerably more slowly than in the unstructured case. But until sufficiently large quan-
36 · E. Rieffel and W. Polak
tum computers are built, or better techniques for analyzing such algorithms are found, the
efficiency cannot be determined for sure.
For the general case of quantum registers, possible errors are expressed as linear com-
binations of unitary error operators Ei . These could be combinations of single bit errors,
like tensor products of the single bit error transformations {I, X,P
Y, Z}, or more general
multi-bit transformations. In any case, an error can be written as i ei Ei for some error
operators Ei and coefficients ei .
Given an error correcting code C with syndrome extraction operator SC , an n-bit quan-
tum state |ψi is encoded
P in a n+k bit quantum state |φi = C|ψi. Assume that decoherence
leads to an error state i ei Ei |φi for some combination of correctable errors Ei . The orig-
inal encoded state |φi can be recovered as follows:
(1) Apply the syndrome extraction operator SC to the quantum state padded with suffi-
cient |0i bits:
X X
SC ( ei Ei |φi) ⊗ |0i = ei (Ei |φi ⊗ |ii).
i i
Quantum parallelism gives a superposition of different errors each associated with
their respective error index i.
(2) Measure the |ii component of the result. This yields some (random) value i0 and
projects the state to
Ei0 |φ, i0 i
(3) Apply the inverse error transformation Ei−1
0
to the first n + k qubits of Ei0 |φ, i0 i to
get the corrected state |φi.
Note that step 2 projects a superposition of multiple error transformations into a single
error. Consequently, only one inverse error transformation is required in step 3.
8.3 Error Correction Example
Consider the trivial error correcting code C that maps |0i → |000i and |1i → |111i. C
can correct single bit flip errors
E = {I ⊗ I ⊗ I, X ⊗ I ⊗ I, I ⊗ X ⊗ I, I ⊗ I ⊗ X}.
The syndrome extraction operator is
S : |x0 , x1 , x2 , 0, 0, 0i → |x0 , x1 , x2 , x0 xor x1 , x0 xor x2 , x1 xor x2 i,
with the corresponding error correction operators shown in the table. Note that Ei = Ei−1
for this example.
Bit flipped Syndrome Error correction
none |000i none
0 |110i X ⊗I ⊗I
1 |101i I ⊗X ⊗I
2 |011i I ⊗I ⊗X
Consider the quantum bit |ψi = √1 (|0i − |1i) that is encoded as
2
1
C|ψi = |φi = √ (|000i − |111i)
2
and the error
4 3
E= X ⊗ I ⊗ I + I ⊗ X ⊗ I.
5 5
The resulting error state is
4 3 1
E|φi = ( X ⊗ I ⊗ I + I ⊗ X ⊗ I)( √ (|000i − |111i))
5 5 2
38 · E. Rieffel and W. Polak
4 1 3 1
= X ⊗ I ⊗ I( √ (|000i − |111i)) + I ⊗ X ⊗ I( √ (|000i − |111i))
5 2 5 2
4 3
= √ X ⊗ I ⊗ I(|000i − |111i) + √ I ⊗ X ⊗ I(|000i − |111i)
5 2 5 2
4 3
= √ (|100i − |011i) + √ (|010i − |101i)
5 2 5 2
Measuring the last three bits of this state yields either |110i or |101i. Assuming the mea-
surement produces the former, the state becomes
1
√ (|100i − |011i) ⊗ |110i.
2
The measurement has the almost magical effect of causing all but one summand of the
error to disappear. The remaining part of the error can be removed by applying the inverse
error operator X ⊗ I ⊗ I, corresponding to the measured value |110i, to the first three bits,
to produce
1
√ (|000i − |111i) = C|ψi = |φi.
2
9. CONCLUSIONS
Quantum computing is a new, emerging field that has the potential to dramatically change
the way we think about computation, programming and complexity. The challenge for
computer scientists and others is to develop new programming techniques appropriate for
quantum computers. Quantum entanglement and phase cancellation introduce a new di-
mension to computation. Programming no longer consists of merely formulating step-by-
step algorithms but requires new techniques of adjusting phases, and mixing and diffusing
amplitudes to extract useful output.
We have tried to give an accurate account of the state-of-the-art of quantum computing
for computer scientists and other non-physicists. We have described some of the quantum
mechanical effects, like the exponential state space, the entangled states, and the linearity
of quantum state transformations, that make quantum parallelism possible. Even though
quantum computations must be linear and reversible, any classical algorithm can be imple-
mented on a quantum computer. But the real power of these new machines, the exponential
parallelism, can only be exploited using new, innovative programming techniques. People
have only recently begun to research such techniques.
Introduction to Quantum Computing · 39
the ideas related to quantum computing than the present paper, and has more references as
well. Another shorter and very readable tutorial can be found in [Berthiaume 1997].
Richard Feynman’s Lectures on Computation [Feynman 1996] contains a reprint of the
lecture “Quantum Mechanical Computers” [Feynman 1985] which began the whole field.
It also discusses the thermodynamics of computations which is closely tied with reversible
computing and information theory.
Colin Williams and Scott Clearwater’s book Explorations in Quantum Computing [Williams
and Clearwater 1998] comes with software, in the form of Mathematica notebooks, that
simulates some quantum algorithms like Shor’s algorithm.
The second half of the October 1997 issue of the SIAM Journal of Computing contains
six seminal articles on quantum computing, including four we have already cited [Bennett
et al. 1997] [Bernstein and Vazirani 1997] [Shor 1997] [Simon 1997].
Most of the articles referenced in this paper, and many more, can be found at the Los
Alamos preprint server: http://xxx.lanl.gov/archive/quant-ph. Links to
research projects and other information about quantum computing can be found on our
web site http://www.pocs.com/qc.html.
REFERENCES
A BRAMS , D. S. AND L LOYD , S. 1998. Nonlinear quantum mechanics implies polynomial-time solution
for NP-complete and #p problems. Los Alamos Physics Preprint Archive, http://xxx.lanl.gov/
abs/quant-ph/9801041.
BARENCO , A., B ENNETT, C. H., C LEVE , R., D I V INCENZO , D. P., M ARGOLUS , N. H., S HOR , P. W.,
S LEATOR , T., S MOLIN , J. A., AND W EINFURTER , H. 1995. Elementary gates for quantum compu-
tation. Physical Review A 52, 5, 3457–3467. Preprint at Los Alamos Physics Preprint Archive, http:/
/xxx.lanl.gov/abs/quant-ph/9503016 and at http://vesta.physics.ucla.edu/
cgi-bin/uncompress ps cgi?torgats1.ps.
B ENNETT, C. H. 1992. Quantum cryptography using any two nonorthogonal states. Physical Review
Letters 68.
B ENNETT, C. H., B ERNSTEIN , E., B RASSARD , G., AND VAZIRANI , U. V. 1997. Strengths and weak-
nesses of quantum computing. Society for Industrial and Applied Mathematics Journal on Comput-
ing 26, 5, 1510–1523. Preprint at Los Alamos Physics Preprint Archive, http://xxx.lanl.gov/
abs/quant-ph/9701001.
B ENNETT, C. H. AND B RASSARD , G. 1987. Quantum public key distribution reinvented. SIGACTN:
SIGACT News (ACM Special Interest Group on Automata and Computability Theory) 18.
B ENNETT, C. H., B RASSARD , G., AND E KERT, A. K. 1992. Quantum cryptography. Scientific Ameri-
can 267, 4 (Oct.), 50.
B ERNSTEIN , E. AND VAZIRANI , U. V. 1997. Quantum complexity theory. Society for Industrial and
Applied Mathematics Journal on Computing 26, 5, 1411–1473. A preliminary version of this paper ap-
peared in the Proceedings of the 25th Association for Computing Machinery Symposium on the Theory
of Computing.
B ERTHIAUME. 1997. Quantum computation. In Alan L. Selman, Editor, Complexity Theory Retrospective,
In Honor of Juris Hartmanis on the Occasion of His Sixtieth Birthday, July 5, 1988, Volume 2.
B IRON , D., B IHAM , O., B IHAM , E., G RASSEL , M., AND L IDAR , D. A. 1998. Generalized grover
search algorithm for arbitrary initial amplitude distribution. Los Alamos Physics Preprint Archive,
http://xxx.lanl.gov/abs/quant-ph/9801066.
B OSCHI , D., B RANCA , S., M ARTINI , F. D., H ARDY, L., AND P OPESCU , S. 1998. Experimental re-
alization of teleporting an unknown pure quantum state via dual classical and einstein-podolski-rosen
channels. Physical Review Letters 80, 1121 – 1125.
B OUWMEESTER , D., PAN , J.-W., M ATTLE , K., E IBL , M., W EINFURTER , H., AND Z EILINGER , A. 1997.
Experimental quantum teleportation. Nature 390, 575.
B OYER , M., B RASSARD , G., H ØYER , P., AND TAPP, A. 1996. Tight bounds on quantum search. In
Introduction to Quantum Computing · 41
Proceedings of the Workshop on Physics of Computation: PhysComp ’96 (Los Alamitos, CA, 1996).
Institute of Electrical and Electronic Engineers Computer Society Press. Preprint at Los Alamos Physics
Preprint Archive, http://xxx.lanl.gov/abs/quant-ph/9605034.
B RASSARD , G., H ØYER , P., AND TAPP, A. 1998. Quantum counting. Preprint at Los Alamos Physics
Preprint Archive, http://xxx.lanl.gov/abs/quant-ph/9805082.
C ERF, N. J., G ROVER , L. K., AND W ILLIAMS , C. P. 1998. Nested quantum search and np-complete
problems. Preprint at Los Alamos Physics Preprint Archive, http://xxx.lanl.gov/abs/quant-
ph/9806078.
C IRAC , J. I. AND Z OLLER , P. 1995. Quantum computations with cold trapped ions. Physical Review
Letters 74, 4091–4094.
C ORY, D. G., M ASS , W., P RICE , M., K NILL , E., L AFLAMME , R., Z UREK , W. H., H AVEL , T. F., AND
S OMAROO , S. S. 1998. Experimental quantum error correction. Preprint at Los Alamos Physics
Preprint Archive, http://xxx.lanl.gov/abs/quant-ph/9802018.
D EUTSCH , D. 1985. Quantum theory, the Church-Turing principle and the universal quantum computer.
Proceedings of the Royal Society of London Ser. A A400, 97–117.
D EUTSCH , D. AND J OZSA , R. 1992. Rapid solution of problems by quantum computation. Proceedings
of the Royal Society of London Ser. A A439, 553–558.
D IRAC , P. 1958. The Principles of Quantum Mechanics (4th ed.). Oxford University Press.
E KERT, A. K., R ARITY, J., TAPSTER , P., AND PALMA , G. 1992. Practical quantum cryptography based
on two-photon interferometry. Physical Review Letters 69.
F EYNMAN , R. 1982. Simulating physics with computers. International Journal of Theoretical
Physics 21, 6&7, 467–488.
F EYNMAN , R. 1985. Quantum mechanical computers. Optics News 11. Also in Foundations of Physics,
16(6):507–531, 1986.
F EYNMAN , R. 1996. In A. J. H EY AND R. W. A LLEN Eds., Feynman Lectures on Computation.
Addison-Wesley.
F EYNMAN , R. P., L EIGHTON , R. B., AND S ANDS , M. 1965. Lectures on Physics, Vol. III. Addison-
Wesley.
G ERSHENFELD , N. A. AND C HUANG , I. L. 1997. Bulk spin resonance quantum computing. Science 275,
350–356.
G REENSTEIN , G. AND Z AJONC , A. G. 1997. The Quantum Challenge. Jones and Bartlett Publishers,
Sudbury, Mass.
G ROVER , L. K. 1996. A fast quantum mechanical algorithm for database search. In Proceedings of the
Twenty-Eighth Annual ACM Symposium on the Theory of Computing (Philadelphia, Pennsylvania, 22–24
May 1996), pp. 212–219.
G ROVER , L. K. 1998. A framework for fast quantum mechanical algorithms. Proceedings of the 30th
annual ACM symposium on the theory of computing, 53–62. Preprint at Los Alamos Physics Preprint
Archive, http://xxx.lanl.gov/abs/quant-ph/9711043.
H ARDY, G. H. AND W RIGHT, E. M. 1979. An Introduction to the Theory of Numbers. Oxford University
Press.
H OGG , T. 1996. Quantum computing and phase transitions in combinatorial search. Journal of Artifi-
cial Intelligence Research 4, 91–128. Preprint at Los Alamos Physics Preprint Archive, http://xxx.
lanl.gov/abs/quant-ph/9508012.
H OGG , T. 1998. Highly structured searches with quantum computers. Physical Review Letters 80, 2473–
2473.
H UGHES , R. J., B UTTLER , W. T., K WIAT, P. G., L AMOREAUX , S. K., M ORGAN , G. L., N ORDHOLT,
J. E., AND P ETERSON , C. G. 1999. Practical quantum cryptography for secure free-space commu-
nications. Preprint at Los Alamos Physics Preprint Archive, http://xxx.lanl.gov/abs/quant-
ph/9905009.
H UGHES , R. J., B UTTLER , W. T., K WIAT, P. G., L UTHER , G. G., M ORGAN , G. L., N ORDHOLT, J. E.,
P ETERSON , C. G., AND S IMMONS , C. M. 1997. Secure communications using quantum cryptogra-
phy. In S. P. H OTALING AND A. R. P IRICH Eds., Photonic Quantum Computing, Volume 3076 (1997),
pp. 2–11.
H UNGERFORD , T. A. 1974. Algebra. Springer Verlag, New York, Heidelberg, Berlin.
42 · E. Rieffel and W. Polak
ACKNOWLEDGMENTS
The authors would like to thank Tad Hogg and Carlos Mochon for many enjoyable conver-
sations about quantum computing, and for their feedback on an earlier draft of this paper.
We are also grateful to Lee Corbin, David Goldberg, Lov Grover, Norman Hardy, Vaughan
Pratt, Marc Rieffel and the anonymous referees for detailed comments on earlier drafts
Introduction to Quantum Computing · 43
of this paper. Finally, we would like to thank FXPAL for enthusiastically supporting this
work.
APPENDIX
A. TENSOR PRODUCTS
The tensor product (⊗) of a n-dimensional and a k-dimensional vector is a nk-dimensional
vector. Similarly, if A and B are transformations on n-dimensional and a k-dimensional
vectors respectively, then A ⊗ B 9 is a transformation on nk-dimensional vectors.
The exact mathematical details of tensor products are beyond the scope of this paper
(see [Hungerford 1974] for a comprehensive treatment). For our purposes the following
algebraic rules are sufficient to calculate with tensor products. For matrices A,B,C,D, U ,
vectors u, x, y, and scalars a, b the following hold:
(A ⊗ B)(C ⊗ D) = AC ⊗ BD
(A ⊗ B)(x ⊗ y) = Ax ⊗ By
(x + y) ⊗ u = x ⊗ u + y ⊗ u
u ⊗ (x + y) = u ⊗ x + u ⊗ y
ax ⊗ by = ab(x ⊗ y)
A B A⊗U B⊗U
⊗U = ,
C D C⊗U D⊗U
which specialized for scalars a, b, c, d to
a b aU bU
⊗U = .
c d cU dU
The conjugate transpose distributes over tensor products, i.e.
(A ⊗ B)∗ = A∗ ⊗ B ∗ .
A matrix U is unitary if its conjugate transpose its inverse: U ∗ U = I.
The tensor product of several matrices is unitary if and only if each one of the matrices
is unitary up to a constant. Let U = A1 ⊗ A2 ⊗ . . . ⊗ An . Then U is unitary if A∗i Ai = ki I
and Πi ki = 1.
U ∗ U = (A∗1 ⊗ A∗2 ⊗ . . . ⊗ A∗n )(A1 ⊗ A2 ⊗ . . . ⊗ An )
= A∗1 A1 ⊗ A∗2 A2 ⊗ . . . ⊗ A∗n An
= k1 I ⊗ . . . kn I
= I
= (a0 |0i ⊗ a1 |0i) + (b0 |1i ⊗ a1 |0i) + (a0 |0i ⊗ b1 |1i) + (b0 |1i ⊗ b1 |1i)
= a0 a1 ((|0i ⊗ |0i) + b0 a1 (|1i ⊗ |0i) + a0 b1 (|0i ⊗ |1i) + b0 b1 (|1i ⊗ |1i)
= a0 a1 (|00i + b0 a1 |10i + a0 b1 |01i + b0 b1 |11i
′
The difference between two distinct fractions pq and pq′ with denominators less than M is
bounded
p p′ pq ′ − p′ q
− = > 1 .
q q ′ qq ′ M2
Thus there is at most one fraction pq with denominator q < M such that 2vm − pq < M12 .
m
In the high probability case that v is within 21 of j 2r , this fraction will be jr .
The unique fraction with denominator less than M that is within M12 of 2vm can be ob-
tained efficiently from the continued fraction expansion of 2vm as follows. Using the se-
quences
h v i
a0 =
2m
v
ǫ 0 = m − a0
2
1
an =
ǫn−1
1
ǫn = − an
ǫn−1
p 0 = a0
p 1 = a1 a0 + 1
pn = an pn−1 + pn−2
q0 = 1
q1 = a1
qn = an qn−1 + qn−2
compute the first fraction pqnn such that qn < M ≤ qn+1 . See any standard number theory
text, like Hardy and Wright [Hardy and Wright 1979], for why this procedure works.
Introduction to Quantum Computing · 45
In the high probability case when 2vm is within M12 of a multiple rj of 1r , the fraction
obtained from the above procedure is rj as it has denominator less than M . We take the
denominator q of the obtained fraction as our guess for the period, which will work when
j and r are relatively prime.