Quantum algorithms Andrew Childs Pawel Wocjan University of Waterloo University of Central Florida 10th Canadian Summer School on Quantum Information 17–19 July 2010 Outline I. Quantum circuits II. Elementary quantum algorithms III. The QFT and phase estimation IV. Factoring V. Quantum search VI. Quantum walk Part I Quantum circuits Quantum circuit model Quantum circuits are generalizations of Boolean circuits input |1i |1i |0i |1i |0i transformation U1 U3 U6 U5 U2 NM NM NM U6 U4 U3 output (probabilistic) U7 NM NM 0 1 0 1 1 Classical bit Classical bit (bit): B := {0, 1} I Basis state: either 0 or 1 I General state: a probability distribution p = (p0 , p1 ) on B Classical register Classical register: Bn := B × B × . . . × B {z } | n I Basis state: a binary string x ∈ Bn I General state: a probability distribution p = (px : x ∈ Bn ) on Bn (written as a column vector) Remark: Note that p is a vector with positive entries that is normalized with respect to the `1 -norm (the sum of the absolute values of the entries) Classical transformation Transformations on the classical register B are described by stochastic matrices Stochastic matrices preserve the `1 -norm, i.e., probability distributions are mapped on probability distributions Let p be the state of the register. The state after the transformation P is given by the matrix-vector-product Pp Qubit Quantum bit (qubit): two-dimensional complex Hilbert space C2 I Computational basis states (classical states): |0i := I 1 0 and |1i := 0 1 General states: superpositions |ψi = α0 α1 = α0 |0i + α1 |1i , |α0 |2 + |α1 |2 = 1 the coefficients α0 , α1 ∈ C are called probability amplitudes Quantum register Quantum register: 2n -dimensional complex Hilbert space (C2 )⊗n with tensor product structure (C2 )⊗n := C2 ⊗ C2 ⊗ · · · ⊗ C2 | {z } n I Computational basis states (classical states): |xi = |x1 i ⊗ |x2 i ⊗ · · · ⊗ |xn i , I x ∈ Bn General state: |ψi = X x∈Bn αx |xi , X x |αx |2 = 1 Remark: Note that |ψi is a column vector (ket) that is normalized with respect to the `2 -norm (Euclidean norm) Quantum transformations Transformations on the quantum register H := (C2 )⊗n are described by unitary matrices U ∈ U(H) Unitary matrices preserve the `2 -norm Let |ψi ∈ H be the state of the quantum register; the state after the transformation U is given by the matrix-vector product U|ψi Quantum circuit Each transformations U has to be implemented by a quantum circuit, i.e., a sequence of elementary gates Quantum circuit model = Quantum mechanics + Notion of complexity Single qubit gate on two qubits U single-qubit gate U on first qubit action on basis states of C2 ⊗ C2 |0i ⊗ |0i |0i ⊗ |1i |1i ⊗ |0i |1i ⊗ |1i 7→ 7 → 7→ 7 → (U|0i) ⊗ |0i (U|0i) ⊗ |1i (U|1i) ⊗ |0i (U|1i) ⊗ |1i corresponding matrix u00 0 u01 0 0 u00 0 u01 = u10 0 u11 0 0 u10 0 u11 U ⊗I = u00 · I u10 · I u01 · I u11 · I Single qubit gate on two qubits single-qubit gate U on second qubit action on basis states of C2 ⊗ C2 U |0i ⊗ |0i |0i ⊗ |1i |1i ⊗ |0i |1i ⊗ |1i 7→ 7 → 7 → 7 → |0i ⊗ U|0i |0i ⊗ U|1i |1i ⊗ U|0i |1i ⊗ U|1i corresponding matrix I ⊗U = 1·U 0·U 0·U 1·U u00 u01 0 0 u10 u11 0 0 = 0 0 u00 u01 0 0 u10 u11 Controlled-NOT gate control: first qubit; target: second qubit • action on basis states of C2 ⊗ C2 |ci ⊗ |ti 7→ |ci ⊗ |c ⊕ ti corresponding matrix 1 0 0 0 1 0 0 0 0 0 0 1 0 0 = |0ih0| ⊗ I2 + |1ih1| ⊗ X 1 0 where I2 = |0ih0| + |1ih1| and X = |0ih1| + |1ih0| Controlled U gate control: qubit; target: m-qubit register / • U let U be a unitary acting on the m-qubit register action on basis states of C2 ⊗ (C2 )⊗m |ci ⊗ |ti 7→ |ci ⊗ U c |ti where b ∈ B, t ∈ Bm corresponding matrix I 0 = |0ih0| ⊗ I + |1ih1| ⊗ U 0 U Toffoli gate control: first and second qubits; target: third qubit • • action on basis states of C2 ⊗ C2 ⊗ C2 |c1 i ⊗ |c2 i ⊗ |ti 7→ |c1 i ⊗ |c2 i ⊗ |(c1 ∧ c2 ) ⊕ ti corresponding matrix 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 = (I4 − |11ih11|) ⊗ I2 + |11ih11| ⊗ X Simulating irreversible gates with Toffoli gate The classical AND gate is irreversible because if the output is 0 then we cannot determine which of the three possible pairs was the actual input x1 0 0 1 1 x2 0 1 0 1 x1 ∧ x2 0 0 0 1 But it is easy to simulate the AND gate with one Toffoli gate • |x1 i |x1 i • |x2 i |x2 i |0i |x1 ∧ x2 i Problem of garbage To simulate irreversible circuits with Toffoli gates, we keep the input and intermediary results to make everything reversible Consider the function y = x1 ∧ x2 ∧ x3 |x1 i |x2 i |x3 i |0i |0i • • • • |x1 i |x2 i |x3 i |x1 ∧ x2 ∧ x3 i |x1 ∧ x2 i garbage It is important to not leave any garbage; otherwise, we could not make use of quantum parallelism and constructive interference effects Reversible garbage removal It is always possible to reversibly remove (uncompute) the garbage In the case y = x1 ∧ x2 ∧ x3 , this can be done with the circuit |x1 i |x2 i |x3 i |0i |0i • • • • • • |x1 i |x2 i |x3 i |x1 ∧ x2 ∧ x3 i |0i garbage uncomputed Simulating irreversible circuits with Toffoli gates Let f : {0, 1}n → {0, 1} be any boolean function Assume this function can be computed classically using only t classical elementary gates such as AND, OR, NAND We can implement a unitary Uf on (C2 )⊗n ⊗ C2 ⊗ (C2 )⊗w such that ⊗w Uf |xiin ⊗ |y iout ⊗ |0i⊗w work = |xi ⊗ |y ⊕ f (x)i ⊗ |0i Uf is built from polynomially many in t Toffoli gates and the size w of the workspace register is polynomial in t During the computation the qubits of the workspace register are changed, but at the end they reversibly reset to |0i⊗w Universal gate set – exact implementation Each unitary U ∈ U(H) can be implemented exactly by quantum circuits using only: I CNOT gates (acting on adjacent qubits) I arbitrary single qubit gates Gate complexity of unitaries – exact implementation The gate complexity κ(U) of a unitary U ∈ U(H) is minimal number of elementary gates needed to implement U For example, quantum Fourier Transform has complexity O(n2 ) =⇒ Shor’s factorization algorithm Universal gate set – approximate implementation For each ∈ (0, 1) and each unitary U ∈ U(H), there is a unitary V such that kU − V k ≤ where kU − V k = sup k(U − V )|ψik |ψi and V is implemented by quantum circuits using only: I CNOT gates (acting on adjacent qubits) I the single qubit gates 1 H=√ 2 1 1 1 −1 R(θ) = There are other universal gate sets 1 0 0 e iθ , with θ = π 4 Gate complexity of unitaries – approximate implementation The gate complexity κ (U) of a unitary U is the minimal number of gates (from a universal gate set) need to implement a unitary V with kU − V k ≤ The Solovay-Kitaev theorem implies that κ (U) = O κ(U) · logc κ(U)/ for some small constant c Counting arguments show that most n-qubit unitaries have gate complexity exponential in n. Quantum measurement A general measurement is described by a collection P0 ,. . . ,Pm−1 of orthogonal projectors such that m−1 X i=0 Pi = IH where H denotes the identity on H Let |ψi be the state of the quantum register. The probability of obtaining the outcome i is given by Pr(i) = kPi |ψik2 The post-measurement state (collapse of the wavefunction) is Pi |ψi kPi |ψik Elementary quantum measurements A measurement has to be realized by first applying a suitable quantum circuit followed by an elementary measurement An elementary measurement on the n-qubit quantum register H consists of measuring the first (w.l.o.g.) m qubits (m ≤ n) with respect to the computational basis The 2m orthogonal projectors Pb are labeled by m-bit strings b ∈ Bm and are defined by Pb = |b1 ihb1 | ⊗ |b2 ihb2 | ⊗ · · · ⊗ |bm ihbm | ⊗ I2n−m The probability of obtaining outcome b is given by X Pr(b) = kPb |ψik2 = |αb1 ,...,bm ,xm+1 ,...,xn |2 xm+1 ,...,xn ∈B Structure of quantum algorithms A quantum algorithm consists of I preparing the initial state |xi with x ∈ Bn , I applying a quantum circuit of polynomially many in n gates from some universal gate set, and I performing an elementary measurement These steps are repeated polynomially many times to collect enough samples and followed by classical post-processing =⇒ solution of the problem Hadamard test |0i H • |ψi / U H NM The probabilities of obtaining the outcomes 0 and 1 are: Pr(0) = 1 (1 + Rehψ|U|ψi) 2 Pr(1) = 1 (1 − Rehψ|U|ψi) 2 Hadamard test 7→ = 7→ 7→ = =: |0i H • |ψi / U H NM |0i ⊗ |ψi 1 √ (|0i + |1i) ⊗ |ψi 2 1 1 √ |0i ⊗ |ψi + √ |1i ⊗ |ψi 2 2 1 1 √ |0i ⊗ |ψi + √ |1i ⊗ U|ψi 2 2 1 1 (|0i + |1i) ⊗ |ψi + (|0i − |1i) ⊗ U|ψi 2 2 1 1 |0i ⊗ (|ψi + U|ψi) + |1i ⊗ (|ψi − U|ψi) 2 2 |Φi Hadamard test Pr(0) = kP|Φik2 = = = = = = = with P = |0ih0| ⊗ I 1 1 k |0ih0| ⊗ I |0i ⊗ (|ψi + U|ψi) + |1i ⊗ (|ψi − U|ψi) k2 2 2 1 2 k |0i ⊗ (|ψi + U|ψi)k 2 1 k|0ik2 · k|ψi + U|ψik2 4 1 hψ| + hψ|U † |ψi + U|ψi 4 1 hψ|ψi + hψ|U|ψi + hψ|U † |ψi + hψ|U † U|ψi 4 1 2 + hψ|U|ψi + hψ|U|ψi 4 1 1 + Rehψ|U|ψi 2 Hadamard test – Figure it out yourself How can you estimate the imaginary part of hψ|U|ψi? Hint: Add a simple gate on the control register before the measurement. SWAP test – Figure it out yourself Let S denote the swap gate acting on two qubits S = |00ih00| + |01ih10| + |10ih01| + |11ih11| Determine the matrix representation of S with respect to the computational basis Consider the Hadamard test where the controlled operation is |0ih0| ⊗ I4 + |1ih1| ⊗ S and the state of the target register |ψi = |ψ1 i ⊗ |ψ2 i Determine the probability of obtaining 0 and 1 for the cases: I I I arbitrary |ψ1 i and |ψ2 i, hψ1 |ψ2 i = 0 (orthogonal), and hψ1 |ψ2 i = 1 (the same). Part II Elementary quantum algorithms Black box problems Standard computational problem: determine a property of some input data I Example: Find the prime factors of N Alternate model: Input is provided by a black box (or oracle) I Query: On input x, black box returns f (x) I Determine a property of f using as few queries as possible I The minimum number of queries is the query complexity I Example: Given a black box for f : {1, 2, . . . , N} → {0, 1}, is there some x such that f (x) = 1? Why black boxes? I I I Facilitates proving lower bounds Can lead to algorithms for standard problems Black boxes for reversible/quantum computing Black box x Reversible version: f (x) f x x z is not reversible f z ⊕ f (x) Given a circuit that computes f non-reversibly, we can implement the reversible version with little overhead Quantum version: |xi |zi f |xi |z ⊕ f (x)i A reversible circuit is a quantum circuit Deutsch’s problem Problem I I Given: a black-box function f : {0, 1} → {0, 1} Task: determine whether f is constant or balanced x 0 1 | f1 (x) 0 0 x 0 1 f2 (x) 1 1 {z } constant: f (0) = f (1) x 0 1 | f3 (x) 0 1 x 0 1 f4 (x) 1 0 {z } balanced: f (0) 6= f (1) How many queries are needed? I Classically: 2 queries are necessary and sufficient I Quantumly: ? Toward a quantum algorithm for Deutsch’s problem Quantum black box for f : |xi |xi f |zi Compute f in superposition: |0i |0i |z ⊕ f (x)i H f |0i + |1i √ ⊗ |0i 2 1 7 √ (|0i ⊗ |f (0)i + |1i ⊗ |f (1)i) → 2 |0i ⊗ |0i 7→ Can’t extract more than one bit of information about f Phase kickback Quantum black box for f : |xi |zi f |xi |z ⊕ f (x)i Phase kickback: |xi |0i−|1i √ 2 |xi ⊗ √1 (|0i 2 f (−1)f (x) |xi |0i−|1i √ 2 √1 (|xi ⊗ |0i − |xi ⊗ |1i) 2 7→ √12 (|xi ⊗ |f (x)i − |xi ⊗ |1 ⊕ = |xi ⊗ √12 (|f (x)i − |f (x)i) = (−1)f (x) |xi ⊗ √12 (|0i − |1i) | {z } not necessarily global − |1i) = f (x)i) Quantum algorithm for Deutsch’s problem |0i |0i−|1i √ 2 |0i ⊗ H H f NM f (0) ⊕ f (1) |0i − |1i |0i + |1i |0i − |1i √ 7→ √ ⊗ √ 2 2 2 f (0) (−1) |0i + (−1)f (1) |1i |0i − |1i √ ⊗ √ 7→ 2 2 f (0)⊕f (1) |1i |0i + (−1) |0i − |1i √ = (−1)f (0) ⊗ √ 2 2 |0i − |1i 7→ (−1)f (0) |f (0) ⊕ f (1)i ⊗ √ 2 1 quantum query vs. 2 classical queries! The Deutsch-Jozsa problem Problem I I I Given: a black-box function f : {0, 1}n → {0, 1} Promise: f is either constant (f (x) is independent of x) or balanced (f (x) = 0 for exactly half the values of x) Task: determine whether f is constant or balanced How many queries are needed? I Classically: 2n /2 + 1 queries to answer with certainty I Quantumly: ? Phase kickback for a Boolean function of n bits Black box function: |x1 i |xn i |zi .. . f .. . |x1 i |xn i |z ⊕ f (x)i Phase kickback: |x1 i ⊗ · · · ⊗ |xn i ⊗ |0i − |1i |0i − |1i √ 7→ (−1)f (x) |x1 i ⊗ · · · ⊗ |xn i ⊗ √ 2 2 Quantum algorithm for the Deutsch-Jozsa problem |0i H .. . |0i H H .. . f H |0i−|1i √ 2 |0i ⊗n NM .. . NM |0i + |1i ⊗n |0i − |1i √ ⊗ √ 2 2 X 1 |0i − |1i =√ |xi ⊗ √ n 2 x∈{0,1}n 2 |0i − |1i ⊗ √ 7→ 2 1 7→ √ 2n X (−1)f (x) |xi ⊗ x∈{0,1}n |0i − |1i √ 2 Hadamard transform What do the final Hadamard gates do? 1 H|xi = √ (|0i + (−1)x |1i) 2 1 X =√ (−1)xy |y i 2 y ∈{0,1} n O √1 (−1)xi yi |yi i 2 i=1 yi ∈{0,1} X 1 =√ (−1)x·y |y i n 2 y ∈{0,1}n H ⊗n (|x1 i ⊗ · · · ⊗ |xn i) = X Quantum D-J algorithm: Finishing up 1 √ 2n I X H ⊗n (−1)f (x) |xi 7→ x∈{0,1}n 1 2n X (−1)f (x) (−1)x·y |y i x,y ∈{0,1}n If f is constant, the amplitude of |y i is ( 1 if y = 0 . . . 0 1 X ± n (−1)x·y = ± 2 0 otherwise x∈{0,1}n so we definitely measure 0 . . . 0 I If f is balanced, the amplitude of |0 . . . 0i is X (−1)f (x) = 0 x∈{0,1}n so we measure some nonzero string The Deutsch-Jozsa problem: Quantum vs. classical Above quantum algorithm uses only one query. Need 2n /2 + 1 classical queries to answer with certainty. What about randomized algorithms? Success probability arbitrarily close to 1 with a constant number of queries. Can we get a separation between randomized and quantum computation? Simon’s problem Problem I I I Given: a black-box function f : {0, 1}n → {0, 1}m Promise: there is some s ∈ {0, 1}n such that f (x) = f (y ) if and only if x = y or x = y ⊕ s Task: determine s One classical strategy: I query a random x I repeat until we find xi 6= xj such that f (xi ) = f (xj ) I output xi ⊕ xj By the birthday problem, this uses about √ 2n queries. It can be shown that this strategy is essentially optimal. Quantum algorithm for Simon’s problem Quantum black box: |xi ⊗ |y i 7→ |xi ⊗ |y ⊕ f (x)i (x ∈ {0, 1}n , y ∈ {0, 1}m ) |0i H .. . |0i H |0i .. . H .. . f H NM .. . NM .. . |0i Repeat many times and post-process the measurement outcomes Quantum algorithm for Simon’s problem: Analysis I |0i H .. . |0i H |0i |0i .. . H .. . f H NM .. . NM .. . |0i⊗n ⊗ |0i⊗m X 1 7→ √ |xi ⊗ |0i⊗m 2n x∈{0,1}n X 1 7→ √ |xi ⊗ |f (x)i 2n x∈{0,1}n =√ 1 2n−1 X |xi + |x ⊕ si √ ⊗ |f (x)i 2 x∈R for some R ⊂ {0, 1}n Quantum algorithm for Simon’s problem: Analysis II Recall H ⊗n |xi = H ⊗n x·y |y i y ∈{0,1}n (−1) P |xi + |x ⊕ si √ 2 =√ =√ 1 2n+1 1 2n+1 X y ∈{0,1}n X y ∈{0,1}n [(−1)x·y + (−1)(x⊕s)·y ]|y i (−1)x·y [1 + (−1)s·y ]|y i Two cases: I I if s · y = 0 mod 2, 1 + (−1)s·y = 2 if s · y = 1 mod 2, 1 + (−1)s·y = 0 Measuring gives a random y orthogonal to s (i.e., s · y = 0) Quantum algorithm for Simon’s problem: Post-processing Measuring gives a random y orthogonal to s (s · y = 0) Repeat k times, giving vectors y1 , . . . , yk ∈ {0, 1}n ; solve a system of k linear equations for s ∈ {0, 1}n : y1 · s = 0, y2 · s = 0, ..., yk · s = 0 How big should k be to give a unique (nonzero) solution? I I Clearly k ≥ n − 1 is necessary It can be shown that k = O(n) suffices O(n) quantum queries, O(n3 ) quantum gates Compare to Ω(2n/2 ) classical queries (even for bounded error) Recap We have seen several examples of quantum algorithms that outperform classical computation: I Deutsch’s problem: 1 quantum query vs. 2 classical queries I Deutsch-Jozsa problem: 1 quantum query vs. 2Ω(n) classical queries (deterministic) I Simon’s problem: O(n) quantum queries vs. 2Ω(n) classical queries (randomized) Quantum algorithms for more interesting problems build on the tools used in these examples. Exercise: One-out-of-four search Let f : {0, 1}2 → {0, 1} be a black-box function taking the value 1 on exactly one input. The goal is to find the unique (x1 , x2 ) ∈ {0, 1}2 such that f (x1 , x2 ) = 1. I Write the truth tables of the four possible functions f . I How many classical queries are needed to solve the problem? I Suppose f is given as a quantum black box Uf acting as |x1 , x2 , y i 7→ |x1 , x2 , y ⊕ f (x1 , x2 )i. Determine the output of the following quantum circuit for each of the possible black-box functions f : I |0i H |0i H |1i H f Show that the four possible outputs obtained in the previous part are pairwise orthogonal. What can you conclude about the quantum query complexity of one-out-of-four search? Part III The QFT and phase estimation Quantum phase estimation Problem We are given a unitary U and an eigenvector |ψi of U with unknown eigenvalue We seek to determine its eigenphase ϕ ∈ [0, 1) such that U|ψi = e 2πiϕ |ψi More precisely, we want to obtain an estimate ϕ̂ such that Pr |ϕ̂ − ϕ| ≤ 1 3 ≥ 2n 4 The deviation |ϕ̂ − ϕ| is computed modulo 1 Phase kick back • U |+i |ψi |0i + |1i √ ⊗ |ψi 2 = 7→ = = = |0i |1i √ ⊗ |ψi + √ ⊗ |ψi 2 2 |0i |1i √ ⊗ |ψi + √ ⊗ U|ψi 2 2 |0i |1i √ ⊗ |ψi + √ ⊗ e 2πiϕ |ψi 2 2 2πiϕ |0i e |1i √ ⊗ |ψi + √ ⊗ |ψi 2 2 |0i + e 2πiϕ |1i √ ⊗ |ψi 2 Phase kick back |+i |ψi • U |0i + |1i |0i + e 2πiϕ |1i √ √ ⊗ |ψi 7→ ⊗ |ψi 2 2 The eigenstate |ψi in the target register emerges unchanged ⇒ It suffices to focus on the control register The state |0i + |1i of the control qubit is changed to |0i + e 2πiϕ |1i by phase kick back Hadamard test + phase kick back 7→ 7→ |0i H • |ψi / U H NM |0i + e 2πiϕ |1i √ 2 1 (|0i + |1i) + e 2πiϕ (|0i − |1i) 2 1 (1 + e 2πiϕ )|0i + (1 − e 2πiϕ )|1i) := |ϕi 2 Hadamard test + phase kick back |ϕi = 1 (1 + e 2πiϕ )|0i + (1 − e 2πiϕ )|1i) 2 The probability of obtaining 0 is Pr(0) = k|0ih0| |ϕik2 1 = | (1 + e 2πiϕ )|2 2 1 πiϕ = |e + e −πiϕ )|2 4 1 = |2 cos(πϕ)|2 4 1 = cos2 (πϕ) = 1 + cos(2πϕ) 2 Phase kick back due to higher powers of U For arbitrary k, we obtain √1 (|0i 2 |0i H • |ψi / U2 |ψi k since k k k + e 2πi2 ϕ |1i) U 2 |ψi = e 2πi2 ϕ |ψi Phase kick back part of phase estimation |0i H |0i H .. . H |0i |ψi • • 0 / U2 .. ··· • n−1 ϕ |1i |0i+e 2πi2 √ 2 n−2 ϕ |0i+e 2πi2 |1i √ 2 . |0i+e 2πi2 √ 2 1 n−1 U2 U2 0ϕ |ψi We set n−1 ϕ |ϕi := |0i + e 2πi2 √ 2 n−2 ϕ |1i |0i + e 2πi2 √ ⊗ 2 |1i 0 ⊗· · ·⊗ |0i + e 2πi2 ϕ |1i √ 2 |1i Binary fractions Assume that the eigenphase ϕ is an exact n-bit binary fraction, i.e., ϕ = 0.x1 x2 . . . xn = n X xi i=1 2i For arbitrary k ∈ {0, . . . , n − 1}, we have 2k ϕ = x1 x2 . . . xk .xk+1 . . . xn e 2πi2 kϕ = e 2πi(x1 x2 ...xk .xk+1 ...xn ) = e 2πi(x1 x2 ...xk +0.xk+1 ...xn ) = e 2πi(x1 x2 ...xk ) · e 2πi(0.xk+1 ...xn ) = e 2πi(0.xk+1 ...xn ) Phase kick back part of phase estimation |0i H |0i H .. . H |0i |ψi / • • U2 0 .. ··· • 1 U2 |0i+e 2πi0.xn |1i √ 2 |0i+e 2πi0.xn−1 xn |1i √ 2 . |0i+e 2πi0.x1 ...xn−1 xn |1i √ 2 n−1 U2 |ψi Quantum Fourier transform The quantum Fourier transform F is defined by F |xn i ⊗ |xn−1 i ⊗ · · · ⊗ |x1 i = |0i + e 2πi0.xn |1i |0i + e 2πi0.xn−1 xn |1i |0i + e 2πi0.x1 x2 ...xn |1i √ √ √ ⊗ ⊗· · ·⊗ 2 2 2 We use inverse quantum Fourier transform F † to obtain the bits of the eigenphase Note: QFT is defined by F |x1 i ⊗ |x2 i ⊗ · · · ⊗ |xn i = |0.x1 x2 . . . xn i in the literature; we use the above definition for the sake of notational simplicity (otherwise, we would have to include the so-called bit-reversal) Quantum circuit for phase estimation |0i H |0i H .. . H |0i |ψi / • • U2 0 F† ··· • 1 U2 |xn i |xn−1 i |x1 i n−1 U2 |ψi Inverse quantum Fourier transform for 3 bits _ _ _ |0i+e 2πi0.x3 |1i √ 2 |0i+e 2πi0.x2 x3 |1i √ 2 |0i+e 2πi0.x1 x2 x3 |1i √ 2 _ _ _ _ _ _ _ • R† H 2 _ _ _ _ _ _ _ H _ _ _ _ _ _ _ _ _ _ • |x3 i • R3† R2† H _ _ _ _ _ _ _ The phase shift Rk is defined by 1 0 Rk := k 0 e 2πi/2 |x2 i |x1 i QPE: least significant bit – top qubit _ _ _ |0i+e 2πi0.x3 |1i √ 2 H _ _ _ |0i + (−1)x3 |1i |0i + e 2πi0.x3 |1i √ √ = 2 2 H − → |x3 i QPE: second bit – middle qubit _ _ _ _ _ _ • R2† |x3 i |0i+e 2πi0.x2 x3 |1i √ 2 H _ _ _ _ _ _ |0i + e 2πi0.x2 x3 |1i √ 2 † 2πi0.x 2 0 |1i ctrl R2 |0i + e √ −−−−→ |x3 i ⊗ 2 |x3 i ⊗ I ⊗H −−−→ |x3 i ⊗ |x2 i QPE: most significant bit – bottom qubit _ _ _ _ _ _ _ _ _ • R3† |x3 i |x2 i |0i+e 0.x1 x2 x3 |1i √ 2 • R2† H _ _ _ _ _ _ _ _ _ ctrl R † ctrl R † 2 −−−−→ I ⊗I ⊗H |0i + e 2πi0.x1 x2 x3 |1i √ 2 2πi0.x 1 x2 0 |1i |0i + e √ |x3 i ⊗ |x2 i ⊗ 2 2πi0.x 1 00 |1i |0i + e √ |x3 i ⊗ |x2 i ⊗ 2 |x3 i ⊗ |x2 i ⊗ 3 −−−−→ −−−−→ |x3 i ⊗ |x2 i ⊗ |x1 i Summary of phase estimation circuit k We use phase kick back due to the controlled U 2 gate to prepare the state |0i + e 2πi0.xk+1 xk+2 ...xn |1i √ 2 Using the previously determined bits xk+2 , . . . , xn , we change this state to |0i + (−1)xk |1i |0i + e 2πi0.xk+1 0...0 |1i √ √ = 2 2 We apply the Hadamard gate to obtain |xk+1 i The controlled phase shifts enable us to reduce the problem of determining each bit to distinguishing between |+i and |−i (deterministic Hadamard test) Special case: exact n-bit binary fraction Assume that ϕ is an exact n-bit binary fraction, i.e., ϕ = 0.x1 . . . xn−1 xn |0i H |0i H .. . H |0i |ψi / • • 0 U2 F† ··· • 1 U2 |xn i |xn−1 i |x1 i n−1 U2 ⇒ The measurment of the qubits yields the bits xn , xn−1 , . . . , x1 deterministically |ψi General case: arbitrary eigenphases Let ϕ be arbitrary Unless ϕ is an exact n-bit fraction, the application of the inverse quantum Fourier transform F † |ϕi produces a superposition of n-bit strings Geometric summation Lemma We have N−1 X e 2πiθy = N for θ = 0 e 2πiθy = y =0 N−1 X y =0 Assume that θ = x N 1 − e 2πiNθ for θ ∈ (0, 1) 1 − e 2πiθ for some x ∈ [0, N − 1] ⇒ We have N−1 X y =0 x e 2πi N y = N δx,0 Probability of obtaining a certain estimate Lemma P Let x = nk=1 xi 2n−i and ϕx := 0.x1 x2 . . . xn = corresponding n-bit fraction x 2n be the The probability of obtaining the estimate ϕx is Pr(x) = 1 sin2 2n π (ϕ − ϕx ) 22n sin2 π (ϕ − ϕx ) Examples of probability distributions for different ϕ Examples of probability distributions for different ϕ Examples of probability distributions for different ϕ Examples of probability distributions for different ϕ Examples of probability distributions for different ϕ Examples of probability distributions for different ϕ Examples of probability distributions for different ϕ Examples of probability distributions for different ϕ Examples of probability distributions for different ϕ Probability of obtaining a certain estimate Proof. The probability of obtaining the estimate ϕx is Pr(x) = |hx|F † |ϕi|2 = |hϕx |ϕi|2 n = 2 −1 1 X 2πi (ϕ−ϕx ) y e 22n 2 geometric summation y =0 n = = 1 1 − e 2πi(2 (ϕ−ϕx )) 2 22n 1 − e 2πi(ϕ−ϕx ) 1 sin2 (2n π(ϕ − ϕx )) 22n sin2 (π(ϕ − ϕx )) |1 − e i2θ | = |e −iθ − e iθ | = 2| sin θ| Lower bound on success probability Theorem Let x be such that x 2n ≤ϕ< x+1 2n The probability of returning one of the two closest n-bit fractions ϕx and ϕx+1 is at least π82 Proof of lower bound on success probability Pr(success) := Pr(x) + Pr(x + 1) 2n −1 1 X 2πi(ϕ−ϕx )y e = 22n 2 + y =0 n −1 2X 2 e 2πi(ϕ−ϕx )y y =0 This function attains its minimum at ϕ = 21 (ϕx + ϕx+1 ) n −1 2X y 2 2 Pr(success) ≥ e 2πi 2n+1 22n y =0 ≥ ≥ 4 2 π 22n 4 sin2 ( 2n+1 ) 8 π2 The last inequality follows from 1 | sin θ|2 ≥ 1 |θ|2 ⇒ Summary of phase estimation We are given a unitary U and an eigenvector |ψi of U with unknown eigenphase ϕ We obtain an estimate ϕ̂ such that Pr |ϕ̂ − ϕ| ≤ 1 8 ≥ 2 2n π n−1 To do this, we need invoke each of the controlled U, U 2 ,. . . ,U 2 gates once We can boost the success probability to 1 − by repeating the above algorithm O(log(1/)) times and outputting the median of the outcomes Phase estimation applied to superpositions of eigenstates We are given a unitary U with eigenvectors |ψi i and corresponding eigenphases ϕi Let |ψi = X i αi |ψi i What happens if we apply phase estimation to |0i⊗n ⊗ |ψi? 0 1 After the n phase kick-backs due to U 2 , U 2 , . . . U 2 X i n−1 , we obtain αi |ϕi i ⊗ |ψi i After applying the inverse quantum Fourier transform, we obtain X i αi |x̃i i ⊗ |ψi i where |x̃i i denotes a superpositions of n-bit estimates of ϕi Part IV Factoring The fundamental theorem of arithmetic Theorem Every positive integer larger than 1 can be factored as a product of prime numbers, and this factorization is unique (up to the order of the factors). N = 2n2 × 3n3 × 5n5 × 7n7 × · · · Examples 15 = 3 × 5 239815173914273 = 15485863 × 15486071 16347336458092538484 43133883865090859841 3107418240490043721350750 78367003309231218111 0358885679300373460228427 08523893331001045081 2754572016194882320644051 51212118167511579 8081504556346829671723286 × = 7824379162728380334154710 19008712816648221131 7310850191954852900733772 26851573935413975471 4822783525742386454014691 89678996851549366663 736602477652346609 85390880271038021044 98957191261465571 “The problem of distinguishing prime numbers from composite numbers and of resolving the latter into their prime factors is known to be one of the most important and useful in arithmetic. It has engaged the industry and wisdom of ancient and modern geometers to such an extent that it would be superfluous to discuss the problem at length... Further, the dignity of the science itself seems to require that every possible means be explored for the solution of a problem so elegant and so celebrated.” – Carl Friedrich Gauss, Disquisitiones Arithmeticæ (1801) RSA Alice Eve Bob M message primes p, q n n n = pq e e e ∈ Z× (p−1)(q−1) encryption key d := e −1 mod (p − 1)(q − 1) decryption key C := M e mod n ciphertext C C d = M ed mod n = M Order finding Definition Given a, N ∈ Z with gcd(a, N) = 1, the order of a modulo N is the smallest positive integer r such that ar ≡ 1 (mod N). Problem I I Given: a, N ∈ Z with gcd(a, N) = 1 Task: find the order of a modulo N Spectrum of a cyclic shift Let P be a cyclic shift modulo r : P|xi = |x + 1 mod r i r −1 1 X −2πikx/r e |xi is an r x=0 Claim. For any k ∈ Z, the state |uk i := √ eigenstate of P. r −1 1 X −2πikx/r e |x + 1 mod r i r x=0 Proof. U|uk i = √ r −1 1 X 2πik/r −2πik(x+1)/r e e |x + 1 mod r i =√ r x=0 =e 2πik/r r 1 X −2πikx/r √ e |x mod r i r x=1 = e 2πik/r |uk i The multiplication-by-a map Define U by U|xi = |axi for x ∈ ZN . Computing U: |x, 0i 7→ |x, axi 7→ |ax, xi 7→ |ax, 0i (reversible multiplication by a) (swap) (uncompute reversible division by a) High powers of U can be implemented efficiently using repeated squaring Spectrum of the multiplication-by-a map Define U by U|xi = |axi for x ∈ ZN . Claim. Let r be the order of a modulo N. For any k ∈ Z, the state r −1 1 X −2πikx/r x |uk i := √ e |a mod Ni r x=0 is an eigenstate of U with eigenvalue e 2πik/r . Proof. Same as for the cyclic shift, due to the isomorphism x mod r ↔ ax mod N Order finding and phase estimation U|uk i = e 2πik/r |uk i Phase estimation of U on |uk i can be used to approximate k/r . Problems: I We don’t know r , so we can’t prepare |uk i. I We only get an approximation of k/r . I Even if we knew k/r exactly, k and r could have common factors. Estimating k/r in superposition A useful identity: r −1 X e 2πikx/r k=0 ( r = 0 if x = 0 otherwise Consider r −1 r −1 1 X −2πikx/r x 1 X √ e |a mod Ni |uk i = r r k,x=0 0 k=0 = |a mod Ni = |1i Phase estimation: r −1 r −1 1 X 1 X g |0i ⊗ |uk i 7→ √ |k/r i ⊗ |uk i |0i ⊗ |1i = √ r r k=0 k=0 Measurement gives an approximation of k/r for a random k Continued fractions Problem n n Given samples x of the form bk 2r c, dk 2r e (k ∈ {0, 1, . . . , r − 1}), determine r . Continued fraction expansion: 1 x = n 2 a1 + a + 1 2 1 a3 +··· Gives an efficiently computable sequence of rational approximations Theorem If 2n ≥ N 2 , then k/r is the closest convergent of the CFE to x/2n among those with denominator smaller than N. Since r < N, it suffices to take n = 2 log2 N Common factors If gcd(k, r ) = 1, then the denominator of k/r is r Fact The probability that gcd(k, r ) = 1 for a random k ∈ {0, 1, . . . , r − 1} is φ(r ) 1 =Ω r log log r jHnLn 1.0 0.8 0.6 0.4 0.2 0 200 400 600 800 n 1000 Thus Ω(log log N) repetitions suffice to give r with constant probability Alternatively, find two (or more) denominators and take their least common multiple; then O(1) repetitions suffice Factoring → finding a nontrivial factor Suppose we want to factor the positive integer N. Since primality can be tested efficiently, it suffices to give a procedure for finding a nontrivial factor of N with constant probability. function factor(N) if N is prime output N else repeat x=find_nontrivial_factor(N) until success factor(x) factor(N/x) end if We can assume N is odd, since it is easy to find the factor 2. We can also assume that N contains at least two distinct prime powers, since it is easy to check if it is a power of some integer. Reduction of factoring to order finding Factoring N reduces to order finding in Z× N [Miller 1976]. Choose a ∈ {2, 3, . . . , N − 1} uniformly at random. If gcd(a, N) 6= 1, then it is a nontrivial factor of N. If gcd(a, N) = 1, let r denote the order of a modulo N. Suppose r is even. Then ar = 1 mod N m (ar /2 )2 − 1 = 0 mod N m (ar /2 − 1)(ar /2 + 1) = 0 mod N so we might hope that gcd(ar /2 − 1, N) is a nontrivial factor of N. Miller’s reduction Question Given (ar /2 − 1)(ar /2 + 1) = 0 mod N, when does gcd(ar /2 − 1, N) give a nontrivial factor of N? Note that ar /2 − 1 6= 0 mod N (otherwise the order of a would be r /2, or smaller). So it suffices to ensure that ar /2 + 1 6= 0 mod N. Lemma Suppose a ∈ Z× N is chosen uniformly at random, where N is an odd integer with at least two distinct prime factors. Then with probability at least 1/2, the order r of a is even and ar /2 6= −1 mod N. Proof (part 1 of 2) Let N = p1m1 × · · · × pkmk a = ai mod pimi (pi distinct odd primes, k ≥ 2) ri = order of ai mod pimi 2ci = largest power of 2 that divides ri Claim 1. If r is odd or ar /2 + 1 = 0 mod N, then c1 = · · · = ck . Since r = lcm(r1 , . . . , rk ), r is odd iff c1 = . . . = ck = 0. If r is even and ar /2 = −1 mod N, then ar /2 = −1 mod pimi for each i, so ri does not divide r /2; but notice that ri does divide r . Hence r /ri is an odd integer for each i, and every ri must contain the same number of powers of 2 as r . Proof (part 2 of 2) Claim 2. Pr(ci = any particular value) ≤ 1/2 (Then the lemma follows, since in particular Pr(c1 = c2 ) ≤ 1/2.) a ∈ Z× N uniformly at random ⇔ ai ∈ Z× m p i i uniformly at random Since Z× m is cyclic and of even order, exactly half its elements p i i have the maximal value of ci , so in particular the probability of any particular ci is at most 1/2. Shor’s algorithm Input: Integer N Output: A nontrivial factor of N 1. Choose a random a ∈ {2, 3, . . . , N − 1} 2. Compute gcd(a, N); if it is not 1 then it is a nontrivial factor, and otherwise we continue 3. Perform phase estimation with the multiplication-by-a operator U on the state |1i using n = 2 log2 N bits of precision 4. Compute the continued fraction expansion of the estimated phase, and find the best approximation with denominator less than N; call the result r 5. Compute gcd(ar /2 − 1, N). If it is a nontrivial factor of N, we are done; if not, go back to step 1 Quantum vs. classical factoring algorithms Best known classical algorithm for factoring N 1/2 (log log N)1/2 ) I Proven running time: 2O((log N) I With plausible heuristic assumptions: 2O((log N) 1/3 (log log N)1/3 ) Shor’s quantum algorithm I QFT modulo 2n with n = O(log N): takes O(n2 ) steps I Modular exponentiation: compute ax for x < 2n . With repeated squaring, takes O(n3 ) steps I Running time of Shor’s algorithm: O(log3 N) Beyond factoring There are many fast quantum algorithms based on related ideas I Computing discrete logarithms I Decomposing abelian/solvable groups I Estimating Gauss sums I Counting points on algebraic curves I Computations in number fields (Pell’s equation, etc.) I Abelian hidden subgroup problem I Non-abelian hidden subgroup problem? Part V Quantum search Unstructured search Quantum computers can quadratically outperform classical computers at a very basic computational task, called unstructured search. There is a set X containing N items, some of which are marked We are given a Boolean black box f : X → {0, 1} that indicates whether a given item is marked The problem is to decide if any item is marked, or alternatively, to find a marked item given that one exists Applications of unstructured search Unstructured search can be thought of as a model for solving problems in NP by brute force search If a problem is in NP, then we can efficiently recognize a solution, so one way to find a solution is to solve unstructured search Of course, this may not be the best way to find a solution in general, even if the problem is NP-hard We don’t know if NP-hard problems are really “unstructured” Unstructured search It is obvious that even a randomized classical algorithm needs Ω(N) queries to decide if any item is marked On the other hand, a quantum algorithm can do much better! Phase oracle We assume that we a unitary operator U satisfying ( |xi x is not marked U|xi = (−1)f (x) |xi = −|xi x is marked Target state We consider the case where there is exactly one x ∈ X element that is marked; call this element m Our goal is to prepare the state |mi Initial state We have no information about which item might be marked ⇒ We take N 1 X |ψi := √ |xi N x=1 as the initial state Rough idea behind Grover search We start with the initial state |ψi We prepare the target state |mi by implementing a rotation that moves |ψi toward |mi We realize the rotation with the help of two reflections Visualization of a reflection in R2 PIC 1 v Visualization of a reflection in R2 PIC 1 v w ω Visualization of a reflection in R2 PIC 1 w' v 2ω w ω ω Reflections U = I − 2|mihm| is a reflection about the target state |mi V = I − 2|ψihψ| is the reflection around about the initial state |ψi: V |ψi = − |ψi V |ψ ⊥ i = for any state |ψ ⊥ i orthogonal to |ψi |ψ ⊥ i Structure of Grover The algorithm is as follows: I start in |ψi, I apply the Grover iteration G := V U some number of times, I make a measurement, and hope that the outcome is m Invariant subspace Observe that span{|mi, |ψi} is a U- and V -invariant subspace, and both the inital and target states belong to this subspace ⇒ It suffices to understand the restriction of VU to this subspace Consider an orthonormal basis {|mi, |φi} for span{|mi, |ψi} The Gram-Schmidt process yields |ψi − α|mi |φi = √ 1 − α2 √ where α := hm|ψi = 1/ N Invariant subspace Now in the basis {|mi, |φi}, we have √ |ψi = sin θ|mi + cos θ|φi where sin θ = hm|ψi = 1/ N U = V −1 0 0 1 = I − 2|ψihψ| sin θ 1 0 sin θ cos θ = −2 0 1 cos θ 1 − 2 sin2 θ −2 sin θ cos θ = −2 sin θ cos θ 1 − 2 cos2 θ − cos 2θ sin 2θ = − sin 2θ cos 2θ Grover iteration within the invariant subspace ⇒ We find − cos 2θ sin 2θ −1 0 sin 2θ cos 2θ 0 1 cos 2θ sin 2θ = − − sin 2θ cos 2θ VU = − This is a rotation up to a minus sign Visualization of first Grover iteration PIC 4 φ ψ θ m Visualization of first Grover iteration PIC 4 φ ψ θ π 2 −θ m π 2 Uψ −θ Visualization of first Grover iteration PIC 4 φ ψ θ π − 2θ π −θ π − 22θ m π VU ψ 2 Uψ −θ Visualization of first Grover iteration PIC 4 φ ψ θ θ π − 2θ −VU ψ π −θ π − 22θ m π VU ψ 2 Uψ −θ Visualization of first Grover iteration PIC 4 φ ψ θ θ ππ−−3θ2θ −VU ψ π −θ π − 22θ m π VU ψ 2 Uψ −θ Visualization of first Grover iteration PIC 4 φ ψ θ θ ππ−−3θ2θ −VU ψ π −θ π − 22θ m π VU ψ 3θ 2 Uψ −θ Visualization of first Grover iteration PIC 4 φ ψ θ θ ππ−−3θ2θ 3θ −VU ψ π −θ π − 22θ m π VU ψ 3θ 2 Uψ −θ Visualization of first Grover iteration PIC 4 φ θ θ θ ππ−−3θ2θ ψ 32θθ π −θ π − 22θ −VU ψ m π VU ψ 3θ 2 Uψ −θ Grover search Geometrically, U is a reflection around the |mi axis and V is a reflection around the |ψi axis, which is almost but not quite orthogonal to the |mi axis The product of these two reflections is a clockwise rotation by an angle 2θ, up to an overall minus sign From this geometric picture, or by explicit calculation using trig identities, it is easy to verify that k k (VU) = (−1) cos 2kθ sin 2kθ − sin 2kθ cos 2kθ Grover search Recall that our initial state is |ψi = sin θ|mi + cos θ|φi How large should k be before (VU)k |ψi is close to |mi? We start an angle θ from the |φi axis and rotate toward |mi by an angle 2θ per iteration ⇒ To rotate by π/2, we need θ + 2kθ = π/2 k ≈ π −1 π √ θ ≈ N 4 4 Grover search It is easy to calculate that |hm|(VU)k |ψi|2 = sin2 ((2k + 1)θ) This is the probability that, after k steps of the algorithm, a measurement reveals the marked state We are solving a completely unstructured search problem with N possible solutions, yet we can find a unique solution in only √ O( N) queries! While this is only a polynomial separation, it is very generic, and it is surprising that we can obtain a speedup for a search in which we have so little information to go on Grover search It can also be shown that this quantum algorithm is optimal √ Any quantum algorithm needs at least Ω( N) queries to find a marked item (or even to decide if some item is marked) Multiple solutions Assume that there are t marked items ⇒ There is a two-dimensional invariant subspace spanned by span{|µi, |ψi} where 1 |µi = √ t X x marked |xi is the uniform superposition of all solutions The Gram-Schmidt process yields the ONB {|µi, |φi} where |φi = √ 1 N −t X x unmarked |xi is the uniform superposition of all non-solutions Invariant subspace Now in the basis {|µi, |φi}, we have r |ψi = sin θ|µi + cos θ|φi where sin θ = hµ|ψi = cos 2θ sin 2θ VU = − − sin 2θ cos 2θ t N Overshooting The success probability is given by r sin((2k + 1)θ) where sin θ = t N ⇒ We need to apply VU π k≈ 4 r N t times Due to the oscillatory behaviour of the success probability it is important not to overshoot, i.e., to choose a number of iterations that it too large, so that the probability starts decreasing Quantum counting The eigenvalues of −VU = cos 2θ sin 2θ − sin 2θ cos 2θ are e i2θ and e −i2θ The initial state |ψi is a superposition of the two eigenvectors corresponding to the above two eigenvalues ⇒ Using phase estimation, we can obtain an estimate θ̃ such that |θ − θ̃| ≤ by invoking the controlled version of −VU O(1/) times Quantum counting Using the estimate θ̃, we obtain an estimate t̃ satifying √ |t − t̃| ≤ (2 tN + ) Quantum counting We use the following two inequalities: r | sin θ + sin θ̃| ≤ 2 sin θ + |θ − θ̃| ≤ 2 t + N | sin θ − sin θ̃| ≤ |θ − θ̃| ≤ We have t̃ t − N N = | sin2 θ − sin2 θ̃| = | sin θ + sin θ̃| | sin θ − sin θ̃| ! r t ≤ 2 + N Amplitude amplification Assume that there is a classical (randomized) algorithm that produces a solution to some problem with probability p Assume that we can recognized if the output produced by the algorithm is a valid solution or not ⇒ We repeat the algorithm until we obtain a solution The expected number of times we have to repeat is O(1/p) (geometric random variable) Quantum amplitude amplification makes it possible to reduce the √ complexity to O(1/ p) Part VI Quantum walk Randomized algorithms Randomness is an important tool in computer science Black-box problems I Huge speedups are possible (Deutsch-Jozsa: 2Ω(n) vs. O(1)) I Polynomial speedup for some total functions (game trees: Ω(n) vs. O(n0.754 )) Natural problems I Majority view is that derandomization should be possible (P=BPP) I Randomness may give polynomial speedups (Schöning algorithm for k-SAT) I Can be useful for algorithm design Random walk u u Q Q Q Graph G = (V , E ) u Two kinds of walks: I Discrete time I Continuous time u Q Qu Random walk algorithms Undirected s–t connectivity in log space I Problem: given an undirected graph G = (V , E ) and s, t ∈ V , is there a path from s to t? I A random walk from s eventually reaches t iff there is a path I Taking a random walk only requires log space I Can be derandomized (Reingold 2004), but this is nontrivial Markov chain Monte Carlo I Problem: sample from some probability distribution (uniform distribution over some set of combinatorial objects, thermal equilibrium state of a physical system, etc.) I Create a Markov chain whose stationary distribution is the desired one I Run the chain until it converges Continuous-time quantum walk Graph G r1 2r Q r3 4 r A= QQr5 0 1 1 0 0 1 0 0 1 1 1 0 0 1 0 0 1 1 0 1 adjacency matrix −2 1 1 0 0 0 1 0 1 0 L= 1 −3 0 1 1 1 0 −2 1 0 Laplacian Random walk on G I State: probability pv (t) of being at vertex v at time t I Dynamics: d p (t) dt ~ = −L~p (t) Quantum walk on G I I State: amplitude P qv (t) to be at vertex v at time t (i.e., |ψ(t)i = v ∈V qv (t)|v i) d ~q (t) = −L~q (t) Dynamics: i dt 0 1 1 −3 1 0 1 0 1 −2 Random vs. quantum walk on the line r -4 r r -3 r -2 r -1 r 0 r 1 r 2 r 3 4 Classical: -60 -40 -20 0 20 40 60 -60 -40 -20 0 20 40 60 Quantum: - Random vs. quantum walk on the hypercube V = {0, 1} n s 001 s 000 s 101 s E = {(x, y ) ∈ V × V : x and y differ in exactly one bit} 111 011 n = 3: s s s 010 110 s 100 Classical random walk: reaching 11 . . . 1 from 00 . . . 0 is exponentially unlikely Quantum walk: with A = e −iAt = n Y j=1 e Pn −iXj t j=1 Xj , n O cos t −i sin t = −i sin t cos t j=1 Glued trees problem in out Black-box description of a graph I Vertices have arbitrary labels I Label of ‘in’ vertex is known I Given a vertex label, black box returns labels of its neighbors I Restricts algorithms to explore the graph locally Glued trees problem: Classical query complexity in out Let n denote the height of one of the binary trees Classical random walk from ‘in’: probability of reaching ‘out’ is 2−Ω(n) at all times In fact, the classical query complexity is 2Ω(n) Glued trees problem: Exponential speedup Column subspace in out X 1 |v i |col ji := p Nj v ∈column j ( 2j if j ∈ [0, n] Nj := 22n+1−j if j ∈ [n + 1, 2n + 1] Reduced adjacency matrix √ col 0 2 √ col 1 2 √ col 2 2 √ col 3 ↓ 2 col 4 2 √ col 5 2 √ col 6 2 √ col 7 2 √ col 8 2 col 9 hcol j|A|col j + 1i √ √2 if j ∈ [0, n − 1] = 2 if j ∈ [n + 1, 2n] 2 if j = n Discrete-time quantum walk: Need for a coin Quantum analog of discrete-time random walk? Unitary matrix U ∈ C|V |×|V | with Uvw 6= 0 iff (v , w ) ∈ E Consider the line: r -4 r -3 r Define walk by |xi 7→ But then |x + 2i 7→ r -2 -1 √1 (|x 2 √1 (|x 2 r 0 r 1 r 2 r 3 r 4 - − 1i + |x + 1i)? + 1i + |x + 3i), so this is not unitary! In general, we must enlarge the state space. Discrete-time quantum walk on a line r -4 r -3 r -2 r -1 r 0 r 1 r 2 r 3 r 4 Add a “coin”: state space span{|xi ⊗ |←i, |xi ⊗ |→i : x ∈ Z} Coin flip: C := I ⊗ H Shift: S|xi ⊗ |←i = |x − 1i ⊗ |←i S|xi ⊗ |→i = |x + 1i ⊗ |→i Walk step: SC -60 -40 -20 0 20 40 60 - The Szegedy walk State space: span{|v i ⊗ |w i, |w i ⊗ |v i : (v , w ) ∈ E } Let W be a stochastic matrix (a discrete-time random walk) Define |ψv i := |v i ⊗ R := 2 X v ∈V Xp Wwv |w i w ∈V (note hψv |ψw i = δv ,w ) |ψv ihψv | − I S(|v i ⊗ |w i) := |w i ⊗ |v i Then a step of the walk is the unitary operator U := SR Spectrum of the walk Let T := P v ∈V |ψv ihv |, so R = 2TT † − I . Theorem (Szegedy) Let W be a stochastic matrix. Suppose the matrix Xp Wvw Wwv |w ihv | v ,w has an eigenvector |λi with eigenvalue λ. Then I − e ±i arccos λ S p T |λi 2(1 − λ2 ) are eigenvectors of U = SR with eigenvalues e ±i arccos λ . Proof of Szegedy’s spectral theorem Proof sketch. Straightforward calculations give X TT † = |ψv ihψv | T †T = I v ∈V X X p Wvw Wwv |w ihv | = |λihλ| T † ST = v ,w ∈V λ which can be used to show U(T |λi) = ST |λi U(ST |λi) = 2λST |λi − T |λi. Diagonalizing within the subspace span{T |λi, ST |λi} gives the desired result. Exercise. Fill in the details Random walk search algorithm Given G = (V , E ), let M ⊂ V be a set of marked vertices Start at a random unmarked vertex Walk until we reach a marked vertex: w ∈ M and v = w 1 0 Wvw := 0 w ∈ M and v 6= w Wvw w ∈ / M. WM 0 = (WM : delete marked rows and columns of W ) V I Question. How long does it take to reach a marked vertex? Classical hitting time Take t steps of the walk: t WM 0 0 t (W ) = t−1 V (I + WM + · · · + WM ) I ! t WM 0 t = I −WM V I −WM I Convergence time depends on how close kWM k is to 1, which depends on the spectrum of W Lemma Let W = W T be a symmetric Markov chain. Let the second largest eigenvalue of W be 1 − δ, and let = |M|/|V | (the fraction of marked items). Then the probability of reaching a marked vertex is Ω(1) after t = O(1/δ) steps of the walk. Quantum walk search algorithm Start from the state √ 1 N−|M| P v 6∈M |ψv i Consider the walk U corresponding to W 0 : X q WM 0 0 Wv ,w Ww ,v |w ihv | = 0 v ,w ∈V 0 I Eigenvalues of U are e ±i arccos λ where the λ are eigenvalues of WM √ Perform phase estimation on U with precision O( δ) I no marked items =⇒ estimated phase is 0 I fraction of marked items =⇒ nonzero phase with probability Ω(1) Further refinements give algorithms for finding a marked item Grover’s algorithm revisited Problem Given a black box f : X → {0, 1}, is there an x with f (x) = 1? Markov chain on N 1 1 . W := .. N 1 = |X | vertices: ··· 1 . .. . .. = |ψihψ|, ··· 1 Eigenvalues of W are 0, 1 =⇒ δ = 1 Hard case: one marked vertex, = 1/N Hitting times I I Classical: O(1/δ) = O(N) √ √ Quantum: O(1/ δ) = O( N) 1 X |xi |ψi := √ N x∈X Element distinctness Problem Given a black box f : X → Y , are there distinct x, x 0 with f (x) = f (x 0 )? Let N = |X |; classical query complexity is Ω(N) Consider a quantum walk on the Hamming graph H(N, M) I I I Vertices: {(x1 , . . . , xM ) : xi ∈ X } Store the values (f (x1 ), . . . , f (xM )) at vertex (x1 , . . . , xM ) Edges between vertices that differ in exactly one coordinate Element distinctness: Analysis Spectral gap: δ = O(1/M) Fraction of marked vertices: ≥ N−2 M−2 / N M = Θ(M 2 /N 2 ) √ √ Quantum hitting time: O(1/ δ) = O(N/ M) Quantum query complexity: I M queries to prepare the initial state I 2 queries for each step of the walk (compute f , uncompute f ) √ Overall: M + O(N/ M) I Choose M = N 2/3 : query complexity is O(N 2/3 ) (optimal!) Quantum walk algorithms Quantum walk search algorithms I Spatial search I Finding a triangle in a graph I Checking matrix multiplication I Testing if a black-box group is abelian Evaluating Boolean formulas Exponential speedup for a natural problem?
- Library Home /
- Search Collections /
- Open Collections /
- Browse Collections /
- Canadian Summer School on Quantum Information (CSSQI) (10th : 2010) /
- Quantum Algorithms
Open Collections
Canadian Summer School on Quantum Information (CSSQI) (10th : 2010)
Quantum Algorithms Wocjan, Pawel; Childs, Andrew 2010-07-18
Notice for Google Chrome users:
If you are having trouble viewing or searching the PDF with Google Chrome, please download it here instead.
If you are having trouble viewing or searching the PDF with Google Chrome, please download it here instead.
Page Metadata
Item Metadata
Title | Quantum Algorithms |
Creator |
Wocjan, Pawel Childs, Andrew |
Contributor |
Summer School on Quantum Information (10th : 2010 : Vancouver, B.C.) University of British Columbia. Department of Physics and Astronomy Pacific Institute for the Mathematical Sciences |
Date Issued | 2010-07-18 |
Description | Quantum information offers the possibility to solve certain problems dramatically faster than is possible with classical computers. In these lectures, we will give an introduction to quantum algorithms. We will begin with an overview of the quantum circuit model and some elementary examples of quantum speedup. Next, we will introduce the quantum Fourier transform and show how it can be used to estimate the eigenvalues of a unitary operator. Using phase estimation, we will describe Shor's algorithm for factoring integers. We will also describe Grover's search algorithm, and will conclude with a discussion of recent quantum algorithms based on quantum analogs of random walks. |
Type |
Moving Image |
Language | eng |
Date Available | 2016-11-22 |
Provider | Vancouver : University of British Columbia Library |
Rights | Attribution-NonCommercial-NoDerivatives 4.0 International |
DOI | 10.14288/1.0040932 |
URI | http://hdl.handle.net/2429/29926 |
Affiliation |
Non UBC |
Peer Review Status | Unreviewed |
Scholarly Level | Other |
Rights URI | http://creativecommons.org/licenses/by-nc-nd/4.0/ |
AggregatedSourceRepository | DSpace |
Download
- Media
- 59370-SS Algorithms 1.mp4 [ 191.1MB ]
- 59370-SS Algorithms 2.mp4 [ 214.39MB ]
- 59370-SS Algorithms 5.mp4 [ 207.21MB ]
- 59370-SS Algorithms 6.mp4 [ 233.33MB ]
- 59370-SS Algorithms 3.mp4 [ 214.95MB ]
- 59370-SS Algorithms 4.mp4 [ 206.82MB ]
- 59370-quantum_algorithms.pdf [ 1.47MB ]
- Metadata
- JSON: 59370-1.0040932.json
- JSON-LD: 59370-1.0040932-ld.json
- RDF/XML (Pretty): 59370-1.0040932-rdf.xml
- RDF/JSON: 59370-1.0040932-rdf.json
- Turtle: 59370-1.0040932-turtle.txt
- N-Triples: 59370-1.0040932-rdf-ntriples.txt
- Original Record: 59370-1.0040932-source.json
- Full Text
- 59370-1.0040932-fulltext.txt
- Citation
- 59370-1.0040932.ris
Full Text
Cite
Citation Scheme:
Usage Statistics
Share
Embed
Customize your widget with the following options, then copy and paste the code below into the HTML
of your page to embed this item in your website.
<div id="ubcOpenCollectionsWidgetDisplay">
<script id="ubcOpenCollectionsWidget"
src="{[{embed.src}]}"
data-item="{[{embed.item}]}"
data-collection="{[{embed.collection}]}"
data-metadata="{[{embed.showMetadata}]}"
data-width="{[{embed.width}]}"
data-media="{[{embed.selectedMedia}]}"
async >
</script>
</div>
Our image viewer uses the IIIF 2.0 standard.
To load this item in other compatible viewers, use this url:
https://iiif.library.ubc.ca/presentation/dsp.59370.1-0040932/manifest