P. 1
Quantum computing notes

Quantum computing notes

|Views: 11|Likes:
Published by jelena_luzija9197
Quantum computing notes and l.
Quantum computing notes and l.

More info:

Categories:Types, Brochures
Published by: jelena_luzija9197 on Aug 02, 2014
Copyright:Traditional Copyright: All rights reserved

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as PDF, TXT or read online from Scribd
See more
See less

03/02/2015

pdf

text

original

Sections

  • 1 Linear Algebra (short review)
  • 2 Postulates of Quantum Mechanics
  • 2.1 Postulate 1: A quantum bit
  • 2.2 Postulate 2: Evolution of quantum systems
  • 2.3 Postulate 3: Measurement
  • 2.4 Postulate 4: Multi-qubit systems
  • 3 Entanglement
  • 4 Teleportation
  • 5 Super-dense Coding
  • 6 Deutsch’s Algorithm
  • 6.1 Deutsch-Jozsa Algorithm
  • 7 Bloch Sphere
  • 7.1 Phase traveling backwards through control operations
  • 7.2 Phaseflips versus bitflips
  • 8 Universal Quantum Gates
  • 8.1 More than two qubit controlled operations
  • 8.2 Other interesting gates
  • 8.3 Swap
  • 9 Shor’s Algorithm
  • 9.1 Factoring and order-finding
  • 9.2 Quantum Fourier Transform (QFT)
  • 9.3 Shor’s Algorithm – the easy way
  • 9.4 Phase estimation
  • 9.5 Shor’s Algorithm – Phase estimation method
  • 9.6 Continuous fraction expansion
  • 9.7 Modular Exponentiation
  • 10 Grover’s Algorithm
  • 11 Error Correction
  • 11.1 Shor’s 3 qubit bit-flip code
  • 11.2 Protecting phase
  • 11.3 7 Qubit Steane code
  • 11.4 Recursive error correction and the threshold theorem

Quantum Computing - Lecture Notes

Mark Oskin £
Department of Computer Science and Engineering
University of Washington

Abstract
The following lecture notes are based on the book Quantum Computation and Quantum Information by Michael A. Nielsen and Isaac L. Chuang. They are for a math-based quantum
computing course that I teach here at the University of Washington to computer science graduate students (with advanced undergraduates admitted upon request). These notes start with a
brief linear algebra review and proceed quickly to cover everything from quantum algorithms
to error correction techniques. The material takes approximately 16 hours of lecture time to
present. As a service to educators, the LATEXand Xfig source to these notes is available online
from my home page: http://www.cs.washington.edu/homes/oskin. In addition, under
the section “course material” from my web page, in the spring quarter/2002 590mo class you
will find a sequence of homework assignments geared to computer scientists. Please feel free to
adapt these notes and assignments to whatever classes your may be teaching. Corrections and
expanded material are welcome; please send them by email to oskin@cs.washington.edu.

£ The

following work is supported in part by NSF CAREER Award ACR-0133188.

1

Contents
1 Linear Algebra (short review)

4

2 Postulates of Quantum Mechanics

5

2.1

Postulate 1: A quantum bit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

5

2.2

Postulate 2: Evolution of quantum systems . . . . . . . . . . . . . . . . . . . . . .

6

2.3

Postulate 3: Measurement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

7

2.4

Postulate 4: Multi-qubit systems . . . . . . . . . . . . . . . . . . . . . . . . . . .

8

3 Entanglement

9

4 Teleportation

11

5 Super-dense Coding

15

6 Deutsch’s Algorithm

16

6.1

Deutsch-Jozsa Algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20

7 Bloch Sphere

22

7.1

Phase traveling backwards through control operations . . . . . . . . . . . . . . . . 27

7.2

Phaseflips versus bitflips . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28

8 Universal Quantum Gates

29

8.1

More than two qubit controlled operations . . . . . . . . . . . . . . . . . . . . . . 31

8.2

Other interesting gates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31

8.3

Swap . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32

2

9 Shor’s Algorithm

33

9.1

Factoring and order-finding . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33

9.2

Quantum Fourier Transform (QFT) . . . . . . . . . . . . . . . . . . . . . . . . . . 34

9.3

Shor’s Algorithm – the easy way . . . . . . . . . . . . . . . . . . . . . . . . . . . 38

9.4

Phase estimation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39

9.5

Shor’s Algorithm – Phase estimation method . . . . . . . . . . . . . . . . . . . . 40

9.6

Continuous fraction expansion . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42

9.7

Modular Exponentiation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42

10 Grover’s Algorithm

43

11 Error Correction

46

11.1 Shor’s 3 qubit bit-flip code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
11.2 Protecting phase . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
11.3 7 Qubit Steane code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
11.4 Recursive error correction and the threshold theorem . . . . . . . . . . . . . . . . 53

3

1 Linear Algebra (short review)
The following linear algebra terms will be used throughout these notes.
Z £ - complex conjugate
if Z a · b ¡ i then Z £

a b¡i

ψ - vector,
“ket”
i.e.
¾
¿
c1
c2
cn
ψ - vector, “bra” i.e.
c£1 c£2
c£n
ϕ ψ - inner product between vectors ϕ and ψ .
Note for QC this is on n space not Ê n !
ψϕ £
Note ϕ ψ
2
3
Example: ϕ
, ψ
6i
4
3
ϕψ
2  6i
6   24i
4
ϕ

ªψ

- tensor product of ϕ and ψ .
Also written as ϕ ψ

Example: ϕ ψ

2
6i

ª

3
4

¾

2¢3
2¢4
6i ¢ 3
6i ¢ 4

A£ - complex conjugate of matrix A.
1
6i
then A£
if A
3i 2 · 4i

1
 6i
 3i 2   4i

AT - transpose of matrix A.
1
6i
then AT
if A
3i 2 · 4i

1
3i
6i 2 · 4i

A† - Hermitian conjugate
  T ¡£ (adjoint) of matrix A.

A
Note A
1
6i
1
 3i
if A
then A†
 6i 2   4i
3i 2 · 4i

4

¿

¾

6
8
18i
24i

¿

ψ

- norm ofÔ
vector ψ
ψ
ψψ
Important for normalization of ψ i.e. ψ

ψ

ϕ A ψ - inner product of ϕ and A ψ .
or inner product of A† ϕ and ψ

2 Postulates of Quantum Mechanics
An important distinction needs to be made between quantum mechanics, quantum physics and
quantum computing. Quantum mechanics is a mathematical language, much like calculus. Just
as classical physics uses calculus to explain nature, quantum physics uses quantum mechanics to
explain nature. Just as classical computers can be thought of in boolean algebra terms, quantum
computers are reasoned about with quantum mechanics. There are four postulates to quantum
mechanics, which will form the basis of quantum computers:

¯
¯
¯
¯

Postulate 1: Definition of a quantum bit, or qubit.
Postulate 2: How qubit(s) transform (evolve).
Postulate 3: The effect of measurement.
Postulate 4: How qubits combine together into systems of qubits.

2.1 Postulate 1: A quantum bit
Postulate 1 (Nielsen and Chuang, page 80):

“Associated to any isolated physical system is a complex vector space with inner product (i.e. a Hilbert space) known as the state space of the system. The system is
completely described by its state vector, which is a unit vector in the system’s state
space.”

Consider a single qubit - a two-dimensional state space. Let φ 0 and φ1 be orthonormal basis
for the space. Then a qubit ψ
a φ0 · b φ1 . In quantum computing we usually label the basis
0 and
with some boolean name but note carefully that this is only a name. For example, φ 0
φ1
1 . Making this more concrete one might imagine that “ 0 ” is being represented by an
up-spin while “ 1 ” by a down-spin. The key is there is an abstraction between the technology
5

ψ¼ Uψ. That is.(spin state or other quantum phenomena) and the logical meaning. The fact that U cannot depend on ψ and only on t 1 and t2 is a subtle and disappointing fact. That is x y ¾ 0 1 . way may write that a classical bit ω is in the state ω x 0 · y 1 . 2. We will see later that if U could depend on ψ then quantum computers could easily solve NP complete problems! Conceptually think of U as something you can apply to a quantum bit but you cannot conditionally apply it. Example: ψ a 0 ·b 1 0 1 1 0 U ψ¼ 0 1 1 0 Uψ a b b a b0 ·a 1 Example: Let ψ U ψ¼ Ô1 2 1 0 ·0 1 1 1 1  1 Uψ Ô1 2 0 1 1 1  1 1 0 Ô1 2 6 1 1 Ô1 0 2 1 ·Ô 2 1 . ψ ψ quantum computing a b ¾ 1 or a 2 · b2 1. page 81): “The evolution of a closed quantum system is described by a unitary transformation.e.2 Postulate 2: Evolution of quantum systems Postulate 2 (Nielsen and Chuang. This same detachment occurs classically where we traditionally call a high positive voltage “1” and a low ground potential “0”. Note that ψ a 0 · b 1 must be a unit vector. The transform occurs without any regard to the current state of ψ . That is. In other words.” I. For This formalism for a quantum bit is a direct extension of one way to describe a classical computer. This normalization condition is not a property of quantum mechanics but rather of probability theory. The only difference is x and y are defined not over the complex numbers but rather from the set 0 1 . The same normalization condition applies x 2 · y 2 1. the state ψ of the system at time t 1 is related to the state of ψ¼ of the system at time t2 by a unitary operator U which depends only on times t 1 and t2 .

3 Postulate 3: Measurement Postulate 3 (Nielsen and Chuang. page 84): “Quantum measurements are described by a collection M m of measurement operators. These are operators acting on the state space of the system being measured.Important: U must be unitary. Example: ψ a 0 ·b 1 p´0µ ψ M0† M0 ψ 7 1 1 . The index m refers to the measurement outcomes that may occur in the experiment. If the state of the quantum system is ψ immediately before the measurement then the probability that result m occurs is given by: †M ψ ψ Mm m p´mµ and the state of the system after measurement is: Õ Mm ψ † ψ Mm Mm ψ The measurement operators satisfy the completeness equation: †M ψ ∑m ψ Mm m I The completeness equation expresses the fact that probabilities sum to one: †M ψ ” 1 ∑m p´mµ ∑m ψ Mm m Some important measurement operators are M0 M0 1 0 10 1 0 0 0 M1 0 1 01 0 0 0 1 Observe that M0† M0 · M1† M1 0 0 and M1 I and are thus complete. that is U †U I Example: U U †U 1 1 Ô1 2 1  1 Ô1 ¡ Ô1 2 1 1 2 Ô1 then U † 1  1 2 1 1 1 1 1  1 1  1 1 2 2 0 0 2 I 2.

At this point though physicists don’t know how derive the measurement postulate from the other three. [sic] e. Tensor product exposes this. hence a£ b£ ψ M0 ψ = a£ b£ a 0 1 0 0 0 a b a2 Hence the probability of measuring 0 is related to its probability amplitude a by way of a 2 . For quantum systems tensor product captures the essence of superposition. Thus it seems strange to have measurement be its own postulate. then the state of the system after this measurement is re-normalized as: M0 ψ a a a 0 As a side note we are forced to wonder if Postulate 3 can be derived from Postulate 2. 8 . then the joint state of the total system is ψ 1 ψ2 ψn . that is if system A is in state A and B in state B then there should be some way to have a little of A and a little of B. It important to note that the state after measurement is related to the outcome of the measurement. but one would expect some way to describe a composite system. suppose systems 1 through n and system i is in state ψi . suppose 0 was measured.” ª ª ª Example: a 0 · b 1 and ψ2 c 0 · d 1 . 2. It seems natural given that measurement in the physical world is just interacting a qubit with other qubits. so we shall just have to be pragmatic and accept it. then: Suppose ψ1 ψ1 ª ψ2 ψ1 ψ2 a¡c 0 0 ·a¡d 0 1 ·b¡c 1 0 ac 00 · ad 01 · bc 10 · bd 11 ·b ¡d 1 1 Why the tensor product? This is not a proof.4 Postulate 4: Multi-qubit systems Postulate 4 (Nielsen and Chuang. Tensor product works for classical systems (except the restricted definition of the probability amplitudes makes it so that the result is a simple concatenation).g. page 94): “The state space of a composite physical system is the tensor product of the state spaces of the component physical systems.Note that M0† M0 p´0µ M0 . For example.

and Rosen. The joint state-space probability vector is the tensor product of these two: ª ψ2 ψ¼1 ψ¼1 ψ2 Ô1 00 2 ·0 01 · Ô1 2 10 ·0 11 Now define a new unitary transform: ¾ CNot 1 0 0 0 0 1 0 0 0 0 0 1 0 0 1 0 ¿ (As an exercise show that CNot is unitary). Entanglement is a property of a multi-qubit state space (multi-qubit system) and can be thought of as a resource. lets consider performing a measurement just prior to applying the CNot gate.3 Entanglement Entanglement is a uniquely quantum phenomenon. for our example. 2 To illustrate why entanglement is so strange. Podolsky. Suppose you begin with a qubit ψ 1 in a zero 0 state. there does not exists any ϕ 1 and ϕ2 such that ϕ1 ª ϕ2 Ô1 ´ 00 · 11 µ. Let U Ô1 H 2 Then let ψ¼1 1 1 1  1 Ô1 0 2 H ψ1 1 ·Ô 2 Ô1 1 ´ 2 0 · 1 µ Now take another qubit ψ2 also in the zero 0 state. That is. but for now lets just apply CNot to our two qubits: ¾ ¼¼ ´ψ¼ ψ2 µ 1 CNot ψ¼1 ψ2 1 0 0 0 0 1 0 0 0 0 0 1 0 0 1 0 ¿ ¾ Ô1 ¿ 2 0 Ô1 2 0 ¾ 1 ¿ Ô 2 0 0 Ô1 Ô1 2 ´ 00 · 11 µ 2 The key to entanglement is the property that the state space cannot be decomposed into component spaces. The two measurement operators (for obtaining a 0 or a 1 ) are: 9 . To explain entanglement we’ll examine the creation and destruction of an EPR pair of qubits named after Einstein.

It remains in a superposition of 0 and 1 . both outcomes are equally likely. Note that M02 . Now lets consider the same measurement but just after the CNot gate is applied. after the CNot gate is applied we have only a 1 2 chance of obtaining 0 . hence the result of measuring the second qubit will clearly be 0 . To see this. Of particular interest to our discussion. lets calculate the probability of obtaining 0 : p´0µ ψ M0†2 M02 ψ Ô1 2 00 Ô1 2 ¾ ψ M02 ψ 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 ¿ ¾ Ô1 ¿ ¾ 1 ¿ Ô 2 0 0 Ô1 2 2 Ô1 2 00 Ô1 2 0 0 0 1 2 Hence. however.¾ M02 Ô1 10 2 1 0 0 0 0 0 0 0 0 0 1 0 ¾ ¿ 0 0 0 0 0 0 0 0 and M12 0 1 0 0 0 0 0 0 0 0 0 1 ¿ Recall that just prior to the CNot the system is in the state ψ ¼1 ψ2 ·0 M0†2 M02 Ô1 00 2 ·0 01 · 11 . Here: ψ ¼¼ ´ψ¼1 ψ2 µ Ô1 2 ´ 00 · 11 µ Now it is not clear whether the second qubit will return a 0 or a 1 . Therefore: p´0µ ψ¼1 ψ2 M0†2 M02 ψ¼1 ψ2 ¾ Ô1 2 Ô1 2 0 1 0 0 0 0 ψ¼1 ψ2 M02 ψ¼1 ψ2 0 0 0 0 0 0 1 0 0 0 0 0 ¿ ¾ Ô1 ¿ ¾ 2 Ô1 2 Ô1 2 0 Ô1 2 0 0 1 Ô1 2 0 Ô1 ¿ 2 0 ¾ Ô1 0 ¿ 2 0 Ô1 2 After measurement: Õ ψ ψ¼1 ψ2 0 Mm ψ † Mm Mm 1 ψ We can see that measurement had no effect on the first qubit. is what happens to the state vector of the system: 10 .

Thus think of an EPR pair as having as much “superposition” as an unentangled set of qubits.¾ After measurement: Õ Mm ψ ψ ¾ 1 ¿ Ô 2 Ô11 2 ¢ 0 0 0 † Mm Mm ¾ 1 0 0 0 ψ Ô11 2 ¢ ¿ 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 ¿ ¾ Ô1 ¿ 2 0 0 Ô1 2 00 This is the remarkable thing about entanglement. one in a superposition between zero and one. without the source (first) and destination (third) qubit ever directly interacting. quantum teleportation is rather mundane. It gets its out-of-this-world name from the fact that the state is “transmitted” by setting up an entangled state-space of three qubits and then removing two qubits from the entanglement (via measurement). albeit migrated through entanglement to another physical qubit. Entanglement links that information across quantum bits. but does not create any more of it. state) ends up in the final third. We mix them about with additional superposition and entanglement and then measure out the superposition we just added. This occurs. The interaction occurs via entanglement. 4 Teleportation Contrary to its sci-fi counterpart. destination qubit. By measuring one qubit we can affect the probability amplitudes of the other qubits in a system! How to think about this process in an abstract way is an open challenge in quantum computing. There we insert an unknown quantum state (carrying a fixed amount of “quantum information”) into a system of qubits. Since the information of the source qubit is preserved by these measurements that “information” (i. The superposition in the EPR pair is simply linked across qubits instead of being isolated in one. Quantum teleportation is a means to replace the state of one qubit with that of another. superposition and measurement is that superposition “is” quantum information. Suppose ψ a0 ·b 1 and given an EPR pair Ô12 ´ 00 11 · 11 µ the state of the entire system is: . One useful. but imprecise way to think about entanglement. and another in a pure state. however. Measurement “destroys” quantum information turning it into classical. The net effect is the unknown quantum state remains in the joint system of qubits. admittedly fuzzy way of thinking about these concepts is useful when we examine teleportation. This. The difficulty is the lack of any classical analog.e.

It is then measured and only classical information is transmitted to the destination. The qubit containing the state to be “teleported” interacts with onehalf of this EPR pair creating a joint state space. as an aside.Generate EPR pair and distribute to each end Destination in state A Fixup result Source in state A (destroyed in process) Transmit classical information Figure 1: Teleportation works by pre-transmitting an EPR pair to the source and destination. lets examine what happens when we apply the H gate to 0 and to 1 . However. Recall that: 1 1 H Ô1 2 1  1 H0 Ô1 2 1 1 1  1 1 0 Ô1 2 1 1 12 . This classical information is used to “fixup” the destination qubit ¾ Ô1 a 0 2 ´ 00 · 11 µ·b 1 ´ · 00 11 µ Ô1 2 a 0 0 a b 0 0 b ¿ Perform the CNot operation and you obtain ¾ Ô1 a 0 2 ´ 00 · 11 µ·b 1 ´ · 10 01 µ Ô1 2 a 0 0 a 0 b b 0 ¿ Next we apply the H gate.

Note that in this diagram single lines represent quantum data while double lines represent classical information. applying H to our system we have: ¾ Ô1 Ô1 a ´ 0 2 2 ϕ · 1 µ´ 00 · µ· 01 ´a 1 11 µ· Ô1 b ´ 0 2   1 µ ´ 10 · 01 a b b a a  b  b a 1 2 µ ¿ We can rewrite this expression as: ¾ a b ¿ b a 1 2 a  b 00 ´a 0 ·b 1 ·b 0 µ· 10 1 0 10 ´a 0   b 1 µ · 11 ´a 1  b 0 µ  b a Which we can shorten to: 1 2 00 1 0 0 1 ψ · 01 0 1 1 0 ψ · 0  1 ψ · 11 i 0 i These gates are the famous “Pauli” (I.H |y> |0> |0> H X Z |y> Figure 2: Quantum circuit depicting teleportation.Z. Ô1 H1 2 1 1 1  1 0 1 Ô1 2 1  1 Thus.X.Y) operators and this is also written as: 13  i 0 ψ .

The same is true for the other outcomes. either applying nothing. hence the probability of mea- . This fixup is fairly straightforward. These two classical bits tell us what transform was applied to the third qubit. Z or both X and Z. Lets work through an example: ¾ M10 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 P´10µ † ϕ M10 M10 ϕ ¾ M10 ϕ 1 2 0 0 0 0 0 0 0 0 0 0 0 0 a  b 0 0 0 0 0 0 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 0 0 0 0 0 0 0 0 0 ¿ † ϕ M10 ϕ . Thereby we can “fixup” the third qubit by knowing the classical outcome of the measurement of the first two qubits. X . 14 ¿ 1 4 a ¡ a£ · b ¡ b£ 1. since here M10 M10 .1 2 00 I ψ · 01 X ψ · 10 Z ψ · 11 iY ψ And of interest to us with teleportation: ϕ 1 2 00 I ψ · 01 X ψ · 10 Z ψ · 11 X Z ψ This implies that we can measure the first and second qubit and obtain two classical bits. Thus: ¿ ¾ Therefor: ϕ M10 ϕ 1 2 abbaa  b  b a 1 2 0 0 0 0 a  b 0 0 Recall that by definition of a qubit we know that a ¡ a £ · b ¡ b£ suring 01 is 1 4.

To send two bits of classical information one half of this EPR pair (a single qubit) is manipulated and sent to the other side.5 Super-dense Coding Super dense coding is the less popular sibling of teleportation.e. do nothing) 01: apply Z 10: apply X 11: apply iY (i. Pre−communicated EPR pair b0b1 Interpret Transmit Figure 3: Super-dense coding works by first pre-communicating an EPR pair.e. Ô1 ψ 2 ´ · 00 µ 11 To send information apply particular quantum gates: ¯ ¯ ¯ ¯ 00: apply I (i. both X and Z) ¾ ¯ 00: 1 0 0 1 Ô1 2 ´ 00 · 11 µ   Ô1 2 ´ 00 · 11 µ Ô1 2 1 0 0 1 ¾ ¯ 01: 1 0 0  1 Ô1 2 ´ 00 · 11   µ Ô1 2 ´ 00   11 µ Ô1 2 ¾ ¯ 10: 0 1 1 0 Ô1 2 ´ 00 · 11 µ   Ô1 2 ´ 10 · 15 01 µ Ô1 2 0 1 1 0 ¿ 1 0 0  1 ¿ ¿ . It can actually be viewed as the process in reverse. The process starts out with an EPR pair that is shared between the receiver and sender (the sender has one half and the receiver has the other). The idea is to send two classical bits of information by only sending one quantum bit. The two qubits (the one pre-communicated and the one sent) are then interacted and the resulting two bits of classical information is obtained.

bit 0 H bit 1 Figure 4: To obtain the two bits of classical information a bell-basis measurement is performed. It calculates a solution to a problem faster than any classical computer 16 . subtle. 6 Deutsch’s Algorithm Deutsch’s algorithm is a perfect illustration of all that is miraculous. They key to super-dense coding is that they are orthonormal from eachother and are hence distinguishable by a quantum measurement. and disappointing about quantum computers.¾ ¯  i 0 i 11: i Ô1 0 2 ´ 00 · 11 µ   Ô1 2 ´ 01   10 µ Ô1 2 0 1  1 0 ¿ These states are known as bell basis states. Examining this process in more detail: ψ00 Ô1 Ô1 ´ 0 0 · 1 1 µ 2 apply CNot gives us: Ô1 ´ 0 0 · 1 0 µ 2 apply H gives us: Ô1 Ô1 ´´ 0 · 1 µ 0 · ´ 0 2 ´ 00 · 1 2´ ψ01 2 ´ 00 2 00 · 10 2 · 00   10 µ Ô1 00 2 00 · 10 2 · 10   00 µ ´ 10 · 01 µ 2 01  0µ0µ 10 Ô1 ´ 1 0 · 0 1 µ 2 apply CNot gives us: Ô1 ´ 1 1 · 0 1 µ 2 apply H gives us: Ô1 Ô1 ´´ 0   1 µ 1 · ´ 0 2  1µ0µ   11 µ 1 2´   µ Ô1 ´ 0 0   1 1 µ 2 apply CNot gives us: Ô12 ´ 0 0   1 0 µ apply H gives us: Ô1 Ô1 ´´ 0 · 1 µ 0 · ´ 1 Ô1 1 2´ ψ01 11   11 2 · 01 · 11 µ · 1 µ 1 µ 01 Leave the last one for homework.

and y. let x equal ´ 0 · 1 µ 2 and y equal 0. However. x is input as ´ 0 · 1 µ 2 and y as 0 . The input is written as 1 ª0 10. as 0 and apply the U f transform. acts as a result register. Suppose we wish to calculate f ´1µ. We begin by illustrating how superposition of quantum state creates quantum parallelism or the ability to compute on many states simultaneously. y. then we could input x as 0 . The output is transformed by U f to be 0 0 ¨ f ´0µ . To answer this question classically.ever can. unfortunately. our output register. and y. The input is written as 0 ª0 00. Quantum mechanically though we will illustrate how this can be solved in just one query. Suppose we wish to calculate f ´0µ. Deutsch’s algorithm answers the following question: suppose f ´xµ is either constant or balanced. as 0 and apply the U f transform. our output register. and interference. The output is transformed by U f to be 1 0 ¨ f ´1µ . which one is it? If f ´xµ were constant then for all x the result is either 0 or 1. hence two queries are required. phase-kick back. we clearly need to query for both x 0 and x 1.Ô then the remarkable aspect of quantum computing is the output is equal to ´ 0 f ´0µ · 1 f ´1µ µ 2. The second qubit. if f ´xµ were balanced then for one half of the inputs f ´xµ is 0 and for the other half it is 1 (which x’s correspond to 0 or 1 is completely arbitrary). The input ψ1 0 0Ô ·10 2 17 . Let U f be the unitary transform that implements this. x x Uf y y f(x) Ô Figure 5: Suppose U f implements f . use two qubits x y and transform them into x y ¨ f ´xµ (where ¨ represents addition modular two). “un-changed”. then we could input x as 1 . Finally. We use two qubits since we wish to leave the input x or the query register. This is illustrated in Figure 5. Given a function f ´xµ : 0 1 0 1 using a quantum computer. But this is not a classical computer – we can actually queryÔthe results of 0 and 1 simultaneously using quantum parallelism. It illustrates the subtle interaction of superposition. is solves a completely pointless problem. For this.

Let ψ2 be the state of the system after applying U f and ψ3 be the state of the system prior to measurement. whereby the structure of the solution space is promised to be of some form and by carefully using superposition.0 f ´0µ Ô · 1 f ´1µ 2 The output ψ2   Remarkable: U f is applied to 0 and 1 simultaneously! This is known as quantum parallelism. and how we go about extracting the answer. |0> H x x H Uf |1> H y y f(x) Figure 6: Deutsch’s Algorithm uses quantum parallelism and interference to extract information about a global property of the solution space. The reason these problems obtain exponential improvement over all known classical algorithms is that classically one has to calculate every point in the solution space in order to obtain full knowledge about this structure.   Problem: sounds good. entanglement and interference we can extract information about that structure. Usually we work with problems that are phrased of the form “what x gives a value of f ´xµ with the desired property?” Thus far. These are often called promise problems. Hence we need to be clever about what type of question we ask. we will return to it shortly. The solution is to use another quantum mechanical property: interference. Unfortunately this is often not how most algorithms are phrased. but measurement produces either 0 f ´0µ or 1 f ´1µ . Apply the H gate to the query and result registers to obtain: ψ1 Ô1 2 ´ 0 · 1 µ Ô12 ´ 0  1µ Now. Key: Deutsch’s algorithm. Input: ψ0 01 It may seem strange to start out with a result register of 1 instead of 0. as all known quantum algorithms that provide exponential speedup over classical systems do. Quantum mechanically we calculate every point using quantum parallelism. but ignore this for now. lets examine y ¨ f ´xµ: 18 . answers a question about a global property of a solution space. Let ψ0 be the initial state vector and ψ1 be the state of the system prior to applying U f . quantum computers can only provide square-root improvement to such query-based problems.

that is f ´0µ 1 2 ´ 0 ´ µ   1 µ  1 ´ µ ´ f ´1µ. then: ´ 0  1µ f 0 0 ´ 0   1 µ · ´ 1µ ¢ ´ 1µ f 0 0 ´ 0   1 µ  1 ´ µ  1µ f 0 ´ µ 1 2´ 0 ´ 0 1 ´  1µ 0 1 2 ´ ¦ 12 0  1µ Suppose instead that f is balanced. U f transforms x Ô12 ´ 0 ´  1µ f x ´ µ   1 µ into:  1µ x Ô12 ´ 0 Or we can say that: U f Ô1 2 ´ 1 µ Ô1 · 0 2 ´  1µ 0  1µ f 0 Suppose f is constant.Suppose f ´xµ 0 then y ¨ f ´xµ y¨0 Ô1 ´ 0¨0   1¨0 µ Ô1 ´ Suppose f ´xµ 1 then y ¨ f ´xµ y¨1 Ô1 ´ 0¨1   1¨1 µ Ô1 ´ · ´ 0  1µ 2 2 2 2 0  1µ  0 We can compactly describe this behavior in the following formula: y ¨ f ´xµ  1µ f x Ô12 ´ 0   1 µ ´ µ ´ Thus. that is f ´0µ  1µ f 0 ´ µ 1 2 ´ 0  1µ f 0 ´ µ 1 2´ ¦ 12 0 ´ 0 ¦ Ô12 ´ 0 · ´ µ 1 2 ´ 0   1 µ · ´ 1µ f 1 0 ´ 0 ´ µ   1 µ· 1 1 µ Ô1 2 ´ 0 ´ 0 ´ 0 1 ´ 0  1µ  1µ f 0 ´ µ  1µ  1µ   1 µ · ´ 1µ f 1 ´ µ f ´1µ. then: ´   1 µ· 1   1 µ · ´ 1µ f 1 0 ´ 0 ´ 0  1µ  1µ ¦ Ô12 ´ 0   1 µ Ô12 ´ 0   1 µ Now run the x qubit through an H gate to get ψ 3 19 1 ´ 0  1µ 1 1 µ .

The goal is determine which Suppose f ´xµ : 2n one it is. since it is the key to Shor’s algorithm..ψ3 ¦ Ô12 0 ¦ Ô12 1 ´ 0 ´0  1µ  1µ Since in our case f ´0µ ¨ f ´1µ ψ3 ¦ f ´0µ ¨ f ´1µ if if f ´0µ f ´0µ 0 ¸ f ´0µ f ´1µ f ´1µ f ´1µ we can write this as 0Ô ·1 2 Hence it is possible to measure x to find f ´0µ ¨ f ´1µ. The Deutsch-Jozsa algorithm answers this question with just one query! |00. or 2n 2 · 1 queries.. Another more subtle point is that the phase of the result qubit transfers to the query qubit. the phase of the query qubit is altered by the phase of the result (or target) qubit! We will explore this property in more detail later. This is a special case of phase kick back. the query qubit acts as a control of whether or not to flip the result qubit.0> H n x x H n Uf |1> H y y f(x) Figure 7: The Deutsch-Jozsa algorithm is simply a multi-qubit generalization of Deutsch’s algorithm The starting state of the system ψ0 is fairly straightforward ψ0 0 ªn 1 The symbolic notation 0 ªn simply means n consecutive 0 qubits. 6. In effect. While the result qubit is potentially flipped by the state of the query qubit. 20 . 0 1 and that f is either constant or balanced. Key: Note that f ´0µ ¨ f ´1µ is a global property of f ´xµ. Using a quantum computer we are able to evaluate both answers simultaneously and then interfere these answers to combine them together.. Classically it would require two evaluations of f ´xµ to find this answer.1 Deutsch-Jozsa Algorithm The Deutsch-Jozsa algorithm is a generalization of Deutsch’s algorithm. Classically it is trivial to see that this would require (in worst case) querying just over half the solution space.

This symbol means to apply the H gate to each of the n qubits (in parallel. For example. Each component of this state vector is transformed into a superposition of components j . “10”. but what it is saying is that given any arbitrary state vector. lets examine a single qubit: a0 ·b 1 Apply H ª1 to get: 0¡0 ´ 1µ a Ô2 0 ·a ´  Ô1µ0¡1 1 2 ·b  Ô1µ1¡0 0 2 ´ ·b  Ô1µ1¡1 1 2 ´ Ô1 ´a · bµ 0 2 · Ô1 ´a   bµ 1 2 When we look at the actual transform as we have been writing it in the past we find: Ô1 2 1 1 1 a b  1 aÔ ·b 2 · 0 aÔ  b 2 1 Returning back to ψ0 we transform it by: ψ1 H ªn 0 ªn H 1 1 ∑ n Ô2n x 0 x¾ 0 1 Ô  1 2 The notation 0 1 n means all possible bit strings of size n. it will be composed of components i . this would be We then apply the transform U f that implements f ´xµ to obtain the state ψ 2 : ψ2  Ô1µ f x ∑ 2n ´ µ ´ x¾ 0 1 x 0 Ô  1 2 n Finally we apply another H ªn transform to obtain ψ3 : ψ3 ∑ z¾ 0 1 nx ¾ ∑ 01  1µx¡z · f ´xµ ´ n 2n z 0 Ô  1 2 The key to the Deutsch-Jozsa algorithm is the rather subtle point: Observe the probability ampli- 21 . The key is only that the H gate is applied once to each qubit). “01”. For example. if n “00”. although this does not matter. and “11”. One way to define this transform is: i¡ j ´ 1µ ∑ j Ô2n j H ªn i This notation is rather terse.We then apply the H ªn transform. 2.

if f ´xµ is constant the probability amplitude for z 0 ªn is expressed as: 1 n n 2 ∑ x¾ 0 1 ¦1 Hence when you measure the query register you will obtain a zero. This is where the balanced requirement comes into play. lets consider if f ´xµ is balanced. Further f ´xµ was constant). we need to refresh our complex math a little. On the other hand. then we must measure a zero. and the function is perfectly balanced. Hence. Since all x’s are considered. the probability of obtaining z 0 ªn is expressed as:  1 ·1 ∑ 2n · ∑ 2n x1 0 x2 Where x1 is the set of x’s such that f ´xµ is equal to 0 and x 2 are those x’s where f ´xµ is equal to 1. Then ´ 1µx¡z· f ´xµ will be ·1 for some x and  1 for other x’s. Hence you will not measure 0 when f ´xµ is balanced since the probability amplitudes perfectly destructively interfere to produce a probability of zero for that quantity. Since postulate one tells that the probabilities must sum to 1. we know that ´ 1µx¡z· f ´xµ is either  1 or ·1 for all values of x (since z is equal to zero x ¡ z must be equal to zero.tude of z 0 ªn . Consider when f ´xµ is constant. Before discussing it. Since z 0 ªn . What will be measured if the function is balanced? Anything except 0. A complex number Z x · y ¡ i can be expressed in polar form: x rcos ´θµ y rsin ´θµ Z r ´cos ´θµ · isin ´θµµ Z£ Suppose ψ Claim: a reiθ re iθ a0 ·b 1 and a 2 · b 2 eiγ cos θ2 and b 1 ei´γ·ϕµ sin θ2 22 . if f ´xµ is constant. 7 Bloch Sphere The block sphere is a useful visualization tool for single quantum bits.

Clearly eiγ cos θ2 is a fully general way of expressing all values of a that can still be normalized to 1. therefore: ei´γ·ϕµ sin θ2 ¡ e i´γ·ϕµ sin θ2 sin2 θ2 Hence. under any measurement.9 from the book for rigorous mathematical proofs. I refer you to Examples 4. b 2 b2 eiγ cos θ2 ¡ e iγ cos θ2 1   cos2 θ2 cos2 θ2 sin2 θ2 .8 and 4. then the probability of measuring M is: ψ e iγ M † Meiγ ψ ψ M†M ψ Hence. It is not observable. another way to express an arbitrary single qubit is: ψ eiγ cos θ2 0 ψ eiγ cos θ2 0 Claim: eiγ ψ θ · ei´γ·ϕµ sin 2 ¢ · eiϕ sin θ2 1 1 £ ψ under measurement. the global phase of a quantum bit does not matter. Therefore it is sufficient to write a quantum bit as: ψ cos θ2 0 θ · eiϕ sin 2 1 |0> z y x |1> Figure 8: The Bloch sphere is a useful visualization technique for single qubits and unitary transform on them. Lets examine a 2 : a2 Hence. Let M be the measurement operator. but here note: 23 .

Y . Any unitary transform becomes a rotation on this sphere: U e iγ Rnˆ ´θµ. lets build up to the R y rotation. Lets assume that:   sin θ2 cos θ2 sin θ2 Ry ´θµ cos θ2 Recall the relations: sin ´A · Bµ cos ´A · Bµ sin ´Aµcos ´Bµ · cos ´Aµsin ´Bµ cos ´Aµcos ´Bµ   sin ´Aµsin ´Bµ Assume a qubit in the state: cos   sin θ2 cos θ2 sin θ2  ϕ¡ 2 0  ϕ¡ · sin 2 1 . then rotating this by R y ´θµ is: cos ϕ2 sin ϕ2 cos θ2 cos ´θ 2µcos ´ϕ 2µ   sin ´θ 2µsin ´ϕ 2µ sin ´θ 2µcos ´ϕ 2µ · cos ´θ 2µsin ´ϕ 2µ cos θ ·ϕ 2 0 · sin θ ·ϕ 2 1 Which is what we would expect.Any single qubit state is a point on the surface of the Bloch sphere. and Z axis are related to the Pauli operators: 0 1 1 0 X  i 0 i Y 1 0 Z 0 0  1 Before discussing this precisely. More usefully this can be broken down into: eiγ Rz ´βµ Ry ´ϕµ Rz ´δµ U Rotations about the X . Decomposing R y ´θµ further: cos This e iθY 2   sin θ2 cos θ2 sin θ2 Ry ´θµ cos θ2 0 0 cos θ2 cos θ2  θ¡  θ¡ 2 2 I   i ¡ sin Y e iθY · 0 sin θ2   sin θ2 0 2 notation relates the Pauli operators back to rotations on the Bloch sphere: Rx ´θµ e iθX cos θ2 0 0 cos θ2 2 cos θ2 I   i ¡ sin θ2 X θ   i ¡ sin 0θ i ¡ sin 02 2 cos θ2  i ¡ sin θ2 24  i ¡ sin θ2 cos θ2 . This is a rotation across some arbitrary angle nˆ and a global phase shift.

e iθY Ry ´θµ θ   i ¡ i ¡ sin 0θ  i ¡ i ¡ sin 02 2 cos θ2 0 0 cos θ2 e iθZ Rz ´θµ cos θ2 I   i ¡ sin θ2 Y 2 cos θ2 cos θ2 I   i ¡ sin θ2 Z 2 cos θ2 0 0 cos θ2   sin θ2 cos θ2 sin θ2 e iθ θ   i ¡ sin 02  i ¡ sin 0θ 2 2 0 ·iθ 0 e 2 Claim: Any single qubit unitary transform can be decomposed into the following: U e iα Rz ´βµ Ry ´γµ Rz ´δµ Consider an arbitrary transform: a b c d U Since U is unitary: U †U a£ c£ b£ d £ I or a b c d 1 0 0 1 Which implies: a£ a · c£ c b£ b · d £ d a£ b · c£ d b£ a · d £ c 1 1 0 0 ¼ e ia then a£ Assuming an arbitrary form for a ¼ 1   eia cos c£ c  γ¡ 2 ¼ e ia cos  γ¡ ¼ eia cos  γ¡ 2 and c£ c 2 1   cos2 2γ Which implies that c ¼ e ic sin  γ¡ 2 . We can then rewrite our unitary equations: cos2 2γ · sin2 2γ 1 b£ b · d £ d¡ 1   ¡ ¼ ¼ eia cos 2γ ¡ b · eic sin 2γ ¡ d 0   ¡   ¡ ¼ ¼ b£ ¡ e ia cos 2γ · d £ ¡ e ic sin 2γ 0 25 .

but a clever one (for our purposes) is: a b c d  δ   β µ 2   α ´δ   β µ 2   α ´ δ · βµ 2   α ´δ · βµ 2   α ´ This makes:  e iα eiδ 2e iβ 2 sin ´γ e iα e iδ 2 e iβ 2 cos ´γ 2µ e iα e iδ 2 eiβ 2 sin ´γ 2µ U e iα e iα e iα e iδ 2 e iβ 2 cos ´γ 2µ e iδ 2 eiβ 2 sin ´γ 2µ e iβ e β 2 0 0 eiβ 2 2 eiδ 2 eiβ 2 cos ´γ cos ´γ 2µ sin ´γ 2µ 0 0  eiδ 2 e iβ 2 sin ´γ 2µ 2µ  eiδ 2 sin ´γ e iδ 2 cos ´γ 2µ e iδ 2 sin ´γ 2µ eβ 2 2µ e iα eiδ 2 eiβ 2 cos ´γ 2µ eiδ 2 cos ´γ e δ  sin ´γ 2µ cos ´γ 2µ 2µ 2µ 2 0 0 eδ 2 e iα Rz ´βµ Ry ´γµ Rz ´δµ Claim: H Rz Rz  π¡ 2  π¡ 2 Rx  π¡ e iπ 2 Rz  π¡ 2 4 0 0 eiπ 4 eiπ 4 e iπ 4 0 0 eiπ 4 26 1 0 iπ 0 e 2 1 0 0 i 2 (it is . but it is equivalent). which gives us:  γ¡ cos2 2γ · sin2 2γ 1 sin2 2γ · cos2 2γ 1   ¡   ¡   ¡   ¡  eia¼¼ cos  2γ¡ ¡ e ib¼¼ sin   2γ ¡ · eic¼¼sin 2γ ¡ e ¼id¼ cos  ¡2γ 0  eib sin 2γ ¡ e ia cos 2γ · eid cos 2γ ¡ e ic sin 2γ 0 Focusing on the last two equations we have: ¼   ¡ ¼   ¡ ¼ ei´a  b µ cos 2γ sin 2γ   ¡   ¡ ¼ ¼ ei´b  a µ cos 2γ sin 2γ Or quite simply: a¼   b¼   c¼   ¡ ¼   ¡ ei´c  d µ cos 2γ sin 2γ   ¡   ¡ ¼ ¼ ei´d  c µ cos 2γ sin 2γ  d ¼ There are many solutions with three free variables.  ¡ ¼ ¼ From the last two equations it should be clear that b  e  ib sin 2γ and d e id cos possible to invert where the negative sign is placed.

that is the notion that with controlled operations the target qubit is amplitude flipped on the basis of the control qubit. This is a key component of the Deutsch-Jozsa algorithm and as we will see shortly Shor’s algorithm as well. but the control qubit is phase flipped by the target.Rx Rz  π¡  π¡ 2  isin ´π cos ´π 4µ 4µ 4µ cos ´π 4µ  isin ´π 2 Rx  π¡ 2 Rz  π¡ 1 0 0 i Ô1 2 Ô1 2 2 1 1  i i 1 0 0 i Ô1 2 2 1 1  i  i 1  i  i 1 Ô1 1 1 0 0 i 1 1  1 Note: is there a similar visualization for two or n qubits? 7. Consider two qubits: ¢ cos θ 0 · eiφ sin θ cos θ 0 cos σ 0 1 £ cos σ 0 · eiλ sin σ 1 · eiλ sin σ 1 · eiφ sin θ 1 cos σ 0 · eiλ sin σ · eiλ sin σ 1 · eiφ sin θ 1 eiλ sin σ 0 1 Perform a CNot operation: cos θ 0 cos σ 0 · cos σ 1 Now return this back to “normal form”: cos θ 0 cos σ 0 · eiλ sin σ 1 · ei´φ·λµ sin θ 1 sin σ 0 · e iλ cos σ 1 Recall that: sin θ cos θ  cos    θ ·¡π2 ¡ sin θ · π2 Thus we can write: cos θ 0 cos σ 0 · eiλ sin σ 1 · ei´φ·λµ sin θ 1 27  cos   ¡ σ · π2 0 · e iλ sin   ¡ σ · π2 1 .1 Phase traveling backwards through control operations Using our new canonical description of a qubit we can illustrate a fundamental aspect of quantum computing.

a Z rotation surrounded by H gates is an X rotation Claim: HZH XÔ ·Z 2 X Z XÔ·Z 2 28 . has now become part of the phase of the control. The phase of the target. 7.  cos θ 0 cos σ 0 · eiλ sin σ 1   ei φ cos θ 0 cos σ 0 · eiλ sin σ 1 · ei´φ·λ·πµ sin θ ´ ·λµ ¡ sin θ 1 cos σ · π2 0   ¡   e iλsin 1 cos σ · π2 0   ¡ σ · π2 1 · ei´π λµ sin   ¡ σ · π2 1 Observe the phase shift that occurs on the first (control qubit).2 Phaseflips versus bitflips Observe that: 1 1 Ô1 H 2 1  1 Ô1 2 H 0 1 1 0 X 1 0 · H 0  1 XÔ·Z 2 Z Figure 9: An X rotation surrounded by H gates is a Z rotation Claim: HX H XÔ ·Z 2 Z X XÔ·Z 2 XÔ·Z 2 X 2Ô ·XZ 2 XÔ·Z 2 I· ÔXZ 2 XI ·XXZ ·ZI ·ZXZ 2 X ·Z ·Z · X 2 2Z 2 Z Conversely: H Z H X Figure 10: Conversely. λ.

X and T . This universal set is the quantum analog of the universal gate (NOR or NAND) for classical systems. X . imagine a circle. While an arbitrary single qubit gate will do this with arbitrary precision. then in theory anyway we can synthesize the arbitrary gate. One can view this approximation as dividing up the surface of the Bloch sphere into patches. A universal set of operations are: H. By being irrational we are assured that k1 ¡ 2π ∆ k2 ¡ 2π ∆ for all choices of k1  k2 . For multiple qubit gates I refer you to pages 189-191 in your book. So long as we can approximate it to arbitrary precision from only a basic set of gates. The key is the irrationality of the amount (lets name it ∆). The T gate is sometimes referred to as the π 8 gate. Performing this operation again. Assuming we are somewhere on the circumference of this circle. if we move ∆ amount in one direction we will never get back to where we started by continuing to move ∆ increments in the same direction (the only way to get back is to move  ∆). To understand the significance of this. for computation purposes we can approximate the single qubit gate. Fortunately there is a method to synthesize any arbitrary quantum gate from only a small minimal set. T . and CNot. The intuition behind approximating an arbitrary rotation is we are going to form a rotation of an irrational amount about some axis. Eventually these unique points cover within ε distance the entire 29 . In this section we will show how any single qubit gate can be implemented from H. we will be at yet another unique point. Assuming we are at some point on this circle and we move ∆ distance around the circumference then we will move be at some other unique point. It is a rotation about the Z axis by π 4: T π 8 1 0 iπ 0 e 4 eiπ 8 e iπ 8 0 0 eiπ 8 Rz ´π 4µ The essential idea with synthesizing single qubit gates is that any single qubit gate is going to take a qubit which is a point on the Bloch sphere from one position to another. circles each of which is ε small in size.XÔ·Z 2 ZXÔ·Z 2 2 XÔ·Z 2 ZX Ô·I 2 XZX ·XI ·ZZX ·ZI 2  Z ·XI ·IX ·Z 2 2X 2 X 8 Universal Quantum Gates Quantum technologies will not be able to directly implement any quantum gate.

except we are rotating some amount θ 2 cos 2 cos 8 . the only thing left is the ability to move along an orthogonal vector m.circumference. using our decomposition idea we can approximate any rotation to arbitrary precision: U Rnˆ ´β ¡ θµ Rmˆ ´γ ¡ θµ Rnˆ ´δ ¡ θµ 30 . So the big question is how do we move an irrational amount? Lets examine T HT H e i 8 Z e i 8 X π T HT H π Note this is using the relation HZH ¢ X . ˆ This is accomplished using something similar to HZH X . HRnˆ ´θµ H ¢ cos HT HT HH  π¡ 8 I   i ¡ sin  π¡ £¢ 8 e i 8 X e i 8 Z π HT HT Z cos  π¡ 8 I   i ¡ sin π  π¡ £   ¡ 8 Z Which we note is the same except for the sin2 π8 X Z. instead of ZX . hence: ¢ cos2 cos2  π¡ I   i ¡ sin2 8  π¡ 8 I   i ¡ sin  π¡ £ Y  i cos  π¡ 8  π¡¢ 8 cos 8 sin  π¡  π¡  π¡ 8 8 8 IX · sin cos IZ £   ¡ £ π 8 ´X · Z µ · sin 8 Y We  are¡ now back   π ¡ to our “canonical form” for a rotation. The angle at which this rotation occurs is along the vector:   nˆ cos π8 sin π8 cos π8 ¡ This irrational rotation of amount θ along the vector nˆ we will denote as R nˆ ´θµ. This covering holds for the surface of the Bloch sphere as well as a circle. The key is θ is irrational. This is equal to: cos  π¡ cos2  π¡  π¡  π¡  π¡ 8 8 8 8 I   i ¡ sin 8 ¢ cos2 Recall that iY  π¡ £¢ I   i ¡ cos sin  π¡  π¡ 8 8 I   sin2  π¡ Z cos 8 ZX £ 8 I   i ¡ sin IX   i ¡ sin  i ¢  π¡ £ X 8 cos  π¡  π¡ 8 8 IZ · i2 sin2 cos  π¡  π¡  π¡  π¡ 8 8 8 8 ¢  π¡ sin IX · sin cos ZX IZ £ ZX . hence Hence. a new orthogonal rotation Rmˆ along the vector: mˆ   cos π8   sin π8 cos π8  iY instead of iY . Simply rotate along HR nˆ ´θµ H. ¡ Hence. We are close to finishing.

8. Suppose two qubits: ψ1 ψ2 a0 c0 ψ ψ1 ac 00 ·b ·d 1 1 ª ψ2 · ad 01 · bc 10 · bd 11 Now apply the two H gates: 1 2 ac ´ 0 · ·bc ´ 0   1 1 µ´ 0 µ´ 0 · · 1 1 µ · ad ´ µ 0 · bd ´ 0 ·   1 1 31 µ´ 0 µ´ 0  1µ  1µ .1 More than two qubit controlled operations Setup undo−Setup X |0> X |0> X |0> X X |0> X Figure 11: Generalizations of the Toffoli gate are constructed by simply composing a “super control” and then de-composing it.8.2 Other interesting gates Claim: The control and target of a CNot gate can be swapped when surrounding the input and output with H gates. H H H H Figure 12: The control and target of a CNOT gate can be swapped when the inputs are surrounded by H gates.

A Swap gate is three back to back CNot gates as shown in Figure 13.ac 00 · 01 · 10 · 11 · ad 00   01 · 10   11 ·bc 00 · 01   10   11 bd 00   01   10 · 11 1 2 Apply the CNot gate: 1 2 ac ·bc 00 00 · 01 01 · ·   11 11 ·   10 · ad 00   01 · 11   10 10 bd 00   01   11 · 10 ac 00 · 01 · 10 · 11 · ad 00   01   10 · 11 ·bc 00 · 01   10   11 bd 00   01 · 10   11 1 2 ac ´ 0 · 1 µ ´ 0 · 1 µ · ad ´ 0   1 µ ´ 0   1 ·bc ´ 0   1 µ ´ 0 · 1 µ · bd ´ 0 · 1 µ ´ 0   1 µ 1 2 µ Apply the H gates: ac 00 · ad ac 00 11 · bd · bc 01 · bd 10 · bc 10 01 · ad 11 Which is as if the control and target qubits where swapped! 8. Suppose two qubits: a b ª ac 00 c d · ad 01 · bc 10 · bd 11 Apply the first CNot: ac 00 · ad 01 · bd 10 · bc 11 32 .3 Swap |y1> |y2> |y2> |y1> Figure 13: A swap gate exchanges the state of two qubits.

In this section we are going to begin by constructing a set of tools needed to actually implement Shor’s algorithm. Then we put these tools together to actually factor. being able to factor in polynomial time on a quantum computer has attracted significant interest.1 Factoring and order-finding For positive x. the order of x modulo N is the least positive integer r such that Why do we care about this problem: Suppose N xr 10 r : 0 1 2 3 4 5 6 7 8 9 10 11 12 13 N : 1 10 23 76 67 54 1 10 23 76 67 54 1 10 Suppose N xr 77 and x 15 and x 2 r: 0 1 2 3 4 5 6 7 8 9 N: 1 2 4 8 1 2 4 8 1 2 33 .   factor ¡ It does this in roughly O n3 quantum operations. N such that x xr ´modN µ 1 N. 9. Since the difficulty of factoring is believed to be exponentially hard it forms the basis of most modern crypto systems.Apply the second CNot: ac 00 · bc 01 · bd 10 · ad 11 · ad 10 · bd 11 Apply the third CNot: ac 00 · bc ca 00 c d 01 · cb ª 01 · da 10 · db 11 a b 9 Shor’s Algorithm Shor’s algorithm is used to numbers into their components (which can potentially be prime). Our first tool is how factoring is related to another problem: order finding. while the best known classical algorithms are exponential. Hence.

Suppose N xr 15 and x 4 r: 0 1 2 3 4 5 6 7 8 9 N: 1 4 1 4 1 4 1 4 1 4 Suppose N 15 and x 11 r: 0 1 2 3 4 5 6 7 8 9 xr N : 1 11 1 11 1 11 1 11 1 11 Observe that the period of repetition is one less than a factor of N! Shor’s algorithm can be summarized in this way: ¯ ¯ ¯ ¯ Choose some random x (actually x co-prime of N) Use quantum parallelism to compute x r for all r simultaneously. It transforms a state space of size 2n from the amplitude to the frequency domain (just as the Fourier transform can be viewed as a transform from 2n numbers into a range of size 2n containing the frequency components from the domain... The classical Fourier Transform is defined as: yk Ô1 n 2 2n  1 ∑ x j e2πi jk 2 n j 0 34 . Use this period to find the factor of N |0> 2t 2t j !QFT H s/r yx^j mod N |000.1> t y yx^j mod N Figure 14: Overview of Shor’s algorithm 9. the period) of the solutions..2 Quantum Fourier Transform (QFT) The Quantum Fourier Transform (QFT) implements the analog of the classical Fourier Transform. Interfere all of the xr ’s to obtain knowledge about a global property of the structure (i.e.

e.: 0 8 16 24 is transformed to: 0 4 8 12 16 20 24 28 So how do we implement the QFT? This derivation is in the book at pages 216-219.The QFT is similarly defined: j   Ô1 n 2 2n  1 ∑ e2πi jk 2 n k k 0 Thus an arbitrary quantum state is transformed: 2n  1 2n  1 ∑ x j j   ∑ yk k j 0 Ô1 n 2 k 0 2n  1 2n  1 ∑ ∑ x j e2πi jk 2 n k k 0 j 0 Example: 00000 · 01000 · 10000 · 11000 is transformed to: 00000 · 00100 · 01000 · 011000 · 10000 · 10100 · 11000 · 11100 i. but we will expand many of the steps and deviate from it slightly for clarity: The transform is defined as: j   Ô1 n 2 2n  1 ∑ x j e2πi jk 2 n k k 0 Note that j is a binary number and can be decomposed into the form: j j1 2n 1 · j2 2n 2 · n · j n 20 ∑ ji2n i i 1 Similarly for k n k ∑ ki2n i i 1 35 .

) Note: 2πi j2 k e 2πi2 k ∑ jl 2n l l 1 e n 1 k j e2πi2 n 1 ¢ e2πi2     j ¢ n 2 k 2  k j1 2n 1 e2πi2 ¢ e2πi2  j 2   ¢ n n k j e2πi2 k n 36 2 n 2  k j2 20 e2πi2  n ∑ e2πi jkn2 k .Re-express the transform as n Ô1 n 2 2n  1 2πi j ∑e ∑ kl 2n l 2n l 1 k k 0 Canceling the 2n terms we have: n Ô1 n 2 2n  1 2πi j ∑e ∑ kl 2 l l 1 k k 0 Now decompose the exponent: Ô1 n 2 2n  1  1  2  n ∑ e2πi jk12 ¢ e2πi jk2 2 ¢ ¢ e2πi jkn 2 k k 0 Similarly. pull out the n’th component: Ô1 n 2 1 1 1 ∑ ∑ ∑  1 e2πi jk1 2 kn 1 0 k1 0 k2 0 ¢ e2πi jk 2  ¢ ¢ e2πi jk 2  2 2 n n k1 k2 kn 1 1 kn 0 Similarly for all components and we have: Ô1 n 0 2  1 · e2πi jk1 2 1 0  2 · e2πi jk2 2 1 0  n · e2πi jkn 2 1 Next. lets define a new notation: 0 jl jl ·1 jm jl ·1 jl jm 2 · 22 · 2m l ·1 (Suspend your skepticism on why we need this notation for a short while. decompose the summation: Ô1 n 2 1 1 1  1  2  n ∑ e2πi jk1 2 ¢ e2πi jk2 2 ¢ ¢ e2πi jkn 2 k1k2 ∑ ∑ k1 0 k2 0 kn kn 0 Now.

n i k Suppose that ji 0 then e2πi2 ji Suppose that ji 1 and 2n i k 1 then the exponent is a multiple of 2πi. We want to achieve:   0 · e2πi0 j1 j2 jn Start with j1 j2 1 ¡ jn 37 . lets look at any one of the qubits and how it should be transformed: Ô1   2 0 · e2π0 jl jn 1 ¡ Pull off the first component: Ô1 0 2 · e2πi0 jl ¢ e2π0 j   l 1 jn 2 1 Looking at the first component only: Ô1 2   0 · e2πi0 jl 1 ¡ Ô1 2 0 · e2πi jl 2 1 Ô1 2 0  1µ j ·´ l 1 This is just an H gate! What about e2π0 jl  1 Rk jn 2 ? Use a rotation: 1 0 k 2πi 2 0 e Note we apply this rotation conditionally on whether or not j i is equal to 1.. n   i   k 0 For k 1  1 · e2πi j2 1 0 · e2πi0 jn  2 · e2πi j2 1 0 · e2πi0 jn 1 jn 0 then lets look at k 1 1 2: 0 1 and similarly for the rest. Hence. We do this by focusing on the least significant digit first. can rewrite the transform as:   Ô1 n 0 2 · e2πi0 jn ¡  1 · e2πi0 jn 1 jn 0 1 ¡   · e2πi0 j1 j2 jn 0 1 ¡ which matches what is in your book again. i.e. hence equal to 1 Suppose that ji 1 and 2n i k 1. To see how to actually implement this.

Apply H to obtain: Ô1   2 0 · e2πi0 j1 1 ¡ j2 jn Apply a controlled R2 rotation to obtain: Ô1   2 0 · e2πi0 j1 j2 1 ¡ j2 jn Apply controlled R3 : Ô1   2 0 · e2πi0 j1 j2 j3 1 ¡ j2 jn And so on to obtain: Ô1 2   0 · e2πi0 j1 j2 jn 1 ¡ j2 jn This is done similarly for the other bits j 2 then j3 . here is the straightforward description of Shor’s algorithm: 38 .3 Shor’s Algorithm – the easy way A less rigorous. a deeper understanding of Shor’s algorithm comes from Phase estimation. but more intuitive way to think of Shor’s algorithm is that you simply compute the function yx j modN for all j. etc. However. and that’s it. Note the outputs are reversed in their bit-significance. which is the number we are looking for. simply fourier transform the solution space and measure the period. and one that makes y disappear is to choose the number 1. In some respects. One wonders what value of y should be chosen. For now. but simply swap them and you have the QFT! H R2 R3 Rn H R2 R n−1 H Figure 15: The above circuit implements the Quantum Fourier Transform (QFT). which we’ll get to next. The result ends up with the bits in reverse order. Then. this is exactly how Shor’s algorithm works and we give that derivation here. 9. but an easy value.

U ). Then apply inverse QFT to n qubits and obtain ϕ˜ . Suppose u is an eigenvector of U with eigenvalue e2πiϕ This means: ¢ 2πiϕ e I  U e2πiϕ I u £ 0 from ´λI   Aµ x u 0 Uu Or more generally e2πi2 ϕ I u t t U2 u The idea with phase estimation is to apply the controlled U 2 operation with Ô12 ´ 0 · 1 µ as the 01 n . for k In summary: k 39 . an estimate of ϕ.ψ1 0 ªt 00 ψ2 Ô1 t ∑ j 00 2 1 1 j Ô1 t ∑ j x j modN 2 ψ3 j ψ4 Ô Ô rt ψ5 r 1 Ô1r ∑ s r xk modN 2 j xk modN k ¾ 0 r   1 ∑ j¾ k k·r k·r2 s 0 s¼ r xk modN ψ6 9. control.4 Phase estimation 2t |0> |j> !QFT H |u> U j |u> Figure 16: Phase estimation estimates the phase of a particularly formed eigenvalue of the eignvector to a matrix (in the case depicted.

5 Shor’s Algorithm – Phase estimation method ¯ ¯ ¯ ¯ xy´modN µ Use phase estimation on U where U y find us Estimate phase s r Use continued fraction expansion to find r xy´modN µ claim that us . the eigenvectors of U are: Given U y r 1 Ô1r ∑ e 2πi rs k xk modN us k 0 s Suppose e2πi r for 0 r   1 are eigenvalues. then: s s e2πi r us U us s e2πi r Ô1r r 1 ∑ e 2πi r k xk modN s k 0 r 1 Ô1r ∑ e 2πi sr ´k 1µ xk modN k 0 r 1 Ô1r ∑ e 2πi sr k xk·1 modN k 0 40 .Start with: 0 ªt u Apply H ªt to get: Ô1 t ∑ j u 2 j k Apply controlled-U 2 operation for each of the k qubits of j Ô1 t ∑ e2πi jϕu j u 2 j Apply inverse QFT: ϕ˜ u 9.

we can for a superposition of them! r 1 Ô1r ∑ us s 0 r 1 r 1 Ô1r Ô1r ∑ ∑ e 2πi rs k xk modN s 0k 0 Look carefully at k 1 r 0 r 1 ∑ e0 x0 modN r r 00 1 00 1 s 0 So. but note. Shor’s algorithm starts out with the state: r 1 r 1 0 ªt Ô1r Ô1r ∑ ∑ e 2πi r k xk modN s 0 ªt 00 s 0k 0 The H ªt transform is applied: r 1 r 1 Ô1 t ∑ j Ô1r Ô1r ∑ ∑ e 2πi sr k xk modN 2 j s 0k 0 Modular exponentiation is applied: r 1 r 1 Ô1 t ∑ j Ô1r Ô1r ∑ ∑ e 2πi sr j·´ 2πi rs kµ xk modN 2 j s 0k 0 41 1 .r 1 Ô1r ∑ e 2πi sr k xk modN k 0 r 1 Ô1r ∑ e 2πi rs kU xk modN U us k 0 r 1 s Ô1r ∑ e 2πi r k xk·1 modN k 0 r 1 Ô1r ∑ e 2πi sr k xk modN k 0 So how to prepare us for Shor’s algorithm? We can’t for a single eigenvalue.

Measure the second register to obtain some k r 1 s Ô1 t ∑ j Ô1r ∑ e 2πi r ´ j·kµ xk modN 2 j s 0 2 r 1 e 2πi r ´ j·kµ r∑ Ô1 t ∑ Ô1 j s j xk modN s 0 Inverse QFT to obtain: r 1 Ô1r ∑ s r xk modN s 0 Measure first register to obtain a particular s r. 9.7 Modular Exponentiation z y   z xz ymodN Note that: Z xZ zt 2t  1 · zt  1 2t  2 · t  1 xzt 2 · z 1 20 ¢ xz   2   ¢ ¢ xZ t 1 t 2 0 xz1 2 42 3· 1 1· 1 2 1· 8 2 7 .6 Continuous fraction expansion (See page 230 from the book) a0 a1 am a0 · a 1· 1 1 a2 · 1 Examples: 13 64 18 64 1 64 13 1 64 18 1 4· 12 13 1 1 4· 13 4· 1 1 3· 10 18 1 1 3· 18 3· 12 10 1 1 5 1 3· 1 1· 12 1 1 8 1· 10 1 1 1 1· 10 8 9. and then use continued fraction expansion to find r.

t  1 x2 zt zt  1 t  2 ¢ x2 ¢ ¢ 0 x2 z0 i Can compute x2 classically. The tricky bit is mod. i. almost. 10 Grover’s Algorithm sqrt{2^n} times n |0> H n G |1> G G H Figure 17: Grover’s algorithm n H n H x x n H |0> to |0> n |x> to −|x> f(x) y (y + f(x)) mod 2 Figure 18: A Grover iteration X X X X X X X X X H H X Figure 19: A Grover operator taking 0   0 and x     x for x 0. but that distributes. compute: t  1 x2 zt modN t  2 ¢ x2 zt  1 modN ¢ ¢ 0 x2 modN z0 modN Note that this is only t conditional modular multiplications. Note.e.: ´iN · αµ k iN ¡ k · α ¡ k modN modN αk modN Thus. which isn’t observable. but that is the same up to a global phase of  1. hence this is really a sequence of conditional multiplies. Note that zi is binary. 43 . this actually does the reverse.

Examine the first iteration of Grover’s algorithm: Apply H gates: 0 ªn 1   Ô1 n ∑ j 2 ´ 0  1 µ Ô1 2 j Apply oracle:   Ô1 n ∑ ´ 1µ f ´ jµ j 2 ´ 0 2 j  m ´ ∑ j  2 m ´ ∑ Ô1 n 2 j 0 2  1 µ Ô1 2 j m Ô1 n  1 µ Ô1 0  1 µ Ô1 2 j Apply H ªn 0 ªn   Ô1 n Ô1 n 2∑ ´ 1µm¡ j j   2 2 ´ 0  1 µ Ô1 2 j   ¡ 1   22n 0 ªn   22n ∑ ´ 1µm¡ j j ´  1 µ 0 Ô1 2 j 0   Apply Grover operator transforming 0   0 and x   ¡ 1   22n 0 ªn · 22n ∑ ´ 1µm¡ j j ´ 0 0 ªn · 22n ∑ ´ 1µm¡ j j j ´  1 µ Ô1 2 j 0 2n  4 2n    x 0  1 µ Ô1 2 Apply H ªn 2n  4 2n ∑ j j 2 · 2n m ´ 0  1 µ Ô1 2 So observe that the “other” part has a slightly lower probability. 44 . and the correct answer (m) has a slightly more likely chance of being measured. Lets generalize this for an arbitrary iteration.

for each iteration the probability of obtaining a random answer “W” changes from: Wi Wi 1   2 Ri 1 ·2Wi 1 2n and the probability of obtaining the correct answer changes from: Ri Ri 1 · 2Wi 1 (these probability amplitudes are all over Ô 2n Note that the sequence W1 W2 Wn is non-increasing and the seqeuence R1 R2 Rn is Rn   non-decreasing. Suppose that Wi 1 Ri   Ri 1 1 2 after 2 ¢ Wi 1 Ô 2n iterations. Then: 2¢1 2 1 45 .ÔW n ∑ j 2 · j ÔR n m 2 Apply oracle:   ÔW n ∑ ´ 1µ f ´ jµ j 2   ÔR2 n j ÔW n ∑ j 2 j   RÔ22W · m m n Apply H ªn     RÔ22W Ô12 ∑ ´ 1µ j¡m · W 0 n j n j Apply Grover operator:   W  1 W  2 ¢ R·2W £ 2n ¢ R·2W £ 2n 0 0 ·2W Ô1 · RÔ 2n 2n ·2W Ô1 · RÔ 2n 2n ∑ ´ 1µ j¡m j j 0 ∑ ´ 1µ j¡m j j Apply H ªn   W  2 ¢ R·2W £ 1 Ô 2n 2n ∑ j · R·22W n m j Thus. We can use this fact to prove the correctness of Grover’s algorithm. This (and the above equation) implies that the sequence R 1 R2   R1 Rn 1 is non-increasing.

but that is acceptable since if we fail we will just measure random data. Then a single quantum bit de-coheres (randomizes) at the same rate as a classical bit: e  λt . which we can check and then re-run the algorithm anew). WÔ2n 2n . That is: e λt ¢ e λt ¢ ¢ e λt e λt ¡n As an example of how faulty quantum systems are.Ô Hence. So for λ 10  6 . Furthermore. it is above a critical threshold – more on this later. Shor’s algorithm is roughly t 65n 3 complexity. this is far to aggressive for current demonstration systems (which are more like 10 3 ). but is around what we expect future quantum systems to be. when factoring n qubits. Suppose ε 0 05 is the probability of failure that we want (this says that with 5% chance we will fail. hence we must measure the correct answer. This implies that: 1 ε Let p´nµ e λt ¡n t ¡ n (p´nµ is the space-time complexity of an algorithm) 1 ε e λ¡ p´nµ An appropriate value of λ is 10 6 . Discounting the inverse QFT. except for quantum systems they tend to be so error prone that λ is quite large. 11 Error Correction Let’s suppose there was no theory of error correction for quantum computers. This means that probability of obtaining the wrong answer Ô nis less than 1 4. which means with 75% chance we will measure the correct answer m after 2 iterations. which is a direct contradiction to Ô Wi 1 1 2 ! Therefore after 2n iterations Wi 1 1 2. how many bits can we factor with Shor’s algorithm? 1 ε e λ¡ p´nµ log´1   εµ 65n3 n  λp´nµ p´nµ  log´1   εµ λ 46 . Given a system if n qubits the probability that there is no error in the entire system is the probability of no-error on each qubit multiplied together. lets compute the largest number of bits we can factor using Shor’s algorithm without error correction.

we create codes whereby we can gain knowledge about the error.e. Fortunately. Error correction overview: ¯ ¯ ¯ ¯ Errors are caused by decoherence (entanglement with the environment).1 Shor’s 3 qubit bit-flip code Shor’s code for protecting against bit-flip errors is the most basic of quantum codes and is a direct translation of TMR. but not the state. I view this as information loss. That is. 47 . 11. given a qubit: ψ a0 ·b 1 encode it to be: ψc a 000 ·b 111 To see how to correct errors on this code.  ¢  log´1   0 05µ 10 6 n ¡ 65 £ 14 342 1 4 4 qubits! Clearly. 0 000 and 1 111. Create codes that allow for the measurement of error. this is not good. Based on the ideas of classical codes (well almost). without the measurement of the value. Classical codes such as TMR. lets write it as: ψc a z 1 z2 z3 · b z¯1 z¯2 z¯3 |0> z1 xor z2 |0> z2 xor z3 |z1> |z2> |z3> Figure 20: Measurement of errors in the 3 qubit bit flip code.. and thereby we “leak” the knowledge about the errors out of the system. Just repeat the classical bit and then take a majority vote. i. We “fight” this entanglement with more entanglement. there are methods to apply essentially classical error correction techniques to quantum systems.

Here is how to do this in the quantum world: Start with a code word: ψc a z 1 z2 z3 · b z¯1 z¯2 z¯3 48 . chiefly in this case. does tell us where the error is and how to correct it. lets arrive at this result using the restriction that we cannot gain knowledge about the logical state of the code. lets return to the classical TMR codes again. That is. To gain this knowledge (and this knowledge only!). Clearly majority voting would lead us to conclude that the code should really be 000.Error correction is based around the idea of using an ancilla set of qubit(s) that are entangled with the code word. Thus we won’t be able to know whether it is 010 or 101. To see how to do this. However. We devise a measurement that gives us partial knowledge. This is the key concept behind quantum error correction (one of two). The ancilla is carefully entangled in such a way that it’s state is entangled with the error on the qubits (if there is any) and not the state. lets arrive not at the knowledge that the code should be 000. measure the following: s1 z1 ¨ z2 (that is s1 s2 z2 ¨ z3 z1 xor z2 ) Lets examine the outcome possibilities: code-word s1 000 0 0 001 1 010 011 1 1 100 101 1 0 110 0 111 s2 0 1 1 0 0 1 1 0 Focus in on the 010 and 101 code words: code-word s1 010 1 101 1 s2 1 1 There in lies the key: s1 and s2 do not tell us whether the code word should be 000 or 111. Suppose we have a classical code 010. but they do tell us that the 2nd bit has been flipped. We can use it to know whether to apply a NOT gate to the 2nd’s qubit. the xor. This knowledge. but that only there is a bit-flip error on the 2nd qubit. while incomplete.

then: 0 and z¯1 ¨ z¯2 z2 (thus.   a z 1 z2 z3 z1 ¨ z2 Suppose that z1 z1 ¨ z2 Suppose that z1 z1 ¨ z2 · b z¯1 z¯2 z¯3 z2 (thus z¯1 z¯1 ¨ z¯2 z¯2 ). but it does gain knowledge about the parity of z 1 and z2 .   a z 1 z2 z3 z1 · b z¯1 z¯2 z¯3 z¯1 Apply a 2nd CNot with the code-word bit 2 as the control and the ancilla the target. quantum bits can be in a continuous range between 0 and 1. so are the errors! The true power of quantum error correction is that it transform continuous errors to either no error at all. or a discrete error. then: 1 and z¯1 ¨ z¯2 1 Hence. Furthermore. This is expressed as:   a 0 0 Rx´θµ 0 ·b 1 1 Rx´θµ 1 Recall that: Rx ´θµ cos θ2  i ¡ sin θ2  i ¡ sin θ2 cos θ2 Thus. 49 . Unlike classical bits.And use an ancilla qubit: a z 1 z2 z3 · b z¯1 z¯2 z¯3 0 a z 1 z2 z3 0 · b z¯1z¯2 z¯3 0 Apply a CNot with the code-word bit 1 as the control and the ancilla the target. z¯1 0 z¯2 ). Here’s an example of how: Suppose ψc a 000 · b 111 and some random rotation about the x-axis R x ´θµ occurs on the third qubit. the ancilla qubit above does not gain knowledge on whether z 1 or z2 is equal to 1 or 0. Doing the same for bits z2 and z3 we have: z1 ¨ z2 0 0 1 1 z2 ¨ z3 0 1 0 1 error ? None qubit 3 has flipped qubit 1 has flipped qubit 2 has flipped This is understating the power of quantum error correction.

11. First add the ancilla qubit: ¢ a 0 0 cos θ2 0 0   i sin θ2 1 0 £ ·b 1 1 ¢  i sin θ2 0 0 θ · cos 2 1 0 £ Apply the first CNot:   ¢ a 0 0 cos θ2 0 0   i sin θ2 1 0   i sin θ2 1 1 £ ·b 1 1 ·b 1 1 ¢  i sin θ2 0 1 · cos θ2 1 1 1 · cos θ2 1 0 £ Apply the 2nd CNot:   ¢ a 0 0 cos θ2 0 0 £ ¢  i sin θ2 0 £ Measure the ancilla qubit. and in this case has made the error go away! Why did it go away? Think of it this way. just think of the error as additional “information” in the state vector and measurement has observed (and made classical) that information. What is the probability of measuring 0? p´0µ a2 cos2 θ2 · b2 cos2 θ2 £ ¢ 2 a · b2 cos2 θ2 cos2 θ2 Similarly for 1: p´1µ a2 sin2 θ2 · b2 sin2 θ2 ¢ 2 £ a · b2 sin2 θ2 sin2 θ2 It doesn’t matter which one we pick. Alternatively. More generally.2 Protecting phase Quantum bits have a phase as well as an amplitude.¢ a 0 0 cos θ2 0   i sin θ2 1 £ ·b 1 1 ¢  i sin θ2 0 θ · cos 2 1 £ Now parity check the 2nd and 3rd qubits. the error was some superposition / entanglement with the environment. Thus a phase error is just a bit-flip error if the code is setup to protect for bit flips but then the qubits of the code are passed through H gates prior 50 . but lets choose 0. but in a joint system of the two qubits is subtle. and measurement has clasped that entanglement and superposition. after measurement the qubits are renormalized to become: a cos θ2 000 0 θ Õ ·b cos 2 111 0 cos2 θ2 a 000 ·b 111 0 Key: The very fact of measuring a continuous error has made it discrete. The fact that that information was not in a single qubit. However. a phase rotation surrounded by two H gates is an amplitude rotation. This too must be protected. recall that the phase flip Z surrounded by two H gates is a bit flip X.

and pass those qubits through H gates. The tool we use is concatenation. The solution is to transform a basic set of quantum operations that would ordinarily be applied to physical qubits such that they can be applied to logical qubits in a fault tolerant manner. This is exactly like the classical use of concatenation. We first perform error correction on the lowest layer to obtain “111-000-111”. This protects the lower layer for amplitude. we need an additional tool. and then re-encode it. then the computation is lost. However. Doing this for the Shor code is not easy. Starting with the 3 bit Shor bit flip code we can derive the 3 bit Shor phase flip code in this way. This protects the upper layer for phase. 11. We then re-encode each of those qubits again with a bit flip code. What we can do is take each bit of the “1-1-1” and re-encode that with TMR to obtain: “111-111-111”. The reason is the physical qubit is susceptible to errors. This is not the most efficient classical code. The encoder is shown in Figure 21 |y> H |0> H |0> H Figure 21: Encoder that takes an arbitrary state ψ and encodes it in the 3 qubit Shor phase-flip protecting code However we need to correct for both phase and amplitude to be fully fault tolerant. Next we perform error correction on the upper layer (in logical space) to obtain “111-111-111”. Logical 51 X and Z operations can be performed simply .3 7 Qubit Steane code Now that we have the 9 qubit Shor code we can protect quantum state. To protect for both phase and amplitude on a qubit we first encode it with a bit-flip code. suppose the error rate is so high that it is possible for two bits to be in error. For example. It can also be translated directly into quantum codes. and if an error does occur to it. shown in Figure 22) protects for a single phase or a single amplitude error on any of the 9 qubits and logically holds one 1 quantum bit. Then suppose we have the value “111001-111”. transform it. and we TMR encode this to be “111”. This can protect for one of the bits being in error. Figure 23 illustrates how to measure the error in a phase. the entire code (known as the Shor 9 qubit code.to use. For this. All told. in this unencoded state. To compute in a fault tolerant manner we cannot decode the code word (which we’ll call the logical qubit) into a single qubit (which we’ll call a physical qubit). But we also want compute on it. but it is easy to reason and work with. suppose we have the classical bit “1”.

but one of the easiest to transform codes is the 7 qubit Steane code. Thus we say that ψ is stabilized by X1 X2 and Z1 Z2 (here X1 means the X gate applied to the first qubit).|y> H |0> |0> |0> H |0> |0> |0> H |0> |0> Figure 22: Encoder that takes an arbitrary state ψ and encodes it in the 9 qubit Shor code. A vast amount of quantum coding research is out there. the 3 qubit bit-flip Shor code is stabilized by Z 1 Z2 and Z2 Z3 . Here is the idea with stabilizer codes. Note that X1 X2 is only a stabilizer for this particular ψ . The 3 qubit phase-flip code is stabilized by X1X2 and X2 X3 . Thus. What is nifty about the stabilizer formalism is that they indicate precisely how to measure the error. Suppose: ψ 00 · Ô1 11 2 Then X1 X2 ψ ψ and Z1 Z2 ψ ψ . but logical H. The stabilizers for the 7 qubit Steane code are: 52 . (challenge: what are the logical implementations of these?). and does not generalize to arbitrary a 00 · b 11 . Stabilizer codes and their associated stabilizers is a neat compact theory useful for describing quantum codes. To introduce the 7 qubit Steane code we’ll take a brief detour into stabilizer codes. CNOT. To measure the error in a logical quantum bit one measures the stabilizers. and T cannot.

To implement this. g1 g2 g3 g4 g5 g6 I1 I1 X1 I1 I1 Z1 I2 X2 I2 I2 Z2 I2 I3 X3 X3 I3 Z3 Z3 X4 I4 I4 Z4 I4 I4 X5 I5 X5 Z5 I5 Z5 X6 X6 I6 Z6 Z6 I6 X7 X7 X7 Z7 Z7 Z7 The Steane code is particularly nice because once we measure these stabilizers if any stabilizer g1 g2 g3 is non-zero then a phase error has occurred on the physical qubit that is part of the logical qubit at position g 1 22 · g2 21 · g3 20   1 and if any stabilizer g4 g5 g6 is non-zero then a bit-flip error has occurred on the physical qubit g4 22 · g5 21 · g6 20   1. The important part about the 7 qubit Steane code is that the H. 11. which is to perform a controlled X (i. CNOT) operation. Assume the following: 53 . bit-wise across the qubits of the code. See pages 485-491 of the book for details on how to implement T. T cannot. This figure is from John Preskill at Caltech and is not in your book. That is. To measure the phase error we just directly implement the formalism. Z. To formalize this thinking we thought of this as a controlled Z operation with the ancilla as the control. we surrounded both the ancilla and the code bits with H gates and inverted the direction of the CNOT gate. This was so that an phase error on the ancilla did not pollute the qubits in the code word. and CNOT gates can be applied in logical form transversally.e.Think about bit−flip error measure this way |0> Implement it like this |0> Formalize it like this: H H H H |0> H H Z Thus for phase−flip measurement just: |0> H H X Figure 23: Recall that to measure the amplitude error we performed two CNOT operations on an ancilla qubit initially in the 0 state. Unfortunately.4 Recursive error correction and the threshold theorem How fault tolerant is the Steane code? For this lets perform a calculation. however. Figure 24 depicts how to (non-fault tolerantly) encode a physical qubit into the Steane code. X.

In general.bit 7 |0> H |0> H |0> H |0> |0> |0> bit 1 |y> Figure 24: Non-fault tolerant encoder for the 7 Qubit Steane code. It is about 21.942 for a straightforward implementation of stabilizer measurement for the 7 qubit Steane code. This figure is from John Preskill at Caltech. Fault tolerant operation transforms: 1 ε eλp´nµ 1 ε ¢ into: 1   cp2 1 ε ε p´nµ £ p´nµ 1   cp2 ¡ p´nµ cp2 Assuming we want a 95% chance of obtaining the correct answer and the same error rate as before (λ 10 6 ) we have that: 0 05 65n3 n n  6 2 21 942 1   e 10 35 057 1 4 54 . Failure occurs when two or more errors show up in a code word. ¯ ¯ ¯ On average. no fixup is required (the likely case) after each logical operation and error correction step. the number of places that can both fail to produce two errors in a code word). The constant c is the number of double-points of failure in the logical operation and error correction step (i.e. error correction takes an error rate of p 1   e λ to cp2 .

Note that this repetition would seem to imply an exponential blowup in resources – and it does. n 13 qubits Clearly we have to do better. and the measurement must be repeated at least two times. The idea is to take a qubit and encode it in the 7 qubit Steane code. however. then arbitrarily long quantum computation cannot be sustained. The concept is straightforward: we have to be able to correct fast enough such that any decoherence that occurs while we are correcting can be corrected away. Thus the overhead is polynomial to perform computation. Repeat this procedure until we have a sufficiently strong error correcting code. we are going to concatenate the 7 qubit Steane code with itself. just being polynomial doesn’t make the overhead insignificant. This is the result of the threshold theorem which underpins fault tolerant computation. Similar to the concatenation we used to combine the bit and phase flip codes we can concatenate a quantum code with another quantum code. the unit of complexity of the error correction step. Key: Concatenating codes recursively works so long as the underlying decoherence rate p 1   e λ is less than 1 c. Then take each physical qubit that is part of that single logical qubit and re-encode it again in the 7 qubit Steane code. If error correction takes so long that it would do more harm than good. but it also creates an exponentially strong error correcting code. and for this we turn to recursive error correction. Applying error correction recursively we obtain the following equation: 55 . To make this circuit fault tolerant. the ancilla must be a checked CAT state. As we will see. For our example.|0> b7 b6 b5 b4 H H g1 X |0> H H X X H H H X H X H H X H b3 b2 H b1 H g6 H H X H H X H Figure 25: Almost fault-tolerant measurement of the stabilizers g 1 and g6 .

there is a down side. c 21 942. the whole process must be repeated at least twice for each stabilizer since the measurement must be p2 reliable. k 1 is the number of recursive levels of error correction. this is where the exponential improvement in tolerance to errors comes from. ε 65n3 n 25 21 942 n 0 05. At 1Mhz operation 1 logical gate takes 23 hours to do (serially). Worse still 1 logical gate requires about 153 5 83 841 135 993 physical gates. This CAT state must be checked to make sure it is reliable. Now we can factor large numbers. Furthermore. Lets examine what happens when we apply 5 layers of error correction: k 5. a CAT state must be used in order to prevent errors in one qubit of the code word from polluting other qubits via the ancilla qubit. However. so at k 5. First. factoring a 1024 bit number takes 200 million years! 56 . Note the 2k in the equation. p  6 21 942 1 e 10  6 1   e 10 . The overhead for each qubit is 75 16 807 physical qubits. p´nµ 0 05 65n3 n 3 7 ¢ 1013 qubits. 2k ´c p˙µ c ε p´nµ Here.Basic measurement is not fault tolerant: Measurement needs to be p^2 accurate and this is only p |0> H H Phase errors can travel up to control and polute bits Solution is to use a checked CAT state: Create CAT Check the CAT for errors use it H |0> un−create CAT H |0> |0> |0> |0> =0? |0> =0? check check Discard if check != 0 Do this at least 2X for each stabilizer This will increase the measurement reliability from p to p^2 Figure 26: Making measurement of stabilizers fault-tolerant is an arduous task.

p hours! 10 8 . g6 2 qubit gate Syndrome measurement H X Z H X Z H X Z H X Z H X Z H X Z H X Z Recover Figure 27: Fault tolerant computation proceeds by performing the coded operation. clustering. simply apply them transversally. Z. g3. g5. This requires only 8000 years serially. still need quantum architecture. optmized error correction. k 2. 1 Ghz operation (electron state).577 ops/logical op. g5. and 3. g6 Syndrome measurement Logical Recover g1. Note this is not the case for T. g3. and CNOT operations are easily applied in code-space. The solution: parallelism and quantum architecture. g3. ¯ ¯ ¯ Really only need k 3 for 1024 bits. g6 Logical gate Syndrome measurement Recover g1. g4. and then possibly recovering from an error. the X. Hence. 51 years 10 9 . g2. g4. p k 2. measuring the stabilizers (syndrome measurement). g4. 31 57 . H. so only 343 qubits of overhead. For the Steane code. g5. g2. g2.g1.581.

You're Reading a Free Preview

Download
scribd
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->