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 transformation output (probabilistic)
1 U1 0 | i U3 U6 1 U5 1 | i U2 NM 0 0 | i U6 NM 1 U4 1 | i U3 U7 NM 0 1 | i NM
NM 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
n Classical register: B := B B ... B × × × | {zn }
n I Basis state: a binary string x B ∈ n I General state: a probability distribution p = (px : x B ) on n ∈ B (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
2 Quantum bit (qubit): two-dimensional complex Hilbert space C
I Computational basis states (classical states):
1 0 0 := and 1 := | i 0 | i 1
I General states: superpositions
α0 2 2 ψ = = α0 0 + α1 1 , α0 + α1 = 1 | i α1 | i | i | | | |
the coefficients α0, α1 C are called probability amplitudes ∈ Quantum register n 2 ⊗n Quantum register: 2 -dimensional complex Hilbert space (C ) with tensor product structure
2 ⊗n 2 2 2 (C ) := C C C ⊗ ⊗ · · · ⊗ | {zn }
I Computational basis states (classical states):
n x = x1 x2 xn , x B | i | i ⊗ | i ⊗ · · · ⊗ | i ∈ I General state:
X X 2 ψ = αx x , αx = 1 | i | i | | x∈Bn x
Remark: Note that ψ is a column vector (ket) that is | i normalized with respect to the `2-norm (Euclidean norm) Quantum transformations
2 ⊗n Transformations on the quantum register := (C ) are described by unitary matrices U ( ) H ∈ U H
Unitary matrices preserve the `2-norm
Let ψ be the state of the quantum register; the state after the transformation| i ∈ H 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
0 0 (U 0 ) 0 | i ⊗ | i 7→ | i ⊗ | i 2 2 0 1 (U 0 ) 1 action on basis states of C C | i ⊗ | i 7→ | i ⊗ | i ⊗ 1 0 (U 1 ) 0 |1i ⊗ |1i 7→ (U|1i) ⊗ |1i | i ⊗ | i 7→ | i ⊗ | i corresponding matrix u00 0 u01 0 u00 I u01 I 0 u00 0 u01 U I = · · = ⊗ u10 I u11 I u10 0 u11 0 · · 0 u10 0 u11 Single qubit gate on two qubits
single-qubit gate U on second qubit U
0 0 0 U 0 | i ⊗ | i 7→ | i ⊗ | i 2 2 0 1 0 U 1 action on basis states of C C | i ⊗ | i 7→ | i ⊗ | i ⊗ 1 0 1 U 0 |1i ⊗ |1i 7→ |1i ⊗ U|1i | i ⊗ | i 7→ | i ⊗ | i corresponding matrix u00 u01 0 0 1 U 0 U u10 u11 0 0 I U = · · = ⊗ 0 U 1 U 0 0 u00 u01 · · 0 0 u10 u11 Controlled-NOT gate
control: first qubit; target: second qubit •
2 2 action on basis states of C C ⊗ c t c c t | i ⊗ | i 7→ | i ⊗ | ⊕ i
corresponding matrix
1 0 0 0 0 1 0 0 = 0 0 I2 + 1 1 X 0 0 01 | ih | ⊗ | ih | ⊗ 0 0 10
where I2 = 0 0 + 1 1 and X = 0 1 + 1 0 | ih | | ih | | ih | | ih | Controlled U gate
control: qubit; target: m-qubit register • / U
let U be a unitary acting on the m-qubit register
2 2 ⊗m action on basis states of C (C ) ⊗ c m c t c U t where b B, t B | i ⊗ | i 7→ | i ⊗ | i ∈ ∈
corresponding matrix
I 0 = 0 0 I + 1 1 U 0 U | ih | ⊗ | ih | ⊗ Toffoli gate control: first and second qubits; target: third qubit • •
2 2 2 action on basis states of C C C ⊗ ⊗
c1 c2 t c1 c2 (c1 c2) t | i ⊗ | i ⊗ | i 7→ | i ⊗ | i ⊗ | ∧ ⊕ i
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 = (I4 11 11 ) I2 + 11 11 X 0 0 0 0 1 0 0 0 −| ih | ⊗ | ih |⊗ 0 0 0 0 0 1 0 0 0 0 0 0 0 0 01 0 0 0 0 0 0 10 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 x2 x1 x2 ∧ 0 0 0 0 1 0 1 0 0 1 1 1
But it is easy to simulate the AND gate with one Toffoli gate
x1 x1 |x2i • |x2i | i • | i 0 x1 x2 | i | ∧ 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 x1 |x2i • |x2i |x3i • |x3i | i • | i 0 x1 x2 x3 | i | ∧ ∧ i 0 x1 x2 garbage | i • | ∧ i 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 x1 |x2i • • |x2i |x3i • • |x3i | i • | i 0 x1 x2 x3 | i | ∧ ∧ i 0 0 garbage uncomputed | i • | i 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
2 ⊗n 2 2 ⊗w We can implement a unitary Uf on (C ) C (C ) such that ⊗ ⊗