




























































































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!





























































































ii
8.4 A periodic function for the units of Z[
This is a set of lecture notes on quantum algorithms. It is primarily intended for graduate students who have already taken an introductory course on quantum information. Such a course typically covers only the early breakthroughs in quantum algorithms, namely Shor’s factoring algorithm and Grover’s searching algorithm. Here we show that there is much more to quantum computing by exploring some of the many quantum algorithms that have been developed subsequently. These notes cover several major topics in quantum algorithms, divided into six parts:
These notes were originally prepared for a course that was offered three times at the University of Waterloo: in the winter terms of 2008 (as CO 781) and of 2011 and 2013 (as CO 781/CS 867/QIC 823). The course has also been offered three times at the University of Maryland (in 2017, 2021, and 2025). I thank the students in these courses for their feedback on the lecture notes. Each offering of the course has covered a somewhat different set of topics. This document collects the material from all versions of the course and includes a few subsequent improvements. The material on quantum algorithms for algebraic problems has been collected into a review article that was written with Wim van Dam [38]. I thank Wim for his collaboration on that project, which strongly influenced the presentation in Part II. Please keep in mind that these are rough lecture notes; they are not meant to be a comprehensive treatment of the subject, and they surely contain mistakes. Corrections (by email to [email protected]) are welcome. I hope you find these notes to be a useful resource for learning about quantum algorithms.
viii CONTENTS
1.3 Universal gate sets
In principle, any unitary operator on n qubits can be implemented using only 1- and 2-qubit gates. Thus we say that the set of all 1- and 2-qubit gates is (exactly) universal. Of course, some unitary operators may take many more 1- and 2-qubit gates to realize than others, and indeed, a counting argument shows that most unitary operators on n qubits can only be realized using an exponentially large circuit of 1- and 2-qubit gates. In general, we are content to give circuits that give good approximations of our desired unitary transfor- mations. We say that a circuit with gates U 1 , U 2 ,... , Ut approximates U with precision ϵ if
∥U − Ut... U 2 U 1 ∥ ≤ ϵ. (1.3)
Here ∥·∥ denotes some appropriate matrix norm, which should have the property that if ∥U − V ∥ is small, then U should be hard to distinguish from V no matter what quantum state they act on. A natural choice (which will be suitable for our purposes) is the spectral norm
∥A∥ := max |ψ⟩
∥A|ψ⟩∥ ∥|ψ⟩∥
(where ∥|ψ⟩∥ =
p ⟨ψ|ψ⟩ denotes the vector 2-norm of |ψ⟩), i.e., the largest singular value of A. Then we call a set of elementary gates universal if any unitary operator on a fixed number of qubits can be approximated to any desired precision ϵ using elementary gates. It turns out that there are finite sets of gates that are universal: for example, the set {H, T, C} with
eiπ/^8 0 e−iπ/^8
There are situations in which we say a set of gates is effectively universal, even though it cannot actually approximate any unitary operator on n qubits. For example, the set {H, T 2 , Tof}, where
Tof :=
is universal, but only if we allow the use of ancilla qubits (qubits that start and end in the | 0 ⟩ state). Similarly, the basis {H, Tof} is universal in the sense that, with ancillas, it can approximate any orthogonal matrix. It clearly cannot approximate complex unitary matrices, since the entries of H and Tof are real; but the effect of arbitrary unitary transformations can be simulated using orthogonal ones by simulating the real and imaginary parts separately.
1.4 Reversible computation
Unitary matrices are invertible: in particular, U −^1 = U †. Thus any unitary transformation is a reversible operation. This may seem at odds with how we often define classical circuits, using irreversible gates such as and and or. But in fact, any classical computation can be made reversible by replacing any irreversible gate x 7 → g(x) by the reversible gate (x, y) 7 → (x, y ⊕ g(x)), and running it on the input (x, 0), producing (x, g(x)). In other words, by storing all intermediate steps of the computation, we make it reversible. On a quantum computer, storing all intermediate computational steps could present a problem, since two identical results obtained in different ways would not be able to interfere. However, there is an easy way to
remove the accumulated information. After performing the classical computation with reversible gates, we simply xor the answer into an ancilla register, and then perform the computation in reverse. Thus we can implement the map (x, y) 7 → (x, y ⊕ f (x)) even when f is a complicated circuit consisting of many gates. Using this trick, any computation that can be performed efficiently on a classical computer can be performed efficiently on a quantum computer: if we can efficiently implement the map x 7 → f (x) on a classical computer, we can efficiently perform the transformation |x, y⟩ 7 → |x, y ⊕ f (x)⟩ on a quantum computer. This transformation can be applied to any superposition of computational basis states, so for example, we can perform the transformation
1 √ 2 n
x∈{ 0 , 1 }n
|x, 0 ⟩ 7 →
2 n
x∈{ 0 , 1 }n
|x, f (x)⟩. (1.7)
Note that this does not necessarily mean we can efficiently implement the map |x⟩ 7 → |f (x)⟩, even when f is a bijection (so that this is indeed a unitary transformation). However, if we can efficiently invert f , then we can indeed do this efficiently by computing f (x) in another register and then reversibly uncomputing x using the inverse of the reversible circuit for computing f −^1.
1.5 Uniformity
When we give an algorithm for a computational problem, we consider inputs of varying sizes. Typically, the circuits for instances of different sizes will be related to one another in a simple way. But this need not be the case; and indeed, given the ability to choose an arbitrary circuit for each input size, we could have circuits computing uncomputable languages. Thus we require that our circuits be uniformly generated : say, that there exists a fixed (classical) Turing machine that, given a tape containing the symbol ‘1’ n times, outputs a description of the nth circuit in time poly(n).
1.6 Quantum complexity
We say that an algorithm for a problem is efficient if the circuit describing it contains a number of gates that is polynomial in the number of bits needed to write down the input. For example, if the input is a number modulo N , the input size is ⌈log 2 N ⌉. With a quantum computer, as with a randomized (or noisy) classical computer, the final result of a computation may not be correct with certainty. Instead, we are typically content with an algorithm that can produce the correct answer with high enough probability (for a decision problem, bounded above 1/2; for a non-decision problem for which we can check a correct solution, Ω(1)). By repeating the computation many times, we can make the probability of outputting an incorrect answer arbitrarily small. In addition to considering explicit computational problems, in which the input is a string, we will also consider the concept of query complexity. Here the input is a black box transformation, and our goal is to discover some property of the transformation by making as few queries as possible. For example, in Simon’s problem, we are given a transformation f :^ Zn 2 → S satisfying f (x) = f (y) iff y = x ⊕ t for some unknown t ∈ Zn 2 , and the goal is to learn t. The main advantage of considering query complexity is that it allows us to prove lower bounds on the number of queries required to solve a given problem. Furthermore, if we find an efficient algorithm for a problem in query complexity, then if we are given an explicit circuit realizing the black-box transformation, we will have an efficient algorithm for an explicit computational problem. Sometimes, we care not just about the size of a circuit for implementing a particular unitary operation, but also about its depth, the maximum number of gates on any path from an input to an output. The depth of a circuit tells us how long it takes to implement if we can perform gates in parallel.
1.7 Fault tolerance
In any real computer, operations cannot be performed perfectly. Quantum gates and measurements may be performed imprecisely, and errors may happen even to stored data that is not being manipulated. Fortu-
Thus, in order to simulate a t-gate quantum circuit with total error at most ϵ, it suffices to simulate each individual gate with error at most ϵ/t.
2.2 The group commutator and a net around the identity
To simulate an arbitrary individual gate, the strategy is to first construct a very fine net covering a very small ball around the identity using the group commutator,
JU, V K := U V U −^1 V −^1. (2.7)
To approximate general unitaries, we will effectively translate them close to the identity. Note that it suffices to consider unitary gates with determinant 1 (i.e., elements of SU(2)) since a global phase is irrelevant. Let Sϵ := {U ∈ SU(2) :^ ∥I − U ∥ ≤ ϵ} (2.8)
denote the ϵ-ball around the identity. Given sets Γ, S ⊆ SU(2), we say that Γ is an ϵ-net for S if for any A ∈ S, there is a U ∈ Γ such that ∥A − U ∥ ≤ ϵ. The following result (to be proved later on) indicates how the group commutator helps us to make a fine net around the identity.
Lemma 2.3. If Γ is an ϵ^2 -net for Sϵ, then JΓ, ΓK := {JU, V K : U, V ∈ Γ} is an O(ϵ^3 )-net for Sϵ 2.
To make an arbitrarily fine net, we apply this idea recursively. But first it is helpful to derive a consequence of the lemma that is more suitable for recursion. We would like to maintain the quadratic relationship between the size of the ball and the quality of the net. If we aim for a k^2 ϵ^3 -net (for some constant k), we would like it to apply to arbitrary points in Skϵ 3 / 2 , whereas the lemma only lets us approximate points in Sϵ^2. To handle an arbitrary A ∈ Skϵ 3 / 2 , we first let W be the closest gate in Γ to A. For sufficiently small ϵ we have kϵ^3 /^2 < ϵ, so Skϵ 3 / 2 ⊂ Sϵ, and therefore A ∈ Sϵ. Since Γ is an ϵ^2 -net for Sϵ, we have ∥A − W ∥ ≤ ϵ^2 , i.e., ∥AW †^ − I∥ ≤ ϵ^2 , so AW †^ ∈ Sϵ^2. Then we can apply the lemma to find U, V ∈ Γ such that ∥AW †^ − JU, V K∥ = ∥A − JU, V KW ∥ ≤ k^2 ϵ^3. In other words, if Γ is an ϵ^2 -net for Sϵ, then JΓ, ΓKΓ := {JU, V KW :^ U, V, W ∈ Γ} is a k^2 ϵ^3 -net for Skϵ 3 / 2. Now suppose that Γ 0 is an ϵ^20 -net for Sϵ 0 , and let Γi := JΓi− 1 , Γi− 1 KΓi− 1 for all positive integers i. Then
Γi is an ϵ^2 i -net for Sϵi , where ϵi = kϵ 3 / 2 i− 1. Solving this recursion gives^ ϵi^ = (k (^2) ϵ 0 )(3/2)i /k (^2).
2.3 Proof of the Solovay-Kitaev Theorem
With these tools in hand, we are prepared to establish the main result.
Proof of Theorem 2.1. It suffices to consider how to approximate an arbitrary U ∈ SU(2) to precision ϵ by a sequence of gates from a given universal gate set Γ. First we take products of elements of Γ to form a new universal gate set Γ 0 that is an ϵ^20 -net for SU(2), for some sufficiently small constant ϵ 0. We know this can be done since Γ is universal. Since ϵ 0 is a constant, the overhead in constructing Γ 0 is constant. Now we can find V 0 ∈ Γ 0 such that ∥U − V 0 ∥ ≤ ϵ^20. Since ∥U − V 0 ∥ = ∥U V 0 † − I∥, we have U V 0 † ∈ Sϵ 20. If
ϵ 0 is sufficiently small, then ϵ^20 < kϵ^30 / 2 = ϵ 1 , so U V 0 † ∈ Sϵ 1. Since Γ 0 is an ϵ^20 -net for SU(2), in particular it is an ϵ^20 -net for Sϵ 0. Thus by the above argument, Γ 1 is
an ϵ^21 -net for Sϵ 1 , so we can find V 1 ∈ Γ 1 such that ∥U V 0 † − V 1 ∥ ≤ ϵ^21 < kϵ^31 / 2 = ϵ 2 , i.e., U V 0 † V 1 † ∈ Sϵ 2.
In general, suppose we are given V 0 , V 1 ,... , Vi− 1 such that U V 0 † V 1 †... V (^) i†− 1 ∈ Sϵi. Since Γi is an ϵ^2 i -net
for Sϵi , we can find Vi ∈ Γi such that ∥U V 0 † V 1 †... V (^) i†− 1 − Vi∥ ≤ ϵ^2 i. In turn, this implies that U V 0 † V 1 †... V (^) i† ∈ Sϵi+. Repeating this process t times gives a very good approximation of U by Vt... V 1 V 0 : in particular, we have ∥U − Vt... V 1 V 0 ∥ ≤ ϵ^2 t. Suppose we consider a gate from Γ 0 to be elementary. (These gates can be implemented using only a constant number of gates from Γ, so there is a constant factor overhead if we only count gates in Γ as elementary.) The number of elementary gates needed to implement a gate from Γi is 5i,
so the total number of gates in the approximation is
Pt i=0 5
i (^) = (5t+1 (^) − 1)/4 = O(5t). To achieve an overall
error at most ϵ, we need ϵ^2 t = ((k^2 ϵ 0 )(3/2)
t /k^2 )^2 ≤ ϵ, i.e., 3 2
t
1 2 log(k
(^4) ϵ) log(k^2 ϵ 0 )
Thus the number of gates used is O(logν^1 ϵ ) where ν = log 5/ log 32. At this point, it may not be clear that the approximation can be found quickly, since Γi contains a large number of points, so we need to be careful about how we find a good approximation Vi ∈ Γi of U V 0 † V 1 †... V (^) i†− 1. However, by constructing the approximation recursively, it can be shown that the running time of this procedure is poly(log (^1) ϵ ). It will be clearer how to do this after we prove the lemma, but we leave the details as an exercise.
2.4 Proof of Lemma 2.
It remains to prove the lemma. A key idea is to move between the Lie group SU(2) and its Lie algebra, i.e., the Hamiltonians generating these unitaries. In particular, we can represent any A ∈ SU(2) as A = eai⃗^ σ·⃗^ , wherea⃗ ∈ R^3 andσ⃗ = (σx, σy , σz ) is a vector of Pauli matrices. Note that we can choose ∥a⃗ ∥ ≤ π without loss of generality. In the proof, the following basic facts about SU(2) will be useful. (i) ∥I − eai⃗^ σ·⃗^ ∥ = 2 sin ∥a⃗^2 ∥ = ∥a⃗ ∥ + O(∥a⃗ ∥^3 )
(ii) if ∥⃗b∥, ∥c⃗ ∥ ≤ ϵ then ∥ei⃗bσ·⃗^ − eci⃗^ σ·⃗^ ∥ = ∥⃗b −c⃗ ∥ + O(ϵ^3 ) (iii) [⃗b ·σ,⃗⃗c ·σ⃗ ] = 2i(⃗b ×c⃗ ) ·σ⃗ (iv) ∥Jei⃗bσ·⃗^ , eci⃗^ σ·⃗^ K − e−[⃗bσ,⃗·c⃗^ σ·⃗^ ]∥ = O(∥⃗b∥∥c⃗ ∥(∥⃗ b∥ + ∥c⃗ ∥)) Here the big-O notation is with respect to ∥a⃗ ∥ → 0 in (i) and with respect to ∥⃗b∥, ∥c⃗ ∥ → 0 in (iv).
Proof of Lemma 2.3. Let A ∈ Sϵ 2. Our goal is to find U, V ∈ Γ such that ∥A − JU, V K∥ = O(ϵ^3 ). Choosea⃗ ∈ R^3 such that A = eai⃗^ σ·⃗^. Since A ∈ Sϵ 2 , by (i) we can choosea⃗ so that ∥a⃗ ∥ = O(ϵ^2 ). Then choose ⃗b,⃗c ∈ R^3 such that − 2 ⃗b ×c⃗ =a⃗. We can choose these vectors to be orthogonal and of equal length, so that ∥⃗b∥ = ∥c⃗ ∥ =
p ∥a⃗ ∥/2 = O(ϵ). Let B = ei⃗bσ·⃗^ and C = eci⃗^ σ·⃗^. Then the only difference between A and JB, CK is the difference between the commutator and the group commutator, which is O(ϵ^3 ) by (iv). However, we need to choose points from the net Γ. So let U = eui⃗^ σ·⃗^ be the closest element of Γ to B, and let V = evi⃗^ σ·⃗^ be the closest element of Γ to C. Since Γ is an ϵ^2 -net for Sϵ, we have ∥U − B∥ ≤ ϵ^2 and ∥V − C∥ ≤ ϵ^2 , so in particular (by (ii)), ∥u⃗ − ⃗b∥ = O(ϵ^2 ) and ∥v⃗ −c⃗ ∥ = O(ϵ^2 ). Now by the triangle inequality, we have
∥A − JU, V K∥ ≤ ∥A − e^2 iu(⃗^ ×v⃗^ )σ·⃗^ ∥ + ∥e^2 iu(⃗^ ×v⃗^ )σ·⃗^ − JU, V K∥. (2.10)
For the first term, using (ii), we have
∥A − e^2 i(u⃗^ ×v⃗^ )σ·⃗^ ∥ = ∥e^2 i( ⃗ b×c⃗ )σ·⃗ − e^2 iu(⃗^ ×v⃗^ )σ·⃗^ ∥ (2.11) ≤ 2 ∥⃗b ×c⃗ −u⃗ ×v⃗ ∥ + O(ϵ^3 ) (2.12) = 2∥(⃗b −u⃗ +u⃗ ) × c(⃗ −v⃗ +v⃗ ) −u⃗ ×v⃗ ∥ + O(ϵ^3 ) (2.13) = 2∥(⃗b −u⃗ ) × c(⃗ −v⃗ ) + (⃗ b −u⃗ ) ×v⃗ +u⃗ × c(⃗ −v⃗ )∥ + O(ϵ^3 ) (2.14) = O(ϵ^3 ). (2.15)
For the second term, using (iii) and (iv) gives
∥e^2 iu(⃗^ ×v⃗^ )σ·⃗^ − JU, V K∥ = ∥e−u[⃗^ σ,⃗·v⃗^ σ·⃗^ ]^ − JU, V K∥ = O(ϵ^3 ). (2.16)
The lemma follows.
As we discussed in Chapter 2, the Solovay-Kitaev Theorem tells us that we can convert between gate sets with overhead that is only poly(log(1/ϵ)). However, the overhead may not be that small in practice (we upper bounded the power of the log by log 5/ log 32 ≈ 3 .97), and it is natural to ask if we can do better. A counting argument shows that the best possible exponent is 1 (see [72] and [88, Section 4.5.4]). Can we get close to this lower bound—ideally while retaining a fast algorithm?
In general, no such result is known (even if we do not require a fast algorithm). However, there are strong circuit synthesis results for particular gate sets with nice structure. In particular, one can perform fast, nearly-optimal synthesis for the set of single-qubit Clifford+T circuits. Not only does it admit fast synthesis, but this gate set is also the most common choice for fault-tolerant quantum computation, so it is likely to be relevant in practice.
To understand the synthesis of Clifford+T circuits, we focus here on the problem of exactly expressing a given unitary operation over that gate set, assuming such a representation is possible. This result can be extended to give an algorithm for approximately synthesizing arbitrary single-qubit gates, although the details are beyond the scope of this lecture. (Note that some of these ideas can also be applied to the synthesis of multi-qubit circuits, but that is also beyond our scope.)
An algorithm for exact synthesis of Clifford+T circuits was first presented in [71]. However, our presentation here is based on a simpler analysis [53] that uses a normal form for such circuits introduced by Matsumoto and Amano [84]. The single-qubit Clifford group C = ⟨H, S, ω⟩ is generated by the Hadamard gate H, the phase gate S, and the phase ω := eiπ/^4 , where
0 ω
0 i
By adding the T gate, we get a universal gate set—in other words, the set ⟨H, T, ω⟩ is dense in U(2). We call any unitary operation that can be represented exactly over this gate set a Clifford+T operation.
Clearly, any single-qubit Clifford+T operation M can be written in the form
M = CnT Cn− 1 T · · · C 1 T C 0 (3.2)
where C 0 ,... , Cn ∈ C. Our goal is to rewrite such an expression into a simpler form.
Let S := ⟨S, X, ω⟩ ≤ C. Any element of S can be pushed through T (say, to the right), since we have ST = T S (3.3) XT = ω−^1 T XS (3.4) ωT = T ω. (3.5)
Thus we can assume C 1 ,... , Cn− 1 ∈ S/. (In some cases, pushing elements of S to the right might cause two T gates to merge into S ∈ C; we take n to be the number of Clifford gates after any such cancellations.) An explicit calculation shows that |S| = 64, whereas |C| = 192. Since I, H, and SH are in different left cosets of S in C, they can be chosen as the three coset representatives, and we can write every element of the Clifford group in the form H˜ S˜, where H˜ ∈ {I, H, SH} and S˜ ∈ S. Similarly, every element of C \ S can be written in the same form, where H˜ ∈ {H, SH}. Thus we can write M in the form
M = HnSnT Hn− 1 Sn− 1 T · · · H 1 S 1 T C 0 (3.6)
where C 0 ∈ C, H 1 ,... , Hn− 1 ∈ {H, SH}, Hn ∈ {I, H, SH} and S 1 ,... , Sn ∈ S. Now we can further simplify this expression by again pushing elements of S to the right. We have already seen that such operators can be pushed through T gates, giving new elements of S. But furthermore, they can also be pushed through elements of {H, SH}, since
SH ∈ {H, SH} SSH = HX (3.7) XH = HZ = HS^2 XSH = SHY = SH(ω^2 XS^2 ) (3.8) ωH = Hω ωSH = SHω. (3.9)
After applying these rules, we are left with an expression of the form
M = HkT Hk− 1 T · · · H 1 T C 0 (3.10)
where H 1 ,... , Hk− 1 ∈ {H, SH} and Hk ∈ {I, H, SH}. (Note that we can have k < n, since again we could find cancellations as we push gates to the right.) This expression is now in Matsumoto-Amano (MA) normal form. In terms of regular expressions, we can write this form as (ε | T ) (HT | SHT )∗^ C, where ε denotes the empty string. Since the above argument is constructive, it also gives an algorithm for converting circuits to MA normal form. A naive implementation would take time O(n^2 ), since we might make a pass through O(n) gates to find a simplification, and we might have to repeat this O(n) times before reaching MA normal form. However, we can reduce to MA normal form in linear time by simplifying the given circuit gate-by-gate, maintaining MA normal form along the way. If N is in MA normal form and C ∈ C, then N C can be reduced to MA normal form in constant time (we simply combine the rightmost two Clifford operators). On the other hand, case analysis shows that reducing N T to MA normal form only requires updating the rightmost 5 gates, so it can also be reduced in constant time. Overall, this approach takes O(n) steps, each taking time O(1), for a total running time of O(n). An important parameter of a Clifford+T circuit is its T -count, which is simply the number of T gates it contains. Clearly there is a way of writing any Clifford+T circuit in MA normal form such that the T -count is minimal, simply because the reduction procedure described above never increases the T -count.
3.2 Uniqueness of Matsumoto-Amano normal form
In fact, the MA normal form is unique, so the procedure described above always produces a circuit with minimal T -count. Furthermore, the proof of this helps to develop an algebraic characterization of Clifford+T unitaries that facilitates approximate synthesis. Given a single-qubit unitary U , let Uˆ denote its Bloch sphere representation. If U (xX + yY + zZ)U †^ =
x′X + y′Y + z′Z, then Uˆ
(^) x y z
(^) x′ y′ z′
, and this relationship serves to define Uˆ by linearity. We have