This action might not be possible to undo. Are you sure you want to continue?
by Riley T. Perry
Version 1.2  December 17, 2010
Contents
Acknowledgements vii
1 Introduction 1
1.1 What is Quantum Computing? . . . . . . . . . . . . . . . . . . . . 1
1.2 Why Another Quantum Computing Tutorial? . . . . . . . . . . . . 2
1.2.1 The Bible of Quantum Computing . . . . . . . . . . . . . . 2
2 Computer Science 3
2.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
2.2 History . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
2.3 Turing Machines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
2.3.1 Binary Numbers and Formal Languages . . . . . . . . . . 6
2.3.2 Turing Machines in Action . . . . . . . . . . . . . . . . . . 10
2.3.3 The Universal Turing Machine . . . . . . . . . . . . . . . . 11
2.3.4 The Halting Problem . . . . . . . . . . . . . . . . . . . . . . 11
2.4 Circuits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
2.4.1 Common Gates . . . . . . . . . . . . . . . . . . . . . . . . . 15
2.4.2 Combinations of Gates . . . . . . . . . . . . . . . . . . . . . 17
2.4.3 Relevant Properties . . . . . . . . . . . . . . . . . . . . . . . 18
2.4.4 Universality . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
2.5 Computational Resources and Efﬁciency . . . . . . . . . . . . . . . 19
2.5.1 Quantifying Computational Resources . . . . . . . . . . . 20
2.5.2 Standard Complexity Classes . . . . . . . . . . . . . . . . . 22
2.5.3 The Strong ChurchTuring Thesis . . . . . . . . . . . . . . . 24
2.5.4 Quantum Turing Machines . . . . . . . . . . . . . . . . . . 26
2.6 Energy and Computation . . . . . . . . . . . . . . . . . . . . . . . 26
2.6.1 Reversibility . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
2.6.2 Irreversibility . . . . . . . . . . . . . . . . . . . . . . . . . . 26
i
ii CONTENTS
2.6.3 Landauer’s Principle . . . . . . . . . . . . . . . . . . . . . . 27
2.6.4 Maxwell’s Demon . . . . . . . . . . . . . . . . . . . . . . . 27
2.6.5 Reversible Computation . . . . . . . . . . . . . . . . . . . . 28
2.6.6 Reversible Gates . . . . . . . . . . . . . . . . . . . . . . . . 29
2.6.7 Reversible Circuits . . . . . . . . . . . . . . . . . . . . . . . 32
3 Mathematics for Quantum Computing 33
3.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
3.2 Polynomials . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
3.3 Logical Symbols . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
3.4 Trigonometry Review . . . . . . . . . . . . . . . . . . . . . . . . . . 35
3.4.1 Right Angled Triangles . . . . . . . . . . . . . . . . . . . . 35
3.4.2 Converting Between Degrees and Radians . . . . . . . . . 36
3.4.3 Inverses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
3.4.4 Angles in Other Quadrants . . . . . . . . . . . . . . . . . . 36
3.4.5 Visualisations and Identities . . . . . . . . . . . . . . . . . . 37
3.5 Logs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
3.6 Complex Numbers . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
3.6.1 Polar Coordinates and Complex Conjugates . . . . . . . . 40
3.6.2 Rationalising and Dividing . . . . . . . . . . . . . . . . . . 43
3.6.3 Exponential Form . . . . . . . . . . . . . . . . . . . . . . . . 44
3.7 Matrices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
3.7.1 Matrix Operations . . . . . . . . . . . . . . . . . . . . . . . 46
3.8 Vectors and Vector Spaces . . . . . . . . . . . . . . . . . . . . . . . 50
3.8.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
3.8.2 Column Notation . . . . . . . . . . . . . . . . . . . . . . . . 53
3.8.3 The Zero Vector . . . . . . . . . . . . . . . . . . . . . . . . . 54
3.8.4 Properties of Vectors in C
n
. . . . . . . . . . . . . . . . . . . 54
3.8.5 The Dual Vector . . . . . . . . . . . . . . . . . . . . . . . . . 55
3.8.6 Linear Combinations . . . . . . . . . . . . . . . . . . . . . . 55
3.8.7 Linear Independence . . . . . . . . . . . . . . . . . . . . . . 56
3.8.8 Spanning Set . . . . . . . . . . . . . . . . . . . . . . . . . . 56
3.8.9 Basis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
3.8.10 Probability Theory . . . . . . . . . . . . . . . . . . . . . . . 57
3.8.11 Probability Amplitudes . . . . . . . . . . . . . . . . . . . . 58
3.8.12 The Inner Product . . . . . . . . . . . . . . . . . . . . . . . 58
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
CONTENTS iii
3.8.13 Orthogonality . . . . . . . . . . . . . . . . . . . . . . . . . . 60
3.8.14 The Unit Vector . . . . . . . . . . . . . . . . . . . . . . . . . 61
3.8.15 Bases for C
n
. . . . . . . . . . . . . . . . . . . . . . . . . . . 62
3.8.16 The Gram Schmidt Method . . . . . . . . . . . . . . . . . . 64
3.8.17 Linear Operators . . . . . . . . . . . . . . . . . . . . . . . . 64
3.8.18 Outer Products and Projectors . . . . . . . . . . . . . . . . 65
3.8.19 The Adjoint . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
3.8.20 Eigenvalues and Eigenvectors . . . . . . . . . . . . . . . . 70
3.8.21 Trace . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
3.8.22 Normal Operators . . . . . . . . . . . . . . . . . . . . . . . 73
3.8.23 Unitary Operators . . . . . . . . . . . . . . . . . . . . . . . 73
3.8.24 Hermitian and Positive Operators . . . . . . . . . . . . . . 76
3.8.25 Diagonalisable Matrix . . . . . . . . . . . . . . . . . . . . . 76
3.8.26 The Commutator and AntiCommutator . . . . . . . . . . 77
3.8.27 Polar Decomposition . . . . . . . . . . . . . . . . . . . . . . 78
3.8.28 Spectral Decomposition . . . . . . . . . . . . . . . . . . . . 79
3.8.29 Tensor Products . . . . . . . . . . . . . . . . . . . . . . . . . 79
3.9 Fourier Transforms . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
3.9.1 The Fourier Series . . . . . . . . . . . . . . . . . . . . . . . 82
3.9.2 The Discrete Fourier Transform . . . . . . . . . . . . . . . . 85
4 Quantum Mechanics 89
4.1 History . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
4.1.1 Classical Physics . . . . . . . . . . . . . . . . . . . . . . . . 90
4.1.2 Important Concepts . . . . . . . . . . . . . . . . . . . . . . 91
4.1.3 Statistical Mechanics . . . . . . . . . . . . . . . . . . . . . . 94
4.1.4 Important Experiments . . . . . . . . . . . . . . . . . . . . 95
4.1.5 The Photoelectric Effect . . . . . . . . . . . . . . . . . . . . 96
4.1.6 Bright Line Spectra . . . . . . . . . . . . . . . . . . . . . . . 97
4.1.7 Proto Quantum Mechanics . . . . . . . . . . . . . . . . . . 98
4.1.8 The New Theory of Quantum Mechanics . . . . . . . . . . 102
4.2 Important Principles for Quantum Computing . . . . . . . . . . . 105
4.2.1 Linear Algebra . . . . . . . . . . . . . . . . . . . . . . . . . 107
4.2.2 Superposition . . . . . . . . . . . . . . . . . . . . . . . . . . 107
4.2.3 Dirac Notation . . . . . . . . . . . . . . . . . . . . . . . . . 108
4.2.4 Representing Information . . . . . . . . . . . . . . . . . . . 110
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
iv CONTENTS
4.2.5 Uncertainty . . . . . . . . . . . . . . . . . . . . . . . . . . . 110
4.2.6 Entanglement . . . . . . . . . . . . . . . . . . . . . . . . . . 111
5 Quantum Computing 113
5.1 Elements of Quantum Computing . . . . . . . . . . . . . . . . . . 113
5.1.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
5.1.2 History . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
5.1.3 Bits and Qubits . . . . . . . . . . . . . . . . . . . . . . . . . 114
5.1.4 Entangled States . . . . . . . . . . . . . . . . . . . . . . . . 127
5.1.5 Quantum Circuits . . . . . . . . . . . . . . . . . . . . . . . . 129
5.2 Important Properties of Quantum Circuits . . . . . . . . . . . . . . 142
5.2.1 Common Circuits . . . . . . . . . . . . . . . . . . . . . . . . 142
5.3 The Reality of Building Circuits . . . . . . . . . . . . . . . . . . . . 148
5.3.1 Building a Programmable Quantum Computer . . . . . . . 148
5.4 The Four Postulates of Quantum Mechanics . . . . . . . . . . . . . 149
5.4.1 Postulate One . . . . . . . . . . . . . . . . . . . . . . . . . . 149
5.4.2 Postulate Two . . . . . . . . . . . . . . . . . . . . . . . . . . 150
5.4.3 Postulate Three . . . . . . . . . . . . . . . . . . . . . . . . . 151
5.4.4 Postulate Four . . . . . . . . . . . . . . . . . . . . . . . . . . 154
6 Information Theory 157
6.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157
6.2 History . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158
6.3 Shannon’s Communication Model . . . . . . . . . . . . . . . . . . 158
6.3.1 Channel Capacity . . . . . . . . . . . . . . . . . . . . . . . . 159
6.4 Classical Information Sources . . . . . . . . . . . . . . . . . . . . . 160
6.4.1 Independent Information Sources . . . . . . . . . . . . . . 160
6.5 Classical Redundancy and Compression . . . . . . . . . . . . . . . 162
6.5.1 Shannon’s Noiseless Coding Theorem . . . . . . . . . . . . 163
6.5.2 Quantum Information Sources . . . . . . . . . . . . . . . . 165
6.5.3 Pure and Mixed States . . . . . . . . . . . . . . . . . . . . . 165
6.5.4 Schumacher’s Quantum Noiseless Coding Theorem . . . . 166
6.6 Noise and Error Correction . . . . . . . . . . . . . . . . . . . . . . 173
6.6.1 Quantum Noise . . . . . . . . . . . . . . . . . . . . . . . . . 174
6.6.2 Quantum Error Correction . . . . . . . . . . . . . . . . . . 175
6.7 Bell States . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 180
6.7.1 Same Measurement Direction . . . . . . . . . . . . . . . . . 181
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
CONTENTS v
6.7.2 Different Measurement Directions . . . . . . . . . . . . . . 182
6.7.3 Bell’s Inequality . . . . . . . . . . . . . . . . . . . . . . . . . 183
6.8 Cryptology . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 187
6.8.1 Classical Cryptography . . . . . . . . . . . . . . . . . . . . 188
6.8.2 Quantum Cryptography . . . . . . . . . . . . . . . . . . . . 189
6.9 Alternative Models of Computation . . . . . . . . . . . . . . . . . 193
7 Quantum Algorithms 195
7.0.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . 195
7.1 Deutsch’s Algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . 196
7.1.1 The Problem Deﬁned . . . . . . . . . . . . . . . . . . . . . . 196
7.1.2 The Classical Solution . . . . . . . . . . . . . . . . . . . . . 196
7.1.3 The Quantum Solution . . . . . . . . . . . . . . . . . . . . . 197
7.1.4 Physical Implementations . . . . . . . . . . . . . . . . . . . 199
7.2 The DeutschJosza Algorithm . . . . . . . . . . . . . . . . . . . . . 200
7.2.1 The Problem Deﬁned . . . . . . . . . . . . . . . . . . . . . . 200
7.2.2 The Quantum Solution . . . . . . . . . . . . . . . . . . . . . 201
7.3 Shor’s Algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . 202
7.3.1 The Quantum Fourier Transform . . . . . . . . . . . . . . . 202
7.3.2 Fast Factorisation . . . . . . . . . . . . . . . . . . . . . . . . 207
7.3.3 Order Finding . . . . . . . . . . . . . . . . . . . . . . . . . . 208
7.4 Grover’s Algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . 214
7.4.1 The Travelling Salesman Problem . . . . . . . . . . . . . . 214
7.4.2 Quantum Searching . . . . . . . . . . . . . . . . . . . . . . 214
8 Using Quantum Mechanical Devices 219
8.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 219
8.2 Physical Realisation . . . . . . . . . . . . . . . . . . . . . . . . . . . 219
8.2.1 Implementation Technologies . . . . . . . . . . . . . . . . . 221
8.3 Quantum Computer Languages . . . . . . . . . . . . . . . . . . . . 222
8.4 Encryption Devices . . . . . . . . . . . . . . . . . . . . . . . . . . . 223
A Complexity Classes 225
A.1 Classical . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 225
A.2 Quantum . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 227
Bibliography 229
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
vi CONTENTS
Index 237
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
Acknowledgements
I would like to thank the following people:
Brian Lederer, my supervisor, who always provided detailed answers to my
questions. Brian is directly responsible for some parts of this text. He wrote the
section on Bell states, some parts of the chapter on quantum mechanics, and
a substantial amount of the other chapters. Without his help this work would
never have been completed.
Waranyoo Pulsawat, my dear girlfriend. Waranyoo has been a constant source
of support, companionship, and inspiration.
Version 1.2 is dedicated to Dr Mohamed Barakat who has published his own
translation of this book in Arabic! It is fantastic  thanks Dr Barakat, it looks
great.
Most of the credit for the corrections and improved content in version 1.1 goes
to Andreas Gunnarsson. Andreas’ attention to detail is astonishing. Simply put,
this version would not have been possible without him. So a big thanks to An
dreas, to whom this version 1.1 is dedicated.
A special thanks to Xerxes R˚ anby. Xerxes had some valuable comments about
version 1.0 and found a number of errors. I’ve also had great fun discussing a
variety of different eclectic topics with him via email.
Carlos Gon¸ calves who has kindly offered to translate version 1.1 into Portuguese.
All the members of the QC4Dummies Yahoo group (http://groups.yahoo.
com/group/QC4dummies/) and administrators David Morris and David Rick
man.
Sean Kaye and Micheal Nielson for mentioning version 1.0 in their blogs.
The people at Slashdot (http://slashdot.org/) and QubitNews (http://
quantum.fis.ucm.es/) for posting version 1.0 for review.
viii CONTENTS
James Hari, Simon Johnson, James Hollis, Nick Oosterhof, Rad Radish, Karol Bartkiewicz,
Robin Kothari, Varun Vaidya, and Slashdotters AC, Birdie 1013, and s/nemesis
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
Chapter 1
Introduction
1.1 What is Quantum Computing?
In quantum computers we exploit quantum effects to compute in ways that are
faster or more efﬁcient than, or even impossible, on conventional computers.
Quantumcomputers use a speciﬁc physical implementation to gain a computa
tional advantage over conventional computers. Properties called superposition
and entanglement may, in some cases, allow an exponential amount of paral
lelism. Also, special purpose machines like quantum cryptographic devices
use entanglement and other peculiarities like quantum uncertainty.
Quantum computing combines quantum mechanics, information theory, and
aspects of computer science [Nielsen, M. A. & Chuang, I. L. 2000]. The ﬁeld
is a relatively new one that promises secure data transfer, dramatic computing
speed increases, and may take component miniaturisation to its fundamental
limit.
This text describes some of the introductory aspects of quantum computing.
We’ll examine some basic quantum mechanics, elementary quantum comput
ing topics like qubits, quantum algorithms, physical realisations of those algo
rithms, basic concepts from computer science (like complexity theory, Turing
machines, and linear algebra), information theory, and more.
1
2 Why Another Quantum Computing Tutorial?
1.2 Why Another Quantum Computing Tutorial?
Most of the books or papers on quantum computing require (or assume) prior
knowledge of certain areas like linear algebra or physics. The majority of the
literature that is currently available is hard to understand for the average com
puter enthusiast, or interested layman. This text attempts to teach basic quan
tum computing from the ground up in an easily readable way. It contains a lot
of the background in math, physics, and computer science that you will need,
although it is assumed that you know a little about computer programming.
At certain places in this document, topics that could make interesting research
topics have been identiﬁed. These topics are presented in the following format:
Question The topic is presented in bolditalics.
1.2.1 The Bible of Quantum Computing
Every Temple needs a Bible right? Well there is one book out there that is by far
the most complete book available for quantum computing, Quantum Computa
tion and QuantumInformation by Michael A. Nielsen and Isaac L. Chuang, which
we’ll abbreviate to QCQI. The main references for this work are QCQI and a
great set of lecture notes, also written by Nielsen. Nielsen’s lecture notes are
currently available at http://www.qinfo.org/people/nielsen/qicss.
html. An honourable mention goes out to Vadim V. Bulitko who has managed
to condense a large part of QCQI into 14 pages!
QCQI may be a little hard to get into at ﬁrst, particularly for those without a
strong background in math. So the Temple of Quantum Computing is, in part,
a collection of worked examples from various web sites, sets of lecture notes,
journal entries, papers, and books which may aid in understanding of some of
the concepts in QCQI.
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
Chapter 2
Computer Science
2.1 Introduction
The special properties of quantum computers force us to rethink some of the
most fundamental aspects of computer science. In this chapter we’ll see how
quantum effects can give us a new kind of Turing machine, new kinds of cir
cuits, and new kinds of complexity classes. This is important as it was thought
that these things were not affected by what the computer was built from, but it
turns out that they are.
A distinction has been made between computer science and information the
ory. Although information theory can be seen as a part of computer science it
is treated separately in this text with its own dedicated chapter. This is because
The quantum aspects of information theory require some of the concepts intro
duced in the chapters that follow this one.
There’s also a little mathematics and notation used in this chapter which is
presented in the ﬁrst few sections of chapter 3 and some basic C and Javascript
code for which you may need an external reference.
2.2 History
The origins of computer science can at least be traced back to the invention of
algorithms like Euclid’s Algorithm (c. 300 BC) for ﬁnding the greatest com
mon divisor of two numbers. There are also much older sources like early
3
4 History
Figure 2.1: Charles Babbage and Ada Byron.
Babylonian cuneiform tablets (c. 2000  1700 BC) that contain clear evidence of
algorithmic processes [Gilleland M. ? 2000]. But up until the 19th century it’s
difﬁcult to separate computer science fromother sciences like mathematics and
engineering. So we might say that computer science began in the 19th century.
In the early to mid 19th century Charles Babbage, 1791  1871 (ﬁgure 2.1) de
signed and partially built several programmable computing machines (see ﬁg
ure 2.4 for the difference engine built in 1822) that had many of the features of
modern computers. One of these machines called the analytical engine had re
movable programs on punch cards based on those used in the Jacquard loom,
which was invented by Joseph Marie Jacquard (1752  1834) in 1804 [Smithso
nian NMAH1999]. Babbage’s friend, Ada Augusta King, Countess of Lovelace,
1815  1852 (ﬁgure 2.1) and the daughter of Lord Byron is considered by some
as the ﬁrst programmer for her writings on the Analytical engine. Sadly, Bab
bage’s work was largely forgotten until the 1930s and the advent of modern
computer science. Modern computer science can be said to have started in
1936 when logician Alan Turing, 1912  1954 (ﬁgure 2.2) wrote a paper which
contained the notion of a universal computer.
The ﬁrst electronic computers were developed in the 1940’s and led Jon Von
Neumann, 1903  1957 (ﬁgure 2.3) to develop a generic architecture on which
modern computers are loosely based. Von Neumann architecture speciﬁes an
Arithmetic Logic Unit (ALU), control unit, memory, input/output (IO), a bus,
and a computing process. The architecture originated in 1945 in the ﬁrst draft
of a report on EDVAC [Cabrera, B. J. ? 2000].
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
History 5
Figure 2.2: Alan Turing and Alonzo Church.
Figure 2.3: Jon Von Neumann.
Computers increased in power and versatility rapidly over the next sixty years,
partly due to the development of the transistor in 1947, integrated circuits
in 1959, and increasingly intuitive user interfaces. Gordon Moore proposed
Moore’s law in 1965, the current version of which states that processor com
plexity will double every eighteen months with respect to cost (in reality it’s
more like two years) [wikipedia.org 2006]. This law still holds but is starting
to falter, and components are getting smaller. Soon they will be so small, being
made up of a few atoms [Benjamin, S. & Ekert, A. ? 2000] that quantum effects
will become unavoidable, possibly ending Moore’s law.
There are ways in which we can use quantum effects to our advantage in a
classical sense, but by fully utilising those effects we can achieve much more.
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
6 Turing Machines
This approach is the basis for quantum computing.
2.3 Turing Machines
In 1928 David Hilbert, 1862  1943 (ﬁgure 2.5) asked if there was a universal
algorithmic process to decide whether any mathematical proposition was true.
His intuition suggested ”yes”, then, in 1930 he went as far as claiming that
there were no unsolvable problems in mathematics [Natural Theology 2004].
This was promptly refuted by Kurt G¨ odel, 1908  1976 (ﬁgure 2.5) in 1931 by
way of his incompleteness theorem which can be roughly summed up as follows:
You might be able to prove every conceivable statement about num
bers within a system by going outside the system in order to come
up with new rules and axioms, but by doing so you’ll only create a
larger systemwith its own unprovable statements. [Jones, J. Wilson,
W. 1995, p. ?]
Then, in 1936 Alan Turing and Alonzo Church, 1903  1995 (ﬁgure 2.2) indepen
dently came up with models of computation, aimed at resolving whether or
not mathematics contained problems that were ”uncomputable”. These were
problems for which there were no algorithmic solutions (an algorithm is a pro
cedure for solving a mathematical problem that is guaranteed to end after a
number of steps). Turing’s model, now called a called a Turing Machine (TM) is
depicted in ﬁgure 2.6. It turned out that the models of Turing and Church were
equivalent in power. The thesis that any algorithm capable of being devised
can be run on a Turing machine, as Turing’s model was subsequently called,
was given the names of both these pioneers, the ChurchTuring thesis [Nielsen,
M. A. 2002].
2.3.1 Binary Numbers and Formal Languages
Before deﬁning a Turing machine we need to say something about binary num
bers, since this is usually (although not conﬁned to) the format in which data is
presented to a Turing machine (see the tape is ﬁgure 2.6).
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
Turing Machines 7
Figure 2.4: Babbage’s difference engine.
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
8 Turing Machines
Figure 2.5: David Hilbert and Kurt G¨ odel.
Binary Representation
Computers represent numbers in binary form, as a series of zeros and ones,
because this is easy to implement in hardware (compared with other forms,
e.g. decimal). Any information can be converted to and from zeros and ones
and we call this representation a binary representation.
Example Here are some binary numbers and their decimal equivalents:
The binary number, 1110 in decimal is 14.
The decimal 212 when converted to binary becomes 11010100.
The binary numbers (on the left hand side) that represent the decimals
04 are as follows:
0 = 0
1 = 1
10 = 2
11 = 3
100 = 4
A binary number has the form b
n−1
. . . b
2
b
1
b
0
where n is the number of binary
digits (or bits, with each digit being a 0 or a 1) and b
0
is the least signiﬁcant digit.
We can convert the binary string to a decimal number D using the following
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
Turing Machines 9
formula:
D = 2
n−1
(b
n−1
) +. . . + 2
2
(b
2
) + 2
1
(b
1
) + 2
0
(b
0
). (2.1)
Here is another example:
Example Converting the binary number 11010100 to decimal:
D = 2
7
(1) + 2
6
(1) + 2
5
(0) + 2
4
(1) + 2
3
(0) + 2
2
(1) + 2
1
(0) + 2
0
(0)
= 128 + 64 + 16 + 4
= 212
We call the binary numbers a base 2 number system because it is based on
just two symbols 0 and 1. By contrast, in decimal which is base 10, we have
0, 1, 2, 3, . . . , 9.
All data in modern computers is stored in binary format; even machine instruc
tions are in binary format. This allows both data and instructions to be stored
in computer memory and it allows all of the fundamental logical operations of
the machine to be represented as binary operations.
Formal Languages
Turing machines and other computer science models of computation use formal
languages to represent their inputs and outputs. We say a language L has an al
phabet
∑
. The language is a subset of the set
∑
∗
of all ﬁnite strings of symbols
from
∑
.
Example If
∑
= {0, 1} then the set of all even binary numbers
{0, 10, 100, 110, ...} is a langauge over
∑
.
It turns out that the ”power” of a computational model (or automaton) i.e. the
class of algorithm that the model can implement, can be determined by consid
ering a related question:
What type of ”language” can the automaton recognise?
A formal language in this setting is just a set of binary strings. In simple lan
guages the strings all follow an obvious pattern, e.g. with the language:
{01, 001, 0001, . . .}
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
10 Turing Machines
State
Controller
R/W head
Inﬁnite tape
1 0 0 0 1 1 1 0 ...
Figure 2.6: A Turing machine.
the pattern is that we have one or more zeroes followed by a 1. If an automa
ton, when presented with any string from the language can read each symbol
and then halt after the last symbol we say it recognises the language (provid
ing it doesn’t do this for strings not in the language). Then the power of the
automaton is gauged by the complexity of the patterns for the languages it can
recognise.
2.3.2 Turing Machines in Action
A Turing machine (which we’ll sometimes abbreviate to TM) has the following
components [Copeland, J. 2000]:
1. A tape  made up of cells containing 0, 1, or blank. Note that this gives us a
alphabet of
∑
= {0, 1, blank}.
2. A read/write head  reads, or overwrites the current symbol on each step and
moves one square to the left or right.
3. A controller  controls the elements of the machine to do the following:
1. read the current symbol
2. write a symbol by overwriting what’s already there
4. move the tape left or right one square
5. change state
6. halt.
4. The controller’s behaviour  the way the TM switches states depending on the
symbol it’s reading, represented by a ﬁnite state automata (FSA).
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
Turing Machines 11
The operation of a TM is best described by a simple example:
Example Inversion inverts each input bit, for example:
001 → 110
The behaviour of the machine can be represented by a two state FSA. The
FSA is represented below in table form (where the states are labelled 1 and
2: 1 for the running state, and 2 for the halt state).
State Value New State New Value Direction
1 0 1 1 Move Right
1 1 1 0 Move Right
1 blank 2  HALT blank Move Right
2  HALT N/A N/A N/A N/A
2.3.3 The Universal Turing Machine
A Universal Turning Machine (UTM) is a TM (with an in built mechanism de
scribed by a FSA) that is capable of reading, from a tape, a program describing
the behaviour of another TM. The UTM simulates the ordinary TM performing
the behaviour generated when the ordinary TM acts upon its data. When the
UTM halts its tape contains the result that would have been produced by the
ordinary TM (the one that describes the workings of the UTM).
The great thing about the UTM is that it shows that all algorithms (Turing ma
chines) can be reduced to a single algorithm. As stated above, Church, G¨ odel,
and a number of other great thinkers did ﬁnd alternative ways to represent al
gorithms, but it was only Turing who found a way of reducing all algorithms
to a single one. This reduction in algorithms is a bit like what we have in infor
mation theory where all messages can be reduced to zeroes and ones.
2.3.4 The Halting Problem
This is a famous problem in computer science. Having discovered the simple,
but powerful model of computation (essentially the stored program computer)
Turing then looked at its limitations by devising a problem that it could not
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
12 Turing Machines
solve.
The UTM can run any algorithm. What, asked Turing, if we have another UTM
that, rather than running a given algorithm, looks to see whether that algo
rithm acting on it’s data, will actually halt (in a ﬁnite number of steps rather
than looping forever or crashing). Turing called this hypothetical new Turing
machine H (for halting machine). Like a UTM, H can receive a description
of the algorithm in question (its program) and the algorithm’s data. Then H
works on this information and produces a result. When given a number, say
1 or 0 it decides whether or not the given algorithm would then halt. Is such
a machine possible (so asked Turing)? The answer he found was ”no” (look
below). The very concept of H involves a contradiction! He demonstrated this
by taking, as the algorithmdescription (program) and data that Hshould work
on, a variant of H itself!! The clue to this ingenious way of thinking came from
the liar’s paradox  the question of whether or not the sentence:
This sentence is false.
can be assigned a truth value. Just as a ”universal truth machine” fails in as
signing this funny sentence a truth value (try it), so to does H fail to assign a
halting number 1 or 0 to the variant (the design of the latter involving the same
ingredients, selfreference and negation  that made the sentence problematic).
This proof by contradiction only applies to Turing machines, and machines
that are computationally equivalent. It still remains unproven that the halting
problem cannot be solved in all computational models.
The next section contains a detailed explanation of the halting problem by
means of an example. This can be skipped if you’ve had enough of Turing
machines for now.
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
Turing Machines 13
The Halting Problem  Proof by Contradiction
The halting problem in Javascript [Marshall, J. 2001].
The proof is by contradiction, say we could have a program that could de
termine whether or not another program will halt.
function Halt(program) {
if ( ...Code to check if program can halt... ) {
return true;
} else {
return false;
}
}
Given two programs, one that halts and one that does not:
function Halter(input) {
alert(’finished’);
}
function Looper(input) {
while (1==1) {;}
}
In our example Halt() would return the following:
Halt("function Halter(1){alert(’finished’);}")
\\ returns true
Halt("function Looper(1)while (1==1) {;}}")
\\ returns false
So it would be possible given these special cases, but is it possible for all al
gorithms to be covered in the ...Code to check if program can halt...
section? No  here is the proof, given a new program:
function Contradiction(program) {
if (Halt(program) == true) {
while (1 == 1) {;}
} else {
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
14 Circuits
alert(’finished’);
}
}
If Contradiction() is given an arbitrary program as an input then:
• If Halt() returns true then Contradiction() goes into an inﬁnite loop.
• If Halt() returns false then Contradiction() halts.
If Contradiction() is given itself as input then:
• Contradiction() loops inﬁnitely if Contradiction() halts (given itself
as input).
• Contradiction() halts if Contradiction() goes into an inﬁnite loop
(given itself as input).
Contradiction() here does not loop or halt, we can’t decide algorithmically
what the behaviour of Contradiction() will be.
2.4 Circuits
Although modern computers are no more powerful than TM’s (in terms of the
languages they can recognise) they are a lot more efﬁcient (for more on efﬁ
ciency see section 2.5). However, what a modern or conventional computer
gives in efﬁciency it loses in transparency (compared with a TM). It is for this
reason that a TM is still of value in theoretical discussions, e.g. in comparing
the ”hardness” of various classes of problems.
We won’t go fully into the architecture of a conventional computer. However
some of the concepts needed for quantum computing are related, e.g. circuits,
registers, and gates. For this reason we’ll examine conventional (classical) cir
cuits.
Classical circuits are made up of the following:
1. Gates  which perform logical operations on inputs. Given input(s) with
values of 0 or 1 they produce an output of 0 or 1 (see below). These oper
ations can be represented by truth tables which specify all of the different
combinations of the outputs with respect to the inputs.
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
Circuits 15
2. Wires  carry signals between gates and registers.
3. Registers  made up of cells containing 0 or 1, i.e. bits.
2.4.1 Common Gates
First off we’ll look at the commonly used gates. These are listed below with
their respective truth tables.
The NOT inverts the input bit. The gate part of the diagram is the triangle and
circle, The wires are the lines on either side of the gate and the gate reads from
left to right (as with all gates and circuits).
a x
NOT
a x
0 1
1 0
OR returns a 1 if either of the inputs is 1.
a
b
x
OR
a b x
0 0 0
1 0 1
0 1 1
1 1 1
AND only returns a 1 if both of the inputs are 1.
a
b
x
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
16 Circuits
AND
a b x
0 0 0
1 0 0
0 1 0
1 1 1
NOR is an OR and a NOT gate combined.
a
b
x
NOR
a b x
0 0 1
1 0 0
0 1 0
1 1 0
NAND is an AND and a NOT gate combined.
a
b
x
NAND
a b x
0 0 1
1 0 1
0 1 1
1 1 0
XOR returns a 1 if only one of its inputs is 1.
a
b
x
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
Circuits 17
XOR
a b x
0 0 0
1 0 1
0 1 1
1 1 0
2.4.2 Combinations of Gates
Shown below, a circuit also has a truth table.
a
b
f
c
The circuit shown above has the following truth table:
a b c f
0 0 0 0
0 0 1 1
0 1 0 0
0 1 1 0
1 0 0 0
1 0 1 1
1 1 0 1
1 1 1 1
This circuit has an expression associated with it, which is as follows:
f = OR(AND(a, b), AND(NOT(b), c)).
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
18 Circuits
Figure 2.7: FANOUT.
Figure 2.8: The universal NAND gate.
2.4.3 Relevant Properties
These circuits are capable of FANOUT, FANIN, and CROSSOVER (unlike quan
tum circuits) where FANOUT means that many wires (i.e. many inputs) can be
tied to one output (ﬁgure 2.7), FANIN means that many outputs can be tied
together with an OR, and CROSSOVER means that the value of two bits are in
terchanged.
2.4.4 Universality
Combinations of NAND gates can be used to emulate any other gate (see ﬁgure
2.8). For this reason the NAND gate is considered a universal gate. So, this means
that any circuit, no matter how complicated can be expressed as a combination
of NAND gates. The quantum analogue of this is called the CNOT gate.
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
Computational Resources and Efﬁciency 19
2.5 Computational Resources and Efﬁciency
Computational time complexity is a measure of how fast and with how many
resources a computational problem can be solved. In terms of algorithms, we
can compare algorithms that perform the same task and measure whether one
is more efﬁcient than the other. Conversely, if the same algorithm is imple
mented on different architectures then the time complexities should not differ
by more than a constant, this is called the principle of invariance.
A simple example of differing time complexities is with sorting algorithms,
i.e. algorithms used to sort a list of numbers. The following example uses the
bubble sort and quick sort algorithms. Some code for bubble sort is given be
low, but the code for quick sort is not given explicitly. We’ll also use the code
for the bubble sort algorithm in an example on page 22.
Bubble sort:
for(i = 1;i < = n  1;i ++)
for(j = n;j > = i + 1;j )
{
if (list[j]<list[j  1])
{
Swap(list[j],list[j  1]);
}
}
}
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
20 Computational Resources and Efﬁciency
Example Quick sort vs. bubble sort.
Bubble Sort:
Each item in a list is compared with the item next to it, they are swapped
if required. This process is repeated until all of the numbers are checked
without any swaps.
Quick Sort:
The quick sort has the following four steps:
1. Finish if there are no more elements to be sorted (i.e. 1 or less elements).
2. Select a pivot point.
3. The list is split into two lists  with numbers smaller than the pivot value
in one list and numbers larger than the pivot value in the other list.
4. Repeat steps 1 to 3 for each list generated in step 3.
On average the bubble sort is much slower than the quick sort, regardless of
the architecture it is running on.
2.5.1 Quantifying Computational Resources
Let’s say we’ve gone through an algorithmsystematically and worked out, line
by line (see the end of this section for an example) how fast it is going to run
given a particular variable n which describes the ”size” of the input. E.g. the
number of elements in a list to be sorted. Suppose we can quantify the compu
tational work involved as function of n, consider the following expression:
3n + 2 log n + 12.
The important part of this function is 3n as it grows more quickly than the other
terms, i.e. n grows faster than log n and the constant. We say that the algorithm
that generated this result has,
O(n)
time complexity (i.e. we ignore the 3). The important parts of the function are
shown here:
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
Computational Resources and Efﬁciency 21
0
10
20
30
40
50
0 10 20 30 40 50
3n + 2 log n + 12
3n
2 log n
12
¡¡
So we’ve split the function 3n + 2 log n + 12 into its parts : 3n, 2 log n, and 12.
More formally Big O notation allows us to set an upper bound on the behaviour
of the algorithm. So, at worst this algorithm will take approximately n cycles
to complete (plus a vanishingly small unimportant ﬁgure). Note that this is the
worst case, i.e. it gives us no notion of the average complexity of an algorithm.
The class of O(n) contains all functions that are quicker than O(n). for example,
3n ≤ 3n
2
so 3n is bounded by the class O(3n
2
) (for all positive n).
A more formal deﬁnition of Big O notation is as follows:
f(n) is O(g(n)) if there exist constants n
0
and c that for all n > n
0
, f(n) ≤ cg(n).
(2.2)
For a lower bound we use big Ω notation (Big Omega). This is useful for exam
ining a class of algorithms like those that factorise a number for example.
f(n) is Ω(g(n)) if there exist constants n
0
and c that for all n > n
0
, cg(n) ≤ f(n).
(2.3)
Example 2
n
is in Ω(n
2
) as n
2
≤ 2
n
(for all sufﬁciently large n).
Finally, big Θ is used to show that a function is asymptotically equivalent in both
lower and upper bounds. formally:
f(n) = Θ(g(n)) ⇐⇒ O(g(n)) = Ω(g(n)). (2.4)
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
22 Computational Resources and Efﬁciency
Example 4n
2
−40n + 2 = Θ(n
2
) ̸= Θ(n
3
) ̸= Θ(n).
As promised, here is a more indepth example of the average complexity of
an algorithm.
Example Time Complexity: Quick sort vs. bubble sort [Nielsen, M. A. &
Chuang, I. L. 2000].
Here our n is the number of elements in a list, the number of swap
operations is:
(n −1) + (n −2) +... + 1 =
n(n −1)
2
The most important factor here is n
2
. The average and worst case time
complexities are O(n
2
), so we say it is generally O(n
2
).
If we do the same to the quick sort algorithm, the average time com
plexity is just O(nlog n).
So now we have a precise mathematical notion for the speed of an algorithm.
2.5.2 Standard Complexity Classes
Computational complexity is the study of how hard a problem is to compute.
Or put another way, what is the least amount of resources required by the best
known algorithm for solving the problem. There are many types of resources
(e.g. time and space); but we are interested in time complexity for now. The
main distinction between hard and easy problems is the rate at which they
grow. If the problem can be solved in polynomial time, that is it is bounded
by a polynomial in n, then it is easy. Hard problems grow faster than any
polynomial in n, for example:
n
2
is polynomial, and easy, whereas,
2
n
is exponential and hard. What we mean by hard is that as we make n large the
time taken to solve the problemgoes up as 2
n
, i.e. exponentially. So we say that
O(2
n
) is hard or intractable.
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
Computational Resources and Efﬁciency 23
The complexity classes of most interest to us are P (Polynomial) and NP (Non
Deterministic Polynomial).
P means that the problem can be solved in polynomial time, NP means that
it probably can’t, and NP complete means it almost deﬁnitely can’t. More for
mally:
The class P consists of all those decision problems that can be solved
on a deterministic sequential machine in an amount of time that
is polynomial in the size of the input; the class NP consists of all
those decision problems whose positive solutions can be veriﬁed in
polynomial time given the right information, or equivalently, whose
solution can be found in polynomial time on a nondeterministic
machine [wikipedia.org 2004].
Where:
• Adecision problemis a function that takes an arbitrary value or values as input
and returns a yes or a no. Most problems can be represented as decision
problems.
• Witnesses are solutions to decision problems that can be checked in polyno
mial time. For example, checking if 7747 has a factor less than 70 is a
decision problem. 61 is a factor (61 ×127 = 7747) which is easily checked.
So we have a witness to a yes instance of the problem. Now, if we ask if
7747 has a factor less than 60 there is no easily checkable witnesses for the
no instance [Nielsen, M. A. 2002].
• Non deterministic Turing machines (NTMs) differ from normal deterministic
Turing machines in that at each step of the computation the Turing ma
chine can ”spawn” copies, or new Turing machines that work in parallel
with the original. It’s a common mistake to call a quantum computer an
NTM, as we shall see later we can only use quantum parallelism indi
rectly.
• It is not proven that P ̸= NP it is just very unlikely as this would mean that
all problems in NP can be solved in polynomial time.
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
24 Computational Resources and Efﬁciency
See appendix A.1 for a list of common complexity classes. You can also see
a larger list of complexity classes online at http://qwiki.stanford.edu/
wiki/Complexity Zoo.
2.5.3 The Strong ChurchTuring Thesis
Originally, the strong ChurchTuring thesis went something like this:
Any algorithmic process can be simulated with no loss of efﬁciency
using a Turing machine [Banerjee, S. ? 2004].
We are saying a TM is as powerful as any other model of computation in terms
of the class of problems it can solve; any efﬁciency gain due to using a particu
lar model, is at most polynomial.
This was challenged in 1977 by Robert Solovay and Volker Strassen, who intro
duced truly randomised algorithms, which do give a computational advantage
based on the machine’s architecture [Nielsen, M. A. & Chuang, I. L. 2000]. So,
this led to a revision of the strong ChurchTuring thesis, which now relates to a
probabilistic Turing machine (PTM).
A probabilistic Turing machine can be described as:
A deterministic Turing machine having an additional write instruc
tion where the value of the write is uniformly distributed in the Tur
ing machine’s alphabet (generally, an equal likelihood of writing a
1 or a 0 on to the tape) [TheFreeDictionary.com 2004].
This means that algorithms given the same inputs can have different run times,
and results if necessary. An example of an algorithm that can beneﬁt from a
PTM is quicksort. Although on average quicksort runs in O(nlog n) it still has
a worst case running time of O(n
2
) if say the list is already sorted. Randomis
ing the list beforehand ensures the algorithmruns more often in O(nlog n). The
PTMhas its own set of complexity classes, some of which are listed in appendix
A.1.
Can we efﬁciently simulate any nonprobabilistic algorithm on a probabilistic
Turing machine without exponential slowdown? The answer is ”yes” accord
ing to the new strong ChurchTuring thesis:
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
Computational Resources and Efﬁciency 25
Figure 2.9: Richard Feynman.
Any model of computation can be simulated on a probabilistic Tur
ing machine with at most a polynomial increase in the number of
elementary operations [Bettelli, S. 2000, p.2].
A new challenge came from another quarter when in the early eighties Richard
Feynman, 1918  1988 (ﬁgure 2.9) suggested that it would be possible to sim
ulate quantum systems using quantum mechanics  this alluded to a kind of
protoquantum computer. He then went on to ask if it was possible to simulate
quantum systems on conventional (i.e. classical) Turing machines. It is hard
(timewise) to simulate quantum systems effectively, in fact it gets exponen
tially harder the more components you have [Nielsen, M. A. 2002]. Intuitively,
the TM simulation can’t keep up with the evolution of the physical system it
self: it falls further and further behind, exponentially so. Then, reasoned Feyn
man, if the simulator was ”built of quantum components” perhaps it wouldn’t
fall behind. So such a ”quantum computer” would seem to be more efﬁcient
than a TM. The strong ChurchTuring thesis would seem to have been violated
(as the two models are not polynomially equivalent).
The idea really took shape in 1985 when, based on Feynman’s ideas, David
Deutsch proposed another revision to the strong Church Turing thesis. He pro
posed a newarchitecture based on quantummechanics, on the assumption that
all physics is derived from quantum mechanics (this is the Deutsch  Church 
Turing principle [Nielsen, M. A. 2002]). He then demonstrated a simple quan
tumalgorithmwhich seemed to prove the newrevision. More algorithms were
developed that seemed to work better on a quantum Turing machine (see below)
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
26 Energy and Computation
rather than a classical one (notably Shor’s factorisation and Grover’s search
algorithms  see chapter 7).
2.5.4 Quantum Turing Machines
A quantum Turing machine (QTM) is a normal Turing machine with quantum
parallelism. The head and tape of a QTM exist in quantum states, and each
cell of the tape holds a quantum bit (qubit) which can contain what’s called a
superposition of the values 0 and 1. Don’t worry too much about that now as
it’ll be explained in detail later; what’s important is that a QTM can perform
calculations on a number of values simultaneously by using quantum effects.
Unlike classical parallelism which requires a separate processor for each value
operated on in parallel, in quantum parallelism a single processor operates on
all the values simultaneously.
There are a number of complexity classes for QTMs, see appendix A.2 for a
list of some of them and the relationships between them.
Question Architecture itself can change the time complexity of algorithms so
could there be other revisions?
2.6 Energy and Computation
2.6.1 Reversibility
When an isolated quantum system evolves it always does so reversibly so that
you could at any time determine what an earlier state of the system by using
its current state and ”playing the system backwards”. This implies that if a
quantum computer has components, similar to gates, that perform logical op
erations then these components, if behaving according to quantum mechanics,
will have to implement all the logical operations reversibly.
2.6.2 Irreversibility
Most classical circuits are not reversible. This means that they lose information
in the process of generating outputs from inputs, i.e. they are not invertible. An
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
Energy and Computation 27
a
b
a, b?
Figure 2.10: An irreversible NAND gate.
example of this is the NAND gate (ﬁgure 2.10). It is not possible in general, to
invert the output. E.g. knowing the output is 1 does not allowone to determine
the input: it could be 00, 10, or 01.
2.6.3 Landauer’s Principle
In 1961, IBM physicist Rolf Landauer, 1927  1999 showed that, when infor
mation is lost in an irreversible circuit that information is dissipated as heat
[Nielsen, M. A. 2002]. This result was obtained for circuits based on classical
physics.
Theoretically, if we were to build a classical computer with reversible compo
nents then work could be done with no heat loss, and no use of energy! Prac
tically though we still need to waste some energy for correcting any physical
errors that occur during the computation. A good example of the link between
reversibility and information is Maxwell’s demon, which is described next.
2.6.4 Maxwell’s Demon
Maxwell’s demon is a thought experiment comprised of (see ﬁgure 2.11) a box
ﬁlled with gas separated into two halves by a wall. The wall has a little door
that can be opened and closed by a demon. The second law of thermodynam
ics (see chapter 4) says that the amount of entropy in a closed system never
decreases. Entropy is the amount of disorder in a system or in this case the
amount of energy. The demon can, in theory, open and close the door in a cer
tain way to actually decrease the amount of entropy in the system.
Here are a list of steps to understanding the problem:
1. We have a box ﬁlled with particles with different velocities (shown by the
arrows).
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
28 Energy and Computation
The demon operates this door
Figure 2.11: Maxwell’s Demon.
2. A demon opens and closes a door in the centre of the box that allows parti
cles to travel through it.
3. The demon only opens the door when fast particles come from the right and
slow ones from the left.
4. The fast particles end up on the left hand side, the slow particles on the
right. The demon makes a temperature difference without doing any
work (which violates the second law of thermodynamics).
5. Rolf Landauer and R.W. Keyes resolved the paradox when they examined
the thermodynamic costs of information processing. The demon’s mind
gets ”hotter” as his memory stores the results, the operations are reversible
until his memory is cleared.
6. Almost anything can be done in a reversible manner (with no entropy cost).
2.6.5 Reversible Computation
In 1973 Charles Bennett expanded on Landauer’s work and asked whether it
was possible, in general, to do computational tasks without dissipating heat.
The loss of heat is not important to quantum circuits, but because quantum
mechanics is reversible we must build quantumcomputers with reversible gates.
We can simulate any classical gate with reversible gates. For example, a re
versible NAND gate can be made from a reversible gate called a Toffoli gate.
Reversible gates use control lines which in reversible circuits can be fed from
ancilla bits (which are work bits). Bits in reversible circuits may then go on to
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
Energy and Computation 29
become garbage bits that are only there to ensure reversibility. Control lines en
sure we have enough bits to recover the inputs from the outputs. The reason
they are called control lines is that they control (as in an if statement) whether
or not a logic operation is applied to the noncontrol bit(s). E.g. in CNOT below,
the NOT operation is applied to bit b if the control bit is on (=1).
2.6.6 Reversible Gates
Listed below are some of the common reversible gates and their truth tables.
Note: the reversible gate diagrams, and quantum circuit diagrams were built
with a L
A
T
E
X macro package called QCircuit which is available at http://
info.phys.unm.edu/Qcircuit/.
Controlled NOT
Like a NOT gate (on b) but with a control line, a. b
′
can also be expressed as a
XOR b.
a •
a
′
b
·
b
′
CNOT
a b a
′
b
′
0 0 0 0
0 1 0 1
1 0 1 1
1 1 1 0
Properties of the CNOT gate, CNOT(a, b):
CNOT(x, 0) : b
′
= a
′
= a = FANOUT. (2.5)
Toffoli Gate
If the two control lines are set it ﬂips the third bit (i.e. applies NOT). The Toffoli
gate is also called a controlledcontrolled NOT.
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
30 Energy and Computation
a •
a
′
b
•
b
′
c
·
c
′
Toffoli
a b c a
′
b
′
c
′
0 0 0 0 0 0
0 0 1 0 0 1
0 1 0 0 1 0
0 1 1 0 1 1
1 0 0 1 0 0
1 0 1 1 0 1
1 1 0 1 1 1
1 1 1 1 1 0
Properties of the Toffoli Gate, T
F
(a, b, c):
T
F
(a, b, c) = (a, b, c XOR(a AND b)). (2.6)
T
F
(1, 1, x) : c
′
= NOT x. (2.7)
T
F
(x, y, 1) : c
′
= x NAND y. (2.8)
T
F
(x, y, 0) : c
′
= x AND y. (2.9)
T
F
(x, 1, 0) : c
′
= a = a
′
= FANOUT. (2.10)
A combination of Toffoli gates can simulate a Fredkin gate.
Fredkin Gate
If the control line is set it ﬂips the second and third bits.
a •
a
′
b
×
b
′
c ×
c
′
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
Energy and Computation 31
Fredkin
a b c a
′
b
′
c
′
0 0 0 0 0 0
0 0 1 0 0 1
0 1 0 0 1 0
0 1 1 0 1 1
1 0 0 1 0 0
1 0 1 1 1 0
1 1 0 1 0 1
1 1 1 1 1 1
Properties of the Fredkin Gate, F
R
(a, b, c):
F
R
(x, 0, y) : b
′
= x AND y. (2.11)
F
R
(1, x, y) : b
′
= c and c
′
= b, which is CROSSOVER. (2.12)
F
R
(x, 1, 0) : c
′
= a
′
= c = FANOUT, with b
′
= NOT x. (2.13)
A combination of Fredkin gates can simulate a Toffoli gate.
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
32 Energy and Computation
Figure 2.12: A conventional reversible circuit.
2.6.7 Reversible Circuits
Reversible circuits have been implemented in a classical sense, an example of
a reversible circuit built with conventional technology is shown in ﬁgure 2.12.
Quantum computers use reversible circuits to implement quantum algorithms.
Chapters 6 and 7 contain many examples of these algorithms and their associ
ated circuits.
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
Chapter 3
Mathematics for Quantum
Computing
3.1 Introduction
In conventional computers we have logical operators (gates) such as NOT that
acts on bits. The quantum analogue of this is a matrix operator operating on a
qubit state vector. The mathematics we need to handle this includes:
• Vectors to represent the quantum state.
• Matrices to represent gates acting on the values.
• Complex numbers, because the components of the quantumstate vector are,
in general complex.
• Trig functions for the polar representation of complex numbers and the
fourier series.
• Projectors to handle quantum measurements.
• Probability theory for computing the probability of measurement outcomes.
As well as there being material here that you may not be familiar with (com
plex vector spaces for example), chances are that you’ll know at least some of
the math. The sections you knowmight be useful for revision, or as a reference.
This is especially true for the sections on polynomials, trigonometry, and logs
which are very succinct.
33
34 Polynomials
So what’s not in here? There’s obviously some elementary mathematics that
is not covered. This includes topics like fractions, percentages, basic algebra,
powers, radicals, summations, limits, factorisation, and simple geometry. If
you’re not comfortable with these topics then you may need to study them
before continuing on with this chapter.
3.2 Polynomials
A polynomial is an expression in the form:
c
0
+c
1
x +c
2
x
2
+... +c
n
x
n
(3.1)
where c
0
, c
1
, c
2
, ..., c
n
are constant coefﬁcients with c
n
̸= 0.
We say that the above is a polynomial in x of degree n.
Example Different types of polynomials.
3v
2
+ 4v + 7 is a polynomial in v of degree 2, i.e. a quadratic.
4t
3
−5 is a polynomial in t of degree 3, i.e. a cubic.
6x
2
+ 2x
−1
is not a polynomial as it contains a negative power for x.
3.3 Logical Symbols
A number of logical symbols are used in this text to compress formulae; they
are explained below:
∀ means for all.
Example ∀ n > 5, f(n) = 4 means that for all values of n greater than 5 f(n)
will return 4.
∃ means there exists.
Example ∃ n such that f(n) = 4 means there is a value of n that will make
f(n) return 4. Say if f(n) = (n−1)
2
+4, then the n value in question is n = 1.
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
Trigonometry Review 35
iff means if and only if.
Example f(n) = 4 iff n = 8 means f(n) will return 4 if n = 8 but for no
other values of n.
3.4 Trigonometry Review
3.4.1 Right Angled Triangles
Given the triangle,
&
&
&
&
&
&
&
&
&
&
&
&
b
a
c
θ
A
θ
B
θ
C
we can say the following:
a
2
+b
2
= c
2
, Pythagorean theorem (3.2)
and for the opposite side, adjacent side, and hypotenuse:
sin =
opp
hyp
, cos =
adj
hyp
, tan =
opp
adj
, (3.3)
sin θ
A
=
a
c
, sin θ
B
=
b
c
, (3.4)
tan θ
A
=
a
b
, tan θ
B
=
b
a
, (3.5)
cos θ
A
= sin θ
B
=
b
c
, cos θ
B
= sin θ
A
=
a
c
. (3.6)
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
36 Trigonometry Review
3.4.2 Converting Between Degrees and Radians
Angles in trigonometry can be represented in radians and degrees. For con
verting degrees to radians:
rads =
n
◦
×π
180
. (3.7)
For converting radians to degrees we have:
n
◦
=
180 ×rads
π
. (3.8)
Some common angle conversions are:
360
◦
= 0
◦
= 2π rads.
1
◦
=
π
180
rads.
45
◦
=
π
4
rads.
90
◦
=
π
2
rads.
180
◦
= π rads.
270
◦
=
3π
2
rads.
1 rad = 57
◦
.
3.4.3 Inverses
Here are some inverses for obtaining θ from sin θ, cos θ, and tan θ:
sin
−1
= arcsin = θ from sin θ. (3.9)
cos
−1
= arccos = θ from cos θ. (3.10)
tan
−1
= arctan = θ from tan θ. (3.11)
3.4.4 Angles in Other Quadrants
The angles for right angled triangles are in quadrant 1 (i.e. from 0
◦
to 90
◦
). If
we want to measure larger angles like 247
◦
we must determine which quadrant
the angle is in (here we don’t consider angles larger than 360
◦
). The following
diagram has the rules for doing so:
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
Trigonometry Review 37
0
◦
≤ θ ≤ 90
◦
90
◦
≤ θ ≤ 180
◦
180
◦
≤ θ ≤ 270
◦
270
◦
≤ θ ≤ 360
◦
(0
◦
)
No change
Make cos and tan negative
Change θ to 180
◦
−θ
Make sin and cos negative
Change θ to θ −180
◦
Make sin and tan negative
Change θ to 360
◦
−θ
Example Using the diagram above we can say that sin(315
◦
) = −sin(45
◦
)
and cos(315
◦
) = cos(45
◦
).
3.4.5 Visualisations and Identities
The functions y = sin(x) and y = cos(x) are shown graphically below, where x
is in radians.
−1.5
−1
−0.5
0
0.5
1
1.5
10 5 0 5 10
sin(x)
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
38 Logs
−1.5
−1
−0.5
0
0.5
1
1.5
10 5 0 5 10
cos(x)
Finally, here are some important identities (where sin
2
θ = (sin θ)
2
and cos
2
θ =
(cos θ)
2
):
sin
2
θ + cos
2
θ = 1. (3.12)
sin(−θ) = −sin θ. (3.13)
cos(−θ) = cos θ. (3.14)
tan(−θ) = −tan θ. (3.15)
3.5 Logs
The logarithm of a number (say x) to base b is the power of b that gives back the
number, i.e. b
log
b
x
= x. E.g. The log of x = 100 to base b = 10 is the power (2) of
10 that gives back 100, i.e. 10
2
= 100. So log
10
100 = 2.
Put another way, the answer to a logarithm is the power y put to a base b given
an answer x, with:
y = log
b
x (3.16)
and,
x = b
y
(3.17)
where x >= 0, b >= 0, and b ̸= 1.
Example log
2
16 = 4 is equivalent to 2
4
= 16.
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
Complex Numbers 39
E
T
c
' Z
Z
Z
Z
Z´
a
b
z
r
θ
3
3
Real axis
Imaginary axis
Figure 3.1: Representing z = a+ib in the complex plane with coordinates a = 3
and b = 3. Note the imaginary axis which accounts for i.
3.6 Complex Numbers
A complex number, z is a number in the form:
z = a +ib (3.18)
where a, b ∈ R (the real numbers) where i stands for
√
−1. The complex num
ber z is said to be in C (the complex numbers). z is called complex because it is
made of two parts, a and b. Sometimes we write z = (a, b) to express this.
i is called an imaginary number and was created to solve problems like x
2
+1 =
0, which had no traditional solution.
Except for the rules regarding i, the operations of addition, subtraction, and
multiplication of complex numbers follow the normal rules of arithmetic. Di
vision requires using a complex conjugate, which is introduced in the next sec
tion. With these operations deﬁned via the examples in the box below.
The systemof complex numbers is closed in that, except for division by 0, sums,
products, and ratios of complex numbers give back a complex number: i.e. we
stay within the system. Here are examples of i itself:
i
−3
= i, i
−2
= −1, i
−1
= −i, i =
√
−1, i
2
= −1, i
3
= −i, i
4
= 1, i
5
= i, i
6
= −1.
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
40 Complex Numbers
So the pattern (−i, 1, i, −1) repeats indeﬁnitely (aside from i itself).
Example Basic complex numbers.
Addition:
(5 + 2i) + (−4 + 7i) = 1 + 9i
Multiplication:
(5 + 2i)(−4 + 3i) = 5(−4) + 5(3)i + 2(−4)i + (2)(3)i
2
= −20 + 15i −8i −6
= −26 + 7i.
Finding Roots:
(−5i)
2
= 5i
2
= 5
2
i
2
= 25(−1)
= −25.
−25 has roots 5i and −5i.
3.6.1 Polar Coordinates and Complex Conjugates
Complex numbers can be represented in polar form, (r, θ) where r is the magni
tude and θ is called the phase:
(r, θ) = (z, θ) = z(cos θ +i sin θ) (3.19)
where θ, r ∈ R and z is the norm (also called the modulus) of z:
z =
√
a
2
+b
2
(3.20)
or,
z =
√
z
∗
z (3.21)
where z
∗
is the complex conjugate of z:
z
∗
= a −ib. (3.22)
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
Complex Numbers 41
E
T
c
' Z
Z
Z
Z
Z´
`
`
`
`
`·
`
`
`
`
``
Z
Z
Z
Z
Z»
−z
∗
z
z
∗
−z
Real axis
Imaginary axis
Figure 3.2: z, z
∗
, −z
∗
, and −z.
Two complex numbers may be equivalent when they differ in phase. Com
plex numbers are only unique if the phase is restricted to 0 ≤ θ ≤ 2π. It is not
practical to restrict the phase during calculations (we may for example want to
add angles) but afterwards we can reduce the phase modulo 2π. For two polar
representations of complex numbers, if the magnitude is the same and the the
phase is the same modulo 2π then they are equivalent.
Example Reduction by modulo 2π.
(2, π) and (2, 5π) are equivalent because the phase differs by (2)2π.
Polar Coordinates
For polar coordinates (ﬁgure 3.1) we can say that θ is the angle between a line
drawn between a point (a, b) of length r on the complex plane and the x axis
with the coordinates being taken for the complex number as x = a and y = b.
The horizontal axis is called the real axis and the vertical axis is called the imag
inary axis. It’s also helpful to look at the relationships between z, z
∗
, −z
∗
and z
graphically. These are shown in ﬁgure 3.2.
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
42 Complex Numbers
So for converting from polar to cartesian coordinates:
(r, θ) = a +bi (3.23)
where a = r cos θ and b = r sin θ. Conversely, converting cartesian to polar form
is a little more complicated:
a +bi = (r, θ) (3.24)
where r = z =
√
a
2
+b
2
and θ is the solution to tan θ =
b
a
which lies in the
following quadrant:
1. If a > 0 and b > 0
2. If a < 0 and b > 0
3. If a < 0 and b < 0
4. If a > 0 and b < 0.
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
Complex Numbers 43
Example Convert (3, 40
◦
) to a +bi.
a = r cos θ = 3 cos 40
◦
= 3(0.77)
= 2.3
b = r sin θ = 3 cos 40
◦
= 3(0.64)
= 1.9
z = 2.3 + 1.9i .
Example Convert −1 + 2i to (r, θ). This gives us a = −1 and b = 2.
r =
√
(−1)
2
+ 2
2
=
√
5
= 2.2
tan θ =
b
a
=
2
−1
= −2
arctan(−2) = −63.4
◦
Since a < 0 and b > 0 we use quadrant 2 so we negate −63.4 and subtract
that from 180 which gives us θ = 116.6
◦
and the solution is:
−1 + 2i = (2.2, 116.6
◦
) .
3.6.2 Rationalising and Dividing
1
a+bi
is rationalised by multiplying the numerator and denominator by a −bi.
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
44 Complex Numbers
Example Rationalisation.
1
5 + 2i
=
1
5 + 2i
(5 −2i)
(5 −2i)
=
5
29
−
2
29
i .
Division of complex numbers is done by rationalising in terms of the denomi
nator.
Example Division of complex numbers.
3 + 2i
2i
=
3 + 2i
2i
(−2i)
(−2i)
=
−6i −4i
2
−4i
2
=
−6i + 4
4
= 1 −
3
2
i .
3.6.3 Exponential Form
Complex numbers can also be represented in exponential form:
z = re
iθ
. (3.25)
The derivation of which is:
z = z(cos θ +i sin θ)
= r(cos θ +i sin θ)
= re
iθ
.
This is because:
e
iθ
= cos θ +i sin θ, (3.26)
e
−iθ
= cos θ −i sin θ. (3.27)
which can be rewritten as:
cos θ =
e
iθ
+e
−iθ
2
, (3.28)
sin θ =
e
iθ
−e
−iθ
2i
. (3.29)
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
Complex Numbers 45
To prove (3.26) we use a power series exponent (which is an inﬁnite polyno
mial):
e
x
= 1 +x +
x
2
2!
+
x
3
3!
+. . . , (3.30)
e
iθ
= 1 +iθ −
θ
2
2!
−
iθ
3
3!
+
θ
4
4!
−. . . (3.31)
= 1 −
θ
2
2!
+
θ
4
4!
+i(θ −
iθ
3
3!
+. . .) (3.32)
= cos θ +i sin θ. (3.33)
Example Convert 3 +3i to exponential form. This requires two main steps,
which are:
1. Find the modulus.
r = z =
√
3
2
+ 3
2
=
√
18.
2. To ﬁnd θ, we can use the a and b components of z as opposite and adjacent
sides of a right angled triangle in quadrant one (see ﬁgure 3.1). which
means need to apply arctan. So given tan
−1 3
3
=
π
4
then z in exponential
form looks like:
√
18e
πi/4
.
Example Convert e
πi3/4
to the form: a +bi (also called rectangular form).
e
πi3/4
= e
i(3π/4)
= cos
3π
4
+i sin
3π
4
= cos 135
◦
+i sin 135
◦
=
−1
√
2
+
i
√
2
=
−1 +i
√
2
.
Properties:
z
∗
= re
−iθ
. (3.34)
e
−i2π
= 1. (3.35)
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
46 Matrices
3.7 Matrices
Matrices will be needed in quantum computing to represent gates, operators,
and vectors. So even if you know this material it’ll be useful to revise as they
are used so often.
A matrix is an array of numbers, the numbers in the matrix are called entries,
for example:
17 24 1 8
23 5 7 14
4 6 13 20
¸
¸
¸
.
3.7.1 Matrix Operations
Just as we could deﬁne arithmetic operators  addition and multiplication for
complex numbers, we can do the same for matrices.
Given the following 3 matrices:
M
A
=
¸
2 1
3 4
¸
,
M
B
=
¸
2 1
3 5
¸
,
M
C
=
¸
2 1 0
3 4 0
¸
.
Addition
Addition can only be done when the matrices are of the same dimensions (the
same number of columns and rows), e.g:
M
A
+M
B
=
¸
4 2
6 9
¸
.
Scalar Multiplication
The product of multiplying a scalar (i.e. a number) by a matrix is a new matrix
that is found by multiplying each entry in the given matrix. Given a scalar
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
Matrices 47
α = 2 :
αM
A
=
¸
4 2
6 8
¸
.
Matrix Multiplication
The product of multiplying matrices M and N with dimensions M = m×r and
N = r×n is a matrix Owith dimension O = m×n. The resulting matrix is found
by O
ij
=
∑
r
k=1
M
i
rN
r
j where i and j denote row and column respectively. The
matrices M and N must also satisfy the condition that the number of columns
in M is the same as the number of rows in N.
M
B
M
C
=
¸
(2 ×2) + (1 ×3) (2 ×1) + (1 ×4) (2 ×0) + (1 ×0)
(3 ×2) + (5 ×3) (3 ×1) + (5 ×4) (3 ×0) + (5 ×0)
¸
=
¸
7 6 0
21 23 0
¸
.
Basic Matrix Arithmetic
Suppose M, N, and O are matrices and α and β are scalars:
M +N = N +M. Commutative law for addition (3.36)
M + (N +O) = (M +N) +O. Associative law for addition (3.37)
M(NO) = (MN)O. Associative law for multiplication (3.38)
M(N +O) = MN +MO. Distributive law (3.39)
(N +O)M = NM +OM. Distributive law (3.40)
M(N −O) = MN −MO. (3.41)
(N −O)M = NM −OM. (3.42)
α(N +O) = αN +αO. (3.43)
α(N −O) = αN −αO. (3.44)
(α +β)O = αO +βO. (3.45)
(α −β)O = αO −βO. (3.46)
(αβ)O = α(βO). (3.47)
α(NO) = (αN)O = N(αO). (3.48)
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
48 Matrices
You may have noticed that there is no commutative law for multiplication. It is
not always the case that MN = NM. This is important in quantum mechanics,
which follows the same noncommutative multiplication law.
Zero Matrix
The special case of a matrix ﬁlled with zeroes.
0 =
¸
0 0
0 0
¸
. (3.49)
Identity Matrix
A matrix multiplied by the identity matrix (corresponding to unity in the ordi
nary numbers) will not change.
I =
¸
1 0
0 1
¸
, (3.50)
M
A
I =
¸
2 1
3 4
¸
.
Inverse Matrix
A number a has an inverse a
−1
where aa
−1
= a
−1
a = 1. Equivalently a matrix
A has an inverse:
A
−1
where AA
−1
= A
−1
A = I. (3.51)
Even with a simple 2×2 matrix it is not a trivial matter to determine its inverses
(if it has any at all). An example of an inverse is below, for a full explanation of
how to calculate an inverse you’ll need to consult an external reference.
M
−1
A
=
¸
4
5
−1
5
−3
5
2
5
¸
.
Note A
−1
only exists iff A has full rank (see Determinants and Rank below).
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
Matrices 49
Transpose Matrix
A
T
is the transpose of matrix A if:
A
T
ji
= A
ij
. (3.52)
Here’s an example:
M
T
C
=
2 3
1 4
0 0
¸
¸
¸
.
For a square matrix like M
A
you get the transpose by reﬂecting about the diag
onal (i.e. ﬂipping the values).
Determinants and Rank
Rank is the number of rows (or columns) which are not linear combinations (see
section 3.8.6) of other rows.
In the case of a square matrix A (i.e., m = n), then A is invertible iff A has
rank n (we say that A has full rank). A matrix has full rank when the rank is the
number of rows or columns, whichever is smaller. A nonzero determinant (see
below) determines that the matrix has full rank. So a nonzero determinant im
plies the matrix has an inverse and viceversa, if the determinant is 0 the matrix
is singular (i.e. doesn’t have an inverse).
The determinant of a simple 2 ×2 matrix is deﬁned as:
det
¸
a b
c d
¸
= ad −bc. (3.53)
So now for an example of rank, given the matrix below,
M
D
=
¸
2 4
3 6
¸
.
We can say it has rank 1 because row 2 is a multiple (by
3
2
) of row 1. It’s deter
minant, 2 ×6 −3 ×4 is 0.
Determinants of larger matrices can be found by decomposing theminto smaller
2 ×2 matrices, for example:
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
50 Vectors and Vector Spaces
det
a b c
d e f
g h i
¸
¸
¸
= a · det
¸
e f
h i
¸
−b · det
¸
d f
g i
¸
+c · det
¸
d e
g h
¸
.
(3.54)
Determinants, like inverses are not trivial to calculate. Again, for a full expla
nation you’ll need to consult an external reference.
3.8 Vectors and Vector Spaces
3.8.1 Introduction
Vectors are line segments that have both magnitude and direction. Vectors
for quantum computing are in complex vector space C
n
called n dimensional
Hilbert space. But it’s helpful to look at simpler vectors in real space (i.e. ordi
nary 2D space) ﬁrst.
Vectors in R
A vector in R (the real numbers) can be represented by a point on the cartesian
plane (x, y) if the tail of the vector starts at the origin (see ﬁgure 3.3). The x
and y coordinates that relate to the x and y axes are called the components of the
vector.
The tail does not have to start at the origin and the vector can move anywhere
in the cartesian plane as long as it keeps the same direction and length. When
vectors do not start at the origin they are made up of two points, the initial point
and the terminal point. For simplicity’s sake our vectors in R all have an initial
point at the origin and our coordinates just refer to the terminal point.
The collection of all the vectors corresponding to all the different points in the
plane make up the space (R
2
). We can make a vector 3D by using another axis
(the z axis) and extending into 3 space (R
3
) (see ﬁgure 3.7). This can be further
extended to more dimensions using n space (R
n
).
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
Vectors and Vector Spaces 51
E
T
c
' Z
Z
Z
Z
Z´
`
`·





«
(3, 3)
(−1, −1)
(−3, 1)
Figure 3.3: Vectors in R
2
(i.e. ordinary 2D space like a table top).
E
T
¡
¡
¡
¡
¡
¡
¡
Z
Z
Z
Z´
/
/
/
/
`
`
`
`
`
`
`
`
x
y
z
u
x
u
y
u
z
u = (u
x
, u
y
, u
z
)
Figure 3.4: A 3D vector with components u
x
, u
y
, u
z
.
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
52 Vectors and Vector Spaces
E
T
c
'
`
`
`
`
`·
`
`
`
`
`·
`
`
`
`
`·
Z´
`
`
``
a
b
c
d
e
Figure 3.5: Vector examples.
Example A point in 5 dimensional space is represented by the ordered 5
tuple (4, 7, 8, 17, 20).
We can think of some vectors as having local coordinate systems that are offset
fromthe origin. In computer graphics the distinction is that coordinate systems
are measured in world coordinates and vectors are terminal points that are lo
cal to that coordinate system (see ﬁgure 3.6).
Example Example vectors in R in ﬁgure 3.5.
a = b = c,
d ̸= e ̸= a.
Two Interesting Properties of Vectors in R
3
Vectors in R
3
are represented here by a bolded letter. Let u = (u
x
, u
y
, u
z
) and
v = (v
x
, v
y
, v
z
) (two vectors). An important operation is the dot product (used
below to get the angle between two vectors):
u · v = u
x
v
x
+u
y
v
y
+u
z
v
z
. (3.55)
The dot (·) here means the inner, or dot product. This operation takes two vec
tors and returns a number (not a vector).
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
Vectors and Vector Spaces 53
Knowing the components we can calculate the magnitude (the length of the vec
tor) using Pythagoras’ theorem as follows:
∥u∥ =
√
u
x
u
x
+u
y
u
y
+u
z
u
z
. (3.56)
Example if u = (1, 1, 1) then ∥u∥ =
√
3.
Example if u = (1, 1, 1) and v = (2, 1, 3) then:
cos θ =
2 + 1 + 3
√
3
√
14
=
√
6
7
.
Vectors in C
V = C
n
is a complex vector space with dimension n, this is the set containing all
column vectors with n complex numbers laid out vertically (the above exam
ples were rowvectors with components laid out horizontally). We also deﬁne a
vector subspace as a non empty set of vectors which satisfy the same conditions
as the parent’s vector space.
3.8.2 Column Notation
In C
2
for example, the quantum mechanical notation for a ket can be used to
represent a vector.
u⟩ =
¸
u
1
u
2
¸
(3.57)
where u
1
= a
1
+b
1
i and u
2
= a
2
+b
2
i.
u⟩
can also be represented in row form:
u⟩ = (u
1
, u
2
) (3.58)
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
54 Vectors and Vector Spaces
Example Column Notation.
0⟩ =
¸
1
0
¸
and, 1⟩ =
¸
0
1
¸
.
Example Here’s a more complex example:
u⟩ = (1 +i)0⟩ + (2 −3i)1⟩
=
¸
1 +i
2 −3i
¸
.
3.8.3 The Zero Vector
The 0 vector is the vector where all entries are 0.
3.8.4 Properties of Vectors in C
n
Given scalars (α, β) ∈ C and vectors (u⟩, v⟩, w⟩) ∈ C
n
.
Scalar Multiplication and Addition
Listed here are some basic properties of complex scalar multiplication and ad
dition.
αu⟩ =
αu
1
.
.
.
αu
n
¸
¸
¸
¸
. (3.59)
α(βu⟩) = αβu⟩. (3.60)
α(u⟩ +v⟩) = αu⟩ +αv⟩. Associative law for scalar multiplication (3.61)
(α +β)u⟩ = αu⟩ +βu⟩. Distributive law for scalar addition (3.62)
α(u⟩ +v⟩) = αu⟩ +αv⟩. (3.63)
Vector Addition
A sum of vectors can be represented by:
u⟩ +v⟩ =
u
1
+v
1
.
.
.
u
n
+v
n
¸
¸
¸
¸
. (3.64)
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
Vectors and Vector Spaces 55
This sum has the following properties:
u⟩ +v⟩ = v⟩ +u⟩. Commutative (3.65)
(u⟩ +v⟩) +w⟩ = u⟩ + (v⟩ +w⟩). Associative (3.66)
u⟩ + 0 = u⟩. (3.67)
For every u⟩ ∈ C
n
there is a corresponding unique vector −u⟩ such that:
u⟩ + (−u⟩) = 0. (3.68)
3.8.5 The Dual Vector
The dual vector ⟨u corresponding to a ket vector u⟩ is obtained by transpos
ing the corresponding column vector and conjugating its components. This is
called, in quantum mechanics, a bra and we have:
⟨u = u⟩
†
= [u
∗
1
, u
∗
2
, . . . , u
∗
n
]. (3.69)
The dagger symbol, † is called the adjoint and is introduced in section 3.8.19.
Example The dual of 0⟩.
⟨0 = 0⟩
†
= [1
∗
, 0
∗
].
Example Given the vector u⟩ where:
u⟩ =
¸
1 −i
1 +i
¸
.
The dual of u⟩ is:
⟨u = [(1 −i)
∗
, (1 +i)
∗
]
= [(1 +i), (1 −i)]
3.8.6 Linear Combinations
A vector u⟩ is a linear combination of vectors v
1
⟩, v
2
⟩, . . . , v
n
⟩ if u⟩ can be ex
pressed by:
u⟩ = α
1
v
1
⟩ +α
2
v
2
⟩ +. . . +α
n
v
n
⟩ (3.70)
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
56 Vectors and Vector Spaces
where scalars α
1
, α
2
, . . . , α
n
are complex numbers.
We can represent a linear combination as:
u⟩ =
n
∑
i=1
α
i
v
i
⟩. (3.71)
3.8.7 Linear Independence
A set of nonzero vectors υ
1
⟩, ..., υ
n
⟩ is linearly independent if:
n
∑
i=1
a
i
υ
i
⟩ = 0 iff a
1
= ... = a
n
= 0. (3.72)
Example Linear dependence. The row vectors (bras) [1, −1], [1, 2], and [2, 2]
are linearly dependent because:
[1, −1] + [1, 2] −[2, 1] = [0, 0]
i.e there is a linear combination with a
1
= 1, a
2
= 1, a
3
= −1 (other than the
zero condition above) that evaluates to 0; So they are not linearly indepen
dent.
3.8.8 Spanning Set
A spanning set is a set of vectors υ
1
⟩, ..., υ
n
⟩ for V in terms of which every vec
tor in V can be written as a linear combination.
Example Vectors u = [1, 0, 0], v = [0, 1, 0], and w = [0, 0, 1] span R
3
because
all vectors [x, y, z] in R
3
can be written as a linear combination of u, v, and w
like the following:
[x, y, z] = xu +yv +zw.
3.8.9 Basis
Abasis is any set of vectors that are a spanning set and are linearly independent.
Most of the time with quantum computing we’ll use a standard basis, called
the computational basis. This is also called an orthonormal basis (see section
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
Vectors and Vector Spaces 57
3.8.15). In C
2
we can use 0⟩ and 1⟩ for the basis. In C
4
we can use 00⟩,01⟩,10⟩,
and 11⟩ for a basis (the tensor product is needed to understand this  see section
3.8.28).
3.8.10 Probability Theory
An event x
i
has a probability p
i
of occuring which lies in the range:
0 ≤ p
i
≤ 1 (3.73)
Aprobability of p
i
= 0 means x
i
is impossible and a probability of p
i
= 1 means
x
i
is certain.
Say there are n events and the xth event happens n
x
times and also we have
∑
x=1
n
x
= n. The xth event will occur with the following probability:
p
x
=
n
x
n
(3.74)
This implies the probabilties all sum to 1.
We call the average of the probabilites the expectation value which is deﬁned
as:
⟨x⟩ =
∑
x=1
xp
x
= n (3.75)
Example A group of salesmen make a number of sales
Sales Salesmen
10 6
20 12
30 6
The number of salesmen is n = 6 + 12 + 6 = 24
The probability of a salesman making 20 sales is:
p
2
=
n
2
n
=
12
24
= 0.5
The expectation value ⟨x⟩ is:
⟨x⟩ =
∑
x=1
xp
x
= 10(0.25) + 20(0.5) + 30(0.25) = 20
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
58 Vectors and Vector Spaces
3.8.11 Probability Amplitudes
We can write a vector as a combination of basis vectors. In quantum me
chanics we use a state vector Ψ⟩. The state vector in C
2
is often written as
Ψ⟩ = α0⟩ +β1⟩.
The scalars (e.g. α and β in α0⟩ + β1⟩) associated with our basis vectors are
called probability amplitudes. Because in quantummechanics they give the prob
abilities of projecting the state into a basis state, 0⟩ or a 1⟩, when the appropri
ate measurement is performed (see chapter 4).
To ﬁt with the probability interpretation the square of the absolute values of
the probability amplitudes must sum to 1:
α
2
+β
2
= 1. (3.76)
Example Determine the probabilities of measuring a 0⟩ or a 1⟩ for
√
1
3
0⟩ +
√
2
3
1⟩.
First, check if the probabilities sum to 1.
√
1
3
2
+
√
2
3
2
=
1
3
+
2
3
= 1.
They do sum to 1 so convert to percentages.
1
3
(100) = 33.
˙
3 and
2
3
(100) = 66.
˙
6 .
So this give us a 33.
˙
3% chance of measuring a 0⟩ and a 66.
˙
6% chance of
measuring a 1⟩.
3.8.12 The Inner Product
We’ve already met the inner (or dot) product in R
2
in section 3.7.1. The inner
product in quantum computing is deﬁned in terms of C
n
, but it’s helpful to
think of what the inner product gives us in R
2
, which is the angle between two
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
Vectors and Vector Spaces 59
E
T
c
' .
.
.
.
.
.
.·
Z
Z
Z
Z
Z´
θ
Figure 3.6: The dot product.
vectors. The dot product in R
2
is shown here (also see ﬁgure 3.6):
u · v = ∥u∥∥v∥ cos θ (3.77)
and rearranging we get:
θ = cos
−1
u · v
∥u∥∥v∥
. (3.78)
Now we’ll look at the inner product in C
n
, which is deﬁned in terms of a dual.
An inner product in C
n
combines two vectors and produces a complex number.
So given,
u⟩ =
α
1
.
.
.
α
n
¸
¸
¸
¸
and,
v⟩ =
β
1
.
.
.
β
n
¸
¸
¸
¸
we can calculate the inner product:
[α
∗
1
, ..., α
∗
n
]
β
1
.
.
.
β
n
¸
¸
¸
¸
= ⟨u ×v⟩ (3.79)
= ⟨uv⟩. (3.80)
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
60 Vectors and Vector Spaces
An inner product can also be represented in the following format:
(u⟩, v⟩) = ⟨uv⟩. (3.81)
So for C
2
the following are equivalent:
¸
u
1
u
2
¸
,
¸
v
1
v
2
¸
= (u⟩, v⟩) = ⟨u ×v⟩ = ⟨uv⟩ = [u
∗
1
, u
∗
2
]
¸
v
1
v
2
¸
= u
∗
1
v
1
+u
∗
2
v
2
.
Example Using the inner product notation from above we can extract a
probability amplitude if we use one of the basis vectors as the original vec
tor’s dual:
⟨0(α0⟩ +β1⟩) = [1
∗
, 0
∗
]
¸
α
β
¸
= α
or using dot product notation,
⟨0(α0⟩ +β1⟩) =
¸
1
0
¸
•
¸
α
β
¸
= α.
This is called braket notation. Hilbert space is the vector space for complex
inner products.
Properties:
⟨uv⟩ = ⟨vu⟩
∗
. (3.82)
⟨uαv⟩ = ⟨α
∗
uv⟩ = α⟨uv⟩. (3.83)
⟨uv +w⟩ = ⟨uv⟩ = ⟨uw⟩. (3.84)
∀ u⟩[R ∋ ⟨uu⟩ ≥ 0]. (3.85)
If ⟨uu⟩ = 0 then u⟩ = 0. (3.86)
⟨uv⟩
2
≤ ⟨uu⟩⟨vv⟩. The CauchySchwartz inequality (3.87)
3.8.13 Orthogonality
Orthogonal vectors can be thought of as being ”perpendicular to each other”;
two vectors are orthogonal iff:
u⟩ ̸= 0, v⟩ ̸ = 0, and ⟨uv⟩ = 0. (3.88)
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
Vectors and Vector Spaces 61
Example The vectors:
u⟩ =
¸
1
0
¸
and v⟩ =
¸
0
1
¸
are orthogonal because:
[1
∗
, 0
∗
]
¸
0
1
¸
= 0.
Example The vectors:
u⟩ =
¸
1
1
¸
and v⟩ =
¸
1
−1
¸
are orthogonal because:
⟨uv⟩ = ((1, 1), (1, −1))
= 1 ×1 + 1 ×(−1)
= 0.
Example The vectors:
u⟩ =
¸
1 +i
2 −2i
¸
and v⟩ =
¸
−i
1
2
¸
are orthogonal because:
[1 −i, 2 + 2i]
¸
−i
1
2
¸
= 0.
3.8.14 The Unit Vector
A vector’s norm is:
∥u⟩∥ =
√
⟨uu⟩ . (3.89)
A unit vector is a vector where its norm is equal to 1.
∥u⟩∥ = 1. (3.90)
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
62 Vectors and Vector Spaces
If we want to make an arbitrary vector a unit vector, which here is represented
by theˆ(hat) symbol. We must normalise it by dividing by the norm:
ˆ u⟩ =
u⟩
∥u⟩∥
. (3.91)
Example Normalise u⟩ =
¸
1
1
¸
(= 0⟩ +1⟩).
First we ﬁnd the norm:
∥u⟩∥ =
[1
∗
, 1
∗
]
¸
1
1
¸
=
√
2 .
Now we normalise ∥u⟩∥ to get:
ˆ u⟩ =
¸
1
1
¸
√
2
=
1
√
2
¸
1
1
¸
=
¸
1
√
2
1
√
2
¸
=
1
√
2
0⟩ +
1
√
2
1⟩.
3.8.15 Bases for C
n
C
n
has a standard basis (see 3.7.9) which is:
1
0
. . .
0
¸
¸
¸
¸
¸
¸
,
0
1
. . .
0
¸
¸
¸
¸
¸
¸
, . . . ,
0
0
. . .
1
¸
¸
¸
¸
¸
¸
. (3.92)
This is written as 0⟩, 1⟩, . . . , n − 1⟩. Any other vector in the same space can
be expanded in terms of 0⟩, 1⟩, ..., n − 1⟩. The basis is called orthonormal be
cause the vectors are of unit length and mutually orthogonal. There are other
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
Vectors and Vector Spaces 63
E
T
¡
¡
¡
¡
¡
¡
¡
E
T
¡
¡
x
y
z
Figure 3.7: A local coordinate system.
orthonormal bases in C
n
and, in quantum computing, it is sometimes conve
nient to switch between bases.
Example Orthonormal bases 0⟩, 1⟩ and
1
√
2
(0⟩ +1⟩),
1
√
2
(0⟩ −1⟩) are often
used for quantum computing.
It’s useful at this point to consider what an orthonormal basis is in R
3
. The
”ortho” part of orthonormal stands for orthogonal, which means the vectors
are perpendicular to each other, for example the 3D axes (x, y, z) are orthog
onal. The ”normal” part refers to normalised (unit) vectors. We can use an
orthonormal basis in R
3
to separate world coordinates from a local coordinate
system in 3D computer graphics. In this system we deﬁne the position of the
local coordinate system in world coordinates and then we can deﬁne the po
sitions of individual objects in terms of the local coordinate system. In this
way we can transform the local coordinates system, together with everything
in it while leaving the world coordinates system intact. In ﬁgure 3.7 the local
coordinate system forms an orthonormal basis.
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
64 Vectors and Vector Spaces
3.8.16 The Gram Schmidt Method
Suppose u
1
⟩, . . . , u
n
⟩ is a basis (any basis will do) for vector space V that has
an inner product. Suppose this basis is not orthonormal.
The Gram Schmidt method can be used to produce an orthonormal basis set
v
1
⟩, . . . , v
n
⟩ for V by,
v
1
⟩ =
u
1
⟩
∥u
1
⟩∥
(3.93)
and given v
k+1
⟩ for 1 ≤ k < n −1:
v
k+1
⟩ =
u
k+1
⟩ −
∑
k
i=1
⟨v
i
u
k+1
⟩v
i
⟩
∥u
k+1
⟩ −
∑
k
i=1
⟨v
i
u
k+1
⟩v
i
⟩∥
. (3.94)
Example Given the following vectors in C
3
: u
1
⟩ = (i, i, i), u
2
⟩ = (0, i, i),
and u
3
⟩ = (0, 0, i) ﬁnd an orthonormal basis v
1
⟩, v
2
⟩, v
3
⟩.
v
1
⟩ =
u
1
⟩
∥u
1
⟩∥
=
(i, i, i)
√
3
=
i
√
3
,
i
√
3
,
i
√
3
v
2
⟩ =
u
2
⟩ −⟨v
1
u
2
⟩v
1
⟩
∥u
2
⟩ −⟨v
1
u
2
⟩v
1
⟩∥
=
−
2i
√
6
,
i
√
6
,
i
√
6
v
3
⟩ =
u
3
⟩ −⟨v
1
u
3
⟩v
1
⟩ −⟨v
2
u
3
⟩v
2
⟩
∥u
3
⟩ −⟨v
1
u
3
⟩v
1
⟩ −⟨v
2
u
3
⟩v
2
⟩∥
=
0, −
i
2
,
i
2
.
3.8.17 Linear Operators
A linear operator A : V → W where V and W are complex vector spaces is
deﬁned as:
A(αu⟩ +βv⟩) = α(A(u⟩) +β(Av⟩)). (3.95)
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
Vectors and Vector Spaces 65
With dimensions n for V and m for W the linear operator can be represented
by an m×n matrix.
Example Given a linear operator A, apply it to
√
1
3
0⟩ +
√
2
3
1⟩:
A =
¸
0 1
1 0
¸
, 0⟩ =
¸
1
0
¸
, 1⟩ =
¸
0
1
¸
.
A
√
1
3
0⟩ +
√
2
3
1⟩
=
¸
0 1
1 0
¸
√
1
3
0⟩ +
√
2
3
1⟩
=
¸
0 1
1 0
¸
√
1
3
√
2
3
¸
¸
=
√
2
3
√
1
3
¸
¸
=
√
2
3
0⟩ +
√
1
3
1⟩.
Properties:
⟨uAv⟩ is the inner product of ⟨u and Av⟩. (3.96)
3.8.18 Outer Products and Projectors
We deﬁne an outer product, u⟩⟨v as a linear operator A which does the follow
ing:
(u⟩⟨v)(w⟩) = u⟩⟨vw⟩ = ⟨vw⟩u⟩. (3.97)
This can be read as,
1. The result of the linear operator u⟩⟨v acting on w⟩
or,
2. The result of multiplying u⟩ by ⟨vw⟩.
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
66 Vectors and Vector Spaces
In terms of matrices, u⟩⟨v can be represented by:
u
1
u
2
.
.
.
¸
¸
¸
¸
v
∗
1
v
∗
2
. . .
=
u
1
v
∗
1
u
1
v
∗
2
. . . u
1
v
∗
n
u
2
v
∗
1
u
2
v
∗
2
. . . u
2
v
∗
n
.
.
.
.
.
.
u
n
v
∗
1
u
n
v
∗
2
. . . u
n
v
∗
n
¸
¸
¸
¸
¸
¸
. (3.98)
Example Take Ψ⟩ = α0⟩ +β1⟩ then:
1⟩⟨1Ψ⟩ = 1⟩⟨1(α0⟩ +β1⟩)
= 1⟩β
= β1⟩,
0⟩⟨1Ψ⟩ = 0⟩⟨1(α0⟩ +β1⟩)
= 0⟩β
= β0⟩,
1⟩⟨0Ψ⟩ = 1⟩⟨0(α0⟩ +β1⟩)
= 1⟩α
= α1⟩,
0⟩⟨0Ψ⟩ = 0⟩⟨0(α0⟩ +β1⟩)
= 0⟩α
= α0⟩.
In the chapters ahead we will use projectors to deal with quantum measure
ments. Say we have a vector space V = {00⟩, 01⟩, 10⟩, 11⟩}. A projector P on
to the subspace V
s
= {00⟩, 01⟩} behaves as follows:
P(α
00
00⟩ +α
01
01⟩ +α
10
10⟩ +α
11
11⟩) = α
00
00⟩ +α
01
01⟩.
P projects any vector in V onto V
s
(components not in V
s
are discarded). We
can represent projectors with outer product notation. Given a subspace which
is spanned by orthonormal vectors, {u
1
⟩, u
2
⟩ . . . , u
n
⟩}. A projection on to this
subspace can be represented by a summation of outer products:
P =
n
∑
i=1
u
i
⟩⟨u
i
 (3.99)
= u
1
⟩⟨u
1
 +u
2
⟩⟨u
2
 +. . . +u
n
⟩⟨u
n
. (3.100)
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
Vectors and Vector Spaces 67
So, we can replace the projector notation P with the explicit outer product no
tation:
(00⟩⟨00 +01⟩⟨01)(α
00
00⟩ +α
01
01⟩ +α
10
10⟩ +α
11
11⟩) = α
00
00⟩ +α
01
01⟩.
We can also represent a matrix (an operator for example) using outer product
notation, as shown in the next example.
Example Representing operators X and Z. These two matrices are deﬁned
below, but it turns out they are quite handy for quantum computing. We’ll
be using them frequently in the chapters ahead:
0⟩⟨1 =
¸
1
0
¸
0
∗
1
∗
=
¸
0 1
0 0
¸
,
1⟩⟨1 =
¸
0
1
¸
0
∗
1
∗
=
¸
0 0
0 1
¸
,
0⟩⟨0 =
¸
1
0
¸
1
∗
0
∗
=
¸
1 0
0 0
¸
,
1⟩⟨0 =
¸
0
1
¸
1
∗
0
∗
=
¸
0 0
1 0
¸
.
X =
¸
0 1
1 0
¸
= 0⟩⟨1 +1⟩⟨0,
Z =
¸
1 0
0 −1
¸
= 0⟩⟨0 −1⟩⟨1.
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
68 Vectors and Vector Spaces
Properties:
∑
i
i⟩⟨i = I for any orthonormal basis {i⟩}. The completeness relation
(3.101)
Given a subspace V
s
= 1⟩ , . . . , k⟩
then V = 1⟩ , . . . , k⟩ k + 1⟩ , . . . , d⟩ . (3.102)
Each component u⟩ ⟨u of P is hermitian
and P itself is hermitian (see 3.8.24). (3.103)
P
†
= P(Seethenextsectionontheadjoint). (3.104)
P
2
= P. (3.105)
Q = I −P is called the orthogonal complement
and is a projector onto k + 1⟩ , . . . , d⟩ in 3.98. (3.106)
Later we’ll look at quantum measurements, and we’ll use Mm to represent a
measurement. If we use a projector (i.e. Mm = P ) for measurement then the
probability of measuring m is:
pr(m) = ⟨Ψ M
†
m
M
m
Ψ⟩ .
By 3.100 and 3.101 we can say that this is equivalent to:
pr(m) = ⟨Ψ M
m
Ψ⟩ .
3.8.19 The Adjoint
The adjoint A
†
is the matrix obtained from A by conjugating all the elements of
A (to get A
∗
) and then forming the transpose:
A
†
= (A
∗
)
T
. (3.107)
Example An adjoint.
¸
1 +i 1 −i
−1 1
¸
†
=
¸
1 −i −1
1 +i 1
¸
.
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
Vectors and Vector Spaces 69
Properties:
⟨uAv⟩ = ⟨A
†
uv⟩. (3.108)
(AB)
†
= B
†
A
†
. (3.109)
(A
†
)
†
= A. (3.110)
(u⟩)
†
= ⟨u. (3.111)
(Au⟩)
†
= ⟨uA
†
but not Au⟩ = ⟨uA
†
. (3.112)
(αA +βB)
†
= α
∗
A
†
+β
∗
B
†
. (3.113)
Example Example of ⟨uAv⟩ = ⟨A
†
uv⟩. Given,
u⟩ =
¸
1
i
¸
, v⟩ =
¸
1
1
¸
and A =
¸
1 +i 1 −i
−1 1
¸
.
Av⟩ =
¸
1 +i 1 −i
−1 1
¸¸
1
1
¸
=
¸
2
0
¸
,
⟨uAv⟩ = 2,
A
†
u⟩ =
¸
1 −i −1
1 +i 1
¸¸
1
i
¸
=
¸
1 −2i
1 + 2i
¸
,
⟨A
†
uv⟩ =
1 + 2i 1 −2i
¸
1
1
¸
= 2.
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
70 Vectors and Vector Spaces
3.8.20 Eigenvalues and Eigenvectors
The complex number λ is an eigenvalue of a linear operator A if there exists
vector u⟩ such that:
Au⟩ = λu⟩ (3.114)
where u⟩ is called an eigenvector of A.
Eigenvalues of A can be found by using the following equation, called the char
acteristic equation of A:
c(λ) = det(A −λI) = 0. (3.115)
This comes from noting that:
Au⟩ = λu⟩ ⇔ (A −λI)u⟩ = 0 ⇔ A −λI is singular ⇔ det(A −λI) = 0.
Solving the characteristic equation gives us the characteristic polynomial of A.
We can then solve the characteristic polynomial to ﬁnd all the eigenvalues for
A. If A is an n × n matrix, there will be n eigenvalues (but some may be the
same as others).
Properties:
A’s i
th
eigenvalue λ
i
has eigenvector u
i
⟩ iff Au
i
⟩ = λ
i
u
i
⟩. (3.116)
An eigenspace for λ
i
is the set of eigenvectors that satisﬁes
Au
j
⟩ = λ
i
u
j
⟩, here j is the index for eigenvectors of λ
i
. (3.117)
An eigenspace is degenerate when it has dimension > 1
i.e. more than one eigenvector. (3.118)
Note: The eigenvectors that match different eigenvalues are linearly indepen
dent, which means we can have an orthonormal set of eigenvectors for an op
erator A.
An example is on the next page.
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
Vectors and Vector Spaces 71
Example Eigenvalues and eigenvectors of X.
X =
¸
0 1
1 0
¸
.
det(X −λI) =
¸
−λ 1
1 −λ
¸
= λ
2
−1.
This is the characteristic polynomial. The two solutions to λ
2
− 1 = 0 are
λ = −1 and λ = +1. If we use the eigenvalue of λ = −1 to determine the
corresponding eigenvector λ
−1
⟩ of X we get:
Xλ
−1
⟩ = −1λ
−1
⟩
¸
0 1
1 0
¸¸
α
β
¸
=
¸
−α
−β
¸
¸
β
α
¸
=
¸
−α
−β
¸
.
We get α = −β, so after normalisation our eigenvector is:
λ
−1
⟩ =
1
√
2
0⟩ −
1
√
2
1⟩.
Notice that we’ve used the eigenvalue λ = −1 to label the eigenvector λ
−1
⟩.
3.8.21 Trace
The trace of A is the sum of its eigenvalues, or:
tr(A) =
n
∑
i=1
a
ii
(3.119)
i.e. the sum of its diagonal entries.
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
72 Vectors and Vector Spaces
Example Trace of X and I
X =
¸
0 1
1 0
¸
.
I =
¸
1 0
0 1
¸
.
tr(X) = 0 + 0 = 0 or the sum of the eigenvalues 1 + (−1) = 0. For I we have
tr(I) = 2.
Properties:
tr(A +B) = tr(A) + tr(B). (3.120)
tr(α(A +B)) = αtr(A) +αtr(B). (3.121)
tr(AB) = tr(BA). (3.122)
tr(u⟩⟨v) = ⟨uv⟩. (3.123)
tr(αA) = αtr(A). (3.124)
tr(UAU
†
) = tr(A). Similarity transform for U (3.125)
tr(U
†
AU) = tr(A). (3.126)
tr(Au⟩⟨u) = ⟨uAu⟩ if u⟩ is unitary. (3.127)
For unit normu⟩:
tr(u⟩⟨u) = tr(u⟩⟨uu⟩⟨u) (3.128)
= ⟨uu⟩⟨uu⟩ (3.129)
= ⟨uu⟩⟨uu⟩ (3.130)
= u⟩
4
(3.131)
= 1. (3.132)
As stated, the trace of A is the sum of its eigenvalues. We can also say that:
U
†
AU =
λ
1
.
.
.
λ
n
¸
¸
¸
¸
.
which also has a trace which is the sum the eigenvalues of A as tr(U
†
AU) =
tr(A) (see section 3.8.24 below).
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
Vectors and Vector Spaces 73
Positive
Hermitian
Normal
Unitary
Figure 3.8: Relationships between operators.
3.8.22 Normal Operators
A normal operator satisﬁes the following condition:
AA
†
= A
†
A. (3.133)
The class of normal operators has a number of subsets. In the following sections
we’ll look at some of the important normal operators. These include unitary,
hermitian, and positive operators. The relationships between these operators is
shown in ﬁgure 3.8.
3.8.23 Unitary Operators
Matrix U is unitary (unitary operators are usually represented by U) if:
U
−1
= U
†
(3.134)
or,
UU
†
= U
†
U = I. (3.135)
Eigenvectors of unitary matrices have a modulus of 1:
∥Uu⟩∥ = ∥u⟩∥ ∀ u⟩. (3.136)
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
74 Vectors and Vector Spaces
Unitary operators have the property that they preserve norm, and are invert
ible. There are some particularly important operators called the Pauli operators.
We’ve seen some of them already, they are referred to by the letters I, X, Y,
and Z. In some texts X, Y, and Z are referred to by another notation, where
σ
1
= σ
X
= X, σ
2
= σ
Y
= Y, and σ
3
= σ
Z
= Z. The Pauli operators are deﬁned
as:
I =
¸
1 0
0 1
¸
, (3.137)
X =
¸
0 1
1 0
¸
, (3.138)
Y =
¸
0 −i
i 0
¸
, (3.139)
Z =
¸
1 0
0 −1
¸
. (3.140)
Example I, X, Y, and Z are unitary because:
II
†
= I
2
=
¸
1 0
0 1
¸¸
1 0
0 1
¸
=
¸
1 0
0 1
¸
.
XX
†
= X
2
=
¸
0 1
1 0
¸¸
0 1
1 0
¸
=
¸
1 0
0 1
¸
.
Y Y
†
= Y
2
=
¸
0 −i
i 0
¸¸
0 −i
i 0
¸
=
¸
1 0
0 1
¸
.
ZZ
†
= Z
2
=
¸
1 0
0 −1
¸¸
1 0
0 −1
¸
=
¸
1 0
0 1
¸
.
Note: I = I
†
, X = X
†
, Y = Y
†
, and Z = Z
†
.
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
Vectors and Vector Spaces 75
Properties (of unitary operators):
U =
∑
j
j⟩⟨j. (3.141)
(Uu⟩, Uv⟩) = ⟨uU
†
Uv⟩ = ⟨uv⟩. (3.142)
Unitary matrices are also normal. (3.143)
Unitary matrices allow for spectral decomposition,
(see section 3.8.27). (3.144)
Unitary matrices allow for reversal, i.e. U
†
(Uu⟩) = Iu⟩ = u⟩. (3.145)
Unitary matrices preserve inner product
(Uu⟩, Uv⟩) = (u⟩, v⟩) = ⟨uv⟩. (3.146)
Unitary matrices preserve norm∥Uu⟩∥ = ∥u⟩∥. (3.147)
Given an orthonormal basis set {u
i
⟩}, {Uu
i
⟩} = {v
i
}
is also an orthonormal basis with U =
∑
i
v
i
⟩⟨u
i
. (3.148)
Unitary matrices have eigenvalues of modulus 1. (3.149)
If(u⟩, Au⟩) > 0 ∀u⟩ in V (all positive eigenvalues). (3.150)
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
76 Vectors and Vector Spaces
3.8.24 Hermitian and Positive Operators
A hermitian matrix A has the property:
A = A
†
. (3.151)
The eigenvalues of a hermitian matrix are real numbers and hermitian matrices
are also normal (although not all normal matrices need real eigenvalues).
Example The matrix X is Hermitian because:
X =
¸
0 1
1 0
¸
=, X
†
=
¸
0 1
1 0
¸
.
Properties:
A = B +iC can represent any operator if B and C are hermitian
with C = 0 if A itself is hermitian. (3.152)
If A is hermitian then for u⟩, ⟨uAu⟩ ∈ R. (3.153)
If A is hermitian then A is a positive operator iff for u⟩, ⟨uAu⟩ ∈ R
and ⟨uAu⟩ ≥ 0. (3.154)
If A is positive it has no negative eigenvalues. (3.155)
3.8.25 Diagonalisable Matrix
An operator A is diagonalisable if:
A =
∑
i
λ
i
u
i
⟩⟨u
i
. (3.156)
The vectors u
i
⟩ form an orthonormal set of eigenvectors for A, with eigenval
ues of λ
i
. This is the same as saying that A can be transformed to:
λ
1
.
.
.
λ
n
¸
¸
¸
¸
. (3.157)
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
Vectors and Vector Spaces 77
Example Representing operator X:
X =
¸
0 1
1 0
¸
.
The two normalised eigenvectors for X are:
1
√
2
0⟩ −
1
√
2
1⟩ and
1
√
2
0⟩ +
1
√
2
1⟩.
The two vectors are orthogonal (with eigenvalues −1 and +1),
¸
1
√
2
0⟩ −
1
√
2
1⟩
¸
1
√
2
0⟩ +
1
√
2
1⟩
=
1
2
[⟨00⟩ −⟨01⟩ +⟨10⟩ −⟨11⟩]
=
1
2
[1 −0 + 0 −1]
= 0.
So X is diagonalisable and is given by:
X =
1
2
[0⟩ +1⟩][⟨0 +⟨1] −
1
2
[0⟩ −1⟩][⟨0 −⟨1].
Which expanded is:
1
2
([⟨00⟩ +⟨01⟩ +⟨10⟩ +⟨11⟩]) −
1
2
([⟨00⟩ −⟨01⟩ −⟨10⟩ +⟨11⟩]).
3.8.26 The Commutator and AntiCommutator
Here is a set of properties for the Commutator and AntiCommutator which relate
to commutative relationships between two operators A and B.
Commutator:
[A, B] = AB −BA, A and B commute (AB = BA) if [A, B] = 0. (3.158)
Anticommutator:
{A, B} = AB +BA, we say A and B anticommute if {A, B} = 0. (3.159)
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
78 Vectors and Vector Spaces
Example We test X and Z against the commutator.
[X, Z] =
¸
0 1
1 0
¸¸
1 0
0 −1
¸
−
¸
1 0
0 −1
¸¸
0 1
1 0
¸
=
¸
0 −2
2 0
¸
̸= 0.
So X and Z do not commute.
The simultaneous diagonalisation theorem says that if H
A
and H
B
are hermitian,
[H
A
, H
B
] = 0 if ∃ a set of orthonormal eigenvectors for both H
A
, H
B
so:
H
A
=
∑
i
λ
′
i
i⟩⟨i and H
B
=
∑
i
λ
′′
i
i⟩⟨i. (3.160)
i.e. they are both diagonal in a common basis.
Properties:
AB =
[A, B] +{A, B}
2
. (3.161)
[A, B]
†
= [A
†
, B
†
]. (3.162)
[A, B] = −[B, A]. (3.163)
[H
A
, H
B
] is hermitian if H
A
, H
B
are hermitian. (3.164)
3.8.27 Polar Decomposition
Polar decomposition says that any linear operator A can be represented as A =
U
√
A
†
A (called the left polar decomposition) =
√
AA
†
U (called the right polar
decomposition) where U is a unitary operator.
Single value decomposition says that if a linear operator A that is a square ma
trix (i.e. the same input and output dimension) then there exist unitaries U
A
and U
B
, and D a diagonal matrix with nonnegative elements in R such that
A = U
A
DU
B
.
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
Vectors and Vector Spaces 79
3.8.28 Spectral Decomposition
A linear operator is normal (A
†
A = AA
†
) iff it has orthogonal eigenvectors and
the normalised (orthonormal) versions {u
i
} of the eigenvectors can diagonalise
the operator:
A =
∑
i
λ
i
u
i
⟩⟨u
i
. (3.165)
Example Spectral decomposition of X and Z.
Z =
¸
1 0
0 −1
¸
= 0⟩⟨0 −1⟩⟨1.
X =
¸
0 1
1 0
¸
= +⟩⟨+ −−⟩⟨−.
X has eigenvectors +⟩ =
1
√
2
0⟩ +1⟩, and −⟩ =
1
√
2
0⟩ −1⟩ and eigenvalues
of +1, and −1 Then, if we expand, we get back X:
+⟩⟨+ −−⟩⟨− =
1
2
¸
1
1
¸
[11] −
1
2
¸
1
−1
¸
[1 −1]
=
1
2
¸
1 1
1 1
¸
−
1
2
¸
1 −1
−1 1
¸
=
¸
0 1
1 0
¸
.
Properties:
A = UDU
†
where U is a unitary and D is a diagonal operator. (3.166)
If A is normal then it has a spectral decomposition of
∑
a
a⟩⟨a. (3.167)
3.8.29 Tensor Products
In a tensor product we have a combination of two smaller vector spaces to form
a larger one. The elements of the smaller vector spaces are combined whilst
preserving scalar multiplication and linearity, formally:
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
80 Vectors and Vector Spaces
If {u⟩} and {v⟩} are bases for V and W respectively then {u⟩ ⊗ v⟩} form a
basis for V ⊗W. We can write this in the following way:
u⟩ ⊗v⟩ = u⟩v⟩ = u, v⟩ = uv⟩. (3.168)
Example A simple tensor product.
1⟩ ⊗0⟩ = 1⟩0⟩ = 1, 0⟩ = 10⟩.
The Kronecker product is deﬁned as:
A ⊗B =
¸
a b
c d
¸
⊗
¸
x y
v w
¸
(3.169)
=
¸
a · B b · B
c · B d · B
¸
(3.170)
=
ax ay bx by
av aw bv bw
cx cy dx dy
cv cw dv dw
¸
¸
¸
¸
¸
¸
. (3.171)
where A and B are linear operators.
Example A Kronecker product on Pauli matrices X. and Y
X =
¸
0 1
1 0
¸
and Y =
¸
0 −i
i 0
¸
.
X ⊗Y =
¸
0 · Y 1 · Y
1 · Y 0 · Y
¸
=
¸
0 1
1 0
¸¸
0 −i
i 0
¸
=
0 0 0 −i
0 0 1 0
0 −i 0 0
i 0 0 0
¸
¸
¸
¸
¸
¸
.
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
Fourier Transforms 81
Properties:
Tensor products are related to the inner product:
(uv⟩, u
′
v
′
⟩) = (u⟩, u
′
⟩)(v⟩, v
′
⟩) (3.172)
= ⟨uu
′
⟩⟨vv
′
⟩. (3.173)
u⟩
⊗k
= (u⟩ ⊗. . . ⊗u⟩)
k
k times. (3.174)
(A ⊗B)
∗
= A
∗
⊗B
∗
. (3.175)
(A ⊗B)
T
= A
T
⊗B
T
. (3.176)
(A ⊗B)
†
= A
†
⊗B
†
. (3.177)
ab⟩
†
= ⟨ab. (3.178)
α(u, v⟩) = αu, v⟩ = u, αv⟩. (3.179)
u
1
+u
2
, v⟩ = u
1
, v⟩ +u
2
, v⟩. (3.180)
u, v
1
+v
2
⟩ = u, v
1
⟩ +u, v
2
⟩. (3.181)
uv⟩ ̸= vu⟩. (3.182)
For linear operators A and B, A ⊗B(uv⟩) = Au⟩ ⊗Bv⟩. (3.183)
For normal operators N
A
and N
B
, N
A
⊗N
B
will be normal. (3.184)
For hermitian operators H
A
and H
B
, H
A
⊗H
B
will be hermitian. (3.185)
For unitary operators U
A
and U
B
, U
A
⊗U
B
will be unitary. (3.186)
For positive operators P
A
and P
B
, P
A
⊗P
B
will be positive. (3.187)
3.9 Fourier Transforms
The Fourier transform, which is named after Jean Baptiste Joseph Fourier, 1768
 1830 (ﬁgure 3.9), maps data from the time domain to the frequency domain. The
discrete Fourier transform (DFT) is a version of the Fourier transform which, un
like the basic Fourier transform, does not involve calculus and can be directly
implemented on computers but is limited to periodic functions. The Fourier
transform itself is not limited to periodic functions.
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
82 Fourier Transforms
Figure 3.9: Jean Baptiste Joseph Fourier.
3.9.1 The Fourier Series
Representing a periodic function as a linear combination of sines and cosines is
called a Fourier series expansion of the function. We can represent any periodic,
continuous function as a linear combination of sines and cosines. In fact, like 0⟩
and 1⟩ forms an orthonormal basis for quantum computing, sin and cos form
an orthonormal basis for the time domain based representation of a waveform.
One way to describe an orthonormal basis is:
That which you measure against.
The fourier series has the form:
f(t) =
a
0
2
+
∞
∑
n=1
a
n
sin(nt) +
∞
∑
n=1
b
n
cos(nt). (3.188)
So if we have a waveform we want to model we only need to ﬁnd the coefﬁ
cients a
0
, a
1
, . . . , a
n
and b
0
, b
1
, . . . , b
n
and the number of sines and cosines. We
won’t go into the derivation of these coefﬁcients (or how to ﬁnd the number of
sines and cosines) here. The deﬁnition will be enough, as this is only meant to
be a brief introduction to the Fourier series. For example, suppose we’ve found
a
1
= 0.5, a
4
= 2 and b
2
= 4 and all the rest are 0; then the Fourier series is:
f(t) = 0.5 sin(πt) + 2 sin(4πt) + 4 cos(2πt)
which is represented by the following graph:
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
Fourier Transforms 83
−8
−6
−4
−2
0
2
4
6
8
0 1 2 3 4 5
0.5 sin(πt) + 2 sin(4πt) + 4 cos(2πt)
The function f(t) is made up of the following waveforms, 0.5 sin(πt), 2 sin(4πt),
and 4 cos(2πt). Again, it’s helpful to look at them graphically:
−6
−4
−2
0
2
4
6
0 1 2 3 4 5
0.5 sin(πt)
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
84 Fourier Transforms
−6
−4
−2
0
2
4
6
0 1 2 3 4 5
2 sin(4πt)
−6
−4
−2
0
2
4
6
0 1 2 3 4 5
4 cos(2πt)
If we analyse the frequencies and amplitudes of the components of f(t) we get
the following results [Shatkay, H. 1995]:
Waveform Sine Amplitude Cosine Amplitude Frequency
0.5 sin(πt)
1
2
0 2
2 sin(4πt) 2 0
1
2
4 cos(2πt) 0 4 1
We can also rewrite the sinusoids above as a sum of numbers in complex, ex
ponential form.
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
Fourier Transforms 85
3.9.2 The Discrete Fourier Transform
The DFT maps from a discrete, periodic sequence t
k
to a set of coefﬁcients rep
resenting the frequencies of the discrete sequence. The DFT takes as input and
outputs an array of complex numbers. The number of elements in the array is
governed by the sampling rate and the length of the waveform. Formally, The
N complex numbers t
0
, ..., t
N−1
are transformed into the N complex numbers
f
0
, ..., f
N
−1 according to the formula:
f
j
=
N−1
∑
k=0
t
k
e
−
2πi
N
jk
j = 0, . . . , N −1. (3.189)
The DFT is a linear operator with an invertible matrix representation, so we can
take the conversion back to its original form using:
t
k
=
1
N
N−1
∑
j=0
f
j
e
2πi
N
kj
k = 0, . . . , N −1. (3.190)
We have chosen to represent our periodic functions as a sequence of sines and
cosines. To use the above formulas they need to be converted to complex, expo
nential form. Because the sequence we are after is discrete we need to sample
various points along the sequence. The sample rate N determines the accuracy
of our transformation. With the lower bound on the sampling rate being found
by applying Nyquist’s theorem (which is beyond the scope of this paper).
Let’s look at doing a DFT on f(t) = 0.5 sin(πt) + 2 sin(4πt) + 4 cos(2πt) and
adjust the sampling rate until we get an acceptable waveform in the frequency
domain:
The graph below is just f(t) = 0.5 sin(πt) +2 sin(4πt) +4 cos(2πt) with sampling
points at the whole numbers (1, 2, . . . , N) as you can see if we only sample at
this point we get no notion of a wave at all.
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
86 Fourier Transforms
−6
−4
−2
0
2
4
6
0 2 4 6 8 10 12
0.5 sin(πt) + 2 sin(4πt) + 4 cos(2πt)
Instead of adjusting the sample rate to be fractional, we just have to adjust the
function slightly, which just makes the xaxis longer but retains our wave. The
function now looks like this:
f(t) = 0.5 sin
π
t
2
+ 2 sin
4π
t
2
+ 4 cos
2π
t
2
.
So we are effectively sampling at twice the rate.
−6
−4
−2
0
2
4
6
0 2 4 6 8 10 12
0.5 sin(π
t
2
) + 2 sin(4π
t
2
) + 4 cos(2π
t
2
)
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
Fourier Transforms 87
Below we show a sampling rate of 50 times the original rate and our waveform
looks good, the function now looks like this:
f(t) = 0.5 sin
π
t
50
+ 2 sin
4π
t
50
+ 4 cos
2π
t
50
.
−8
−6
−4
−2
0
2
4
6
8
0 50 100 150 200 250
0.5 sin(π
t
50
) + 2 sin(4π
t
50
) + 4 cos(2π
t
50
)
Finally, here is f(t) = 0.5 sin(π
t
50
)+2 sin(4π
t
50
)+4 cos(2π
t
50
) after it has been put
through the DFT, it is now in the frequency domain:
0
10
20
30
40
50
0 20 40 60 80 100 120
DFT(0.5 sin(π
t
50
) + 2 sin(4π
t
50
) + 4 cos(2π
t
50
))
Later, in chapter 7, we’ll see how the quantum analogue of the DFT (called the
quantum fourier transform) can be used for quantum computing.
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
Chapter 4
Quantum Mechanics
Quantummechanics is generally about the novel behaviour of very small things.
At this scale matter becomes quantised, this means that it can be subdivided no
more. Quantum mechanics has never been wrong, it explains why the stars
shine, how matter is structured, the periodic table, and countless other phe
nomena. One day scientists hope to use quantum mechanics to explain every
thing, but at present the theory remains incomplete as it has not been success
fully combined with classical theories of gravity.
Some strange effects happen at the quantum scale. The following effects are
important for quantum computing:
• Superposition and interference
• Uncertainty
• Entanglement
This chapter is broken into two parts. In the ﬁrst part we’ll look brieﬂy at the
history of quantum mechanics. Then, in the second part we will examine some
important concepts (like the ones above) of quantum mechanics and how they
relate to quantum computing.
The main references used for this chapter are, Introducing Quantum Theory by
J.P. McEvoy and Oscar Zarate, and Quantum Physics, Illusion or Reality by Alas
tair Rae. Both of these are very accessible introductory books.
89
90 History
Figure 4.1: James Clerk Maxwell and Isaac Newton.
4.1 History
4.1.1 Classical Physics
Classical physics roughly means pre20
th
century physics, or prequantumphysics.
Two of the most important classical theories are electromagnetism, the uniﬁca
tion of electricity and magnetism by James Clerk Maxwell, 1831  1879 (ﬁgure
4.1) and Isaac Newton’s mechanics. Isaac Newton, 1642  1727 (ﬁgure 4.1) is ar
guably the most important scientist of all time due to the large body of work
he produced that is still relevant today. Newton’s contributions include work
on gravity, optics and mathematics. Prior to this, Alhazen 965  1039, Nicolaus
Copernicus, 1473  1543 and Galileo Galilei, 1564  1642 (ﬁgure 4.2) contributed
greatly to the development of the modern scientiﬁc method (we might also in
clude Leonardo Davinci, 1452  1519) by testing their theories with observation
and experimentation.
Classical physics has a number of fundamental assumptions, they are:
• The universe is a giant machine.
• Cause and effect, i.e. all nonuniform motion and action is caused by some
thing (uniform motion doesn’t need a cause, this is Galileo’s principle of
inertia).
• Determiznism, if a state of motion is known now then because the universe
is predictable, we can say exactly what it has been and what it will be at
any time.
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
History 91
Figure 4.2: Nicolaus Copernicus and Galileo Galilei.
• Light is a wave that is completely described by a set of wave equations cre
ated by Maxwell. These are four equations that describe all electric and
magnetic phenomena.
• Particles and waves exist, but they are distinct.
• We can measure any system to an arbitrary accuracy and correct for any er
rors caused by the measuring tool.
It’s all proven, or is it? No, the above assumptions do not hold for quantum
mechanics.
4.1.2 Important Concepts
In the lead up to quantum mechanics there are some important concepts from
classical physics that we should look at. These are the concepts of atoms, ther
modynamics, and statistical analysis.
Atoms
Atoms are deﬁned as indivisible parts of matter ﬁrst postulated by Democritus,
460  370 BC(ﬁgure 4.3). The idea was dismissed as a waste of time by Aristotle,
(384  322 BC) but two thousand years later the idea started gaining acceptance.
The ﬁrst major breakthrough was in 1806 when John Dalton, 1766  1844 (ﬁgure
4.3) predicted properties of elements and compounds using the atomic concept.
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
92 History
Figure 4.3: Democritus and John Dalton.
Figure 4.4: Hermann von Helmholtz and Rudolf Clausius.
Thermodynamics
Thermodynamics is the theory of heat energy. Heat is understood to be disor
dered energy; e.g. the heat energy in a gas is the kinetic energies of all the
molecules. The temperature is a measure of how fast the molecules are trav
elling (if a gas or liquid; if solid, how fast they are vibrating about their ﬁxed
positions in the solid).
Thermodynamics is made up of two laws:
• The ﬁrst law of thermodynamics
In a closed system, whenever a certain amount of energy dis
appears in one place an equivalent amount must appear else
where in the system is some form.
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
three laws, here are the first two:
History 93
n
v
a
b
c
Figure 4.5: Maxwell distribution.
This law of conservation of energy was originally stated by Herman Von
Helmholtz, 1824  1894 (ﬁgure 4.4).
• The second law of thermodynamics
Rudolf Clausius, 1822  1888 (ﬁgure 4.4) called the previous law the ﬁrst
of two laws. He introduced a new concept, entropy which in terms of heat
transfer is:
The total entropy of a system increases when heat ﬂows from
a hot body to a cold one. Heat always ﬂows from hot to cold
[Rae, A. 1996, p.18].
So this implies that an isolated system’s entropy is always increasing until
the system reaches thermal equilibrium (i.e. all parts of the system are at
the same temperature).
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
94 History
Figure 4.6: Ludwig Boltzmann and Niels Bohr.
4.1.3 Statistical Mechanics
In 1859, J.C. Maxwell, using the atomic model, came up with a way of statisti
cally averaging the velocities of randomly chosen molecules of a gas in a closed
system like a box (because it was impossible to track each one). The graph is
shown in ﬁgure 4.5, remember hotter molecules tend to go faster, the graph’s n
axis denotes the number of molecules (this particular graph shows CO
2
). The v
axis denotes velocity. The letters a, b, and c represent molecules at 100K, 400K,
and 1600K respectively.
In the 1870s Ludwig Boltzmann, 1844  1906 (ﬁgure 4.6) generalised the the
ory to any collection of entities that interact randomly, are independent, and
are free to move. He rewrote the second law of thermodynamics to say:
As the energy in a system degrades the system’s atoms become
more disordered and there is an increase in entropy. to measure this
disorder we consider the number of conﬁgurations or states that the
collection of atoms can be in.
If this number is W then the entropy S is deﬁned as:
S = k log W (4.1)
where k is Boltzmann’s constant k = 1.38 ×10
−23
J/K. Here J stands for Joule,
a measure of energy and K stands for Kelvin, a unit of temperature.
So the behaviour of ”large things” could now be predicted by the average sta
tistical behaviour of the their smaller parts, which is important for quantum
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
History 95
mechanics. There also remains the probability that a ﬂuctuation can occur, a
statistical improbability that may seem nonsensical but nonetheless the theory
must cater for it. For example, if we have a box containing a gas a ﬂuctuation
could be all particles of the gas randomly clumping together in one corner of
the box.
4.1.4 Important Experiments
There are two major periods in the development of quantum theory, the ﬁrst
culminating in 1913 with the atomic model of Niels Bohr, 1885  1962 (ﬁgure 4.6)
and ending in about 1924. This is called old quantum theory. The new quantum
theory began in 1925. The old quantum theory was developed in some part
to explain the results of three experiments which could not be explained by
classical physics, they are:
• Black body radiation, and the ultraviolet catastrophe.
• The Photoelectric effect.
• Bright Line Spectra.
These experiments, and their subsequent explanations are described in the next
three sections.
Black Body Radiation
A black body absorbs all electromagnetic radiation (light) that falls on it and
would appear black to an observer because it reﬂects no light. To determine
the temperature of a black body we have to observe the radiation emitted from
it.
Max Planck, 1858  1947, (ﬁgure 4.8) measured the distribution of radiation and
energy over frequency in a cavity, a kind of oven with a little hole for a small
amount of heat (light, radiation) to escape for observation. Because the radia
tion is conﬁned in the cavity it settles down to an equilibrium distribution of
the molecules in a gas. They found the frequency distributions to be similar to
Maxwell’s velocity distributions. The colour of the light emitted is dependent
on the temperature. E.g. the element of your electric stove goes from red hot to
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
96 History
white hot as the temperature increases. It didn’t take long for physicists to ap
ply a Maxwell style statistical analysis to the waves of electromagnetic energy
present in the cavity. The difference being is that classical physics saw waves
as continuous which means that more and more waves could be packed into a
”box” as the wavelengths get smaller, i.e. the frequency gets higher. This means
that as the temperature was raised the radiation should keep getting stronger
and stronger indeﬁnitely. This was called the ultraviolet catastrophe. If nature
did indeed behave in this way you would get singed sitting in front of a ﬁre by
all the ultraviolet light coming out of it. fortunately this doesn’t occur so the
catastrophe is not in nature but in classical physics which predicted something
that doesn’t happen.
The results of several experiments had given the correct frequency distribu
tions and it was Max Planck who found a formula that matched the results. He
couldn’t ﬁnd a classical solution, so grudgingly he used Boltzmann’s version
of the second law of thermodynamics. Planck imagined that the waves emit
ted from the black body were produced by a ﬁnite number of tiny oscillators
(a kind of precursor to modern atoms). Eventually he had to divide the en
ergy into ﬁnite chunks of a certain size to ﬁt his own radiation formula. Which
ﬁnally gives us the ﬁrst important formula for quantum mechanics:
E = hf (4.2)
where E is energy, f is frequency and h is Planck’s constant which is:
h = 0.00000000000000000000000000000000066260688J/s = 6.66260688 ×10
−34
J/s.
(4.3)
Where J/s = Joules per second.
4.1.5 The Photoelectric Effect
If a light is shone onto certain kinds of material (e.g. some metals or semi
conductors) then electrons are released. When this effect was examined it was
found that the results of the experiments did not agree with classical electro
magnetic theory. Classical theory predicted that the energy of the released elec
tron should depend on the intensity of the incident light wave. However it was
found that the energy released was dependent not on intensity (an electron
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
History 97
Figure 4.7: Albert Einstein and Johann Jakob Balmer.
would come out no matter how low the intensity was) but on the frequency of
the light.
Albert Einstein, 1879  1955 (ﬁgure 4.7) showed that if we look at the light as a
collection of particles carrying energy proportional to the frequency (as given
by Planck’s law E = hf) and if those particles can transfer energy to electrons
in a target metal then the experimental results could be explained. Put simply
a light particle hits the metal’s surface and its energy is transferred to an elec
tron and becomes kinetic energy; so the electron is ejected fromthe metal. With
different kinds of metals it can be easier or harder for electrons to escape.
4.1.6 Bright Line Spectra
When a solid is heated and emits white light then, if that light is concentrated
and broken up into the separate colours by a prism, we get a rainbowlike spec
trum (continuous spectrum) like the following:
If we do the same thing with a hot gas emitting light then the spectrum con
sists of a number of bright lines that have the colours of the rainbow above,
with dark regions in between. The spectrum for this, which is called an emis
sion spectrum is shown below.
If a cold gas is placed between a hot solid emitting white light and the prism
we get the inverse of the above. This is called an absorbtion spectrum, shown
below.
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
98 History
Figure 4.8: Max Planck and Joseph J. Thomson.
The hot gas is emitting light at certain frequencies and example three shows
us that the cold gas is absorbing light at the same frequencies. These lines are
different for each element, and they allow us to determine the composition of
a gas even at astronomical distances, by observing its spectrum.
In 1885 Johann Jakob Balmer, 1825  1898 (ﬁgure 4.7) derived a formula for
the spectral lines of Hydrogen. Which is:
f = R
1
n
2
f
−
1
n
2
i
(4.4)
where R is the Rydberg constant of 3.29163 × 10
1
5 cycles/second and n
f
and
n
i
are whole numbers. The trouble was that no one knew how to explain the
formula. The explanation came in 1913 with Niels Bohr’s atomic model.
4.1.7 Proto Quantum Mechanics
During the last part of the 19th century it was discovered that a number of
”rays” were actually particles. One of these particles was the electron, discov
ered by Joseph J. Thomson, 1856  1940 (ﬁgure 4.8). In a study of cathode ray
tubes Thompson showed that electrically charged particles (electrons) are emit
ted when a wire is heated. Thomson went on to help develop the ﬁrst model
of the atom which had his (negatively charged) electrons contained within a
positively charged sphere (ﬁgure 4.10).
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
History 99
Figure 4.9: Ernest Rutherford and Arnold Sommerfeld.









+
+
+
+
+
+
+
+
+
Figure 4.10: Thomson’s atomic model.



+
very small nucleus
Figure 4.11: Rutherford’s atomic model.
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
100 History
This ﬁrst atomic model was called the Christmas pudding model. Then, in 1907,
Ernest Rutherford, 1871  1937 (ﬁgure 4.9), developed a new model, which was
found by ﬁring alpha particles (Helium ions) at gold foil and observing that,
very occasionally, one would bounce back. This model had a tiny but massive
nucleus surrounded by electrons (ﬁgure 4.11).
The new model was like a mini solar system with electrons orbiting the nu
cleus, but the atomic model was thought to still follow the rules of classical
physics. However, according to classical electromagnetic theory an orbiting
electron, subject to centripetal acceleration (the electron is attracted by the pos
itively charged nucleus) would radiate energy and so rapidly spiral in towards
the nucleus. But this did not happen: atoms were stable, and all the atoms of an
element emitted the same line spectrum. To explain this Niels Bohr assumed
that the atom could exist in only certain stationary states  stationary because,
even if the electron was orbiting in such a state (and, later, this was questioned
by Heisenberg) it would not radiate, despite what electromagnetic theory said.
However, if the electron jumped from a stationary state to one of lower energy
then the transmission was accompanied by the emission of a photon; vice versa
there was absorption of light in going from a lower to a higher energy.
In this scheme there was a lowest stationary state, called the ground state be
low which the electron could not jump; so this restored stability to the atom.
The frequency of the light emitted as a jump was given by Einstein’s formula:
f =
E
h
(4.5)
where E is the difference in the energies of the stationary states involved. These
energies of the stationary states could be calculated fromclassical physics if one
additional assumption was introduced: that the orbital angular momentum
was an integer multiple of Planck’s constant. Then the calculated frequencies
were found to agree with those observed.
So Bohr developed a model based on stable orbital shells which only gave a
certain number of shells to each atom. Bohr quantised electron orbits in units
of Planck’s constant. He gave us the ﬁrst of several quantum numbers which are
useful in quantum computing, the shell number, n (see ﬁgure 4.12).
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
History 101
...
etc.
n = 1, ground state
n = 3
Figure 4.12: Bohr’s ﬁrst atomic model.
Of particular interest are the ground state at n = 1 and the excited state at n > 1
of an atom. Bohr developed a formula for the radius of the electron orbits in a
hydrogen atom:
r =
h
2
4π
2
mq
2
n
2
(4.6)
where r is the radius of the orbital, h is Planck’s constant, and m and q are the
mass and charge of the electron. In real terms the value of r is 5.3 nanometres
for n = 1.
Bohr went on with this model to derive the Balmer’s formula for hydrogen
by two postulates:
1. Quantum angular momentum:
L = n
h
2π
. (4.7)
2. A jump between orbitals will emit or absorb radiation by:
hf = E
i
−E
f
(4.8)
where E
i
is the initial energy of the electron and E
f
is the ﬁnal energy of
the electron.
Although very close, it didn’t quite match up to the spectral line data. Arnold
Sommerfeld, 1868  1951 (ﬁgure 4.9) then proposed a new model with elliptical
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
102 History
Figure 4.13: Wolfgang Pauli and Louis de Broglie.
orbits and a new quantum number was added, k to deal with the shape of the
orbit, Bohr then introduced quantum number m to explain the Zeeman effect
which produced extra spectral lines when a magnetic ﬁeld was applied to the
atom (i.e. the direction the ﬁeld was pointing).
It was soon discovered that m could not account for all the spectral lines pro
duced by magnetic ﬁelds. Wolfgang Pauli, 1900  1958 (ﬁgure 4.13) hypoth
esised another quantum number to account for this. It was thought, but not
accepted by Pauli that the electron was ”spinning around” and it turns out that
Pauli was right but the name stuck, so we still use spin up and spin down to de
scribe this property of an electron. Pauli then described why electrons ﬁll the
higher energy levels and don’t just occupy the ground state which we now call
the Pauli exclusion principle. Niels Bohr went on to explain the periodic table
in terms of orbital shells with the outer most shell being the valence shell that
allows binding and the formation of molecules.
4.1.8 The New Theory of Quantum Mechanics
In 1909, a few years after demonstrating the photoelectric effect, Einstein used
his photon hypothesis to obtain a simple derivation of Planck’s black body dis
tribution. Planck himself had not gone as far as Einstein: he had indeed as
sumed that the transfer of energy between matter (the oscillators in the walls
of the cavity) and radiation was quantised (i.e. the energy transferred to/from
an oscillator occurred in ”grains” less than h times the frequency of the oscil
lator). But Planck had assumed the energy in the electromagnetic ﬁeld, in the
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
History 103
Figure 4.14: Werner Heisenberg and Erwin Schr¨ odinger.
cavity, was continuously distributed, as in classical theory. By contrast, it was
Einstein’s hypothesis that the energy in the ﬁeld itself was quantised: that for
certain purposes, the ﬁeld behaved like an ideal gas, not of molecules, but of
photons, each with energy h times frequency, with the number of photons be
ing proportional to the intensity. The clue to this was Einstein’s observation
that the high frequency part of Planck’s distribution for black body radiation
(described by Wien’s law) could be derived by assuming a gas of photons and
applying statistical mechanics to it. This was in contrast to the low frequency
part (described by the RayleighJeans law) which could be successfully obtained
using classical electromagnetic theory, i.e. assuming waves. So you had both
particles and waves playing a part. Furthermore, Einstein looked at ﬂuctua
tions of the energy about its average value, and observed that the formula ob
tained had two forms, one which you would get if light was made up of waves
and the other if it was made up of particles. Hence we have waveparticle du
ality. In 1924, Louis de Broglie, 1892  1987 (ﬁgure 4.13) extended the particle
duality for light to all matter. He stated:
The motion of a particle of any sort is associated with the propaga
tion of a wave.
This is the idea of a pilot wave which guides a free particle’s motion. de Broglie
then suggested the idea of electron waves be extended to bound particles in
atoms, meaning electrons move around the nucleus guided by pilot waves. So,
again a duality, de Broglie waves and Bohr’s particles. de Broglie was able to
show that Bohr’s orbital radii could be obtained by ﬁtting a whole number of
waves around the nucleus. This gave an explanation of Bohr’s angular mo
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
104 History
mentum quantum condition (see section 4.2.3).
The new quantum theory was developed between June 1925 and June 1926.
Werner Heisenberg, 1901  1976 (ﬁgure 4.14), using a totally different and sim
pler atomic model (one that did not use orbits) worked out a code to connect
quantum numbers and spectra. He also discovered that quantum mechanics
does not follow the commutative law of multiplication i.e pq ̸= qp. When Max
Born, 1882  1970 (ﬁgure 4.15) saw this he suggested that Heisenberg use matri
ces. This became matrix mechanics, eventually all the spectral lines and quan
tum numbers were deduced for hydrogen. The ﬁrst complete version of quan
tum mechanics was born. It’s interesting to note that it was not observation, or
visualisation that was used to deduce the theory  but pure mathematics. Later
we will see matrices cropping up in quantum computing.
At around the same time Erwin Schr¨ odinger, 1887  1961 (ﬁgure 4.14) built on
de Broglie’s work on matter waves. He developed a wave equation (for which
Ψ is the solution) for the core of bound electrons, as in the Hydrogen atom. It
turns out that the results derived fromthis equation agree with the Bohr model.
He then showed that Heisenberg’s matrix mechanics and his wave mechanics
were equivalent.
Max Born proposed that Ψ, the solution to Schr¨ odinger’s equation can be in
terpreted as a probability amplitude, not a real, physical value. The prob
ability amplitude is a function of the electron’s position (x, y, z) and, when
squared, gives the probability of ﬁnding the electron in a unit volume at the
point (x, y, z). This gives us a new, probabilistic atomic model, in which there
is a high probability that the electron will be found in a particular orbital shell.
A representation of the ground state of hydrogen is shown in ﬁgure 4.16 and
at the places where the density of points is high there is a high probability of
ﬁnding the particle. The linear nature of the wave equation means that if Ψ
1
and Ψ
2
are two solutions then so is Ψ
1
+ Ψ
2
, a superposition state (we’ll look
at superposition soon). This probabilistic interpretation of quantum mechanics
implies the system is in both states until measured.
Schr¨ odinger was unhappy with the probabilistic interpretation (superposition)
and created a scenario that would show it was false. This is called Schr¨ odinger’s
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
Important Principles for Quantum Computing 105
cat, a paradox, which simply put refers to the situation of a cat being in both
states of dead Ψ
1
and alive Ψ
2
until it is observed.
Paul Dirac, 1902  1984 (ﬁgure 4.15) developed a new approach and the bra
ket notation we use for quantum computing (see section 4.2.3). His approach
expanded to a quantum ﬁeld theory, he expanded Schr¨ odinger’s equation, in
corporated spin, and Einstein’s relativity, and predicted antimatter.
In 1927 Heisenberg made his second major discovery, the Heisenberg uncertainty
principle which relates to the position and momentumof a particle. It states that
the more accurate our knowledge of a particle’s position, the more inaccurate
our knowledge of its momentum will be and vice versa. The uncertainty is due
to the uncontrollable effect on the particle of any attempt to observe it (because
of the quantum interaction; see 4.25) and perhaps to a to genuine lack of the
particle having precise properties. This signalled the breakdown of determin
ism.
Now back to Niels Bohr. In 1927 Niels Bohr described the concept of comple
mentarity: it depends on what type of measurement operations you are using
to look at the system as to whether it behaves like a particle or a wave. He
then put together various aspects of the work by Heisenberg, Schr¨ odinger, and
Born and concluded that the properties of a system (such as position and mo
mentum) are undeﬁned having only potential values with certain probabilities
of being measured. This became know as the Copenhagen interpretation of quan
tum mechanics.
Einstein did not like the Copenhagen interpretation and, for a good deal of
time, Einstein kept trying to refute it by thought experiment, but Bohr always
had an answer. But in 1935 Einstein raised an issue that was to later have pro
found implications for quantum computation and lead to the phenomenon we
now call entanglement, a concept we’ll look at in a few pages.
4.2 Important Principles for Quantum Computing
The main parts of quantum mechanics that are important for quantum com
puting are:
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
106 Important Principles for Quantum Computing
Figure 4.15: Max Born and Paul Dirac.
Figure 4.16: Born’s atomic model.
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
Important Principles for Quantum Computing 107
• Linear algebra.
• Superposition.
• Dirac notation.
• Representing information.
• Uncertainty.
• Entanglement.
• The 4 postulates of quantum mechanics.
4.2.1 Linear Algebra
Quantum mechanics leans heavily on linear algebra. Some of the concepts of
quantum mechanics come from the mathematical formalism, not thought ex
periments  that’s what can give rise to counter intuitive conclusions.
4.2.2 Superposition
Superposition means a systemcan be in two or more of its states simultaneously.
For example a single particle can be travelling along two different paths at once.
This implies that the particle has wavelike properties, which can mean that the
waves from the different paths can interfere with each other. Interference can
cause the particle to act in ways that are impossible to explain without these
wavelike properties.
The ability for the particle to be in a superposition is where we get the parallel
nature of quantum computing: If each of the states corresponds to a different
value then, if we have a superposition of such states and act on the system, we
effectively act on all the states simultaneously.
An Example With Silvered Mirrors
Superposition can be explained by way of a simple example using silvered and
half silvered mirrors [Barenco, A. Ekert, A. Sanpera, A. &Machiavello, C. 1996].
Ahalf silvered mirror reﬂects half of the light that hits it and transmits the other
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
108 Important Principles for Quantum Computing
detector 2
detector 1
half silvered mirror
light source
Figure 4.17: Uncertainty.
half of the light through it (ﬁgure 4.17). If we send a single photon through this
system then this gives us a 50% chance of the light hitting detector 1 and a
50% chance of hitting detector 2. It is tempting to think that the light takes
one or the other path, but in fact it takes both! It’s just that the photo detector
that measures the photon ﬁrst breaks the superposition, so it’s the detectors that
cause the randomness, not the half silvered mirror. This can be demonstrated
by adding in some fully silvered mirrors and bouncing both parts of the super
posed photon (which is at this point is in two places at once) so that they meet
and interfere with each other at their meeting point. If another half silvered
mirror (ﬁgure 4.18) is placed at this meeting point and if light was just particle
like we would expect that the light would behave as before (going either way
with 50% probability), but the interference (like wave interference when two
stones are thrown into a pond near each other simultaneously) causes the pho
ton to always be detected by detector 1. A third example (ﬁgure 4.19) shows
clearly that the photons travel both paths because blocking one path will break
the superposition and stop the interference.
4.2.3 Dirac Notation
As described in the previous chapter Dirac notation is used for quantum com
puting. We can represent the states of a quantum system as kets. For example,
an electron’s spin can be represented as 0⟩ = spin up and 1⟩ as spin down.
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
Important Principles for Quantum Computing 109
detector 2
detector 1
half silvered mirror
light source
fully silvered mirror
interference
Figure 4.18: Superposition 1.
detector 2
detector 1
half silvered mirror
light source
fully silvered mirror
interference
Figure 4.19: Superposition 2.
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
110 Important Principles for Quantum Computing
The electron can be thought of as a little magnet, the effect of a charged particle
spinning on its axis. When we pass a horizontally travelling electron through
an inhomogeneous magnetic ﬁeld, in say, the vertical direction, the electron ei
ther goes up or down. If we then repeat this with the up electron it goes up,
with the down electron it goes down. We say the up electron after the ﬁrst mea
surement is in the state 0⟩ and the down electron is in state 1⟩. But, if we take
the up electron and pass it through a horizontal ﬁeld it comes out on one side
50%of the time and on the other side 50%of the time. If we represent these two
states as +⟩ and −⟩ we can say that the up spin electron was in a superposition
of the two states +⟩ and −⟩ such that, when we make a measurement with the
ﬁeld horizontal we project the electron into one or the other of the two states,
with equal probabilities of
1
2
.
4.2.4 Representing Information
Quantum mechanical information can be physically realised in many ways. To
have something analogous to a classical bit we need a quantum mechanical
system with two states only, when measured. We have just seen two examples:
electron spin and photon direction. Two more methods for representing binary
information in a way that is capable of exhibiting quantum effects (e.g. entan
glement and superposition) are: polarisation of photons and nuclear spins.
We examine various physical implementations of these ”quantumbits” (qubits)
in chapter 8.
4.2.5 Uncertainty
The quantum world is irreducibly small so it’s impossible to measure a quan
tumsystemwithout having an effect on that systemas our measurement device
is also quantum mechanical. As a result there is no way of accurately predict
ing all of the properties of a particle. There is a trade off  the properties occur
in complementary pairs (like position and momentum, or vertical spin and
horizontal spin) and if we know one property with a high degree of certainty
then we must know almost nothing about the other property. That unknown
property’s behaviour is essentially random. An example of this is a particle’s
position and velocity: if we know exactly where it is then we know nothing
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
Important Principles for Quantum Computing 111
about how fast it is going. This indeterminacy is exploited in quantum cryp
tography (see chapter 7).
It has been postulated (and currently accepted) that particles in fact DO NOT
have deﬁned values for unknown properties until they are measured. This is
like saying that something does not exist until it is looked at.
4.2.6 Entanglement
In 1935 Einstein (along with colleagues Podolski and Rosen) demonstrated a
paradox (named EPR after them) in an attempt to refute the undeﬁned na
ture of quantum systems. The results of their experiment seemed to show that
quantum systems were deﬁned, having local state BEFORE measurement. Al
though the original hypothesis was later proven wrong (i.e. it was proven that
quantum systems do not have local state before measurement). The effect they
demonstrated was still important, and later became known as entanglement.
Entanglement is the ability for pairs of particles to interact over any distance
instantaneously. Particles don’t exactly communicate, but there is a statisti
cal correlation between results of measurements on each particle that is hard to
understand using classical physics. To become entangled, two particles are al
lowed to interact; they then separate and, on measuring say, the velocity of one
of them (regardless of the distance between them), we can be sure of the value
of velocity of the other one (before it is measured). The reason we say that
they communicate instantaneously is because they store no local state [Rae, A.
1996] and only have well deﬁned state once they are measured. Because of this
limitation particles can’t be used to transmit classical messages faster than the
speed of light as we only know the states upon measurement. Entanglement
has applications in a wide variety of quantumalgorithms and machinery, some
of which we’ll look at later.
As stated before, it has been proven that entangled particles have no local state;
this is explained in section 6.7.
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
Chapter 5
Quantum Computing
5.1 Elements of Quantum Computing
5.1.1 Introduction
Generally we’ll think of a quantum computer as a classical computer with a
quantum circuit attached to it with some kind of interface between conven
tional and quantum logic. Since there are only a few things a quantum com
puter does better than a classical computer it makes sense to do the bulk of the
processing on the classical machine.
This section borrows heavily from [Nielsen, M. A. & Chuang, I. L. 2000] and
[Dawar, A. 2004] so the use of individual citations for these references has been
dropped.
5.1.2 History
In 1982 Richard Feynman theorised that classic computation could be dramat
ically improved by quantum effects, building on this, David Deutsch devel
oped the basis for quantum computing between 1984 and 1985. The next major
breakthrough came in 1994 when Peter Shor described a method to factor large
numbers in quantum polytime (which breaks RSA encryption). This became
known as Shor’s algorithm. At around the same time the quantum complex
ity classes were developed and the quantum Turing machine was described.
Then in 1996 Lov Grover developed a fast database search algorithm (known
as Grover’s algorithm). The ﬁrst prototypes of quantum computers were also
113
114 Elements of Quantum Computing
built in 1996. In 1997 quantum error correction techniques were developed at
Bell labs and IBM. Physical implementations of quantum computers improved
with a three qubit machine in 1999 and a seven qubit machine in 2000.
5.1.3 Bits and Qubits
This section is about the ”nuts and bolts” of quantum computing. It describes
qubits, gates, and circuits.
Quantumcomputers performoperations on qubits which are analogous to con
ventional bits (see below) but they have an additional property in that they can
be in a superposition. A quantum register with 3 qubits can store 8 numbers
in superposition simultaneously [Barenco, A. Ekert, A. Sanpera, A. & Machi
avello, C. 1996] and a 250 qubit register holds more numbers (superposed) than
there are atoms in the universe! [Deutsch, D. & Ekert, A. 1998].
The amount of information stored during the ”computational phase” is essen
tially inﬁnite  its just that we can’t get at it. The inaccessibility of the infor
mation is related to quantum measurement: When we attempt to readout a
superposition state holding many values the state collapses and we get only
one value (the rest get lost). This is tantalising but, in some cases, can be made
to work to our computational advantage.
Single Qubits
Classical computers use two discrete states (e.g. states of charging of a capac
itor) to represent a unit of information, this state is called a binary digit (or bit
for short). A bit has the following two values:
0 and 1.
There is no intermediate state between them, i.e. the value of the bit cannot
be in a superposition.
Quantum bits, or qubits, can on the other hand be in a state ”between” 0 and
1, but only during the computational phase of a quantum operation. When
measured, a qubit can become either:
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
Elements of Quantum Computing 115
0⟩ or 1⟩
i.e. we readout 0 or 1. This is the same as saying a spin particle can be in a
superposition state but, when measured, it shows only one value (see chapter
4).
The ⟩ symbolic notation is part of the Dirac notation (see chapters 3 and 4).
In terms of the above it essentially means the same thing as 0 and 1 (this is
explained a little further on), just like a classical bit. Generally, a qubit’s state
during the computational phase is represented by a linear combination of states
otherwise called a superposition state.
α0⟩ +β1⟩.
Here α and β are the probability amplitudes. They can be used to calculate the
probabilities of the system jumping into 0⟩ or 1⟩ following a measurement or
readout operation. There may be, say a 25% chance a 0 is measured and a 75%
chance a 1 is measured. The percentages must add to 100%. In terms of their
representation qubits must satisfy:
α
2
+β
2
= 1. (5.1)
This the same thing as saying the probabilities add to 100%.
Once the qubit is measured it will remain in that state if the same measure
ment is repeated provided the system remains closed between measurements
(see chapter 4). The probability that the qubit’s state, when in a superposition,
will collapse to states 0⟩ or 1⟩ is
α
2
for 0⟩
and
β
2
for 1⟩.
0⟩ and 1⟩ are actually vectors, they are called the computational basis states
that form an orthonormal basis for the vector space C
2
.
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
116 Elements of Quantum Computing
The state vector Ψ⟩ of a quantum system describes the state at any point in
time of the entire system. Our state vector in the case of one qubit is:
Ψ⟩ = α0⟩ +β1⟩. (5.2)
The α and β might vary with time as the state evolves during the computation
but the sum of the squares of α and β must always must be equal to 1.
Quantum computing also commonly uses
1
√
2
(0⟩ + 1⟩) and
1
√
2
(0⟩ − 1⟩) as a
basis for C
2
, which is often shortened to just +⟩, and −⟩. These bases are some
times represented with arrows which are described below, and are referred to
as rectilinear and diagonal which can say refer to the polarisation of a photon.
You may ﬁnd these notational conventions being used:
0⟩ =  →⟩. (5.3)
1⟩ =  ↑⟩. (5.4)
1
√
2
(0⟩ +1⟩) = +⟩ =  ↗⟩. (5.5)
1
√
2
(0⟩ −1⟩) = −⟩ =  ↖⟩. (5.6)
Some examples of measurement probabilities are on the next page.
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
Elements of Quantum Computing 117
Example Measurement probabilities.
Ψ⟩ =
1
√
2
0⟩ +
1
√
2
1⟩.
The probability of measuring a 0⟩ is:
1
√
2
2
=
1
2
.
The probability of measuring a 1⟩ is:
1
√
2
2
=
1
2
.
So 50% of the time we’ll measure a 0⟩ and 50% of the time we’ll measure a
1⟩.
Example More measurement probabilities.
Ψ⟩ =
√
3
2
0⟩ −
1
2
1⟩.
The probability of measuring a 0⟩ is:
√
3
2
2
=
3
4
.
The probability of measuring a 1⟩ is:
1
2
2
=
1
4
.
So 75% of the time we’ll measure a 0⟩ and 25% of the time we’ll measure a
1⟩.
The sign in the middle of the two values can change, which affects the internal
evolution of the qubit, not the outcome of a measurement. When measuring in
the basis {0⟩, 1⟩} the sign is actually the relative phase of the qubit. So,
α0⟩ +β1⟩
and
α0⟩ −β1⟩
have the same output values and probabilities but behave differently during
the computational phase. Formally we say they differ by a relative phase fac
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
118 Elements of Quantum Computing
tor. So in the case of the qubits above they differ by a phase factor of 1. It is
called a phase factor because it always has magnitude 1 and so its value, as a
complex number, is determined entirely by the phase.
The other type of phase is called global phase. Two states can differ by a global
phase factor and still be considered the same, as the global phase factor is not
observable. One reason for this is that the probabilities for the outcomes α and
β are unaffected if α and β are each multiplied by the same complex number
of magnitude 1. Likewise the relative phase (which ﬁgures in interference ef
fects) is unaffected if α and β are multiplied by a common phase factor. What
this means is that if we have a state on n qubits we can put a complex factor in
front of the entire state to make it more readable. This is best described by an
example (below).
Example Global phase.
Ψ⟩ =
−i
√
2
0⟩ +
1
√
2
1⟩.
can be rewritten as:
Ψ⟩ = −i
1
√
2
0⟩ −
i
√
2
1⟩
.
Remembering that −i × −i = −1 we say the factor at the front of our
state vector (−i) is a global phase factor. We can also say here that because
−i = e
−i
π
2
we have a phase of −
π
2
.
Example More global phase.
Ψ⟩ =
1
2
(−00⟩ +01⟩ −10⟩ +11⟩).
can be rewritten as:
Ψ⟩ = (−1)
1
2
(00⟩ −01⟩ +10⟩ +11⟩).
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
Elements of Quantum Computing 119
E
T
c
' Z
Z
Z
Z
Z´
`
`
`
`
`·
a
b
1⟩
0⟩
−1⟩
Figure 5.1: 2D qubit representations.
The Ket ⟩
Part of Dirac’s notation is the ket (⟩). The ket is just a notation for a vector. The
state of a single qubit is a unit vector in C
2
. So,
¸
α
β
¸
is a vector, and is written as:
α0⟩ +β1⟩
with
0⟩ =
¸
1
0
¸
(5.7)
and
1⟩ =
¸
0
1
¸
. (5.8)
Two Dimensional Qubit Visualisation
Single qubits can be represented in value and relative phase in two dimensions
by the diagram in ﬁgure 5.1 which is similar to the way we represent polar co
ordinates for complex numbers. The graph shows the general form of 2D qubit
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
120 Elements of Quantum Computing
representation where a =
1
√
2
0⟩ +
1
√
2
1⟩ and b =
1
√
2
0⟩ −
1
√
2
1⟩.
This diagram is ok for real numbered values of α and β but cannot accurately
depict all the possible states of a qubit. For this we need three dimensions.
Three Dimensional Qubit Visualisation  The Bloch Sphere
The Bloch sphere is a tool with which the state of single qubit can be viewed in
three dimensions and is useful for visualising all single qubit operations. We
can say that the state of a single qubit can be written as:
Ψ⟩ = e
iγ
(cos
θ
2
0⟩ +e
iφ
sin
θ
2
1⟩). (5.9)
We can ignore the global phase factor in front so Ψ⟩ becomes:
Ψ⟩ = cos
θ
2
0⟩ +e
iφ
sin
θ
2
1⟩. (5.10)
So, in terms of the angle θ and φ the Bloch sphere looks like this:
What’s probably more helpful at this stage is to see where all of the potential
states of a qubit lie on the Bloch sphere. This is shown below with the points
ˆ x, ˆ y, and ˆ z labelling each positive axis:
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
Elements of Quantum Computing 121
As stated in chapter 4, individual qubits can be physically realised using vari
ous quantum two state systems, here are a few ways this can be done:
• Polarisations of a photon.
• Nuclear spins.
• Ground and excited states of an atom (i.e. the energy level, or orbital).
We now look at the equivalent of a register: i.e. a composite system of qubits,
e.g. Ions in a trap (see chapter 8).
Multiple Qubits
The potential amount of information available during the computational phase
grows exponentially with the size of the system, i.e. the number of qubits.
This is because if we have n qubits the number of basis states is 2
n
. E.g. if
we have two qubits, forming a quantum register then there are four (= 2
2
)
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
122 Elements of Quantum Computing
computational basis states: forming,
00⟩, 01⟩, 10⟩, and 11⟩. (5.11)
Here 01⟩ means that qubit 1 is in state 0⟩ and qubit 2 is in state 1⟩, etc. We
actually have 01⟩ = 0⟩ ⊗1⟩, where ⊗ is the tensor product (see below).
Like a single qubit, the two qubit register can exist in a superposition of the four
states (below we change the notation for the complex coefﬁcients, i.e. probabil
ity amplitudes):
Ψ⟩ = α
0
00⟩ +α
1
01⟩ +α
2
10⟩ +α
3
11⟩. (5.12)
Again all of the probabilities must sum to 1, formally for the general case of n
qubits this is can be written as:
2
n
−1
∑
i=0
α
i

2
= 1. (5.13)
Example n = 5 (5 qubits). We can have up to 32 (= 2
5
) basis states in a
superposition.
Ψ = α
0
00000⟩ +α
1
00001⟩ +... +α
2
n
−1
11111⟩.
We don’t have to represent values with 0s and 1s. A qudit has the following
format in C
N
:
Ψ = α
0
0⟩ +α
1
1⟩ +α
2
2⟩ +. . . +α
n−1
N −1⟩ =
α
0
α
1
α
2
.
.
.
α
N
−1
¸
¸
¸
¸
¸
¸
¸
¸
¸
. (5.14)
If N = 2
n
we require an n qubit register.
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
Elements of Quantum Computing 123
Tensor Products
A decomposition into single qubits of a multiqubit system can be represented
by a tensor product, ⊗.
Example Decomposition using a tensor product.
1
2
(00⟩ +01⟩ +10⟩ +11⟩) =
1
√
2
(0⟩ +1⟩) ⊗
1
√
2
(0⟩ +1⟩).
A tensor product can also be used to combine different qubits.
(α
0
0⟩ +α
1
1⟩) ⊗(β
0
0⟩ +β
1
1⟩) = α
0
β
0
00⟩ +α
0
β
1
01⟩ +α
1
β
0
10⟩ +α
1
β
1
11⟩.
(5.15)
Partial Measurement
We can measure a subset of an nqubit system. i.e. we don’t have to get read
outs on all the qubits (some can be left unmeasured). We’ll ﬁrst consider non
entangled states. The simplest way to measure a subset of states is shown in
the following example with two qubits.
An example is presented on the next page.
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
124 Elements of Quantum Computing
Example measuring the ﬁrst bit in a two qubit system.
1. We prepare a quantum system in the following state, the qubit we are
going to measure is bolded, a nonentangled state would mean that all
the probability amplitudes are nonzero:
Ψ = α
0
00⟩ +α
1
01⟩ +α
2
10⟩ +α
3
11⟩.
2. We now measure, so the probability of it being 0 is:
pr(0) = α
0

2
+α
1

2
and, the probability of it being 1 is:
pr(1) = α
2

2
+α
3

2
.
3. If we measured a 0⟩ the post measurement state is:
0⟩ ⊗
α
0
0⟩ +α
1
1⟩
√
α
0

2
+α
1

2
(i.e. we project on to the {00⟩, 01⟩} subspace and the α
2
and α
3
terms
drop out). Similarly, if we measured a 1⟩ measured the post measure
ment state is:
1⟩ ⊗
α
2
0⟩ +α
3
1⟩
√
α
2

2
+α
3

2
.
We can do the same for qubit two, the probability of qubit two being a 0⟩ is:
pr(0) = α
0

2
+α
2

2
and its post measurement state would be:
α
0
0⟩ +α
2
1⟩
√
α
0

2
+α
2

2
⊗0⟩.
This logic can be extended to n qubits.
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
Elements of Quantum Computing 125
Quantummeasurement can be described as a set {M
m
} of linear operators with
1 ≤ m ≤ n where n is the number of possible outcomes. For a single qubit
with an orhtonormal basis of 0⟩ and 1⟩ we can deﬁne measurement operators
M
0
= 0⟩ ⟨0 and M
1
= 1⟩ ⟨1 (which are also both projectors).
If we have a system in state Ψ⟩ then outcome m has a probability of:
pr(m) = ⟨ΨM
†
m
M
m
Ψ⟩. (5.16)
If the outcome is m then the state collapses to:
M
m
Ψ⟩
√
⟨ΨM
†
m
M
m
Ψ⟩
. (5.17)
Example Another way of looking at measuring the ﬁrst bit in a two qubit
system.
Ψ⟩ =
1
√
30
00⟩ +
2
√
30
01⟩ +
3
√
30
10⟩ +
4
√
30
11⟩
When we measure qubit one the resulting states would look like this (unnor
malised):
Ψ⟩ = 0⟩ ⊗
1
√
30
0⟩ +
2
√
30
1⟩
for measuring a 0⟩ and for measuring a 1⟩:
Ψ⟩ = 1⟩ ⊗
3
√
30
0⟩ +
4
√
30
1⟩
.
Nowwe must make sure that the second qubit is normalised, so we multiply
it by a factor:
Ψ⟩ =
√
5
√
30
0⟩ ⊗
1
√
5
0⟩ +
2
√
5
1⟩
+
5
√
30
1⟩ ⊗
3
5
0⟩ +
4
5
1⟩.
This gives us
√
5
√
30
2
=
1
6
probability of measuring a 0⟩ and a
5
√
30
2
=
5
6
prob
ability of measuring a 1⟩. So if we measure a 0⟩ then our post measurement
state is:
Ψ⟩ = 0⟩ ⊗
1
√
5
0⟩ +
2
√
5
1⟩
and if we measure a 1⟩ then our post measurement state is:
Ψ⟩ = 1⟩ ⊗
3
5
0⟩ +
4
5
1⟩
.
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
126 Elements of Quantum Computing
Example Measurement of qubit one in a two qubit system using a simple
projector.
Ψ⟩ =
1
√
30
00⟩ +
2
√
30
01⟩ +
3
√
30
10⟩ +
4
√
30
11⟩.
We ﬁnd the probability of measuring a 0⟩ by using a projector 00⟩⟨00 +
01⟩⟨01:
(00⟩⟨00 +01⟩⟨01)
1
√
30
00⟩ +
2
√
30
01⟩ +
3
√
30
10⟩ +
4
√
30
11⟩
= (00⟩⟨00 +01⟩⟨01) Ψ⟩
=
1
√
30
00⟩ +
2
√
30
01⟩.
Say we change our measurement basis to {0⟩ , 1⟩} then we can represent pro
jectors P
0
and P
1
as 0⟩ ⟨0 and 1⟩ ⟨1 respectively. We measure the probabil
ity of the ﬁrst qubit being 0 by using P
0
on qubit one and I on qubit two, i.e.
P
0
⊗I. If we wanted to measure the probability of the ﬁrst qubit being 1 then
we would use P
1
⊗I.
pr(0) = ⟨ΨP
0
⊗IΨ⟩
= ⟨Ψ 0⟩ ⟨0 ⊗IΨ⟩
= ⟨Ψ
1
√
30
00⟩ +
2
√
30
01⟩
=
1
6
and this gives us a postmeasurement state of:
Ψ
′
⟩ =
P
0
⊗IΨ⟩
√
⟨ΨP
0
⊗IΨ⟩
=
1
√
30
00⟩ +
2
√
30
01⟩
√
1
6
= 0⟩ ⊗
¸
1
√
30
0⟩ +
2
√
30
1⟩
√
1
6
= 0⟩ ⊗
1
√
5
0⟩ +
2
√
5
1⟩
.
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
Elements of Quantum Computing 127
Properties:
All probabilities sum to 1,
m
∑
i=1
pr(i) =
m
∑
i=1
⟨ΨM
†
i
M
i
Ψ⟩ = 1 this is
the result of the completeness equation, i.e.
m
∑
i=1
M
†
i
M
i
= I. (5.18)
Note: our basis needs to be orthogonal, otherwise we can’t reliably distinguish
between two basis states u⟩ and v⟩, i.e. ⟨uv⟩ ̸= 0 means u⟩ and v⟩ are not
orthogonal.
Projective Measurements
Projective measurements are a means by which we can accomplish two tasks,
they are:
1. Apply a unitary transform to Ψ⟩.
2. Measure Ψ⟩.
So we need a unitary transform U and Ψ⟩ to perform a measurement. The uni
tary transform is called the observable, which is denoted here by O
M
.
First we need to ﬁnd the spectral decomposition of O
M
(Z for example), for
O
M
we have:
O
M
=
∑
m
mP
m
(5.19)
where m is each eigenvalue and P
m
is a projector made up of P
m
= m⟩⟨m.
5.1.4 Entangled States
Subatomic particles can be entangled, this means that they are connected, re
gardless of distance. Their effect on each other upon measurement is instanta
neous. This can be useful for computational purposes.
Consider the following state (which is not entangled):
1
√
2
(00⟩ +01⟩)
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
128 Elements of Quantum Computing
it can be expanded to:
1
√
2
00⟩ +
1
√
2
01⟩ + 010⟩ + 011⟩.
Upon measuring the ﬁrst qubit (a partial measurement) we get 0 100% of the
time and the state of the second qubit becomes:
1
√
2
0⟩ +
1
√
2
1⟩
giving us equal probability for a 0 or a 1.
If we try this on an entangled state (in this case an EPR pair or Bell state, see
section 6.7) we ﬁnd that the results for the qubits are correlated.
Example Consider:
1
√
2
(00⟩ +11⟩) .
When expanded this is:
1
√
2
00⟩ + 001⟩ + 010⟩ +
1
√
2
11⟩.
Measuring the ﬁrst qubit gives us 00⟩ 50% of the time and 11⟩ 50% of the
time. So the second qubit is always the same as the ﬁrst, i.e. we get two qubit
values for the price of one measurement.
This type of correlation can be used in a variety of ways in application to the
ﬁrst or second qubit to give us correlations that are strongly statistically con
nected. This is a distinct advantage over classical computation. Measuring
entangled states accounts for the correlations between them. The next example
show the measurement of a partially entangled state.
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
Elements of Quantum Computing 129
Example The following state vector represents an entangled system.
Ψ⟩ =
2
3
01⟩ +
i2
3
10⟩ +
1
3
00⟩.
If we separate out the qubits (tensor decomposition) The state looks like this
(unnormalised):
Ψ⟩ = 0⟩ ⊗
2
3
1⟩ +
1
3
0⟩
+1⟩ ⊗
i2
3
0⟩.
Nowwe must make sure that the second qubit is normalised, so we multiply
it by a factor:
Ψ⟩ =
√
5
3
0⟩ ⊗
2
√
5
0⟩ +
1
√
5
1⟩
+
i2
3
1⟩ ⊗0⟩.
Now say we measure qubit 1. Upon measurement of 0⟩ the state collapses
to:
Ψ
′
⟩ = 0⟩ ⊗
2
√
5
0⟩ +
1
√
5
1⟩
.
Upon measuring a 1⟩ the state collapses to:
Ψ
′
⟩ = 1⟩ ⊗0⟩.
5.1.5 Quantum Circuits
If we take a quantum state, representing one or more qubits, and apply a se
quence of unitary operators (quantum gates) the result is a quantum circuit.
We now take a register and let gates act on qubits, in analogy to a conventional
circuit.
U
1
U
2
Input states
U
3
This gives us a simple form of quantum circuit (above) which is a series of
operations and measurements on the state of nqubits. Each operation is uni
tary and can be described by an 2
n
×2
n
matrix.
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
130 Elements of Quantum Computing
Each of the lines is an abstract wire, the boxes containing U
n
are quantum logic
gates (or a series of gates) and the meter symbol is a measurement. Together, the
gates, wires, input, and output mechanisms implement quantum algorithms.
Unlike classical circuits which can contain loops, quantum circuits are ”one
shot circuits” that just run once from left to right (and are special purpose: i.e.
we have a different circuit for each algorithm).
It should be noted that it is always possible to rearrange quantum circuits so
that all the measurements are done at the end of the circuit.
Single Qubit Gates
Just as a single qubit can be represented by a column vector, a gate acting on
the qubit can be represented by a 2 × 2 matrix. The quantum equivalent of a
NOT gate, for example, has the following form:
¸
0 1
1 0
¸
.
The only constraint these gates have to satisfy (as required by quantum me
chanics) is that they have to be unitary, where a unitary matrix is one that sat
isﬁes the condition underneath. This allows for a lot of potential gates.
U
†
U = I.
The matrix acts as a quantum operator on a qubit. The operator’s matrix must
be unitary because the resultant values must satisfy the normalisation condi
tion. Unitarity implies that the probability amplitudes must still sum to 1. If
(before the gate is applied)
α
2
+β
2
= 1
then, after the gate is applied:
α
′

2
+β
′

2
= 1 (5.20)
where α
′
and β
′
are the values for the probability amplitudes for the qubit after
the operation has been applied.
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
Elements of Quantum Computing 131
Here are some examples:
Pauli I Gate
This is the identity gate.
σ
0
= I =
¸
1 0
0 1
¸
(5.21)
which gives us the following:
0⟩ → I → 0⟩, (5.22)
1⟩ → I → 1⟩, (5.23)
α0⟩ +β1⟩ → I → α0⟩ +β1⟩. (5.24)
Pauli X Gate
The Pauli X gate is a quantum NOT gate.
X
σ
1
= σ
X
= X =
¸
0 1
1 0
¸
(5.25)
which gives us the following:
0⟩ → X → 1⟩, (5.26)
1⟩ → X → 0⟩, (5.27)
α0⟩ +β1⟩ → X → β0⟩ +α1⟩. (5.28)
The operation of the Pauli X gate can be visualised on the Bloch sphere as
follows:
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
132 Elements of Quantum Computing
Here (and in subsequent images) the blue (dark) point is the original state vec
tor and the green (light) point is the state vector after the transformation.
Pauli Y Gate
Y
σ
2
= σ
Y
= Y =
¸
0 −i
i 0
¸
(5.29)
which gives us the following:
0⟩ → Y → i1⟩, (5.30)
1⟩ → Y → −i0⟩, (5.31)
α0⟩ +β1⟩ → Y → −βi0⟩ +αi1⟩. (5.32)
Pauli Z Gate
This gate ﬂips a qubit’s sign, i.e. changes the relative phase by a factor of 1.
Z
σ
3
= σ
Y
= Z =
¸
1 0
0 −1
¸
(5.33)
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
Elements of Quantum Computing 133
which gives us the following:
0⟩ → Z → 0⟩, (5.34)
1⟩ → Z → −1⟩, (5.35)
α0⟩ +β1⟩ → Z → α0⟩ −β1⟩. (5.36)
Phase Gate
S
S =
¸
1 0
0 i
¸
(5.37)
which gives us the following:
0⟩ → S → 0⟩, (5.38)
1⟩ → S → i1⟩, (5.39)
α0⟩ +β1⟩ → S → α0⟩ +βi1⟩. (5.40)
Note, the Phase gate can be expressed in terms of the T gate (see below):
S = T
2
(5.41)
π
8
Gate (T Gate)
T
T =
¸
1 0
0 e
i
π
4
¸
(5.42)
which gives us the following:
0⟩ → T → 0⟩, (5.43)
1⟩ → T → e
i
π
4
1⟩, (5.44)
α0⟩ +β1⟩ → T → α0⟩ +e
i
π
4
β1⟩. (5.45)
If we apply T again we get the same as applying S once.
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
134 Elements of Quantum Computing
Hadamard Gate
Sometimes called the square root of NOT gate, it turns a 0⟩ or a 1⟩ into a su
perposition (note the different sign). This gate is one of the most important in
quantum computing. We’ll use this gate later for a demonstration of a simple
algorithm.
H
H =
1
√
2
¸
1 1
1 −1
¸
(5.46)
which gives us the following:
0⟩ → H →
1
√
2
(0⟩ +1⟩), (5.47)
1⟩ → H →
1
√
2
(0⟩ −1⟩), (5.48)
α0⟩ +β1⟩ → H → α
0⟩ +1⟩
√
2
+β
0⟩ −1⟩
√
2
. (5.49)
Example Using H and Z gates and measuring in the {+⟩, −⟩} basis.
(1) We can put 0⟩ into state +⟩ by using an H gate:
0⟩ → H →
1
√
2
(0⟩ +1⟩).
(2) We can put 0⟩ into state −⟩ by using an H gate followed by a Z gate :
0⟩ → H →
1
√
2
(0⟩ +1⟩) → Z →
1
√
2
(0⟩ −1⟩).
The operation of the H gate can be visualised on the Bloch sphere as follows:
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
Elements of Quantum Computing 135
Outer Product Notation
A handy way to represent gates is with outer product notation, for example a
Pauli X gate can be represented by:
1⟩⟨0 +0⟩⟨1.
When applied to α0⟩ +β1⟩. we get:
X(α0⟩ +β1⟩) = (1⟩⟨0 +0⟩⟨1)(α0⟩ +β1⟩)
= 1⟩⟨0(α0⟩ +β1⟩) +0⟩⟨1(α0⟩ +β1⟩)
= α1⟩1 +β1⟩0 +α0⟩0 +β0⟩1
= β0⟩ +α1⟩.
For the above it’s useful to remember the following:
⟨00⟩ = 1,
⟨01⟩ = 0,
⟨10⟩ = 0,
⟨11⟩ = 1.
Instead of doing all that math, just think of it this way. For each component of
the sequence, take the bra part, ⟨u from v⟩⟨u, and the new qubit’s coefﬁcient
will be the old qubit’s coefﬁcient for the ket part v⟩.
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
136 Elements of Quantum Computing
Example Say we use this method on the Pauli Y outer product representa
tion,
i1⟩⟨0 −i0⟩⟨1.
When applied to Ψ⟩ = α0⟩ +β1⟩) we’ll see what we get:
The ﬁrst part of the outer product notation is i1⟩⟨0 so this means we
take the α0⟩ part of Ψ⟩ and convert it to iα1⟩ so our partially built state
now looks like:
Ψ⟩ = . . . +iα1⟩.
Now we take the second part, −i0⟩⟨1 and β1⟩ becomes −iβ0⟩ and ﬁnally
we get:
Ψ⟩ = −iβ0⟩ +iα1⟩.
Finally, the coefﬁcients of outer product representations are the same as the
matrix entries, so for the matrix:
¸
α
00
α
01
α
10
α
11
¸
.
The outer product representation looks like:
α
00
0⟩⟨0 +α
01
0⟩⟨1 +α
10
1⟩⟨0 +α
11
1⟩⟨1.
Further Properties of the Pauli Gates
Next we’ll look at the eigenvectors, eigenvalues, spectral decomposition, and
outer product representation of the Pauli gates.
I has eigenvectors 0⟩, and 1⟩ with eigenvalues of 1 and 1 respectively. Us
ing the spectral decomposition theorem:
I = 1 · 0⟩⟨0 + 1 · 1⟩⟨1
= 0⟩⟨0 +1⟩⟨1. (5.50)
X has eigenvectors
1
√
2
(0⟩ +1⟩), and
1
√
2
(0⟩ −1⟩) with eigenvalues of 1 and 1
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
Elements of Quantum Computing 137
respectively.
X = 1 ·
1
√
2
(0⟩ +1⟩)
1
√
2
(⟨0 +⟨1) + (−1) ·
1
√
2
(0⟩ −1⟩)
1
√
2
(⟨0 −⟨1)
= 1⟩⟨0 +0⟩⟨1. (5.51)
Y has eigenvectors
1
√
2
(−i0⟩ +1⟩), and
1
√
2
(0⟩ −i1⟩) with eigenvalues of 1 and
1 respectively.
Y = 1 ·
1
√
2
(−i0⟩ +1⟩)
1
√
2
(i⟨0 +⟨1) + (−1) ·
1
√
2
(0⟩ −i1⟩)
1
√
2
(⟨0 +i⟨1)
= i1⟩⟨0 −i0⟩⟨1. (5.52)
Z has eigenvectors 0⟩, and 1⟩ with eigenvalues of 1 and 1 respectively.
Z = 1 · 0⟩⟨0 + (−1) · 1⟩⟨1
= 0⟩⟨0 −1⟩⟨1. (5.53)
The Pauli matrices are:
Unitary (σ
k
)
†
= I ∀ k. (5.54)
Hermitian (σ
k
)
†
= σ
k
∀ k. (5.55)
Rotation Operators
There are three useful operators that work well with the Bloch sphere. These
are the rotation operators R
X
, R
Y
, and R
Z
.
R
X
=
¸
cos
θ
2
−i sin
θ
2
−i sin
θ
2
cos
θ
2
¸
(5.56)
= e
−iθX/2
, (5.57)
R
Y
=
¸
cos
θ
2
−sin
θ
2
sin
θ
2
cos
θ
2
¸
(5.58)
= e
−iθY/2
, (5.59)
R
Z
=
¸
e
−iθ/2
0
0 e
−iθ/2
¸
(5.60)
= e
−iθZ/2
. (5.61)
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
138 Elements of Quantum Computing
The rotation operators can be rewritten as
cos
θ
2
I −i sin
θ
2
P
σ
(5.62)
where P
σ
means a Pauli operator identiﬁed by σ = X, Y, or Z.
In fact if we assume different angles for θ then all single qubit gates can be
represented by the product of R
Y
and R
Z
.
Example We can represent R
Y
(90
◦
) by the following matrix:
1
√
2
¸
1 −1
1 1
¸
=
¸
1
√
2
−
1
√
2
1
√
2
1
√
2
¸
.
So if we apply the gate to state Ψ⟩ = 1⟩ we get the following:
¸
1
√
2
−
1
√
2
1
√
2
1
√
2
¸¸
0
1
¸
=
¸
−
1
√
2
1
√
2
¸
= −
1
√
2
0⟩ +
1
√
2
1⟩
=
1
√
2
0⟩ −
1
√
2
1⟩.
At that last step we multiplied the entire state by a global phase factor of −1.
Multi Qubit Gates
Atrue quantumgate must be reversible, this requires that multi qubit gates use
a control line, where the control line is unaffected by the unitary transforma
tion. We’ll look again at the reversible gates that were introduced in chapter 2,
this time with emphasis on quantum computing.
a⟩ • a⟩
b⟩
·
b ⊕a⟩
In the case of the CNOT gate, the ⊕ is a classical XOR with the input on the b
line and the control line a. Because it is a two qubit gate it is represented by a
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
Elements of Quantum Computing 139
4 ×4 matrix:
1 0 0 0
0 1 0 0
0 0 0 1
0 0 1 0
¸
¸
¸
¸
¸
¸
(5.63)
which gives the following:
00⟩ → CNOT → 00⟩, (5.64)
01⟩ → CNOT → 01⟩, (5.65)
10⟩ → CNOT → 11⟩, (5.66)
11⟩ → CNOT → 10⟩, (5.67)
(α0⟩ +β1⟩)1⟩ → CNOT → α01⟩ +β10⟩, (5.68)
0⟩(α0⟩ +β1⟩) → CNOT → α00⟩ +β01⟩, (5.69)
1⟩(α0⟩ +β1⟩) → CNOT → α11⟩ +β10⟩. (5.70)
Example Evaluating (α0⟩ +β1⟩)0⟩ →CNOT → α00⟩ +β11⟩.
(α0⟩ +β1⟩)0⟩ expanded is α00⟩ +β10⟩, so in matrix form we have:
1 0 0 0
0 1 0 0
0 0 0 1
0 0 1 0
¸
¸
¸
¸
¸
¸
α
0
β
0
¸
¸
¸
¸
¸
¸
=
α
0
0
β
¸
¸
¸
¸
¸
¸
= α00⟩ +β11⟩.
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
140 Elements of Quantum Computing
Qubit Two NOT Gate
As distinct from the CNOT gate we have a NOT
2
gate, which just does NOT on
qubit two and has the following matrix representation:
0 1 0 0
1 0 0 0
0 0 0 1
0 0 1 0
¸
¸
¸
¸
¸
¸
(5.71)
which gives the following:
00⟩ → NOT
2
→ 01⟩, (5.72)
01⟩ → NOT
2
→ 00⟩, (5.73)
10⟩ → NOT
2
→ 11⟩, (5.74)
11⟩ → NOT
2
→ 10⟩. (5.75)
Although it’s not a commonly used gate it’s interesting to note that the gate
can be represented as a Kronecker product of I and X as follows [Knill, E.
Laﬂamme, R. Barnum, H. Dalvit, D. Dziarmaga, J. Gubernatis, J. Gurvits, L.
Ortiz, G. Viola, L. & Zurek, W.H. 2002]:
NOT
2
= I ⊗X =
¸
1 0
0 1
¸
⊗
¸
0 1
1 0
¸
(5.76)
=
¸
¸
¸
¸
¸
1
¸
0 1
1 0
¸
0
¸
0 1
1 0
¸
0
¸
0 1
1 0
¸
1
¸
0 1
1 0
¸
. (5.77)
So, as well as using the NOT
2
notation we can use the tensor product of Pauli
gates on qubits one and two, shown below:
00⟩ → I ⊗X → 01⟩, (5.78)
01⟩ → I ⊗X → 00⟩, (5.79)
10⟩ → I ⊗X → 11⟩, (5.80)
11⟩ → I ⊗X → 10⟩. (5.81)
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
Elements of Quantum Computing 141
Toffoli Gate
The Toffoli gate was ﬁrst introduced in chapter 2. Here we’ll look at some prop
erties that relate to quantum computing. The most important property being
that any classical circuit can be emulated by using Toffoli gates.
a⟩ • a
′
⟩
b⟩ • b
′
⟩
c⟩
·
c
′
⟩
The Toffoli gate can simulate NAND gates and it can perform FANOUT, which
is classical bit copying (but we can’t copy superposed probability amplitudes).
FANOUT is easy in classical computing, but impossible in quantum computing
because of the no cloning theorem (see chapter 6).
A Toffoli gate can be simulated using a number of H, T, and S gates.
Fredkin Gate Also introduced in chapter 2, the Fredkin gate is another three
qubit gate. This gate can simulate AND, NOT, CROSSOVER, and FANOUT, it also
has the interesting property that it conserves 1’s.
a⟩ • a
′
⟩
b⟩ × b
′
⟩
c⟩ × c
′
⟩
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
142 Important Properties of Quantum Circuits
Classical circuit
Quantum circuit
x f(x)
x f(x)
ancilla bits
garbage bits
Figure 5.2: Garbage and ancilla bits.
5.2 Important Properties of Quantum Circuits
Quantum circuit diagrams have the following constraints which make them
different from classical diagrams.
1. They are acyclic (no loops).
2. No FANIN, as FANIN implies that the circuit is NOT reversible, and therefore
not unitary.
3. No FANOUT, as we can’t copy a qubit’s state during the computational phase
because of the nocloning theorem (explained in chapter 6).
All of the above can be simulated with the use of ancilla and garbage bits if
we assume that no qubits will be in a superposition (ﬁgure 5.2). As stated
in chapter 2, Garbage bits are useless qubits left over after computation and
ancilla bits are extra qubits needed for temporary calculations.
5.2.1 Common Circuits
Controlled U Gate
Let U be a unitary matrix, which uses an arbitrary number of qubits. A con
trolled U gate is a U gate with a control line, i.e. if the control qubit is 1⟩ then
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
Important Properties of Quantum Circuits 143
U acts on its data qubits, otherwise they are left alone.
•
U
Bit Swap Circuit
This circuit swaps the values of qubits between lines.
a⟩ •
·
• b⟩
b⟩
·
•
·
a⟩
The circuit can be simpliﬁed to:
a⟩ × b⟩
b⟩ × a⟩
Here are some examples:
0⟩ × 1⟩
1⟩ × 0⟩
1⟩ × 0⟩
0⟩ × 1⟩
Copying Circuit
If we have no superposition then we can copy bits in a classical sense with a
CNOT.
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
144 Important Properties of Quantum Circuits
a⟩ • a⟩
0⟩
·
a⟩
0⟩ • 0⟩
0⟩
·
0⟩
1⟩ • 1⟩
0⟩
·
1⟩
But when we use a superposition as input:
α0⟩ +β 1⟩ •
0⟩
·
The combined state becomes:
(α0⟩ +β1⟩)0⟩ = α00⟩ +β10⟩,
α00⟩ +β10⟩ → CNOT → α00⟩ +β11⟩.
Which is not a copy of the original state because:
(α0⟩ +β1⟩)(α0⟩ +β1⟩) ̸= α00⟩ +β11⟩.
A qubit in an unknown state (as an input) cannot be copied, when it is copied
it must ﬁrst be measured to be copied. The information held in the probability
amplitudes α and β is lost.
Bell State Circuit
This circuit produces Bell states that are entangled. We’ll represent a Bell state
circuit by β, and the individual Bell states as β
00
⟩, β
01
⟩, β
10
⟩, and β
11
⟩.
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
Important Properties of Quantum Circuits 145
a⟩
H
•
β
xx
⟩
b⟩
·
00⟩ → β →
1
√
2
(00⟩ +11⟩) = β
00
⟩,
01⟩ → β →
1
√
2
(01⟩ +10⟩) = β
01
⟩,
10⟩ → β →
1
√
2
(00⟩ −11⟩) = β
10
⟩,
11⟩ → β →
1
√
2
(01⟩ −10⟩) = β
11
⟩.
Superdense Coding
It’s possible, by using entangled pairs, to communicate two bits of information
by transmitting one qubit. Here’s how:
1. Initially Alice and Bob each take one half of an EPR pair, say we start with
β
00
. This means that Alice has the bolded qubit in
1
√
2
(00⟩ + 11⟩) and
Bob has the bolded qubit in
1
√
2
(00⟩ + 11⟩). They then move apart to an
arbitrary distance.
2. Depending on which value Alice wants to send to Bob, she applies a gate
(or gates) to her qubit. This is described below and the combined state is
shown after the gate’s operation with Alice’s qubit shown bolded:
00⟩ → I →
1
√
2
(00⟩ +11⟩),
10⟩ → X(X0⟩ = 1⟩, X1⟩ = 0⟩) →
1
√
2
(10⟩ +01⟩),
01⟩ → Z(Z0⟩ = 0⟩, Z1⟩ = −1⟩) →
1
√
2
(00⟩ −11⟩),
11⟩ → XZ →
1
√
2
(01⟩ −10⟩).
3. Alice now sends her qubit to Bob via a classical channel.
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
146 Important Properties of Quantum Circuits
4. Bob now uses a CNOT which allows him to ”factor out the second qubit”
while the ﬁrst one stays in a superposition.
1
√
2
(α00⟩ +β11⟩) → CNOT →
1
√
2
(α00⟩ +β10⟩) =
1
√
2
(α0⟩ +β1⟩)0⟩,
1
√
2
(α10⟩ +β01⟩) → CNOT →
1
√
2
(α01⟩ +β11⟩) =
1
√
2
(α0⟩ +β1⟩)1⟩,
1
√
2
(α00⟩ −β11⟩) → CNOT →
1
√
2
(α00⟩ −β10⟩) =
1
√
2
(α0⟩ −β1⟩)0⟩,
1
√
2
(α01⟩ −β10⟩) → CNOT →
1
√
2
(α01⟩ −β11⟩) =
1
√
2
(α0⟩ −β1⟩)1⟩.
5. Now Bob applies an H gate to the ﬁrst bit to collapse the superposition.
1
√
2
(α0⟩ −β1⟩) → H → 1⟩,
1
√
2
(α0⟩ +β1⟩) → H → 0⟩.
So Bob gets the following:
1
√
2
(α0⟩ +β1⟩)0⟩ → (H ⊗I) → 00⟩,
1
√
2
(α0⟩ +β1⟩)1⟩ → (H ⊗I) → 01⟩,
1
√
2
(α0⟩ −β1⟩)0⟩ → (H ⊗I) → 10⟩,
1
√
2
(α0⟩ −β1⟩)1⟩ → (H ⊗I) → 11⟩.
Bob can now measure the two qubits in the computational basis and the result
will be the value that Alice wanted to send.
Teleportation Circuit
Teleportation is basically the opposite of superdense coding, i.e. superdense
coding takes a quantum state to two classical bits. Teleportation takes two clas
sical bits to one quantum state.
Alice’s circuit
Ψ⟩ •
H
β
00
·
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
Important Properties of Quantum Circuits 147
Bob chooses one of the following four circuits
β
00 I
Ψ⟩
β
00 X
Ψ⟩
β
00 Z
Ψ⟩
β
00 X Z
Ψ⟩
1. Like superdense coding, initially Alice and Bob each take one half of an EPR
pair, say we start with β
00
. This means that Alice has the bolded qubit in
1
√
2
(00⟩ +11⟩) and Bob has the bolded qubit in
1
√
2
(00⟩ +11⟩). They then
move apart to an arbitrary distance.
2. Alice has a qubit in an unknown state:
Ψ⟩ = α0⟩ +β1⟩.
Which she combines with her entangled qubit:
(α0⟩ +β1⟩)
1
√
2
(00⟩ +11⟩)
.
This gives the following combined state (Alice’s qubits are bolded):
Ψ⟩ =
1
√
2
(α000⟩ +α011⟩ +β100⟩ +β111⟩).
3. Alice then applies a CNOT. Note  This is like using (CNOT⊗I) on the combined
three qubit system, i.e. including Bob’s qubit.
1
√
2
(α000⟩ +α011⟩ +β110⟩ +β101⟩).
4. Alice then applies an H gate to her ﬁrst qubit, the qubit we want to teleport
(or H ⊗I ⊗I for the combined system):
1
2
(α(000⟩ +100⟩ +011⟩ +111⟩) +β(010⟩ −110⟩ +001⟩ −101⟩)).
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
148 The Reality of Building Circuits
Now we rearrange the state to move amplitudes α and β so that we can
read the ﬁrst two bits leaving the third in a superposition.
=
1
2
(00⟩α0⟩ +10⟩α0⟩ +01⟩α1⟩ +11⟩α1⟩ +01⟩β0⟩ −11⟩β0⟩
+00⟩β1⟩ −10⟩β1⟩),
=
1
2
(00⟩(α0⟩ +β1⟩) +01⟩(α1⟩ +β0⟩) +10⟩(α0⟩ −β1⟩)
+11⟩(α1⟩ −β0⟩)).
5. Alice now performs measurements on her state to determine which of the
above bolded states her qubits are in. She then communicates via a clas
sical channel what she measured (i.e. a 00⟩, 01⟩, 10⟩, or a 11⟩) to Bob.
6. Bob now may use X and/or Z gate(s) to ﬁx up the phase and order of the
probability amplitudes, (he selects gates based on what Alice tells him)
so that the result restores the original qubit. Summarised below are the
gates he must use:
Case 00 = α0⟩ +β1⟩ → I → α0⟩ +β1⟩,
Case 01 = α1⟩ +β0⟩ → X → α0⟩ +β1⟩,
Case 10 = α0⟩ −β1⟩ → Z → α0⟩ +β1⟩,
Case 11 = α1⟩ −β0⟩ → XZ → α0⟩ +β1⟩.
5.3 The Reality of Building Circuits
There is a general theorem: Any unitary operation on n qubits can be imple
mented using a set of two qubit operations. This can include CNOTs and other
single bit operations. This result resembles the classical result that any boolean
function can be implemented with NAND gates. This is helpful because some
times we are limited in what we can use to build a quantum circuit.
5.3.1 Building a Programmable Quantum Computer
Is it Possible to Build a Programmable Quantum Computer
Can we build a programmable quantum computer? This means a quantum
computer that has an architecture similar to Von Neumann (or Harvard) archi
tecture? No! This is because:
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
The Four Postulates of Quantum Mechanics 149
Distinct unitary operators U
0
...U
n
require orthogonal programs U
0
⟩, ...U
n
⟩
[Nielsen, M. A. 2002]
This is called the no programming theorem.
If we were to have a programmable quantum computer our ”program” would
consist of one or more unitary operators. Since there are an inﬁnite number of
these unitary operators the program register would have to be inﬁnite in size
(that is our input to the quantumcomputer that contains the program) [Nielsen,
M. A. 2002].
5.4 The Four Postulates of Quantum Mechanics
The theory of quantum mechanics has four main postulates. These are intro
duced here as simple sentences and then explained in more details in the fol
lowing sections.
1. In a closed quantum system we need a way of describing the state of all the
particles within it. The ﬁrst postulate gives us a way to do this by using
a single state vector to represent the entire system. Say the state is to be a
vector in C
n
, this would be C
2
for a spin system.
2. The evolution of a closed system is a unitary transform. Say that, while the
system is evolving under its own steam  no measurement  the state at
some stage Ψ
′
⟩ is related to the state at some previous stage (or time)
Ψ⟩ by a unitary transform Ψ
′
⟩ = UΨ⟩. This means that we can totally
describe the behaviour of a system by using unitary matrices.
3. The third postulate relates to making measurements on a closed quantum
system, and the affect those measurements have on that system.
4. Postulate four relates to combining or separating different closed quantum
systems using tensor products.
5.4.1 Postulate One
An isolated system has an associated complex vector space called a state space.
We will use a state space called a Hilbert space.
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
150 The Four Postulates of Quantum Mechanics
The state of the quantum system can be described by a unit vector in this space
called a state vector.
Example The simplest system we are interested in is a qubit which is in C
2
.
Aqubit is a unit vector Ψ⟩ in C. Most of the time we’ll attach an orthonormal
basis (like {0⟩, 1⟩}). Our qubit can be described by:
Ψ⟩ = α0⟩ +β1⟩ =
¸
α
β
¸
here α and β are known as probability amplitudes and we say the qubit is in
a quantum superposition of states 0⟩ and 1⟩.
5.4.2 Postulate Two
Simple form
An isolated (closed) system’s evolution can be described by a unitary trans
form.
Ψ
′
⟩ = UΨ⟩. (5.82)
Form including time
If we include time (as quantum interactions happen in continuous time):
Ψ(t
2
)⟩ = U(t
1
, t
2
)Ψ(t
1
)⟩ (5.83)
here t
1
and t
2
are points in time and U(t
1
, t
2
) is a unitary operator than can vary
with time.
We can also say that the process is reversible, because:
U
†
UΨ⟩ = Ψ⟩. (5.84)
The history of the quantumsystemdoes not matter as it is completely described
by the current state (this is know as a Markov process).
Note: We can rewrite the above in terms of Schr¨ odinger’s equation, but that
is beyond the scope of this paper.
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
The Four Postulates of Quantum Mechanics 151
5.4.3 Postulate Three
Simple form
This deals with what happens if Ψ⟩ is measured in an orthonormal basis:
{O
1
⟩, O
1
⟩, . . . , O
n
⟩}.
We’ll measure a particular outcome j with probability:
pr(j) = ⟨O
j
Ψ⟩
2
. (5.85)
Example If we measure in the computational basis we have:
pr(0) = ⟨0Ψ⟩
2
= ⟨0(α0⟩ +β 1⟩)
2
= α
2
and pr(1) = β
2
.
After the measurement the system is in state O
j
⟩. This is because measure
ment disturbs the system.
If u
1
⟩ and u
2
⟩ are not orthogonal (i.e. ⟨u
1
u
2
⟩ ̸= 0) then we can’t reliably dis
tinguish between them on measurement.
Projectors
Suppose we have a larger quantum system which is a combination of smaller
systems, i.e. we have an orthonormal basis A = {e
1
⟩, . . . , e
n
⟩} where n is the
dimension of A. Then we have a larger quantum system B such that A ⊂ B.
If we measure A what is the effect on B?
We can say that O
1
⟩, . . . , O
n
⟩ is part of or comprised of one or many of the
orthogonal subspaces V
1
, V
2
, . . . , V
m
which are connected in the following way:
V = V
1
⊕V
2
⊕. . . ⊕V
m
. (5.86)
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
152 The Four Postulates of Quantum Mechanics
Example The state vector:
Ψ⟩ = (αO
1
⟩ +βO
2
⟩) +γO
3
⟩
can be rewritten as:
V (O
1
⟩, O
2
⟩, O
3
⟩) = V
1
(e
1
⟩, e
2
⟩) ⊕V
2
(e
3
⟩).
We can use projectors (P
1
, . . . , P
m
) to ﬁlter out everything other than the sub
space we are looking for (i.e. everything orthogonal to our subspace V ).
Example From the last example, projector P
1
on V
1
(e
1
⟩, e
2
⟩) gives us:
P
1
(αe
1
⟩ +βe
2
⟩ +γe
3
⟩) = αe
1
⟩ +βe
2
⟩.
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
The Four Postulates of Quantum Mechanics 153
Formally, if P
1
, . . . , P
m
is a set of projectors which covers all the orthogonal
subspaces of the state space, upon measuring Ψ⟩ we have,
pr(j) = ⟨ΨP
j
Ψ⟩ (5.87)
leaving the system in the post measurement state:
P
j
Ψ⟩
√
⟨ΨP
j
Ψ⟩
. (5.88)
Example Given a qutrit Ψ⟩ = α0⟩ +β1⟩ +γ2⟩).
P
1
on V
1
(0⟩, 1⟩) and P
2
on V
2
(2⟩) gives us:
pr(1) = ⟨ΨP
1
Ψ⟩
= [α
∗
β
∗
γ
∗
]
α
β
0
¸
¸
¸
= α
2
+β
2
,
pr(2) = ⟨ΨP
2
Ψ⟩
= [α
∗
β
∗
γ
∗
]
0
0
γ
¸
¸
¸
= γ
2
.
So our separated look like this:
Ψ
1
⟩ =
P
1
Ψ⟩
√
⟨ΨP
1
Ψ⟩
=
α0⟩ +β1⟩
√
α
2
+β
2
,
Ψ
2
⟩ =
P
2
Ψ⟩
√
⟨ΨP
2
Ψ⟩
=
γ2⟩
√
γ
2
.
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
154 The Four Postulates of Quantum Mechanics
More importantly we can look at partial measurement of a group of qubits, the
following example uses the tensor product which is also part of postulate 4. If
the system to be measured in the basis {O
1
⟩, O
2
⟩} then we use the projector
with a tensor product with I on the qubit we don’t want to measure. e.g. for
O
2
⟩ of qubit two we use (I ⊗P
2
).
Example If Ψ⟩ = α
00
00⟩ +α
01
01⟩ +α
10
10⟩ +α
11
11⟩:
For measuring qubit one in the computational basis we get 0⟩ with
probability:
pr(0) = ⟨ΨP
0
⊗IΨ⟩
= (α
00
00⟩ +α
01
01⟩ +α
10
10⟩ +α
11
11⟩) • (α
00
00⟩ +α
01
01⟩)
= α
00

2
+α
01

2
.
There is another type of measurement called a POVM (Positive Operator Val
ued Measure) of which projectors are a certain type. POVMs are beyond the
scope of this text.
5.4.4 Postulate Four
A tensor product of the components of a composite physical system, describes
the system. So the state spaces of the individual systems are combined so:
C
n
⊗C
n
= C
n
2
. (5.89)
An example is on the next page.
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
The Four Postulates of Quantum Mechanics 155
Example C
4
⊗C
4
= C
16
can look like:
(Ψ
A
⟩ = 1⟩ +2⟩ +3⟩ +4⟩) ⊗(Ψ
B
⟩ = a⟩ +b⟩ +c⟩ +d⟩)
and can be written as:
Ψ
AB
⟩ = 1a⟩ +1b⟩ +1c⟩ +. . . +4d⟩.
Example If Alice has Ψ
A
⟩ = u⟩ and Bob has Ψ
B
⟩ = v⟩, if their systems
are combined the joint state is:
Ψ
AB
⟩ = u⟩ ⊗v⟩.
If Bob applies gate U to this system it means I ⊗ U is applied to the joint
system.
Example Given the following:
Ψ⟩ =
√
0.100⟩ +
√
0.201⟩ +
√
0.310⟩ +
√
0.411⟩
then,
Ψ⟩ → (I ⊗X) → Ψ⟩ =
√
0.101⟩ +
√
0.200⟩ +
√
0.311⟩ +
√
0.410⟩,
Ψ⟩ → (X ⊗I) → Ψ⟩ =
√
0.110⟩ +
√
0.211⟩ +
√
0.300⟩ +
√
0.401⟩.
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
Chapter 6
Information Theory
6.1 Introduction
Information theory examines the ways information can be represented and
transformed efﬁciently [Steane, A. M. 1998]. This information can be repre
sented in many different ways to express the same meaning. E.g. ”How are
you?” and ”Comment allez vous?” express the same meaning. All known
ways of representing this information must have a physical medium like mag
netic storage or ink on paper. The Information stored on a particular physical
medium is not ”tied” to that medium and can be converted from one form to
another. If we consider information in these terms then it becomes a property
like energy that can be transferred from one physical system to another.
We are interested in quantum information, which has many parallels in con
ventional information theory. Conventional information theory relies heavily
on the classical theorems of Claude E. Shannon, 1916  2001 (ﬁgure 6.1). There
are a number of quantum equivalents for the various parts of his classical the
orems. In this chapter we’ll look at these and other related topics like quantum
error correction, and quantum cryptology. Also, as promised, there is a fairly
indepth section on Bell states and the chapter ends with some open questions
on the nature of information and alternate methods of computation.
As with chapter 5 individual references to QCQI have been dropped as they
would appear too frequently.
157
158 History
Figure 6.1: Claude E. Shannon and George Boole.
6.2 History
The history of information theory can be said to have started with the invention
of boolean algebra in 1847 by George Boole, 1815  1864 (ﬁgure 6.1). Boolean alge
bra introduced the concept of using logical operations (like AND, OR, and NOT)
on the binary number system. The next milestone was in 1948 when Shannon
wrote ”the mathematical theory of communication” in which he outlined the
concepts of Shannon entropy (see section 6.5.1) [Shannon C. E. 1948]. Earlier
Shannon had shown that boolean algebra could be used to represent relays,
switches, and other components in electronic circuits. Shannon also deﬁned
the most basic unit of information theory  the bit (binary digit).
6.3 Shannon’s Communication Model
To formally describe the process of transmitting information from a source to a
destination we can use Shannon’s communication model, which is shown in ﬁgure
6.2. The components of this are described as follows:
Source  The origin of the message, which itself has a formal deﬁnition (see
section 6.4). The message is sent from the source in its raw form.
Transmitter  The transmitter encodes and may compress the message at which
point the message becomes a signal which is transported fromtransmitter
to receiver.
Source of Noise  The noise source can introduce random noise into the sig
nal, potentially scrambling it.
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
Shannon’s Communication Model 159
Source
Transmitter
Destination
Receiver
Source of noise
Message Message
Signal
Figure 6.2: Shannon’s communication model.
Receiver  The receiver may decode and decompress the signal back into the
original message.
Destination  The destination of the raw message.
6.3.1 Channel Capacity
A message is chosen from a set of all possible messages and then transmitted.
Each symbol transferred takes a certain amount of time (which is called the
channel capacity).
Shannon’s name for channel capacity on a binary channel is ”one bit per time
period” e.g. 56, 000 bits per second. His expression for capacity is:
C = lim
T→∞
log
2
N
T
(6.1)
where N is the number of possible messages of length T.
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
160 Classical Information Sources
Example For binary we have:
2 bits = 4 different messages in 2 time periods.
3 bits = 8 different messages in 3 time periods.
so,
N(T) = 2
T
and,
C =
log
2
N
T
= 1 bit per time period.
Example Another example is morse code, where dashes take longer to
transmit than dots. If dashes are represented by 1110 and a dot is 10 for
this we have:
C = 0.34 bit per time period.
6.4 Classical Information Sources
A source of information produces a discrete set of symbols from a speciﬁc al
phabet. The alphabet that is most commonly used is binary (1 and 0), but it
could in principle be any series of symbols.
The way an information source can be modelled is via a probability that cer
tain letters or combinations of letters (words) will be produced by the source.
An example for this probability distribution would be, given an unknown book 
one could, in advance, predict to a certain degree of accuracy the frequency of
words and letters within the book [Nielsen, M. A. 2002].
6.4.1 Independent Information Sources
An independent and identically Distributed (IID) information source is an infor
mation source in which each output has no dependency on other outputs from
the source, and furthermore each output has the same probability of occurring
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
Classical Information Sources 161
each time it is produced [Nielsen, M. A. 2002].
An IID is an information source with an alphabet (i.e a set of symbols or out
puts a
i
):
A = {a
1
, . . . , a
n
} (6.2)
with probabilities pr(a
1
),pr(a
2
), . . . ,pr(a
n
) such that:
n
∑
i=1
pr(a
i
) = 1 where 0 ≤ pr(a
i
) ≤ 1 ∀ i. (6.3)
This source will produce a letter with probability pr(a
i
) with no dependency
on the previous symbols. Independent information sources are also called zero
memory information sources (i.e. they correspond to a Markov process).
Example [Nielsen, M. A. 2002] A biased coin is a good example of an IID.
The biased coin has a probability p of heads and a probability of 1−p of tails.
Given a language
∑
= {heads, tails}:
pr(heads) = 0.3,
pr(tails) = 0.7 .
Our coin will come up tails 70% of the time.
Strictly speaking, Shannon’s results only hold for a subset of information sources
that conform to the following:
1. Symbols must be chosen with ﬁxed probabilities, one by one with no depen
dency on current symbols and preceding choices.
2. An information source must be an ergodic source. This means that there
should be no statistical variation (with a probability of 1) between possi
ble sources. I.e. all systems should have the same probabilities for letters
to appear in their alphabets.
Not many sources are perfect like the above. The reason is that, for example
a book has correlations between syllables, words, etc. (not just letters) like
”he” and ”wh” [Nielsen, M. A. 2002]. We can measure certain qualities and
the source becomes more like an IID (like JUST letter frequency). Shannon
suggested that most information sources can be approximated.
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
162 Classical Redundancy and Compression
6.5 Classical Redundancy and Compression
Compression of data means using less information to represent a message and
reconstructing it after it has been transmitted. When we talk about compression
in this section we mean simple algorithmic compression that can be applied to
all information sources. This is distinct from say, changing the text in a sen
tence to convey the same meaning or using special techniques to only work
on a subset of messages or information sources (like using a simple formula to
exactly represent a picture of a sphere).
We often talk about using a coding K to represent our message. Formally, a
coding is a function that takes a source alphabet A to a coding alphabet B, i.e.
K : A → B. For every symbol a in the language A, K(a) is a word with letters
from B.
A word, w = a
1
a
2
. . . a
n
in A is found by:
K(w) = K(a
1
)K(a
2
) . . . K(a
n
). (6.4)
Example A simple coding.
A = {A, B, C, D},
B = {0, 1}.
Possible encodings are:
A → 0001,
B → 0101,
C → 1001,
D → 1111.
So we encode the word ABBA as:
K(ABBA) = 0001 0101 0101 0001.
Length of Codes
We deﬁne the size of an alphabet A as A and the length of a word w can be
shown with w.
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
Classical Redundancy and Compression 163
Example A and w.
A = {a, b, c, d, e, f},
B = {0, 1, 2}.
Possible encodings are:
a → 0,
b → 1,
c → 20,
d → 220,
e → 221,
f → 222.
We get:
K(a) = 1, K(c) = 2, K(f) = 3, A = 6, B = 3.
6.5.1 Shannon’s Noiseless Coding Theorem
Shannon demonstrated that there is a deﬁnite limit to how much an informa
tion source can be compressed. Shannon Entropy H(S) is the minimum number
of bits needed to convey a message. For a source S the entropy is related to the
shortest average length coding L
min
(S) by:
H(S) ≤ L
min
(S) < H(S) + 1. (6.5)
We can ﬁnd the Shannon Entropy, of a particular source distribution measured
in bits by:
H(X) = −
∑
i
pr
i
log
2
pr
i
. (6.6)
Here, log
2
(a log of base 2) means that the Shannon entropy is measured in bits.
pr
i
is a measure of probability (i.e. the frequency with which it is emitted) for a
symbol being generated by the source and the summation is a sum over all the
symbols i = 1, 2, . . . , n generated by the source.
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
164 Classical Redundancy and Compression
Example Random and dependent sources.
Random Each symbol is chosen from the source totally randomly (with A
and B having equal probability), with no dependencies, this source is
uncompressible with Shannon Entropy of 1 bit per symbol.
Dependent Every second symbol is exactly the same as the last, which is
chosen randomly (e.g. AABBBBAABB). This has Shannon Entropy of
1
2
bit(s) per symbol.
Example We have a language {A, B, C, D, E} of symbols occurring with
the following frequency:
A = 0.5, B = 0.2, C = 0.1, D = 0.1, E = 0.1 .
The entropy is:
H(X) = −[(0.5 log
2
0.5 + 0.2 log
2
0.2 + (0.1 log
2
0.1) ×3)]
= −[−0.5 + (−0.46438) + (−0.9965)]
= −[−1.9]
= 1.9.
So we need 2 bits per symbol to convey the message.
The minimum entropy is realised when the information source produces a sin
gle letter constantly, this gives us a probability of 1 for that letter.
The maximum entropy is realised when we have no information about the
probability distribution of the source alphabet (when all symbols are equally
likely to occur).
A special case of the entropy is binary entropy where the source has just two
symbols with probabilities of p and 1 − p like the biased coin toss for exam
ple. Note a fair coin toss has maximum entropy of 1 bit and a totally unfair,
weighted coin that always comes up heads or always comes up tails has mini
mum entropy of 0 bits.
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
Classical Redundancy and Compression 165
6.5.2 Quantum Information Sources
Shannon entropy gives us a lower bound on how many bits we need to store
a particular piece of information. The question is, is there any difference when
we use quantum states? The answer is yes if we use a superposition.
If the qubits involved are in well deﬁned states (like 0⟩ and 1⟩) a semiclas
sical coin toss [Nielsen, M. A. 2002] gives us:
0⟩ with probability of
1
2
,
1⟩ with probability of
1
2
,
H
1
2
= 1.
If we replace one of these states with a superposition then a ”quantum coin
toss” gives us:
0⟩ with probability of
1
2
,
0⟩+1⟩
√
2
with probability of
1
2
,
H
1 +
1
√
2
2
= 0.6 .
Better than Shannon’s rate!
Generally a quantum information source produces state: Ψ
j
⟩ with probabil
ities pr(j), and our quantum compression performs better than the Shannon
rate H(pr(j)).
6.5.3 Pure and Mixed States
A quantum system is said to be in a pure state if its state is well deﬁned. This
does not mean the state vector will always collapse to a known value; but at
least the state vector is known as distinct fromwhat it collapses to. For example
given a photon and a polariser the photon can be in three states, horizontal (H),
vertical (V), and diagonal (D). If we make our photon diagonal at 45
◦
then we
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
166 Classical Redundancy and Compression
have an equal superposition of H and V.
D⟩ =
1
√
2
H⟩ +
1
√
2
V⟩.
Now if we measure polarisation we have a 50% chance of detecting an H⟩ or a
50% of detecting a V⟩. The state was well deﬁned before measurement, so we
call it pure (i.e. we have a well deﬁned angle of polarisation viz 45
◦
, and if we
measure with a polariser in this direction the result is certain). We don’t have
this situation if there is no direction in which the result is certain. So the state is
not well deﬁned and we call this state mixed. For example, if we have a number
of photons, 50%of which are polarised horizontally and 50%vertically, nowwe
have a mixed state. Each photon has a well deﬁned state H⟩ or V⟩, but not the
group. This situation is indistinguishable from a photon that is in an entangled
state.
When closed quantum systems get affected by external systems our pure states
can get entangled with the external world, leading to mixed states. This is
called decoherence, or in information theory terms, noise.
It is possible to have a well deﬁned (pure) state that is composed of subsys
tems in mixed states. Entangled states like Bell states are well deﬁned for the
composite system (whole), but the state of each component qubit is not well
deﬁned, i.e. mixed.
6.5.4 Schumacher’s Quantum Noiseless Coding Theorem
The quantum analogue of Shannon’s noiseless coding theorem is Schumacher’s
quantum noiseless coding theorem. Which is as follows [Nielsen, M. A. 2002]:
The best data rate R achievable is S(ρ). (6.7)
where S is Von Neumann entropy and ρ is the density matrix. ρ holds equivalent
information to the quantumstate Ψand quantummechanics can be formulated
in terms of ρ as an alternative to Ψ. We now look at ρ.
The Density Matrix
In studying quantum noise it turns out to be easier to work with the density
matrix than the state vector (think of it as just a tool; not a necessary compo
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
Classical Redundancy and Compression 167
nent of quantum computing).
According to Nielsen [Nielsen, M. A. 2002] there are three main approaches
to the density matrix, the ensemble point of view, subsystem, and fundamental
approaches. They are described brieﬂy here:
Ensemble  This is the basic view of the density matrix which gives us mea
surement statistics in a compact form.
Subsystem  If quantum system A is coupled to another quantum system B
we can’t always give A a state vector on its own (it is not well deﬁned).
But we can assign an individual density matrix to either subsystem.
Fundamental  It is possible to restate the four postulates of quantummechan
ics in terms of the density matrix.
For example, as mentioned above, we can view the statistics generated by an
entangled photon as equivalent to that of the corresponding ensemble.
Ensemble Point of View
Consider a collection of identical quantum systems in states in Ψ
j
⟩ with prob
abilities pr
j
. The probability of outcome k when a measurement, which is de
scribed by P
k
, is:
k = tr(ρP
k
) (6.8)
where,
ρ =
∑
j
pr
j
ψ
j
⟩⟨ψ
j
 (6.9)
is the density matrix. ρ completely determines the measurement statistics. The
set of all probabilities and their associated state vectors {pr
j
, ψ
j
⟩} is called an
ensemble of pure states.
If a measurement is done, with projectors P
k
on a system with density matrix ρ
the post measurement density matrix ρ
k
is:
ρ
k
=
P
k
ρP
k
tr(P
k
ρP
k
)
. (6.10)
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
168 Classical Redundancy and Compression
A simple example involving the probabilities for a qubit in a known state is
below:
Example For a single qubit in the basis {0⟩, 1⟩}.
ρ =
2
∑
j=1
pr
j
ψ
j
⟩⟨ψ
j
.
For Ψ⟩ = 1 · 0⟩ +0 · 1⟩, i.e. measurement probabilities pr(0⟩) = 1 and pr(1⟩)
= 0:
ρ = 1 · 0⟩⟨0 + 0 · 1⟩⟨1
= 1 ·
¸
1
0
¸
1 0
+ 0 ·
¸
0
1
¸
0 1
=
¸
1 0
0 0
¸
.
For Ψ⟩ = 0 · 0⟩ +1 · 1⟩, i.e. measurement probabilities pr(0⟩) = 0 and pr(1⟩)
= 1:
ρ = 0 · 0⟩⟨0 + 1 · 1⟩⟨1
= 0 ·
¸
1
0
¸
1 0
+ 1 ·
¸
0
1
¸
0 1
=
¸
0 0
0 1
¸
.
Next we’ll have a look at a qubit in an unknown state, and the use of a trace
over the density matrix given a projector.
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
Classical Redundancy and Compression 169
Example Given measurement probabilities pr(0⟩) = p and pr(1⟩) = 1 −p.
ρ = p0⟩⟨0 + (1 −p)1⟩⟨1
= p
¸
1
0
¸
1 0
+ (1 −p)
¸
0
1
¸
0 1
= p
¸
1 0
0 0
¸
+ 1 −p
¸
0 0
0 1
¸
=
¸
p 0
0 1 −p
¸
.
So, given a density matrix ρ and a projector P = 0⟩⟨0 we can extract the
ﬁnal probability from ρ, say we measure in an orthonormal basis, {0⟩, 1⟩}
then:
pr(0⟩) = tr(ρ0⟩⟨0)
= tr
¸
p 0
0 1 −p
¸¸
1 0
0 0
¸
= tr
¸
p 0
0 0
¸
= p + 0
= p,
pr(1⟩) = tr(ρ1⟩⟨1)
= tr
¸
p 0
0 1 −p
¸¸
0 0
0 1
¸
= tr
¸
0 0
0 1 −p
¸
= 0 + (1 −p)
= 1 −p.
How does a the density matrix evolve?
Suppose a unitary transform U is applied to a quantum system: i.e. UΨ⟩;
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
170 Classical Redundancy and Compression
what is the new density matrix? To answer this, using the ensemble view, we
can say that if the system can be in states Ψ
j
⟩ with probabilities tr
j
then, after
the evolution occurs, it will be in state UΨ⟩ with probabilities pr
j
.
Initially we have ρ =
∑
j
pr
j
ψ
j
⟩⟨ψ
j
. So, after U is applied, we have:
ρ
′
=
∑
j
pr
j
Uψ
j
⟩⟨ψ
j
U
†
(6.11)
= U
∑
j
pr
j
Uψ
j
⟩⟨ψ
j

U
†
(6.12)
= UρU
†
. (6.13)
Note that when ψ
j
⟩ goes to Uψ
j
⟩, ⟨ψ
j
 = ψ
j
⟩
†
goes to (Uψ
j
⟩)
†
= ⟨ψ
j
U
†
.
Example Given measurement probabilities pr(0⟩) = p and pr(1⟩) = 1 − p
then ρ =
¸
p 0
0 1 −p
¸
.
If X is applied to ρ then:
ρ
′
= XρX
†
=
¸
1 −p 0
0 p
¸
.
Example For Ψ⟩ =
1
√
2
00⟩ +
1
√
2
11⟩ we have pr(00⟩) =
1
2
and pr(11⟩) =
1
2
.
This gives us a what is called completely mixed state and ρ =
I
2
. So,
ρ
′
= U
I
2
U
†
=
I
2
because UU
†
= 1.
Properties:
tr(ρ) = 1. (6.14)
ρ is a positive matrix. (6.15)
Subsystem Point of View
The density matrix can describe any subsystem of a larger quantum system,
including mixed subsystems. Subsystems are described by a reduced density
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
Classical Redundancy and Compression 171
matrix. If we have two subsystems A and B of a system C where A ⊗ B = C.
The density matrices for the subsystems are ρ
A
and ρ
B
and the overall density
matrix is ρ
C
(also referred to as ρ
AB
). We can deﬁne ρ
A
and ρ
B
as:
ρ
A
= tr
B
(ρ
C
) and ρ
B
= tr
A
(ρ
C
). (6.16)
tr
A
and tr
B
are called partial traces over systems A and B respectively. The
partial trace is deﬁned as follows:
ρ
A
= tr
B
(a
1
⟩⟨a
2
 ⊗b
1
⟩⟨b
2
) = a
1
⟩⟨a
2
tr(b
1
⟩⟨b
2
) (6.17)
= ⟨b
1
b
2
⟩a
1
⟩⟨a
2
. (6.18)
Previously we mentioned the difference between pure and mixed states. There’s
a simple test we can do to determine is a state is mixed or pure, which is to run
a trace on that state, if we get tr(ρ
2
) < 1 then the state is mixed (tr(ρ
2
) = 1
for a pure state). Bell states for example have a pure combined state with
tr((ρ
C
)
2
) = 1, but they have mixed substates, i.e. tr((ρ
A
)
2
) < 1 and tr((ρ
B
)
2
) < 1.
Fundamental Point of View
In terms of the density matrix the four postulates of quantum mechanics are
[Nielsen, M. A. 2002]:
1. Instead of using a state vector, we can use the density matrix to describe a
quantum system in Hilbert space. If a system is in state ρ
j
with a proba
bility of pr
j
it has a density matrix of
∑
j
pr
j
ρ
j
.
2. Changes in a quantum system are described by ρ → ρ
′
= UρU
†
.
3. Measuring using projectors P
k
gives us k with probability tr(P
k
ρ) leaving
the system in a post measurement state of ρ
k
=
P
k
ρP
k
tr(P
k
ρP
k
)
.
4. A tensor product gives us the state of a composite system. A subsystem’s
state can be found by doing a partial trace on the remainder of the system
(i.e. over the other subsystems making up the system).
Von Neumann Entropy
The probability distributions in classical Shannon entropy H, are replaced by a
density matrix ρ in Von Neumann entropy, S:
S(ρ) = −tr(ρ log
2
ρ). (6.19)
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
172 Classical Redundancy and Compression
We can also deﬁne the entropy in terms of eigenvalues λ
i
:
S(ρ) = −
∑
i
λ
i
log
2
λ
i
(6.20)
where λ
i
are the eigenvalues of ρ.
If we want to deﬁne the uncertainty of a quantum state before measurement
we can use entropy, given a Hilbert space of dimension d then
0 ≤ S(ρ) ≤ log
2
d (6.21)
with S(ρ) = 0 meaning a pure state and S(ρ) = log
2
d giving us a totally mixed
state. For example we could compare two states, by measuring their Von Neu
mann entropy and determine if one is more entangled than the other. We also
use Von Neumann entropy to deﬁne a limit for quantum data compression,
namely Schumacher compression, which is beyond the scope of this paper.
Properties:
S(ρ
A
⊗ρ
B
) = S(ρ
A
) +S(ρ
B
). (6.22)
S(ρ
AB
) ≤ S(ρ
A
) +S(ρ
B
). (6.23)
S(ρ
AB
) ≥ S(ρ
A
) −S(ρ
B
). (6.24)
S(ρ
A
) = −tr(ρ
A
log
2
ρ
A
). (6.25)
S(ρ
B
) = −tr(ρ
B
log
2
ρ
B
). (6.26)
ρ
A
= tr
B
(ρ
AB
). (6.27)
ρ
B
= tr
A
(ρ
AB
). (6.28)
ρ
AB
= ρ
A
⊗ρ
B
. (6.29)
S(A) +S(B) ≤ S(AC) +S(BC). (6.30)
S(ABC) +S(B(≤ S(AB) +S(BC). (6.31)
For S(A) +S(B) ≤ S(AC) +S(BC) it holds for Shannon entropy since H(A) ≤
H(AC) and H(B) ≤ H(BC) we get an advantage with Von Neumann entropy
with:
S(A) > (AC) (6.32)
or,
S(B) > S(BC). (6.33)
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
Noise and Error Correction 173
It should be noted that quantummechanics tells us that (6.32) and (6.33) cannot
be true simultaneously.
6.6 Noise and Error Correction
Noisy Channels
Noise is randomisation in a channel. To combat noise we use redundancy, i.e.
we send additional information to offset the noise. In the case of a binary chan
nel we use repetition, e.g. we can use three 1’s to represent a single 1, that way
two bits have to be ﬂipped to produce an error. An example of this is that a
011 can equate to 1. If two bit ﬂips is highly improbable then upon receiving
011 we assume (with a high degree of certainty) that a 1 was sent (as 111) and a
single bit was ﬂipped. Repetition is inefﬁcient: to make the probability of error
occurring lower, longer encodings are required which increases transmission
times. Shannon found a better way,
”Given a noisy channel there is a characteristic rate R, such that any
information source with entropy less than R can be encoded so as to
transmit across the channel with arbitrarily few errors, above R we
get errors” [indigosim.com ? 2000].
So if there is no noise then R matches the channel capacity C.
Classical Error Correction
We’ll consider using binary symmetric channels with an error probability p with
p ≤ 0.5 and:
• If 0 is transmitted, 0 is received with probability 1 −p.
• If 0 is transmitted, 1 is received with probability p.
• If 1 is transmitted, 1 is received with probability 1 −p.
• If 1 is transmitted, 0 is received with probability p.
We generally use a greater number of bits than the original message to encode
the message with codewords. We call this a K
x
channel coding, with x being the
number of bits used to encode the original message.
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
174 Noise and Error Correction
If we have a code (called a binary block code) K of length n it has an infor
mation rate of:
R(K) =
k
n
(6.34)
if it has 2
k
codewords (k = 1 in the example below).
This means, we have an original message of k bits and we use codewords on n
bits.
Repetition Codes
Using repetition codes we have a greater chance of success by increasing the
number of coding bits for a bit to be transmitted and averaging the result bits.
Repetition codes have an information rate of R(K) =
1
n
.
Example A K
3
channel coding could be:
0 → 000,
1 → 111.
With a channel decoding of:
000 → 0, 001 → 0, 010 → 0, 100 → 0,
111 → 1, 110 → 1, 101 → 1, 011 → 1.
So our information rate is:
R(K
3
) =
1
3
.
So, bit ﬂips in 1 out of 3 bits in codeword are ﬁxable, but the information
rate is down to
1
3
.
6.6.1 Quantum Noise
In practice we cannot make perfect measurements and it’s hard to prepare and
apply quantum gates to perfect quantum states because real quantum systems
are quite noisy.
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
Noise and Error Correction 175
6.6.2 Quantum Error Correction
Quantum error correction codes have been successfully designed, but the area
still remains a hot topic. Some scientists still believe that quantum computing
may be impossible due to decoherence which is external inﬂuences destroying
or damaging quantum states. We use quantum error correction codes in place
of classical ones. The fact that they are quantum gives us a number of extra
problems:
1. No Cloning.
2. Continuous errors, many types of error can occur on a single qubit (not just
a bit ﬂip as with a classical circuit). E.g. we might have a change of phase:
α0⟩ +β1⟩ → α0⟩ +e
iθ
β1⟩.
3. Measurement destroys quantuminformation (so if we used a repetition code,
how do we apply majority logic to recover the qubits?).
Below are some simple examples of quantum errors.
Example A qubit’s relative phase gets ﬂipped:
a0⟩ +b1⟩ → a0⟩ −b1⟩.
Example A qubit’s amplitudes get ﬂipped:
a0⟩ +b1⟩ → b0⟩ +a1⟩.
Example A qubit’s amplitudes and relative phase get ﬂipped:
a0⟩ +b1⟩ → b0⟩ −a1⟩.
Quantum Repetition Code
A quantum repetition code is the analogue of a classical repetition code, for
classical states (states not in a superposition) this is easy:
0⟩ → 000⟩,
1⟩ → 111⟩.
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
176 Noise and Error Correction
The no cloning theorem won’t allow us to make copies of qubits in a superpo
sition, i.e. it prevents us from having:
Ψ⟩ → Ψ⟩Ψ⟩Ψ⟩
which expanded would be:
(α0⟩ +β1⟩) ⊗(α0⟩ +β1⟩) ⊗(α0⟩ +β1⟩).
So what we do is to encode our superposed state into the following entangled
state:
Ψ⟩ = α0⟩ +β1⟩ → α0⟩0⟩0⟩ +β1⟩1⟩1⟩ = Ψ
′
⟩
or,
α0⟩ +β1⟩ → α000⟩ +β111⟩
which, expanded is:
α000⟩ + 0001⟩ + 0010⟩ + 0011⟩ + 0100⟩ + 0101⟩ + 0110⟩ +β111⟩.
A simple circuit for this encoding scheme is shown below:
Ψ⟩ • •
0⟩
·
Ψ
′
⟩
0⟩
·
So if we made our input state α0⟩ +β1⟩ then we would get:
α0⟩ +β 1⟩ • •
0⟩
·
α000⟩ +β 111⟩
0⟩
·
↑ ψ
1
⟩ ↑ ψ
2
⟩ ↑ ψ
3
⟩
The diagram shows the stages in the evolution of Ψ⟩ as the CNOT gates are
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
Noise and Error Correction 177
applied; the Ψ
i
⟩ are as follows:
ψ
1
⟩ = α000⟩ +β100⟩.
ψ
2
⟩ = α000⟩ +β101⟩.
ψ
2
⟩ = α000⟩ +β111⟩.
Fixing Errors
The following circuit detects an amplitude ﬂip (or bit ﬂip) which is the equiv
alent of XΨ⟩ on Ψ⟩. For example noise can ﬂip qubit three, i.e. α000⟩ +
β111⟩ → I ⊗I ⊗X → α001⟩ +β110⟩. We determine that there’s been an error
by entangling the encoded state with two ancilla qubits and performing mea
surements on the ancilla qubits. We then adjust our state accordingly based on
the results of the measurements as described in the table below. Note that we
are assuming that an error has occurred AFTER the encoding and BEFORE we
input the state to this circuit.
Error Correction
•
R
α001⟩ +β110⟩ • • α000⟩ +β111⟩
•
0⟩
· · ´
M
1
•
0⟩
· · ´
M
2
_ _ _
_ _ _
•
Error Syndrome
↑ ψ
1
⟩ ↑ ψ
2
⟩ ↑ ψ
3
⟩ ↑ ψ
4
⟩ ↑ ψ
5
⟩
ψ
1
⟩ = α001⟩ +β110⟩.
ψ
2
⟩ = α00100⟩ +β11000⟩.
ψ
3
⟩ = α00101⟩ +β11001⟩.
ψ
4
⟩ = (α001⟩ +β110⟩) ⊗0⟩1⟩.
The measurements M
1
and M
2
cause a readout of 01 on lines 4 and 5. So now
we feed 01 (called the error syndrome) into our error correction (or recovery) cir
cuit R which does the following to α001⟩ +β110⟩:
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
178 Noise and Error Correction
M
1
M
2
Action
0 0 no action needed, e.g. 111⟩ → 111⟩
0 1 ﬂip qubit 3, e.g. 110⟩ → 111⟩
1 0 ﬂip qubit 2, e.g. 101⟩ → 111⟩
1 1 ﬂip qubit 1, e.g. 011⟩ → 111⟩
So we apply a qubit ﬂip to line 3 giving:
ψ
5
⟩ = α000⟩ +β111⟩.
This circuit will ﬁx a single bit ﬂip in our three qubit repetition code. All that re
mains is to decode Ψ⟩ to return to our original state. We get a problem though
if we have a relative phase error, i.e.:
α000⟩ +β111⟩ → α000⟩ −β111⟩
which, decoded is:
α0⟩ +β1⟩ → α0⟩ −β1⟩.
It turns out we have to change our encoding method to deal with a relative
phase ﬂip, which we can do with the following circuit:
α0⟩ +β 1⟩ • •
H
0⟩
·
H
0⟩
·
H
The error correction circuit for a relative phase ﬂip is almost exactly the same as
the error correction circuit for an amplitude ﬂip, we just add in some Hadamard
gates at the start to deal with the superpositions we generated with the initial
encoding (shown immediately above). Again remember that any errors that
do happen, happen between the encoding and the circuit we are about to intro
duce:
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
Noise and Error Correction 179
Error Correction
H
•
R H
• •
H
•
0⟩
· · ´
M
1
•
0⟩
· · ´
M
2
_ _ _
_ _ _
•
Error Syndrome
↑ ψ
1
⟩ ↑ ψ
2
⟩
Suppose we have a phase ﬂip on line 2. If our input state is:
ψ
1
⟩ = α+ +−⟩ +β −−+⟩
then,
ψ
2
⟩ = (α001⟩ +β 110⟩) 00⟩ .
This is the same as ψ
2
⟩ in the bit ﬂip case. Since the rest of the circuit is the
same we get the output of R being:
α000⟩ +β 111⟩
as before.
It should be noted that these errors are deﬁned in terms of the {0⟩, 1⟩} ba
sis. If we use the {+⟩, −⟩} basis then the phase ﬂip circuit above ﬁxes a bit ﬂip
and vice versa.
In terms of single qubits, a relative phase ﬂip can be ﬁxed with HZH and an
amplitude ﬂip with X. But we still have a problem because the circuit above
cannot detect a amplitude ﬂip. A third encoding circuit produces a Shor code
which is a nine qubit code that has enough information for us to be able to ap
ply both types of error correcting circuits, and is our ﬁrst real QECC (Quantum
Error Correction Code). The circuit is presented below.
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
180 Bell States
Ψ⟩ • •
H
• •
0⟩
·
0⟩
·
0⟩
·
H
• •
0⟩
·
0⟩
·
0⟩
·
H
• •
0⟩
·
0⟩
·
The Shor code is one of many QECCs, another example is the Steane code. These
both in turn are CSS codes (Calderbank, Shor, Steane). CSS codes are part of a
more general group of QECCs called Stabiliser codes.
6.7 Bell States
As mentioned in chapter 4 the EPR experiment showed that entangled particles
seem to communicate certain quantum information instantly over an arbitrary
distance upon measurement. Einstein used this as an argument against the
notion that particles had no deﬁned state until they were measured (i.e. he ar
gued that they had ”hidden variables”). John Bell, 1928  1990 proved in 1964
that there could be no local hidden variables. In the following description of
his proof consider the fact that we can measure the spin of a particle in several
different directions which can be thought of as measuring in different bases.
During this section we’ll refer to Einstein’s position as EPR and the quantum
mechanical position as QM.
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
Bell States 181
Bell takes a system of two entangled spin particles being measured by two
remote observers (observers 1 and 2, say, who observe particles 1 and 2, respec
tively). He shows that, if the observers measure spin in the same direction (e.g.
z) there is no empirical difference between the results predicted by the two po
sitions (QM or EPR). For the purposes of our example we’ll begin by deﬁning
the following entangled state:
Ψ
A
⟩ =
1
√
2
0
1
1
2
⟩ −
1
√
2
1
1
0
2
⟩. (6.35)
We’ve introduced the notation 0
1
1
2
⟩ to distinguish between qubits 1 and 2,
which will become important later.
If we allow the directions to be different it is possible to get a empirically
testable difference. The intuition for this is that if, as QMsays, what happens at
observer 2 is dependent on what happens at observer 1, and the latter is depen
dent on the direction at 1, then what happens at 2 will involve both directions
(we imagine that a measurement at 1, in some direction, causes state collapse
so that particle 2 ”points” in the antiparallel direction to 1 and is then measured
in observer 2’s direction; the probability for an outcome, spin up or spin down,
is dependent on the angle between the two directions  see below). Whereas,
in the EPR view, what happens at observer 2 cannot in any way involve the di
rection at observer 1: what happens at observer 2 will, at most, be determined
by the value particle 2 carries away at emission and the direction at observer 2.
6.7.1 Same Measurement Direction
To see that same direction measurements cannot lead to a testable difference
ﬁrst imagine that there are two separated observers, Alice and Bob, who run
many trials of the EPR experiment with spin particles. Let each measure the
spin of the particle that ﬂies towards them. If they both measure in the same
direction, say z, then the results might be represented as follows:
Alice Bob Frequency
z z
1 0 50%
0 1 50%
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
182 Bell States
We soon realise that we can’t use this case to discriminate between the two po
sitions.
QM position. This explains the result by saying that, upon Alice’s measure
ment of 1, the state vector superposition Ψ
A
⟩ collapses into one or other of the
two terms.
either 0
1
1
2
⟩ or 1
1
0
2
⟩
with 50% probability for Alice measuring 0 or 1. But then we no longer have
a superposition (Alice’s measurement has ”produced” a 0 on particle 1 and a
1 on particle 2, or vice versa) and Bob’s measurement outcome on 2 is com
pletely determined (relative to the outcome on 1) and will be the opposite of
Alice’s outcome.
EPR position. This says the particles actually have well deﬁned values at the
moment they are emitted, and these are (anti)correlated and randomly dis
tributed between 01 and 10 over repeated trials. When Alice measures 0 Bob
measures 1 not because Alice’s measurement has ”produced” anything; but
simply because the 1 is the value the particle had all along (which the measure
ment reveals). The randomness here is due to initial conditions (emission); not
to collapse.
Either way we have the same prediction.
6.7.2 Different Measurement Directions
Bell’s innovation was to realise that a difference will occur if we bring in differ
ent measurement directions. The intuition for this might go as follows.
Suppose there are two directions a(= z) and b. Start with Ψ
A
⟩ and allow Alice
to measure particle 1 in the a direction. This causes a collapse, as before, and
we have:
either 0
1
1
2
⟩ or 1
1
0
2
⟩.
Alice’s measurement has ”produced” a 1 (spin down) in the a direction on par
ticle 2 (to take the ﬁrst case). Bob now measures particle 2 in the b direction. To
work out what happens according to QM we have to express 1
2
⟩ in terms of a
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
Bell States 183
b basis. If b is at angle θ to a this turns out to be:
1
2
⟩ = sin
θ
2
+
2
⟩ + cos
θ
2
−
2
⟩ (6.36)
where +
2
⟩ means spin up along the b axis. This looks right. If θ = 90 (the case
when b = x) we get
1
√
2
, as before; when θ = 0 (the case when b = z) we get −
2
⟩
(= 1⟩ in that case). Likewise, for 0
2
⟩:
0
2
⟩ = cos
θ
2
+
2
⟩ −sin
θ
2
−
2
⟩. (6.37)
The signiﬁcant point is that, since θ is the angle between a and b, the direction
of Alice’s measurement is entering into (inﬂuencing) what happens for Bob.
But this can’t happen in a realist local view as, espoused by EPR, because:
1. The spin values of the particles are determined at the moment of emission,
and are not ”produced” at some later moment as a result of an act of
measurement (realism);
2. by construction, the events at Bob’s end are beyond the reach of the events
at Alice’s end (locality).
The rat is cornered: by bringing different directions of measurement into it, we
should get a detectable difference. So reasons Bell.
6.7.3 Bell’s Inequality
It turns out we need three directions. So allow Alice and Bob to measure in
three possible directions labelled a, b, and c; we will actually take the case where
these directions are all in the plane, perpendicular to line of ﬂight, and at 120
◦
to one another. When Alice and Bob measure in the same direction, say a and
a, they will observe correlation: 1 with 0, or 0 with 1, as above. However, if
they measure in different directions, say a and b, there is no requirement for
correlation, and Alice and Bob might both observe 1, for example (as in row 3
below).
QM View
If we put θ = 120 into 6.38 we have:
1
2
⟩ =
√
3
2
+
2
⟩ + 1/2−
2
⟩.
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
184 Bell States
This tells us that Alice having measured 0 in the a direction (as in 6.37). Bob
now measures + in the b (ie spin up or 0) direction with probability
3
4
and − in
the b direction (i.e. spin down or 1) with probability
1
4
. The net result is that we
have:
Alice Bob Probability
a b
0 0
3
4
0 1
1
4
Equivalent results will be obtained in other pairs of different directions (eg bc,
ie Alice chooses b, Bob c) since the angles between such directions are always
the same. In general we have:
If the directions are different the probability for outcomes to be the
same S (eg 00) is
3
4
; to be different D (eg 01) is
1
4
. On the other hand,
if the directions are the same the probability for different outcomes
(D) is 1.
Suppose we now run 900 trials. Randomly change the directions of measure
ment, so that each combination occurs 100 times. The results must go as:
aa ab ac ba bb bc ca cb cc
Outcome S 0 75 75 75 0 75 75 75 0
Outcome D 100 25 25 25 100 25 25 25 100
The net result is that S occurs 450 times and D 450 times. We conclude:
the probability of different outcomes is
1
2
.
EPR View
We assume each particle carries a ”spin value” relative to each possible direc
tion (as in classical physics), except that (to ﬁt in with what is observed) the
measured value will always be ”spin up” (0) or ”spin down” (1), and not some
intermediate value (so the measured values cannot be regarded as the projec
tion of a spin vector in 3D space onto the direction of the magnetic ﬁeld, as
in classical physics). To try to account for this we say that, at the moment of
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
Bell States 185
emission, each particle leaves with an ”instruction” (the particle’s property, or
hidden variable, or key, or component)  one for each possible direction (a, b, c)
in which it can be measured  which determines the measured outcome in that
direction (in the conventional, prequantum, sense that the measurement just
discovers or reveals what is already there). Since the measurement in the a di
rection can discover two possible values, 0 or 1, the corresponding property,
which we call the A component, must have two values: either A=0, or A=1,
which determines the measurement outcome (as noted above, we cannot allow
randomness in the act of measurement  this would destroy the aa correlation,
etc ; the only possible randomness that can occur is in the assignment of initial
component values at the moment of emission, see below). Likewise, we have
B=0 or B=1; and C=0 or C=1. (It might seem we need an inﬁnity of these prop
erties to cater for the inﬁnity of possible measurement directions. This doesn’t
constitute a problem in classical physics where we have spin behaving like a
magnetic needle: the inﬁnity of possible observed components of the magnetic
moment, dependent on measurement direction, is no more mysterious than the
inﬁnity of shadow lengths projected by a stick dependent on the sun’s direc
tion. But note that it would seem strange to account for the inﬁnity of shadow
length’s by saying the stick had an inﬁnity of components  or ”instructions” 
specifying what shadow should appear, depending on the angle of the sun!).
The A,B,C values are set for each particle at the time of emission and carried off
by them. They can be randomly assigned except that, to obey conservation, if
A=0 for particle 1 then A=1 for particle 2 etc. But we can have A=0 for particle
1 and B=0 for particle 2 since, empirically, the spins are not correlated if we
measure in different directions (in this case if the measurements were in the a
and b directions the result would be 00).
Suppose particle 1 has the assignment A=0, B=1, C=1; ie 011. Interestingly, we
immediately knowwhat the components for particle 2 must be: A=1, B=0, C=0;
ie 100. This is necessary if the two particles are going to give anticorrelated re
sults for the case where we do same direction measurements in each direction
(a, b, c).
We can then lay out the possible assignments of component values, as follows:
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
186 Bell States
Alice Bob
Row a b c a b c
1. 1 1 1 0 0 0
2. 0 1 1 1 0 0
3. 1 0 1 0 1 0
4. 0 0 1 1 1 0
5. 1 1 0 0 0 1
6. 0 1 0 1 0 1
7. 1 0 0 0 1 1
8. 0 0 0 1 1 1
The table respects the rule that measurements in the same direction must be
correlated (this is howthe entries are generated  by allowing Alice’s abc values
to run over the 8 binary possibilities; for each case the correlation rule immedi
ately determines the corresponding Bob entries  i.e. we have no choice). But it
allows for all possibilities in different directions: e.g. we can have Alice ﬁnding
1 in the a direction going with Bob ﬁnding 1 in this direction (rows 3 and 7) or
0 (rows 1 and 5).
We are nowclosing in. Suppose we consider the above 900 trials fromthe realist
perspective. There are only eight possible assignments of properties (Nature’s
choice). And there are nine possible combinations of measurement directions
(the experimenters’ choice). We are assuming that the particles ﬂy off with
their assignments and the measurements simply reveal these (no disturbance
to worry about, as agreed). So in each case we can tell the outcome. For ex
ample, if Nature chooses row 7 (above), ie 100 and the experimenters choose
ab then the outcome is completely determined as S, as follows. Alice gets a
100 particle, measures it in the a direction, and gets 1, Bob gets a 011 particle,
measures it in the b direction, and gets 1. Hence the overall outcome is 11, ie S.
We can now complete the table of outcomes:
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
Cryptology 187
Alice’s particle aa ab ac ba bb bc ca cb cc
111 D D D D D D D D D
011 D S S S D D S D D
101 D S D S D S D S D
001 D D S D D S S S D
110 D D S D D S S S D
010 D S D S D S D S D
100 D S S S D D S D D
000 D D D D D D D D D
What is the probability of different outcomes D? If Alice receives a particle
with equal components (eg 111) this probability is always 1. If Alice receives
a particle with unequal components (eg 011) the probability is always
5
9
(look
along the row for 011: D occurs 5 times out of 9. We don’t know the statistics of
the source: how often particles of the 8 various kinds are emitted. But we can
conclude that the overall probability for D is:
p
equal
+
5
9
p
unequal
.
Since both p’s must be positive we conclude: the probability for different out
comes is greater than
5
9
This is an example of a Bell inequality.
Contradiction!
If we compare the two conclusions we have a contradiction. QMsays the prob
ability should be
1
2
; realism says it should be greater than
5
9
so QM wins!
6.8 Cryptology
Now a proven technology, quantum cryptography provides total security be
tween two communicating parties. Also, the unique properties of quantum
computers promise the ability to break classical encryption schemes like Data
Encryption Standard (DES) and RSA.
The ﬁeld of quantum cryptology has two important subﬁelds, they are:
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
188 Cryptology
1. Cryptography  The use of secure codes.
2. Cryptanalysis  Code breaking.
We’ll concentrate on cryptography in this chapter. Later, in chapter 7 we look
at Shor’s algorithm, which can be used to break RSA encryption.
6.8.1 Classical Cryptography
Secret codes have a long history  dating back to ancient times, one famous
ancient code is the Caesar cipher which simply shifts each letter by three.
A → D, B → E, X → A. (6.38)
This is not very secure as it’s easy to guess and decrypt. Modern codes use
a key. A simple form of key is incorporated into a code wheel, an example of
which follows.
Example An example of a code wheel with the key: ABCDEF is described
below:
Key A B C D E F A B C D E F
Shift By 1 2 3 4 5 6 1 2 3 4 5 6
Message Q U A N T U M C O D E S
Encoding R W D R Y A N E R H J Y
With time secret keys and their respective codes got more complicated, cul
minating in modern codes, e.g. codes called DES and IDEA were implemented
with typically 64 and 128 bit secret keys.
There is another kind of key, a public key. Public key encryption (e.g. RSA 1976
Difﬁe Hellman) uses a combination of a public and a secret key. In a public
key encryption scheme a public key encrypts a message but cannot decrypt it.
This is done by a secret decryption key known only to the owner. Surmising
the decryption key from public (encryption) key requires solving hard (time
complexity wise) problems.
Some codes are stronger than others, for example the DES and IDEA secret
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
Cryptology 189
key codes are stronger than Caesar cipher codes. Possibly the strongest code
is the onetime PAD. A onetime PAD is a key that is large as the message to be
sent (for example a random binary ﬁle) and the sender and receiver both have
a copy of this key. The PAD is used only once to encrypt and decrypt the mes
sage. The problem with onetime PADs is that the key needs to be transmitted
every time and eavesdroppers could be listening in on the key. Quantum key
distribution resolves this issue by providing perfectly secure key distribution.
6.8.2 Quantum Cryptography
Modern classical public key cryptographic systems use a trap door function with
security based on mathematical assumptions, notably that it is difﬁcult to fac
tor large integers. This assumption is now at risk from Shor’s algorithm.
The main advantage of quantum cryptography is that it gives us perfectly
secure data transfer. The ﬁrst successful quantum cryptographic device was
tested in 1989 by C.H. Bennet, and G. Brassard [Castro, M. 1997]. The device
could translate a secret key over 30 centimetres using polarised light, calcite
crystal(s), and other electrooptical devices. This form of cryptography does
not rely on a trap door function for encryption, but on quantum effects like the
nocloning theorem.
Asimple example of the nocloning theorem’s ability to secure data is described
below. After that we’ll look at why it’s impossible to listen in on a quantum
channel, and ﬁnally we’ll examine a method for quantum key distribution.
Quantum Money
Stephen Wiesner wrote a paper in 1970 (unpublished until 1983) in which he
described uncounterfeitable quantum bank notes [Braunstein, S. L. & Lo, H. K.
2000].
Each bank note contains a unique serial number and a sequence of randomly
polarised photons (90
◦
, 180
◦
, 45
◦
, and 135
◦
). The basis of polarisation is kept se
cret (either diagonal or rectilinear). The bank can verify the validity of a note by
matching a serial number with known (only known by the bank) polarisations.
This enables the bank to verify the polarisations without disturbing the quan
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
190 Cryptology
tum system (see the example below). Finally, the counterfeiter can’t counterfeit
the note due to the no cloning theorem. Remember, the no cloning theorem
says that given an unknown quantum state it is impossible to clone that state
exactly without disturbing the state.
Example Let’s say the bank receives a bank not with serial number 1573462.
The bank checks its ”quantum bank note archive” to ﬁnd the polarisations
for bank note 1573462. The banks’ records give the following:
1573462 = {H, H, 135
◦
, V, 45
◦
}.
{H, H, 135
◦
, V, 45
◦
} is a record of the note polarisations, but our copy protec
tion system does not distinguish between H and V or 135
◦
and 45
◦
. Because
the photons are not in superpositions relative to the basis we measure in (as
speciﬁed by the serial numbers) the bank doesn’t disturb the states upon
measurement. The bank only determines the basis of each photon, which is
{0⟩, 1⟩}, (rectilinear) or {+⟩, 1⟩}, (diagonal). It should be noted that states
are always superpositions if we don’t say what the basis is.
Because the counterfeiter does not know the basis of each polarised
photon on the quantum bank note, he must measure using a random basis.
He could, theoretically measure each one and recreate it if he knows the
basis by which to measure each one. The chances of the counterfeiter
randomly measuring in the correct basis decrease by a
1
2
for each successive
polarised photon on the note. So the more polarised photons the bank note
has the harder it is to counterfeit.
Quantum Packet Snifﬁng
Quantum packet snifﬁng is impossible  so the sender and receiver can be sure
that noone is listening in on their messages (eavesdropping). This phenomena
is due to the following properties of quantum mechanics:
1. Quantum uncertainty, for example given a photon polarised in an unknown
state (it might be horizontally (180
◦
), vertically (90
◦
), at 45
◦
, or at 135
◦
)
we can’t tell with certainty which polarisation the photon has without
measuring it.
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
Cryptology 191
2. The no cloning theorem.
3. Disturbance (information gain), if a measurement is done (distinguishing
between two nonorthogonal states) the signal is forever disturbed.
4. Measurements are irreversible, any non orthogonal state will collapse ran
domly into a resultant state  losing the premeasurement amplitudes.
Quantum Key Distribution
We can ensure secure communications by using onetime pads in conjunction
with quantum key distribution. The main drawback for classical onetime pads is
the distribution of encryption/decrytion keys, this is not a problem for quan
tum cryptography as we can transfer key data in a totally secure fashion.
Quantum key distribution (QKD) is a means of distributing keys from one
party to another, and detecting eavesdropping (it is inspired by the quantum
money example). An unusually high error rate is a good indicator of eaves
dropping. Even with a high error rate the eavesdropper cannot learn any use
ful information. It should be noted that this method does not prevent Denial of
service (DOS) attacks.
An example follows on the next page.
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
192 Cryptology
Example Alice and Bob want to use a key based encryption method,
they communicate on two channels. One channel is used to transmit the
encrypted message and another is used to transmit the encryption key. But
they need a way to avoid Eve eavesdropping on their conversation on the
key channel [Ekert, A. 1993].
The following steps allow a totally secure (in terms of eavesdropping)
transfer of the key (later we need to encrypt the message and send it via a
classical channel).
1. Alice randomly polarises photons at 45
◦
, 90
◦
,135
◦
, and 180
◦
 these are
sent to Bob over a quantum channel (which is secure due to quantum
effects, i.e. no eavesdropping).
2. Bob does measurements on the photons. he randomly uses either a rec
tilinear (180
◦
/90
◦
) or diagonal polarising ﬁlter (45
◦
/135
◦
), and records
which one was used for each bit. Also for each bit he records the mea
surement result as a 1 for 135
◦
or 180
◦
or 0 for 45
◦
or 90
◦
polarisations.
3. On a normal (insecure channel) Alice tells Bob which bits Bob used the
right polarisation on (which he also communicates over the classical
channel).
4. Alice and Bob check for quantumerrors to gauge whether or not an eaves
dropper (Eve) was listening.
Comments
The following can be said about the key exchange:
• Eve can’t clone the bit and send it on, her measurements put Bob’s bits in a
new random state. Alice and Bob decide on an acceptable error rate, if
the key exchange’s error rate is higher than that (which means Eve may
have been listening) then they resend the message.
• Eve could do an DOS attack by constantly measuring on the key channel.
• Eve could shave off some of the light if each bit is represented by more than
one photon, so each bit transferred must only be represented by one qubit.
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
Alternative Models of Computation 193
• Eve could listen to a small number of bits and hope to be unnoticed  Alice
and Bob can prevent this by shrinking down their key.
• In 1984 Bennet and Brassard developed BB84, a method of mutual key gen
eration, the ﬁrst QKD system which is based in concepts similar to the
above.
6.9 Alternative Models of Computation
There are other candidates for physical phenomena to enhance computational
power. Some disciplines cannot currently be described by quantummechanics,
like relativity and complexity theory (or chaos theory).
Question Is there a universal computation model? or will there always be
some phenomena which is not well understood that has the potential to be
exploited for the purposes of computation?
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
Chapter 7
Quantum Algorithms
7.0.1 Introduction
Quantum algorithms are ways of combining unitary operations in a quantum
systemto achieve some computational goal. Over the past twenty years a num
ber of algorithms have been developed to harness the unique properties offered
by quantum computers. These algorithms have been designed to give special
advantages over their classical counterparts.
Shor’s algorithm (1995) gives the factorisation of arbitrarily large numbers a
time complexity class of O((log N)
3
), where that classical equivalent is roughly
exponential. This is extremely important for cryptography. For example, RSA
relies on factorisation being intractable, which means that no polynomial solu
tion exists that covers all instances of the problem. Another example is Grover’s
database search algorithm which provides a quadratic speedup when search
ing a list of N items. This takes the classical value of a linear search from O(N)
time to O(N
1
2
) time [TheFreeDictionary.com 2004]. Most known quantum al
gorithms have similarities to, or partially borrow from, these two algorithms.
Some properties of Shor and Grover type algorithms are:
• Shor type algorithms use the quantum Fourier transform. These include: fac
toring, the hidden subgroup problem, discrete logarithms, and order ﬁnd
ing (all variations on a theme).
• Grover type search algorithms can be used for applications like fast database
searching and statistical analysis.
195
196 Deutsch’s Algorithm
There are also hybrid algorithms like quantumcounting that combine elements
fromboth, and more esoteric algorithms like quantumsimulators. In this chap
ter we’ll look at Deutsch’s algorithm, the DeutschJosza algorithm, Shor’s al
gorithm, and Grover’s algorithm.
As with chapters 5 and 6 individual references to QCQI have been dropped.
7.1 Deutsch’s Algorithm
Deutsch’s algorithm is a simple example of quantum parallelism. The prob
lem it solves is not an important one, but its simple nature makes it good for
demonstrating the properties of quantum superposition.
7.1.1 The Problem Deﬁned
We have a function f(x) where f(x) : {0, 1} → {0, 1} with a one bit domain.
This means that f(x) takes a bit (either a 0 or a 1) as an argument and returns
a bit (again, either a 0 or a 1). Therefore both the input and output of this func
tion can be represented by a bit, or a qubit.
We want to test if this function is one to one (balanced), where one to one
means:
f(1) = 1 and f(0) = 0 or f(0) = 1 and f(1) = 0.
The other alternative is that f(x) is not one to one (i.e. it is constant), in which
case we would get:
f(1) = 0 and f(0) = 0 or f(0) = 1 and f(1) = 1.
The circuit for determining some property of a function is called an oracle. It’s
important to note that the thing that quantum computers do well is to test
global properties of functions, not the results of those functions given particular
inputs. To do this efﬁciently we need to look at many values simultaneously.
7.1.2 The Classical Solution
The solution is as follows:
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
Deutsch’s Algorithm 197
iff f(0) ⊕f(1) = 1 the function is one to one (where ⊕ is equivalent to XOR).
This is made up of three operations, involving two function evaluations:
1. x = f(0),
2. y = f(1),
3. z = x ⊕y.
Can we do better with a quantum computer?
7.1.3 The Quantum Solution
The quantum circuit below performs the ﬁrst two steps in the classical solution
in one operation, via superposition.
x 0⟩
H
U
f
x
H
y 1⟩
H
y ⊕f(x)
H
↑ ψ
1
⟩ ↑ ψ
2
⟩ ↑ ψ
3
⟩ ↑ ψ
4
⟩
Below are the steps ψ
1
⟩ to ψ
4
⟩ we need to solve the problem quantum me
chanically.
ψ
1
⟩ The qubits x and y have been set to the following (we call x the query
register and y the answer register):
x = 0⟩,
y = 1⟩.
ψ
2
⟩ Apply H gates to the input registers so our state vector is now:
Ψ⟩ =
¸
0⟩ +1⟩
√
2
¸¸
0⟩ −1⟩
√
2
¸
.
ψ
3
⟩ U
f
acts on qubits x and y, speciﬁcally we use Ψ⟩ → U
f
→ x⟩ y ⊕f(x)⟩.
After some algebraic manipulation the result ends up in x, and y seems
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
198 Deutsch’s Algorithm
unchanged (see the example below).
For f(0) ̸= f(1) (balanced) we get:
Ψ⟩ = ±
¸
0⟩ −1⟩
√
2
¸¸
0⟩ −1⟩
√
2
¸
and for f(0) = f(1) (constant):
Ψ⟩ = ±
¸
0⟩ +1⟩
√
2
¸¸
0⟩ −1⟩
√
2
¸
.
Note: The ± at the start of the state is just a result of internal calculations,
it does not matter whether it is positive or negative for the result of this
circuit (global phase factors have no signiﬁcance).
ψ
4
⟩ x is sent through the H gate again. The H gate, as well as turning a 1
or a 0 into a superposition will take a superposition back to a 1 or a 0
(depending on the sign):
¸
0⟩ +1⟩
√
2
¸
→ H → 0⟩,
¸
0⟩ −1⟩
√
2
¸
→ H → 1⟩.
So at step 4, for f(0) ̸= f(1) we get:
Ψ⟩ = ±1⟩
¸
0⟩ −1⟩
√
2
¸
and for f(0) = f(1):
Ψ⟩ = ±0⟩
¸
0⟩ −1⟩
√
2
¸
.
At this point our state is, combining both cases:
Ψ⟩ = ±f(0) ⊕f(1)⟩
¸
0⟩ −1⟩
√
2
¸
.
Up until now y has been useful to us, now we don’t care about it as x
holds the result. We can just do a partial measurement on x and discard y
as garbage. If x = 0 then the function is constant, and if x = 1 the function
is balanced.
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
Deutsch’s Algorithm 199
Example There’s only four possible combinations for f(x) , we’ll look at
two here. Given our state at ψ
2
⟩ is
1
√
2
[0⟩ + 1⟩]
1
√
2
[0⟩ − 1⟩] our state at ψ
3
⟩
will look like the following:
Ψ⟩ =
¸
0⟩ +1⟩
√
2
¸¸
0 ⊕f(x)⟩ −1 ⊕f(x)⟩
√
2
¸
=
1
2
(0⟩ 0 ⊕f(0)⟩ −0⟩ 1 ⊕f(0)⟩ +1⟩ 0 ⊕f(1)⟩ −1⟩ 1 ⊕f(1)⟩).
Keeping in mind that 0 ⊕0 = 0, 1 ⊕0 = 1, 1 ⊕1 = 0, and 0 ⊕1 = 1 we’ll start
with the constant function f(0) = 0 and f(1) = 0:
Ψ⟩ =
1
2
(0⟩ 0 ⊕0⟩ −0⟩ 1 ⊕0⟩ +1⟩ 0 ⊕0⟩ −1⟩ 1 ⊕0⟩)
=
1
2
(00⟩ −01⟩ +10⟩ −11⟩)
=
¸
0⟩ +1⟩
√
2
¸¸
0⟩ −1⟩
√
2
¸
.
Now for a balanced function f(0) = 1 and f(1) = 0:
Ψ⟩ =
1
2
(0⟩ 0 ⊕1⟩ −0⟩ 1 ⊕1⟩ +1⟩ 0 ⊕0⟩ −1⟩ 1 ⊕0⟩)
=
1
2
(01⟩ −00⟩ +10⟩ −11⟩)
=
1
2
(−00⟩ +01⟩ +10⟩ −11⟩)
= (−1)
1
2
(00⟩ −01⟩ −10⟩ +11⟩)
= −1
¸
0⟩ −1⟩
√
2
¸¸
0⟩ −1⟩
√
2
¸
.
Notice that (1) has been moved outside of the combined state, it is a global
phase factor and we can ignore it. At ψ
4
⟩ we put our entire state through
H ⊗H and get 01⟩ for the constant function and 11⟩ for the balanced one.
7.1.4 Physical Implementations
In theory A simple quantum computer implementing Deutsch’s algorithm can
be made out of a cardboard box, three mirrors, and two pairs of sunglasses
[Stay, M. 2004]. The sunglasses (in a certain conﬁguration) polarise light ini
tially into a nonorthogonal state (a superposition) then back again. The mir
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
200 The DeutschJosza Algorithm
rors within the box reﬂect the light in a certain way depending on their con
ﬁguration (at different angles depending on the type of function you want to
simulate). A torch is then shone into the box, if light comes out the function
is balanced, if not then it is constant. Now, if we use a special optical device
to send just one photon into the box and we have a sensitive photo detector at
the other end then we have an architecture that is a theoretically more efﬁcient
oracle than any classical computer.
Deutsch’s algorithm can of course be executed on any quantum computer ar
chitecture, and has been successfully implemented. For example, in 2001 the
algorithm was run on an NMR computer (see chapter 8) [Dorai, K. Arvind, ?.
Kumar, A. 2001]. Due to the relatively small number of qubits that can be cur
rently made to work together many of the other quantum algorithms have not
been satisfactorily tested.
7.2 The DeutschJosza Algorithm
The DeutschJosza algorithm is an extension of Deutsch’s algorithm which can
evaluate more than one qubit in one operation. We can extend it to evaluate
any number of qubits simultaneously by using an nqubit query register for x
instead of a single qubit.
7.2.1 The Problem Deﬁned
The problem we are trying solve is slightly different to the one presented in
Deutsch’s algorithm, that is: is f(x) the same (constant) for all inputs? Or is
f(x) equal to 1 for half the input values and equal to 0 for the other half (which
means it is balanced)?
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
The DeutschJosza Algorithm 201
7.2.2 The Quantum Solution
The circuit looks like this:
x 0⟩ /
n
H
⊗n
U
f
x
H
⊗n
y 1⟩
H
y ⊕f(x)
H
↑ ψ
1
⟩ ↑ ψ
2
⟩ ↑ ψ
3
⟩ ↑ ψ
4
⟩
The input (x) and output (y) registers have an H gate for each qubit in the
register. This is denoted by H
⊗n
and the /
n
notation just means n wires for n
qubits.
Here are the steps ψ
1
⟩ to ψ
4
⟩ we need to solve the problem quantum mechan
ically.
ψ
1
⟩ The registers x and y have been set to the following:
x = 0⟩
⊗n
,
y = 1⟩.
ψ
2
⟩ Apply H gates to both the x and y registers so our state vector is now:
Ψ⟩ =
1
√
2
n
2
n−1
∑
x=0
x⟩
¸
0⟩ −1⟩
√
2
¸
.
ψ
3
⟩ U
f
acts on registers x and y (remember y is just a single qubit because the
result of evaluating f is, by deﬁnition, just a 0 or 1). This time we use
Ψ⟩ = U
f
Ψ
2
⟩ 0⟩ = x
1
, x
2
, . . . , x
n
⟩ y ⊕f(x)⟩ to evaluate f(x).
ψ
4
⟩ x is sent through H
⊕n
and y through an H gate also. This leaves us with a
set of output qubits and a 1 in the answer register, i.e.
Ψ⟩ = x
1
, x
2
, . . . , x
n
⟩ 1⟩ .
Now the rule is simple: if any of the qubits in the query (x) register are
1⟩ then the function is balanced, otherwise it is constant.
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
202 Shor’s Algorithm
Example Here’s an example with a two qubit query register for the bal
anced function f with f(00) = 0, f(01) = 0, f(10) = 1, and f(11) = 1. So at
state ψ
1
⟩ we have:
Ψ⟩ = 001⟩ .
Then at state ψ
2
⟩, after the H gates we get:
Ψ⟩ =
¸
0⟩ +1⟩
√
2
¸¸
0⟩ +1⟩
√
2
¸¸
0⟩ −1⟩
√
2
¸
.
We are now ready to examine our state at ψ
3
⟩:
Ψ⟩ =
¸
0⟩ +1⟩
√
2
¸¸
0⟩ +1⟩
√
2
¸¸
0 ⊕f(x)⟩ −1 ⊕f(x)⟩
√
2
¸
=
¸
00⟩ +01⟩ +10⟩ +11⟩
√
4
¸¸
0 ⊕f(x)⟩ −1 ⊕f(x)⟩
√
2
¸
=
1
√
8
(00⟩ 0 ⊕f(00)⟩ −00⟩ 1 ⊕f(00)⟩ +01⟩ 0 ⊕f(01)⟩
−01⟩ 1 ⊕f(01)⟩ +10⟩ 0 ⊕f(10)⟩ −10⟩ 1 ⊕f(10)⟩
+11⟩ 0 ⊕f(11)⟩ −11⟩ 1 ⊕f(11)⟩)
=
1
√
8
(000⟩ −001⟩ +010⟩ −011⟩ +101⟩ −100⟩ +111⟩ −110⟩)
=
1
√
8
(000⟩ −001⟩ +010⟩ −011⟩ −100⟩ +101⟩ −110⟩ +111⟩)
=
¸
00⟩ +01⟩ −10⟩ −11⟩
√
4
¸¸
0⟩ −1⟩
√
2
¸
=
¸
0⟩ −1⟩
√
2
¸¸
0⟩ +1⟩
√
2
¸¸
0⟩ −1⟩
√
2
¸
.
At ψ
4
⟩ we put our entire state through H ⊗ H ⊗ H and get 101⟩ meaning
that our function is balanced.
7.3 Shor’s Algorithm
7.3.1 The Quantum Fourier Transform
The quantum analogue of the discrete Fourier transform (see chapter 4) is the
quantum Fourier transform (QFT). The DFT takes a series of N complex num
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
Shor’s Algorithm 203
bers, X
0
, X
1
, ..., X
N−1
and produces a series complex numbers Y
0
, Y
1
, ..., Y
N−1
.
Similarily, the QFT takes a state vector:
Ψ⟩ = α
0
0⟩ +α
1
1⟩ +... +α
N−1
N −1⟩ (7.1)
and performs a DFT on the amplitudes of Ψ⟩ giving us:
Ψ⟩ = β
0
0⟩ +β
1
1⟩ +... +β
N−1
N −1⟩. (7.2)
The main advantage of the QFT is the fact that it can do a DFT on a superposi
tion of states. This can be done on a superposition like the following:
1
√
4
(00⟩ +01⟩ −10⟩ −11⟩)
or a state where the probability amplitudes are of different values. E.g. the fol
lowing state has probability amplitudes of 0 for the majority of its basis states:
1
√
3
(001⟩ +011⟩ −111⟩).
It’ll helpful over the next few sections to use integers when we are describing
states with a large number of qubits, so the previous state could have been
written as:
1
√
3
(1⟩ +3⟩ −7⟩).
The QFT is a unitary operator, and is reversible. In fact we use the inverse
quantum fourier transform (QFT
†
) for Shor’s algorithm. The QFT is deﬁned as
follows:
Given a state vector Ψ⟩:
Ψ⟩ =
2
n−1
∑
x=0
α
x
x⟩ (7.3)
where n is the number of qubits, QFT Ψ⟩ is deﬁned as:
Ψ
′
⟩ = QFT Ψ⟩ =
2
n−1
∑
x=0
2
n−1
∑
y=0
α
x
e
2πixy/2
n
√
2
n
y⟩ . (7.4)
We can also represent the QFT as a matrix:
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
204 Shor’s Algorithm
1
√
2
n
1 1 1 . . . 1
1 ω ω
2
. . . ω
2
n
−1
1 ω
2
ω
4
. . . ω
2(2
n
−1)
1 ω
3
ω
6
. . . ω
3(2
n
−1)
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
1 ω
2
n
−1
ω
2(2
n
−1)
. . . ω
(2
n
−1)(2
n
−1)
¸
¸
¸
¸
¸
¸
¸
¸
¸
¸
¸
(7.5)
where ω = e
2πi/2
n
.
How do we get this matrix? To make it easier to understand we’ll identify the
important part of the summation we need for the matrix representation (which
we’ll label M
xy
):
2
n−1
∑
x=0
2
n−1
∑
y=0
α
x
e
2πixy/2
n
√
2
n
y⟩ =
1
√
2
n
2
n−1
∑
x=0
2
n−1
∑
y=0
M
xy
α
x
y⟩ (7.6)
where M
xy
= e
2πixy/2
n
.
Now using the summations, here are a few values of x and y for M
xy
:
1
√
2
n
e
2πi·0·0/2
n
= e
0
= 1 e
2πi.1.0/2
n
= e
0
= 1 . . .
e
2πi·0·1/2
n
= e
0
= 1 e
2πi·1·1/2
n
= e
2πi/2
n
= ω
.
.
.
.
.
.
¸
¸
¸
¸
. (7.7)
Next we’ll look at two examples using the matrix representation of the QFT.
Examples follow on the next two pages.
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
Shor’s Algorithm 205
Example A simple one qubit QFT. Given:
Ψ⟩ =
2
√
5
0⟩ +
1
√
5
0⟩ .
Find,
Ψ
′
⟩ = QFT Ψ⟩ .
We’ll use the matrix representation, which is:
1
√
2
¸
1 1
1 e
iπ
¸
.
This matrix is actually just an H gate (since e
iπ
= −1), so we get:
Ψ
′
⟩ =
1
√
2
¸
1 1
1 e
iπ
¸¸
2
√
5
1
√
5
¸
=
¸
2
√
10
+
1
√
10
2
√
10
+
e
πi
√
10
¸
=
¸
3
√
10
2
√
10
+
−1
√
10
=
1
√
10
¸
=
3
√
10
0⟩ +
1
√
10
1⟩ .
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
206 Shor’s Algorithm
Example A two qubit QFT. Given:
Ψ⟩ =
1
√
2
00⟩ +
1
√
2
11⟩ .
Find,
Ψ
′
⟩ = QFT Ψ⟩ .
The matrix representation is:
1
√
4
1 1 1 1
1 e
πi/4
e
πi2/4
e
πi3/4
1 e
πi2/4
e
πi4/4
e
πi6/4
1 e
πi3/4
e
πi6/4
e
πi9/4
¸
¸
¸
¸
¸
¸
.
So Ψ
′
⟩ is:
Ψ
′
⟩ =
1
√
4
1 1 1 1
1 e
πi/4
e
πi2/4
e
πi3/4
1 e
πi2/4
e
πi4/4
e
πi6/4
1 e
πi3/4
e
πi6/4
e
πi9/4
¸
¸
¸
¸
¸
¸
1
√
2
0
0
1
√
2
¸
¸
¸
¸
¸
¸
=
1
√
4
1
√
2
+ 0 + 0 +
1
√
2
1
√
2
+ 0 + 0 +
1
√
2
e
πi3/4
1
√
2
+ 0 + 0 +
1
√
2
e
πi6/4
1
√
2
+ 0 + 0 +
1
√
2
e
πi9/4
¸
¸
¸
¸
¸
¸
=
1
√
4
1
√
2
+ 0 + 0 +
1
√
2
1
√
2
+ 0 + 0 +
−1+i
√
2
1
√
2
+ 0 + 0 +
−i
√
2
1
√
2
+ 0 + 0 +
1+i
√
2
¸
¸
¸
¸
¸
¸
=
2
√
8
√
2−1+i
4
1−i
√
8
√
2+1+i
4
¸
¸
¸
¸
¸
¸
=
2
√
8
00⟩ +
√
2 −1 +i
4
01⟩ +
1 −i
√
8
10⟩ +
√
2 + 1 +i
4
11⟩ .
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
Shor’s Algorithm 207
How Do we Implement a QFT?
As stated before, a one qubit QFT has the following rather simple circuit:
H
A three qubit QFT has a more complicated circuit:
H S T
×
•
H S
• •
H
×
We can extend this logic to n qubits by using H and n − 2 different rotation
gates (R
k
 see below) where:
R
k
=
¸
1 0
1 e
2πi/2
k
¸
. (7.8)
For n qubits we use gates R
2
. . . R
n
. For more information on generic QFT
circuits you’ll need to consult an external reference like QCQI.
7.3.2 Fast Factorisation
Finding unknown factors p and q such that p × q = 347347 is very slow com
pared to the reverse problem: calculating 129 × 156. We don’t yet know fast
algorithms for factorising on classical machines but we do now know (thanks
to Shor) a fast factorisation algorithm we can run on a quantum computer.
Public key encryption systems like RSA algorithm rely on the fact that it’s hard
to factorise large numbers; if we could ﬁnd the factors we could use the infor
mation provided in the public key to decrypt messages encrypted with it. In
terms of RSA our task is simple. Given an integer N we know n = pq where p
and q are large prime numbers we want to calculate p and q.
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
208 Shor’s Algorithm
7.3.3 Order Finding
To factorise N we reduce the problem of factorisation to order ﬁnding, that is:
given 1 < x < N the order of x mod N is the smallest value of r where r ≥ 1
and x
r
mod N = 1.
This means that the list of powers of x, 1, x, x
2
, x
3
, x
4
, . . . mod N will repeat
with a period that is less than N.
We’re trying to ﬁnd the period of a periodic function. Why? Because it turns
out there’s a close connection between ﬁnding the factors and ﬁnding the pe
riod of a periodic function. The intuition is that quantum computers might be
good at this because of quantum parallelism: their ability to compute many
function values in parallel and hence be able to get at ”global properties” of the
function (as in Deutsch’s algorithm).
Example Say we have N = 55 and we choose x to be 13.
13
0
mod 55 = 1,
13
1
mod 55 = 13,
13
2
mod 55 = 4,
.
.
.
13
20
mod 55 = 1.
So r = 20, i.e. 13 mod 55 has a period of 20.
The calculation of x
i
mod N can be done in polynomial time and thus can
be done on a classical computer. Once we have the order r we can apply some
further classical calculations to it to obtain a factor of N.
The ”quantum” part gives us the period r in polynomial time by using a pro
cess called phase estimation. Phase estimation attempts to determine an un
known value γ of an eigenvalue e
2πiγ
of an eigenvector u⟩ for some unitary
U. We won’t worry about explicitly understanding phase estimation as Shor’s
algorithm has a number of speciﬁc steps that makes learning it unnecessary.
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
Shor’s Algorithm 209
Before we look at the circuit for Shor’s algorithm. A necessary component of
Shor’s algorithm, the continued fractions algorithm, is introduced.
The Continued Fractions Algorithm
The continued fractions algorithm allows us to calculate an array of integers to
represent a fraction. We simply split the fraction into its whole and fractional
parts, store the whole part, and repeat the process until we have no fractional
parts left. Here’s an example:
Example Convert
11
9
to integer array representation.
11
9
= 1 +
2
9
= 1 +
1
9
2
= 1 +
1
1 +
1
9
2
= 1 +
1
1 +
1
4 +
1
2
.
So, we end up with the following list:
[1, 1, 4, 2]
which is a four element array (that took four steps) that represents
11
9
.
Now we’ll look at the fast factorisation algorithm...
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
210 Shor’s Algorithm
The Fast Factorisation Circuit and Algorithm
0⟩
H
•
QFT
†
.
.
.
0⟩
H
•
. . .
0⟩
H
•
. . .
0⟩
H
•
. . .
1⟩
⊗n
/ U
1
f
U
2
f
U
3
f
U
n
f
↑ ψ
1
⟩ ↑ ψ
2
⟩ ↑ ψ
3
⟩ ↑ ψ
4
⟩ ↑ ψ
5
⟩
The algorithm presented here is similar to Shor’s algorithm, and uses the QFT
introduced earlier. It’s simple, given a number N to be factored, to return a
factor f where f > 1. The algorithm is as follows:
1. If N is divisible by 2 then return f = 2.
2. For a ≥ 1 and b ≥ 2 if N = a
b
then return f = a (we can test this classically).
3. Randomly choose an integer x where 1 < x < N. We can test if two numbers
share a common divisor efﬁciently on a classical computer. There is an
efﬁcient classical algorithm to test if numbers are coprime, that is their
greatest common divisor (gcd) is 1. In this step we test if gcd(x, N) > 1,
if it is then we return f = gcd(x, N). E.g. N = 15 if x = 3; we ﬁnd
gcd(3, 15) = 3, so return 3.
4. This is where the quantumcomputer comes in. We apply the quantumorder
ﬁnding algorithm. Before we start we need to deﬁne the size of the input
registers, register 1 needs to be t qubits in size where 2N ≤ t (this is to
reduce the chance of errors in the output, and there seems to be some
contention in the reference material as to what this lower bound should
be). Register 2 needs to be L qubits in size where L is the number of qubits
needed to store N.
ψ
1
⟩ Initialise register 1, which is t qubits in size to 0⟩
⊗t
and register 2,
which is L qubits in size to 1⟩
⊗L
.
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
Shor’s Algorithm 211
ψ
2
⟩ Create a superposition on register 1:
Ψ⟩ =
1
√
2
t
∑
2
t−1
r
1
=0
R
1
⟩ 1⟩.
ψ
3
⟩ Apply U
f
R
2
= x
R
1
mod N to register 2:
Ψ⟩ =
1
√
2
t
∑
2
t−1
r
2
=0
R
1
⟩
x
R
1
mod N
⟩
.
ψ
4
⟩ We measure register 2, because it is entangled with register 1 and
our state becomes subset of the values in register 1 that correspond
with the value we observed in register 2.
ψ
5
⟩ We apply QFT
†
to register 1 and then measure it.
ψ
6
⟩ (not shown) Now we apply the continued fractions algorithm to
Ψ⟩
2
t
and the number of steps it takes will be the period r.
5. With the result r ﬁrst test if r is even the see if x
r/2
̸= −1 mod N then cal
culate f =gcd(x
r/2
±, N). If the result is not 1 or N then return f as it is a
factor, otherwise the algorithm has failed and we have to start again.
Over the next two pages we’ll look at a couple of worked examples of Shor’s algorithm.
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
212 Shor’s Algorithm
Example Find the factors for N = 15
1. N is not even, continue.
2. N ̸= a
b
so continue.
3. We choose x = 7 gcd(7, 15) = 1 so continue.
4. t = 11 qubits for register 1 and L = 4 qubits for register 2.
ψ
1
⟩ Initialise both the registers so the combined state becomes Ψ⟩ =
000000000001111⟩.
ψ
2
⟩ Create a superposition on register 1, so we get Ψ⟩ =
1
√
2048
(0⟩ + 1⟩ +
2⟩ +. . . +2047⟩) 15⟩.
ψ
3
⟩ applying x
R
1
mod 15 gives us the following:
R
1
0⟩ 1⟩ 2⟩ 3⟩ 4⟩ 5⟩ 6⟩ 7⟩ 8⟩ 9⟩ 10⟩ . . .
R
2
1⟩ 7⟩ 4⟩ 13⟩ 1⟩ 7⟩ 4⟩ 13⟩ 1⟩ 7⟩ 4⟩ . . .
ψ
4
⟩ We Measure R
2
and randomly get a 4 leaving Ψ⟩ in the following post
measurement state:
R
1
2⟩ 6⟩ 10⟩ . . .
R
2
4⟩ 4⟩ 4⟩ . . .
Remember that both registers are actually part of the same state vec
tor, it’s just convenient to think of them separately. The state above is
actually an entangled state that looks like (R
2
is bolded):
Ψ⟩ =
1
√
512
(000000000010100⟩ +000000000110100⟩ +. . .) .
ψ
5
⟩ After applying QFT
†
we get either 0, 512, 1024, or 1536 with a probabil
ity of
1
4
. Say we observe 1536.
ψ
6
⟩ The result from the continued fractions algorithm for
1536
2048
is 4.
5. r is even and satisﬁes
r
2
̸= −1 mod N. So we try gcd(7
2
− 1, 15) = 3 and
gcd(7
2
+ 1, 15) = 5. Now, by testing that 3 × 5 = 15 = N we see we
have now found our factors.
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
Shor’s Algorithm 213
Example Find the factors for N = 55
1 & 2. N is not even and N ̸= a
b
, so continue.
3. We choose x = 13 gcd(13, 55) = 1 so continue.
4. t = 13 qubits for register 1 and L = 6 qubits for register 2.
ψ
1
⟩ Initialise both the registers so the combined state becomes Ψ⟩ =
0000000000000111111⟩.
ψ
2
⟩ Create a superposition on register 1, so we get Ψ⟩ =
1
√
8192
(0⟩ + 1⟩ +
2⟩ +. . . +8191⟩) 63⟩.
ψ
3
⟩ applying x
R
1
mod 55 gives us the following:
R
1
0⟩ 1⟩ 2⟩ . . . 8192⟩
R
2
1⟩ 13⟩ 4⟩ . . . 2⟩
ψ
4
⟩ We Measure R
2
and randomly get a 28 leaving Ψ⟩ in the following post
measurement state:
R
1
9⟩ 29⟩ 49⟩ . . . 8189⟩
R
2
28⟩ 28⟩ 28⟩ . . . 28⟩
So the state vector (ie. with both registers) looks like this:
Ψ⟩ =
1
√
410
(9⟩ 28⟩ +29⟩ 28⟩ +49⟩ 28⟩ +. . . +8189⟩ 28⟩) .
ψ
5
⟩ After applying QFT
†
we observe 4915 (the probability of observing this
is 4.4%).
ψ
6
⟩ The result from the continued fractions algorithm for
4915
8192
is 20.
5. r is even and satisﬁes
r
2
̸= −1 mod N. So we try gcd(13
10
−1, 15) = 5 and
gcd(13
10
+1, 55) = 11. Now, by testing that 5 ×11 = 55 = N we see we
have now found our factors.
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
214 Grover’s Algorithm
7.4 Grover’s Algorithm
Grover’s algorithm gives us a quadratic speed up to a wide variety of clas
sical search algorithms. The most commonly given examples of search algo
rithms that can beneﬁt from a quantum architecture are shortest route ﬁnding
algorithms and algorithms to ﬁnd speciﬁc elements in an unsorted database.
7.4.1 The Travelling Salesman Problem
An example of shortest route ﬁnding is the travelling salesman problem. Put sim
ply, given a number of interconnected cities, with certain distances between
them. Is there a route of less than k kilometres (or miles) for which the sales
man can visit every city?
With Grover’s algorithm it is possible to complete to search for a route of less
than k kilometres in O(
√
N) steps rather than an average of
N
2
(which is O(N))
steps for the classical case. Suppose we have M different solutions for k then
the time complexity for Grover’s algorithm is O(
√
M
N
).
7.4.2 Quantum Searching
For the purpose of explaining Grover type algorithms we’ll use an unsorted
database table as an example.
Given a database table with N elements (it is best if we choose an N that is
approximately 2
n
where n is the number of qubits) with an index i. Our table
is shown below:
0 element 1
1 element 2
2 element 3
.
.
.
N −1 element N
Suppose there are M solutions where 1 < M ≤ N.
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
Grover’s Algorithm 215
In a similar way to Deutsch’s algorithm we use an oracle to decide if a par
ticular index, x is a marked solution to the problem, i.e.
f(x) = 1 if x is a solution,
f(x) = 0 otherwise.
The search algorithm can actually be made up of several oracles. The oracles
functions are very similar to the Deutsch Josza algorithm, as shown below:
x⟩ q⟩ → O → q ⊕f(x)⟩ (7.9)
here x⟩ is a register, q⟩ is a qubit and O is the oracle. The oracle circuit looks
like this:
x⟩ /
n
U
f
q⟩
q ⊕f(x)
As with the Deutsch Josza algorithm if we set q to 1⟩ and then put it through
an H gate the answer appears in the x⟩ register and q⟩ appears the same after
the calculation so we end up with:
x⟩ → O → (−1)
f(x)
x⟩ . (7.10)
The function f(x) contains the logic for the type of search we are doing. Typ
ically there are extra work qubits leading into the oracle that may behave as
ancilla qubits. This is called an oracle’s workspace (represented by w).
The circuit for Grover’s algorithm is shown below:
0⟩ /
n
H
⊗n
G G
. . .
G
0⟩ 0⟩
. . .
0⟩
w⟩ /
. . .
↑ ψ
1
⟩ ↑ ψ
2
⟩ ↑ ψ
3
⟩ ↑ ψ
4
⟩ ↑ ψ
5
⟩ ↑ ψ
6
⟩
The steps for the algorithm for M = 1 are as follows:
ψ
2
⟩ Initialise qubits states.
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
216 Grover’s Algorithm
E
T
/
/
/
/
/
/
/
/
/
/
/
/
/ª
Z
Z
Z
Z
Z
Z
Z
Z
Z
Z´
.
.
.
.
.
.
.
.
.
.
.
.
.·
v⟩
u⟩
G
1
ψ⟩
G
2
ψ⟩
G
3
ψ⟩
Figure 7.1: Visualising grover’s algorithm.
ψ
2
⟩ We put x⟩ into a superposition:
x⟩ →
1
√
N
N−1
∑
x=0
x⟩.
ψ
3
⟩ → ψ
5
⟩ Each G is called a Grover iteration that performs the oracle and a
conditional phase ﬂip on x⟩ which ﬂips the sign on all qubits except for 0⟩
(denoted by CPF below). This is done after collapsing the superposition
on x⟩ via H
⊗n
. After the phase ﬂip is completed the x⟩ register is put
back into a superposition. Each G looks like the following:
x⟩ /
n
x⟩ → (−1)
f(x)
x⟩
H
⊗n
CPF H
⊗n
q⟩
W⟩ /
For M = 1 we will need to apply G ⌈π
√
2
n
/4⌉ times.
ψ
6
⟩ Finally we measure, as we have M = 1 the register x⟩ will contain the
only solution. If we had M > 1 we would randomly measure one of the
possible solutions.
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
Grover’s Algorithm 217
Visualising Grover’s Algorithm
We can deﬁne the superposition of solutions to Grover’s algorithm as:
u⟩ =
1
√
M
∑
=
x⟩ (7.11)
and the superposition of values that are not solutions as:
v⟩ =
1
√
N −M
∑
̸=
x⟩ . (7.12)
The operation of Grover’s algorithm can be seen if ﬁgure 7.1 as a series of ro
tations of Ψ⟩ fromv⟩ to u⟩. With each individual rotation being done by G, a
grover iteration.
A simple exmample follows:
Example Suppose we have an index size of 4, which gives us N = 4. We
have only one solution so M = 1 and our function, f(x) has a marked solu
tion at x = 0. This is like saying the element we are looking for is at index
i = 0. These are the results returned by an oracle call:
f(0) = 1, f(1) = 0, f(2) = 0, and f(3) = 0.
The size of register x⟩ is 2 qubits. We also have a workspace of 1 qubit (which
we set to 1⟩), which we put through an H gate at the same time as the qubits
in x⟩ initially go through their respective H gates (we’ll ignore oracle qubit
q for this example). The steps for the algorithm are as follows:
ψ
1
⟩ We initialise x⟩ and w⟩, so Ψ⟩ = 001⟩.
ψ
2
⟩ x⟩ and w⟩ go through their H gates giving us x⟩ =
1
√
4
[00⟩ + 01⟩ +
10⟩ +11⟩] and w⟩ =
1
√
2
[0⟩ −1⟩].
ψ
3
⟩ A single grover iteration is all we need to rotate x⟩ to match u⟩ (the
marked solution) so we jump straight to ψ
5
⟩.
ψ
5
⟩ Nowx⟩ = 00⟩.
ψ
6
⟩ Measuring register x⟩ gives us a 0.
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
Chapter 8
Using Quantum Mechanical Devices
8.1 Introduction
Today’s manufacturing methods can make chips (ﬁgure 8.1) with transistors
a fraction of a micron wide. As they get smaller, chips also tend to get faster.
Computer power doubles every fewyears (according to Moore’s law) and we’ll
soon reach the threshold below which transistors will not work because of
quantum effects. At tens of nanometres (which we are close to now) electrons
can tunnel between parts of a circuit, so transistor technology may not be able
to shrink much further [Benjamin, S. & Ekert, A. ? 2000].
In 1998 Neil Gershenfeld (MIT) built a three qubit device, then in 2000 Ray
LaFlemme built a seven qubit quantum computer. Currently we are still lim
ited to tens of qubits and hundreds of gates with implementations being slow
and temperamental. The architectures of these machines vary, with scientists
even talking about using cups of coffee and small amounts of chloroform to
build a working quantum computer [Blume, H. 2000].
8.2 Physical Realisation
We’ll take a quick look at physical realisations here, but a warning for those
expecting detail  this section is mainly here for completeness and is strictly an
introduction.
According to Nielsen and Chuang [Nielsen, M. A. & Chuang, I. L. 2000] there
219
220 Physical Realisation
Figure 8.1: A silicon chip [Benjamin, S. & Ekert, A. ? 2000].
are four basic requirements for the physical implementation of a quantumcom
puter. They are:
1. Qubit implementation  The biggest problem facing quantum computing is
the ﬁckle nature of the minute components they work with. Qubits can
be implemented in various ways, like the spin states of a particle, ground
and excited states of atoms, and photon polarisation.
There are several considerations for implementing qubits, one consider
ation is high decoherence times (low stability). E.g. 10
−3
seconds for an
electron’s spin, and 10
−6
seconds for a quantum dot (a kind of artiﬁcial
atom). Another consideration is speed, the stronger the qubit implemen
tation can interact with the environment, the faster the computer. E.g.
nuclear spins give us much slower ”clock speed” than electron spins, be
cause of the nuclear spin’s weak interactions with the ”outside world”.
There are two types of qubits, material qubits like the stationary ones
described above and ﬂying qubits (usually photons). Stationary qubits are
most likely to be used to build quantum hardware, whereas ﬂying qubits
are most likely to be used for communication.
2. Control of unitary evolution  How we control of the evolution of the cir
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
Physical Realisation 221
cuits.
3. Initial state preparation (qubits)  Setting the values of initial qubits. We
need to be able to initialise qubits to values like 000 . . .⟩. This is not just
for initial values of a circuit. E.g. quantum error correction needs a con
stant supply of preinitialised, stable qubits.
4. Measurement of the ﬁnal state(s)  Measuring qubits. We need a way of
measuring the state of our qubits. We need to do this in a way that does
not disturb other parts of our quantum computer. we also need to con
sider if the measurement is a non destructive measurement, which for ex
ample leaves the qubit in the state which can be used later for initialisa
tion. Another issue is that measurement techniques are less than perfect,
so we have to consider ”copying” values of the output qubits and aver
aging the results.
Also, David P. Divenco [Divincenzo, D.P. 2003] has suggested two more ”fun
damental requirements”:
5. Decoherence times need to be much longer than quantum gate times.
6. A universal set of quantum gates.
8.2.1 Implementation Technologies
There are many theoretical ways to implement a quantum computer, all of
which, at present suffer from poor scalability. Two of the important methods
are listed below [Black, P.E. Kuhn, D.R. & Williams, C.J. ? 2000].
• Optical photon computer  This is the easiest type of quantum computer
to understand. One of the ways qubits can be represented is by the fa
miliar polarisation method. Gates can be represented by beamsplitters.
Measurement is done by detecting individual photons and initial state
preparation can be done by polarising photons. In practice, photons do
not interact well with the environment, although there are new methods
that use entanglement to combat this problem. There remain other prob
lems with single photon detection (which is very hard to do), and the fact
that photons are hard to control as they move at the speed of light.
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
222 Quantum Computer Languages
• Nuclear magnetic resonance  NMR uses the spin of an atomic nucleus to
represent a qubit. Chemical bonds between spins are manipulated by a
magnetic ﬁeld to simulate gates. Spins are prepared by magnetising, and
induced voltages are used for measurement. Currently it is thought that
NMR will not scale to more than about twenty qubits.
Several atomic spins can be combined chemically in a molecule. Each
element resonates at a different frequency so we can manipulate different
spins by producing a radio wave pulse at the correct frequency. This spin
is ”rotated” by the radio pulse (the amount of which depends on the am
plitude and direction). A computation is made up of a series of timed,
and sized radio pulses. We are not limited to using atoms as they can
be combined to form a macroscopic liquid with same state spins for all
the component atoms. A seven qubit computer has been made from ﬁve
ﬂuorine atoms whose spins implement qubits.
To explain these in detail is beyond the scope of this text and there are many
more implementation technologies like ion traps (a number of ions, trapped
in a row in a magnetic ﬁeld), SQUIDS (superconducting quantum interference
devices), electrons on liquid helium, optical lattices, and harmonic oscillators.
8.3 Quantum Computer Languages
Even though no quantum computer has been built that hasn’t stopped the pro
liferation of papers on various aspects of the subject. Many such papers have
been written deﬁning language speciﬁcations. Some quantum languages are
listed below [Glendinning, I. 2004].
• QCL  (Bernhard
¨
Omer) C like syntax and very complete. Accessible at http:
//tph.tuwien.ac.at/
∼
oemer/qcl.html .
• qGCL  (Paolo Zuliani and others) Resembles a functional programming lan
guage and claims to be better than Bernhard
¨
Omer’s QCL because QCL
does not include probabilism and nondeterminism, has no notion of pro
gram reﬁnement, and only allows standard observation. Accessible via
http://web.comlab.ox.ac.uk/oucl/work/paolo.zuliani/ .
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
Encryption Devices 223
Figure 8.2: id Quantique’s QKD device.
• Quantum C  (Stephen Blaha) Currently just a speciﬁcation, with a notion of
quantum assembler. Accessible at http://arxiv.org/abs/quant
ph/0201082 .
• Conventions for QuantumPseudo Code  (E. Knill) Not actually a language,
but a nice way to represent quantum algorithms and operations. Accessi
ble at www.eskimo.com/
∼
knill/cv/reprints/knill
:qc1996e.ps .
Question It seems odd that there is no implementation of quantum BASIC,
is there any existing work? Maybe just a speciﬁcation?
8.4 Encryption Devices
The ﬁrst encryption devices using the quantum properties discussed previ
ously have been released. For example, a quantum key distribution unit devel
oped by id Quantique (which can be found at http://www.idquantique.
com/) is pictured in ﬁgure 8.2 and another encryption device was recently re
leased by MagiQ.
Whether or not they become commercial success may affect the future of the
ﬁeld as a whole.
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
Appendix A
Complexity Classes
A.1 Classical
Here is a summary of some of the main complexity classes. Most of these deﬁ
nitions are copied verbatim from [cs.umbc.edu.edu 2003]:
P  the set of languages accepted by deterministic Turing machines in polyno
mial time.
NP  the set of languages accepted by nondeterministic Turing machines in
polynomial time.
NPI (NP intermediate)  the set of languages in NP but not in NPcomplete.
coNP  the set of languages rejected by nondeterministic Turing machines in
polynomial time.
NPcomplete  a decision problem in NP is NPcomplete if all other problems
in NP are reducible to it.
EXP  the set of languages accepted by deterministic Turing machines in t(n) =
2
cn
time.
NEXP  the set of languages accepted by nondeterministic Turing machines in
t(n) = 2
cn
time.
PEXP  the set of languages accepted by deterministic Turing machines in t(n) =
2
p(n)
time.
225
226 Classical
NPEXP  the set of languages accepted by nondeterministic Turing machines
in t(n) = 2
p(n)
time.
UP  the set of languages accepted by unambiguous nondeterministic Turing
machines, that have at least one accepting computation on any input, in
polynomial time.
The next set of classes relate to space complexity  which is the amount of space
(storage) required by the algorithm.
LOGSPACE  the set of languages accepted by deterministic Turing machines
in logarithmic space.
PSPACE  the set of languages accepted by deterministic Turing machines in
polynomial space.
NPSPACE  the set of languages accepted by nondeterministic Turing ma
chines in polynomial space.
NLOGSPACE  the set of languages accepted by nondeterministic Turing ma
chines.
The ﬁnal set of classes refer to probabilistic Turning machines:
PP  the set of languages accepted by probabilistic polynomialtime Turing ma
chines (not proved random = pseudo random).
BPP  the set of languages accepted by bounded probabilistic polynomialtime
Turing machines (balanced probability).
RP  the set of languages accepted by random probabilistic polynomialtime
Turing machines (one sided probability).
coRP  the set of languages accepted by RP machines with accept and reject
probabilities reversed.
ZPP  RP intersection coRP, the set of languages accepted by zero probability
of error polynomialtime Turing machines.
Some of the main classes are related in the following way [Nielsen, M. A. &
Chuang, I. L. 2000]:
• L ⊆ P ⊆ NP ⊆ PSPACE ⊆ EXP.
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
Quantum 227
• Factoring is thought to be in NPI and not proven to be in NPcomplete.
• Graph isomorphism is thought to be in NPI and not proven to be in NP
complete.
• Time hierarchy theorem: TIME(f(n)) ⊂ TIME(f(n) log
2
(f(n))).
• Space hierarchy theorem: SPACE(f(n)) ⊂ SPACE(f(n) log(f(n))).
A.2 Quantum
Some of the quantum complexity classes are listed below. These deﬁnitions are
copied verbatim from [Meglicki, Z. 2002]:
QP  the problem can certainly be solved by a QTM in polynomial time at
worst, with P ⊂ QP.
ZQP  the problemcan be solved by a QTMwithout errors in polynomial time,
with ZP ⊂ ZQP.
BQP  the problem can be solved by a QTM in polynomial time at worst with
probability greater than
2
3
. I.e. in
1
3
of cases the computer may return an
erroneous result, also BPP ⊆ BQP.
Some of the quantumcomplexity classes are related in the following way [Nielsen,
M. A. & Chuang, I. L. 2000]:
• It is known that polynomial quantum algorithms are in PSPACE.
• It is thought that NPcomplete problems cannot be solved by QTMs in poly
nomial time but NPI problems can.
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
Bibliography
Arizona.edu 1999, Lecture 1 [Online]. Available: http://www.consciousness.
arizona.edu/quantum/Library/qmlecture1.htm [Accessed 5 December 2004]
Baeyer, H. C. 2001, In the Beginning was the Bit, New Scientist, February 17
Banerjee, S. ? 2004, Quantum Computation and Information Theory  Lecture 1 [On
line]. Available: http://www.cse.iitd.ernet.in/\
∼
suban/quantum/lectures/
lecture1.pdf [Accessed 4 July 2004]
Barenco, A. Ekert, A. Sanpera, A. & Machiavello, C. 1996, A Short Introduction
to Quantum Computation [Online]. Available: http://www.Qubit.org/library/
intros/comp/comp.html [Accessed 30 June 2004]
Benjamin, S. & Ekert, A. ? 2000, A Short Introduction to QuantumScale Comput
ing. [Online]. Available: http://www.qubit.org/library/intros/nano/nano.
html [Accessed 4 July 2004]
Bettelli, S. 2000, Introduction to Quantum Algorithms [Online]. Available: sra.
itc.it/people/serafini/quantumcomputing/seminars/20001006slides.ps
[Accessed 5 December 2004]
Black, P.E. Kuhn, D.R. & Williams, C.J. ? 2000, Quantum Computing and Commu
nication [Online]. Available: http://hissa.nist.gov/
∼
black/Papers/
quantumCom.pdf [Accessed 7 December 2004]
Blume, H. 2000, Reimagining the Cosmos. [Online]. Available: http://www.
theatlantic.com/unbound/digicult/dc20000503.htm [Accessed 4 July 2004]
229
230 BIBLIOGRAPHY
Braunstein, S. L. & Lo, H. K. 2000, Scalable Quantum Computers  Paving the Way
to Realisation, 1st edn, Wiley Press, Canada.
Bulitko, V.V. 2002, On Quantum Computing and AI (Notes for a Graduate Class).
[Online]. Available: www.cs.ualberta.ca/
∼
bulitko/qc/schedule/qcssnotes.
pdf [Accessed 10 December 2004]
Cabrera, B.J. ? 2000, John von Neumann and von Neumann Architecture for Comput
ers [Online]. Available: http://www.salem.mass.edu/
∼
tevans/VonNeuma.htm
[Accessed 9 September 2004]
Castro, M. 1997, Do I Invest in Quantum Communications Links For My Company?
[Online]. Available: http://www.doc.ic.ac.uk/
∼
nd/surprise 97/journal/
vol1/mjc5/ [Accessed 4 July 2004]
Copeland, J. 2000, What is a Turing Machine? [Online]. Available: http://www.
alanturing.net/turing archive/pages/ReferenceArticles
/WhatisaTuringMachine.html [Accessed 9 August 2004]
cs.umbc.edu.edu 2003, Complexity Class Brief Deﬁnitions [Online]. Available:
http://www.csee.umbc.edu/help/theory/classes.shtml [Accessed 7 Decem
ber 2004]
Dawar, A. 2004, Quantum Computing  Lectures. [Online]. Available: http:
//www.cl.cam.ac.uk/Teaching/current/QuantComp/ [Accessed 4 July 2004]
Dorai, K. Arvind, ?. Kumar, A. 2001, Implementation of a Deutschlike quan
tum algorithm utilising entanglement at the twoqubit level on an NMR quantum
information processor [Online]. Available: http://eprints.iisc.ernet.in/archive
/00000300/01/Deutsch.pdf [Accessed 4 July 2004]
Designing Encodings ? 2000, Designing Encodings [Online]. Available: http:
//www.indigosim.com/tutorials/communication/t3s2.htm
Deutsch, D. & Ekert, A. 1998, Quantum Computation, Physics World, March
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
BIBLIOGRAPHY 231
Divincenzo, D.P. 2003, The Physical Implementation of Quantum Computa
tion, quantph/0002077, vol. 13 April.
Ekert, A. 1993, Quantum Keys for Keeping Secrets, New Scientist, Jan 16
Forbes, S. Morton, M. Rae H. 1991, Skills in Mathematics Volumes 1 and 2, 2nd
edn, Forbes, Morton, and Rae, Auckland.
Gilleland, M. ? 2000, Big Square Roots [Online]. Available: http://www.
merriampark.com/bigsqrt.htm [Accessed 9 September 2004]
Glendinning, I. 2004, QuantumProgramming Languages and Tools. [Online]. Avail
able: http://www.vcpc.univie.ac.at/
∼
ian/hotlist/qc/programming.shtml
[Accessed 4 July 2004]
Hameroff, S. ? 2003, Consciousness at the Millennium: Quantum Approaches to
Understanding the Mind, Introductory Lectures [Online]. Available: http://www.
consciousness.arizona.edu/Quantum/ [Accessed 30 June 2004]
Hameroff, S. & Conrad, M. ? 2003, Consciousness at the Millennium: Quantum
Approaches to Understanding the Mind, Lecture 6 [Online]. Available: http://
www.consciousness.arizona.edu/Quantum/week6.htm [Accessed 30 June 2004]
Jones, J. Wilson, W. 1995, An Incomplete Education , ? edn, ?, ?
Knill, E. Laﬂamme, R. Barnum, H. Dalvit, D. Dziarmaga, J. Gubernatis, J. Gurvits,
L. Ortiz, G. Viola, L. & Zurek, W.H. 2002, Introduction to Quantum Information
Processing
Marshall, J. 2001, Theory of Computation [Online]. Available: http://pages.
pomona.edu/
∼
jbm04747/courses/fall2001/cs10/lectures/Computation
/Computation.html [Accessed 9 August 2004]
McEvoy, J.P. & Zarate, 0. 2002, Introducing Quantum Theory, 2nd edn, Icon
Books, UK.
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
232 BIBLIOGRAPHY
Meglicki, Z. 2002, Quantum Complexity and Quantum Algorithms [Online]. Avail
able: http://beige.ucs.indiana.edu/B679/node27.html [Accessed 7 Decem
ber 2004]
Natural Theology 2004, Goedel [Online]. Available: http://www
.naturaltheology.net/Synopsis/s26Goedel.html
Nielsen, M. A. 2002, Eight Introductory Lectures on Quantum Information Science
[Online]. Available: http://www.qinfo.org/people/nielsen/qicss.html [Ac
cessed 30 June 2004]
Nielsen, M. A. & Chuang, I. L. 2000, Quantum Computation and Quantum In
formation, 3rd edn, Cambridge Press, UK.
Odenwald, S. 1997, Ask the Astronomer (Question) [Online]. Available: http:
//www.astronomycafe.net/qadir/q971.html [Accessed 30 June 2004]
Rae, A. 1996, Quantum Physics: Illusion or Reality?, 2nd edn, Cambridge Press,
UK.
Searle, J. R. 1990, Is the Brain’s Mind a Computer Program, Scientiﬁc Ameri
can, January, pp. 2025.
Shannon, C. E. 1948, A Mathematical Theory of Communication [Online]. Avail
able: http://cm.belllabs.com/cm/ms/what/shannonday/paper.html [Accessed
29 April 2006]
Shatkay, H. 1995, The Fourier Transform  A Primer [Online]. Available: http://
citeseer.ist.psu.edu/shatkay95fourier.html [Accessed 10 December 2004]
Smithsonian NMAH 1999, Jacquard’s Punched Card [Online]. Available: http:
//history.acusd.edu/gen/recording/jacquard1.html [Accessed 9 September
2004]
Stay. M. 2004, Deutsch’s algorithm with a pair of sunglasses and some mirrors [On
line]. Available: http://www.cs.auckland.ac.nz/
∼
msta039/deutsch.txt [Ac
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
BIBLIOGRAPHY 233
cessed 4 July 2004]
Steane, A. M. 1998, Quantum Computing, Rept.Prog.Phys., vol. 61 pp. 117
173
TheFreeDictionary.com 2004, Grover’s Algorithm [Online]. Available: http://
encyclopedia.thefreedictionary.com/groversalgorithm
[Accessed 4 July 2004]
TheFreeDictionary.com 2004, Probabilistic Turing machine [Online]. Available:
http://encyclopedia.thefreedictionary.com/Probabilistic+Turing+machine
[Accessed 3 December 2004]
wikipedia.org 2004, Complexity classes P and NP [Online]. Available: http://
en.wikipedia.org/wiki/Complexity classes P and NP [Accessed 3 November
2004]
Wolfram, S. 2002, A New Kind of Science, 1st edn, Wolfram Media, USA
Image References
Figure 2.1
http://www.mathe.tufreiberg.de/
∼
dempe/schuelerpr neu/babbage.htm
http://www.inzine.sk/article.asp?art=8491
Figure 2.2
http://www.cs.us.es/cursos/tco/
http://wwwgroups.dcs.stand.ac.uk/
∼
history/Mathematicians
/Turing.html
Figure 2.3
http://wwwgroups.dcs.stand.ac.uk/
∼
history/Mathematicians
/Von Neumann.html
Figure 2.4
aima.cs.berkeley.edu/cover.html
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
234 BIBLIOGRAPHY
Figure 2.5
http://www.phy.bg.ac.yu/web projects/giants/hilbert.html
http://wwwgroups.dcs.stand.ac.uk/
∼
history/Mathematicians/Godel.html
Figure 2.9
http://pr.caltech.edu/events/caltech nobel/
Figure 2.12
http://www.elis.UGent.be/ELISgroups/solar/projects/computer.html
Figure 3.9
http://wwwgap.dcs.stand.ac.uk/
∼
history/PictDisplay/Fourier.html
Figure 4.1
http://wwwgap.dcs.stand.ac.uk/
∼
history/Mathematicians/Maxwell.html
http://wwwgap.dcs.stand.ac.uk/
∼
history/Mathematicians/Newton.html
Figure 4.2
http://wwwgap.dcs.stand.ac.uk/
∼
history/Mathematicians
/Copernicus.html
http://wwwgap.dcs.stand.ac.uk/
∼
history/PictDisplay/Galileo.html
Figure 4.3
http://www.svarog.org/filozofija/graph/democritus.jpg
http://www.slcc.edu/schools/hum sci/physics/whatis/biography
/dalton.html
Figure 4.4
http://wwwgap.dcs.stand.ac.uk/
∼
history/PictDisplay/Helmholtz.html
http://www.eatonline.net/english/education/biographies/clausius\.htm
Figure 4.6
http://wwwgap.dcs.stand.ac.uk/
∼
history/Mathematicians
/Boltzmann.html
http://wwwgap.dcs.stand.ac.uk/
∼
history/Mathematicians/bohr.html
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
BIBLIOGRAPHY 235
Figure 4.7
http://wwwgap.dcs.stand.ac.uk/
∼
history/PictDisplay/Einstein.html
http://wwwgap.dcs.stand.ac.uk/
∼
history/PictDisplay/Balmer.html
Figure 4.8
http://wwwgap.dcs.stand.ac.uk/
∼
history/Mathematicians/Planck.html
http://www.trinityprep.org/MAZZAR/thinkquest/History/Thomson.htm
Figure 4.9
http://www.chemheritage.org/EducationalServices/chemach/ans/er.html
http://wwwgap.dcs.stand.ac.uk/
∼
history/Mathematicians
/Sommerfeld.html
Figure 4.13
http://wwwgap.dcs.stand.ac.uk/
∼
history/PictDisplay/Pauli.html
http://wwwgap.dcs.stand.ac.uk/
∼
history/Mathematicians/Broglie.html
Figure 4.14
http://wwwgroups.dcs.stand.ac.uk/
∼
history/Mathematicians
/Schrodinger.html
http://wwwgap.dcs.stand.ac.uk/
∼
history/PictDisplay/Born.html
Figure 4.15
http://wwwgap.dcs.stand.ac.uk/
∼
history/Mathematicians/Born.html
http://wwwgap.dcs.stand.ac.uk/
∼
history/PictDisplay/Dirac.html
Figure 6.1
http://wwwhistory.mcs.standrews.ac.uk/history/PictDisplay
/Shannon.html
http://wwwgap.dcs.stand.ac.uk/
∼
history/PictDisplay/Boole.html
Figure 8.1
http://www.qubit.org/oldsite/intros/nano/nano.html
Figure 8.2
http://www.idquantique.com/
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
Index
Absorbtion spectrum, 97
Adjoint, 68
Alhazen, 90
Analytical engine, 4
Ancilla bits, 28, 142
AND gate, 15
Angles in other quadrants, 36
AntiCommutator, 77
Aristotle, 91
Asymptotically equivalent, 21
Atoms, 91
Automaton, 9
Babbage, Charles, 4
Balmer, Johann Jakob, 98
Basis, 56
BB84, 193
Bell state circuit, 144
Bell states, 128, 180
Bennet, C.H., 189
Bennett, Charles, 28
Big Ω notation, 21
Big Θ notation, 21
Big O notation, 21
Binary entropy, 164
Binary numbers, 6
Binary representation, 8
Binary symmetric channels, 173
Bit swap Circuit, 143
Bits, 8
Black body, 95
Black body radiation, 95
Bloch sphere, 120
Bohr, Niels, 95
Boltzmann’s constant, 94
Boltzmann, Ludwig, 94
Boole, George, 158
Boolean algebra, 158
Born, Max, 104
Bra, 55
Braket notation, 60
Brassard, G., 189
Bright line spectra, 97
Bubble sort, 19
Caesar cipher, 188
CauchySchwartz inequality, 60
Cause and effect, 90
Cavity, 95
Channel capacity, 159
Characteristic equation, 70
Characteristic polynomial, 70
Christmas pudding model, 100
Church, Alonzo, 6
ChurchTuring thesis, 6
Classical circuits, 14
Classical complexity classes, 225
Classical Cryptography, 188
Classical error correction, 173
Classical gates, 14
Classical information sources, 160
Classical physics, 90
Classical redundancy and compression, 162
Classical registers, 15
Classical wires, 15
Clausius, Rudolf , 93
CNOT gate, 29, 138
Code wheel, 188
Codewords, 173
Column notation, 53
Commutative law of multiplication, 104
Commutator, 77
237
238 INDEX
Completely mixed state, 170
Completeness relation, 68
Complex conjugate, 40
Complex number, 39
Complex plane, 41
Complex vector space, 53
Complexity classes, 225
Computational basis, 56
Computational Resources and Efﬁciency, 19
Constant coefﬁcients, 34
Continued fractions algorithm, 209
Continuous spectrum, 97
Control lines, 28
Control of unitary evolution, 220
Controlled U gate, 142
Conventions for quantum pseudo code, 223
Converting between degrees and radians, 36
Copenhagen interpretation, 105
Copernicus, Nicolaus, 90
Copying circuit, 143
CROSSOVER, 18
Cryptology, 187
CSS codes, 180
de Broglie, Louis, 103
Decision problem, 23
Decoherence, 166, 175
Degenerate, 70
Degrees, 36
Democritus, 91
Density matrix, 166
Determinant, 49
Determinism, 90
Deterministic Turing machines, 23
Deutsch  Church  Turing principle, 25
Deutsch’s algorithm, 196
Deutsch, David, 25
DeutschJosza algorithm, 200
Diagonal polarisation, 116
Diagonalisable matrix, 76
Dirac, Paul, 105
Discrete fourier transform, 81
Dot product, 52, 59
Dual vector, 55
Eigenspace, 70
Eigenvalue, 70
Eigenvector, 70
Einstein, Albert, 97
Electromagnetism, 90
Electron, 98
Emission spectrum, 97
Ensemble point of view, 167
Entangled states, 127
Entanglement, 111
Entropy, 93
EPR, 111
EPR pair, 128, 180
Error syndrome, 177
Excited state, 101
Expectation value, 57
Exponential form, 44
FANIN, 18
FANOUT, 18
Fast factorisation, 207
Fast Factorisation algorithm, 210
Fast Factorisation circuit, 210
Feynman, Richard, 25
Finite state automata, 10
First law of thermodynamics, 92
Fluctuation, 95
Flying qubits, 220
For all, 34
Formal languages, 9
Four postulates of quantum mechanics, 149,
171
Fourier series, 82
Fourier transform, 81
Fourier, Jean Baptiste Joseph, 81
Fredkin gate, 30, 141
Frequency domain, 81
Full rank, 49
Fundamental point of view, 171
G¨ odel’s incompleteness theorem, 6
G¨ odel, Kurt, 6
Galilei, Galileo, 90
Garbage bits, 29, 142
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
INDEX 239
Global phase, 118
Global properties of functions, 196
Gram Schmidt method, 64
Ground state, 100
Grover workspace, 215
Grover’s algorithm, 214
Grover, Lov, 113
Hadamard gate, 134
Haltig problem, 11
Heisenberg uncertainty principle, 105
Heisenberg, Werner, 104
Helmholtz, Von, 93
Hermitian operator, 73, 76
Hilbert space, 50, 60
Hilbert, David, 6
id Quantique, 223
Identity matrix, 48
If and only if, 35
Imaginary, 39
Imaginary axis, 41
Independent and identically distributed, 160
Initial point, 50
Inner product, 52, 58
Interference, 107
Intractable, 22, 195
Inverse matrix, 48
Inverse quantum fourier transform, 203
Invertible, 26
Jacquard, Joseph Marie, 4
Joule, 94
Kelvin, 94
Ket, 53, 119
Keyes, R.W., 28
King, Ada Augusta, 4
Kronecker product, 80
Landauer’s principle, 27
Landauer, Rolf, 27
Least signiﬁcant digit, 8
Length of codes, 162
Linear combination, 55
Linear operator, 64
Linearly independent, 56
Local state, 111
Logarithms, 38
Logical symbols, 34
MagiQ, 223
Marked solution, 215
Markov process, 150
Matrices, 46
Matrix addition, 46
Matrix arithmetic, 46
Matrix entries, 46
Matrix multiplication, 47
Maxwell’s demon, 27
Maxwell, James Clerk, 90
Measurement of ﬁnal states, 221
Message Destination, 159
Message Receiver, 159
Message Source, 158
Message Transmitter, 158
Mixed states, 165
Modulus, 40
Moore’s law, 5
Moore, Gordon, 5
Multi qubit gates, 138
Mutual key generation, 193
NAND gate, 16
Neumann, Jon Von, 4
New quantum theory, 95
Newton, Issac, 90
Newtonian mechanics, 90
No programming theorem, 149
Noisy channels, 173
Non destructive measurement, 221
Non deterministic Turing machines, 23
Nondeterministic polynomial time, 23
NOR gate, 16
Norm, 40
Normal operator, 73
Normalise, 62
NOT gate, 15
NOT
2
gate, 140
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
240 INDEX
NP, 23
Nuclear Magnetic Resonance, 222
Nuclear spins, 110
Observable, 127
Old quantum theory, 95
Onetime PAD, 189
Optical photon computer, 221
OR gate, 15
Oracle, 196
Order, 208
Order ﬁnding, 208
Orthogonal, 60
Orthonormal basis, 62
Outer product, 65
Outer product notation, 135
P, 23
Partial Measurement, 123
Partial measurement, 123
Pauli exclusion principle, 102
Pauli gates, 131, 136
Pauli operators, 74
Pauli, Wolfgang, 102
Period, 208
Phase estimation, 208
Phase gate, 133
Photoelectric effect, 96
π
8
gate, 133
Planck’s constant, 96
Polar coordinates, 41
Polar decomposition, 78
Polar form, 40
Polarisation of photons, 110
Polynomial time, 22
Polynomially equivalent, 25
Polynomials, 34
Positive operator, 73, 76
POVMs, 154
Principle of invariance, 19
Probabilistic complexity classes, 226
Probabilistic Turing machine, 24
Probability amplitudes, 58
Probability distribution, 160
Programmable quantum computer, 148
Projective measurements, 127
Projectors, 66, 127, 151
Public key encryption, 188
Pure states, 165
Pythagorean theorem, 35
QCL, 222
qGCL, 222
Quantised, 89
Quantum bits, 114
Quantum C, 223
Quantum circuits, 129
Quantum complexity classes, 227
Quantum computer languages, 222
Quantum cryptography, 189
Quantum dot, 220
Quantum fourier transform, 202
Quantum fourier transform circuits, 207
Quantum information sources, 165
Quantum key distribution, 191
Quantum logic gates, 130
Quantum mechanics, 89
Quantum money, 189
Quantum noise, 174
Quantum numbers, 100
Quantum packet snifﬁng, 190
Quantum repetition code, 175
Quantum searching, 214
Quantum Turing machine, 25
Qubit implementation, 220
Qubit initial state preparation, 221
Qubits, 114
Quick sort, 20
Radians, 36
Rank, 49
Rationalising and dividing complex numbers,
43
RayleighJeans law, 103
Rectilinear polarisation, 116
Reduced density matrix, 170
Relative phase, 117
Repetition, 173
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
INDEX 241
Repetition codes, 174
Reversible circuits, 32
Reversible computation, 28
Reversible gates, 28
Reversibly, 26
Right angled triangles, 35
Rotation operators, 137
RSA, 188, 195, 207
Rutherford, Ernest, 100
Rydberg constant, 98
Scalar, 46
Scalar multiplication by a matrix, 46
Schr¨ odinger’s cat, 104
Schr¨ odinger, Erwin, 104
Schumacher compression, 172
Schumacher’s quantum noiseless coding the
orem, 166
Second law of thermodynamics, 93
Shannon Entropy, 163
Shannon’s communication model, 158
Shannon’s noiseless coding theorem, 163
Shannon, Claude E., 157
Shor code, 179
Shor’s algorithm, 202
Shor, Peter, 113
Shortest route ﬁnding, 214
Simultaneous diagonalisation theorem, 78
Single qubit gates, 130
Single value decomposition, 78
Singular, 49
Sommerfeld, Arnold, 101
Source of Noise, 158
Spanning set, 56
Spectral decomposition, 79
Spin, 102
Square root of NOT gate, 134
Stabiliser codes, 180
State vector, 58, 116
Statistical correlation, 111
Statistical mechanics, 94
Steane code, 180
Strong ChurchTuring thesis, 24
subsystem point of view, 170
Superdense coding, 145
Superposition, 107
Teleportation circuit, 146
Tensor product, 79, 123
Terminal point, 50
There exists, 34
Thermodynamics, 92
Thomson, Joseph J., 98
Time domain, 81
Toffoli gate, 29, 141
Trace, 71
Transpose matrix, 49
Trap door function, 189
Travelling salesman problem, 214
Trigonometric inverses, 36
Trigonometry, 35
Trigonometry identities, 38
Truth tables, 14
Turing Machine, 6
Turing, Alan, 4
Uncertainty, 110
Unit vector, 61
Unitary operator, 73
Universal computer, 4
Universal Turning Machine, 11
Vector addition, 54
Vector scalar multiplication and addition, 54
Vectors, 50
Visualising grover’s algorithm, 217
Von Neumann architecture, 4
Von Neumann entropy, 166, 171
Wien’s law, 103
Wiesner, Stephen, 189
Wire, 130
Witnesses, 23
XOR gate, 16
Zero matrix, 48
Zero memory information sources, 161
Zero vector, 54
The Temple of Quantum Computing  c ⃝Riley T. Perry 2004  2010
Contents
Acknowledgements 1 Introduction 1.1 1.2 What is Quantum Computing? . . . . . . . . . . . . . . . . . . . . Why Another Quantum Computing Tutorial? . . . . . . . . . . . . 1.2.1 The Bible of Quantum Computing . . . . . . . . . . . . . . vii 1 1 2 2 3 3 3 6 6
2 Computer Science 2.1 2.2 2.3 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . History . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Turing Machines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.3.1 2.3.2 2.3.3 2.3.4 2.4 2.4.1 2.4.2 2.4.3 2.4.4 2.5 2.5.1 2.5.2 2.5.3 2.5.4 2.6 2.6.1 2.6.2 Binary Numbers and Formal Languages . . . . . . . . . .
Turing Machines in Action . . . . . . . . . . . . . . . . . . 10 The Universal Turing Machine . . . . . . . . . . . . . . . . 11 The Halting Problem . . . . . . . . . . . . . . . . . . . . . . 11 Common Gates . . . . . . . . . . . . . . . . . . . . . . . . . 15 Combinations of Gates . . . . . . . . . . . . . . . . . . . . . 17 Relevant Properties . . . . . . . . . . . . . . . . . . . . . . . 18 Universality . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 Quantifying Computational Resources . . . . . . . . . . . 20 Standard Complexity Classes . . . . . . . . . . . . . . . . . 22 The Strong ChurchTuring Thesis . . . . . . . . . . . . . . . 24 Quantum Turing Machines . . . . . . . . . . . . . . . . . . 26 Reversibility . . . . . . . . . . . . . . . . . . . . . . . . . . . 26 Irreversibility . . . . . . . . . . . . . . . . . . . . . . . . . . 26 i
Circuits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
Computational Resources and Efﬁciency . . . . . . . . . . . . . . . 19
Energy and Computation . . . . . . . . . . . . . . . . . . . . . . . 26
ii 2.6.3 2.6.4 2.6.5 2.6.6 2.6.7
CONTENTS Landauer’s Principle . . . . . . . . . . . . . . . . . . . . . . 27 Maxwell’s Demon . . . . . . . . . . . . . . . . . . . . . . . 27 Reversible Computation . . . . . . . . . . . . . . . . . . . . 28 Reversible Gates . . . . . . . . . . . . . . . . . . . . . . . . 29 Reversible Circuits . . . . . . . . . . . . . . . . . . . . . . . 32 33
3 Mathematics for Quantum Computing 3.1 3.2 3.3 3.4
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33 Polynomials . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34 Logical Symbols . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34 Trigonometry Review . . . . . . . . . . . . . . . . . . . . . . . . . . 35 3.4.1 3.4.2 3.4.3 3.4.4 3.4.5 Right Angled Triangles . . . . . . . . . . . . . . . . . . . . 35 Converting Between Degrees and Radians . . . . . . . . . 36 Inverses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36 Angles in Other Quadrants . . . . . . . . . . . . . . . . . . 36 Visualisations and Identities . . . . . . . . . . . . . . . . . . 37
3.5 3.6
Logs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38 Complex Numbers . . . . . . . . . . . . . . . . . . . . . . . . . . . 39 3.6.1 3.6.2 3.6.3 Polar Coordinates and Complex Conjugates . . . . . . . . 40 Rationalising and Dividing . . . . . . . . . . . . . . . . . . 43 Exponential Form . . . . . . . . . . . . . . . . . . . . . . . . 44 Matrix Operations . . . . . . . . . . . . . . . . . . . . . . . 46 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . 50 Column Notation . . . . . . . . . . . . . . . . . . . . . . . . 53 The Zero Vector . . . . . . . . . . . . . . . . . . . . . . . . . 54 Properties of Vectors in Cn . . . . . . . . . . . . . . . . . . . 54 The Dual Vector . . . . . . . . . . . . . . . . . . . . . . . . . 55 Linear Combinations . . . . . . . . . . . . . . . . . . . . . . 55 Linear Independence . . . . . . . . . . . . . . . . . . . . . . 56 Spanning Set . . . . . . . . . . . . . . . . . . . . . . . . . . 56 Basis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
3.7 3.8
Matrices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46 3.7.1 3.8.1 3.8.2 3.8.3 3.8.4 3.8.5 3.8.6 3.8.7 3.8.8 3.8.9 Vectors and Vector Spaces . . . . . . . . . . . . . . . . . . . . . . . 50
3.8.10 Probability Theory . . . . . . . . . . . . . . . . . . . . . . . 57 3.8.11 Probability Amplitudes . . . . . . . . . . . . . . . . . . . . 58 3.8.12 The Inner Product . . . . . . . . . . . . . . . . . . . . . . . 58 c The Temple of Quantum Computing  ⃝Riley T. Perry 2004  2010
CONTENTS
iii
3.8.13 Orthogonality . . . . . . . . . . . . . . . . . . . . . . . . . . 60 3.8.14 The Unit Vector . . . . . . . . . . . . . . . . . . . . . . . . . 61 3.8.15 Bases for Cn . . . . . . . . . . . . . . . . . . . . . . . . . . . 62 3.8.16 The Gram Schmidt Method . . . . . . . . . . . . . . . . . . 64 3.8.17 Linear Operators . . . . . . . . . . . . . . . . . . . . . . . . 64 3.8.18 Outer Products and Projectors . . . . . . . . . . . . . . . . 65 3.8.19 The Adjoint . . . . . . . . . . . . . . . . . . . . . . . . . . . 68 3.8.20 Eigenvalues and Eigenvectors . . . . . . . . . . . . . . . . 70 3.8.21 Trace . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71 3.8.22 Normal Operators . . . . . . . . . . . . . . . . . . . . . . . 73 3.8.23 Unitary Operators . . . . . . . . . . . . . . . . . . . . . . . 73 3.8.24 Hermitian and Positive Operators . . . . . . . . . . . . . . 76 3.8.25 Diagonalisable Matrix . . . . . . . . . . . . . . . . . . . . . 76 3.8.26 The Commutator and AntiCommutator . . . . . . . . . . 77 3.8.27 Polar Decomposition . . . . . . . . . . . . . . . . . . . . . . 78 3.8.28 Spectral Decomposition . . . . . . . . . . . . . . . . . . . . 79 3.8.29 Tensor Products . . . . . . . . . . . . . . . . . . . . . . . . . 79 3.9 Fourier Transforms . . . . . . . . . . . . . . . . . . . . . . . . . . . 81 3.9.1 3.9.2 The Fourier Series . . . . . . . . . . . . . . . . . . . . . . . 82 The Discrete Fourier Transform . . . . . . . . . . . . . . . . 85 89
4 Quantum Mechanics 4.1 4.1.1 4.1.2 4.1.3 4.1.4 4.1.5 4.1.6 4.1.7 4.1.8 4.2 4.2.1 4.2.2 4.2.3 4.2.4
History . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90 Classical Physics . . . . . . . . . . . . . . . . . . . . . . . . 90 Important Concepts . . . . . . . . . . . . . . . . . . . . . . 91 Statistical Mechanics . . . . . . . . . . . . . . . . . . . . . . 94 Important Experiments . . . . . . . . . . . . . . . . . . . . 95 The Photoelectric Effect . . . . . . . . . . . . . . . . . . . . 96 Bright Line Spectra . . . . . . . . . . . . . . . . . . . . . . . 97 Proto Quantum Mechanics . . . . . . . . . . . . . . . . . . 98 The New Theory of Quantum Mechanics . . . . . . . . . . 102 Linear Algebra . . . . . . . . . . . . . . . . . . . . . . . . . 107 Superposition . . . . . . . . . . . . . . . . . . . . . . . . . . 107 Dirac Notation . . . . . . . . . . . . . . . . . . . . . . . . . 108 Representing Information . . . . . . . . . . . . . . . . . . . 110
Important Principles for Quantum Computing . . . . . . . . . . . 105
c The Temple of Quantum Computing  ⃝Riley T. Perry 2004  2010
. . . . . . . . .3. . . .4. . . . . . . . . . . 162 6. . . . . . . . . . . . . . . .2. . . . . . . 110 Entanglement . . . . . . . . . .4 5. . . . . . . . . . . . . . . . . .1 6. . .4. . . . 166 Quantum Noise . . . .3 6. . . . .3 5. . . . . . . . . . .1 . . . . . . . . . . . . . . . . . . . . . . . 159 Independent Information Sources . . . . . . . . .2. . . . . . . . . . . . . . . . . . . . . 148 Postulate One . . . .2. . . . . . . . . . . .1 6.6. . . . 129 Common Circuits . . . . . . . 150 Postulate Three . . . . . . . . .4 Channel Capacity . . . . . . . . . . . . . . . 111 113 5 Quantum Computing 5. . . .2 5.5. . . . .1 5. . .5 Introduction . . . . . . . . . . . . . . . . . .1 5. . . .5. . . . . . . . . . .1. . . . . .7. . . . 163 Quantum Information Sources .2 6. . . . . . . . . . . . . .4 6. . . . . . . . 113 Bits and Qubits .1. . . . . .4 Elements of Quantum Computing . . . .⃝Riley T. . . . . . 142 Building a Programmable Quantum Computer . . . .5 4. . . . . . . . . .5. . . . . . . . . . . . . . . 148 The Four Postulates of Quantum Mechanics . . . . . . . . . . 151 Postulate Four . . . . . . 181 c The Temple of Quantum Computing . . .2 5. . . . . . . . . . . . . . . . . . 113 History . . . . . 174 Quantum Error Correction . . . . . . . . . . . . .1. . . 114 Entangled States . . . . . . . . . . . . . . . . . . . . . . . . . .4. . . . . . . .iv 4. . . . . . .1 6. . . 173 6. . . . .3. . .6 CONTENTS Uncertainty . . . . .1 5. . . . . . . 149 Postulate Two . . . . . .1. 165 Pure and Mixed States . . . . . . . . . . . . . 158 6. . . . . . . . . . . .1 6. . . . . . . . . . . .1 5. . . . . . .1. . . . . . . . . . . . . . . . .4 5.6 Noise and Error Correction . . . . . . . . . . . . . . . . . . . . . . . 175 Same Measurement Direction . . . 165 Schumacher’s Quantum Noiseless Coding Theorem . . . . . . . . .3 6. . . .3 5. . . . . . . . 142 The Reality of Building Circuits . . . . 157 History . . . . . . . . .4. . . . . . . Perry 2004 . 127 Quantum Circuits . . . 113 Introduction . . 160 Classical Redundancy and Compression . . . . . . . .7 Bell States . . . . .1 5. . . . . . . . . . . 160 Shannon’s Noiseless Coding Theorem . . . . . . . . . . 180 6. . . . . . . . . . . . . . . . . . . . . . .4. . . . . . . . .5 5. . . . 149 6 Information Theory 6. . . . . 154 157 Important Properties of Quantum Circuits . . . .5. . . . . . . . . . . . . . . . . 158 Shannon’s Communication Model . . . . . . . . . . . . . . .2010 Classical Information Sources .1 6. . . . . . . .6. . . . . . .2 6. . . .2 5. . . . . . . . . . . . . . . . . . . . .3 5. . . . . . . . . . . . . . . .2 6.
. . . . . . . . .1. . . . . .2 6. . . .2 7. . . . . . . . . . . . . .CONTENTS 6. . . . 197 Physical Implementations . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3 7. . . .3 6. . 189 Cryptology . . . .2 Quantum . . . .8 6. . . . . . . . .1 7.9 v Different Measurement Directions . . . . . . . . . 195 The Problem Deﬁned .3 8. . . 221 Quantum Computer Languages . . . . . . . . . 223 225 A Complexity Classes A. . . . . . . . . . .8. . . 219 Physical Realisation . . . . . . . . . . . . . . .1. . . . . . . . . . . . 182 Bell’s Inequality . . . .2. . . . . . . . . . . . . . . . . . . . . . . .2 8. . . . . . . . . . . . . . . . . . . . . .2 Introduction . . . 199 The Problem Deﬁned . . . .4 7. .3. . .4. .1 7. . . . . . . . . . . . . . . .1 6. . .1 7. . 207 Order Finding . . 183 Classical Cryptography . . . . . . . . . . . . . . . . . . . . . . . 188 Quantum Cryptography . . . . . . . . . . . . . 227 Bibliography c The Temple of Quantum Computing . . . . . . . . 200 The Quantum Solution . . .3 7. . 214 8 Using Quantum Mechanical Devices 8. . . . . . . .4. . . . . . . . . Perry 2004 . . . . . . . . . . . . . . . . . 225 A. . . . . . . . . . . . . . . 196 The Classical Solution . . . . . . .1 7. . . . . . . . . . 193 195 7 Quantum Algorithms 7. . . . . . . . . . . . . . . 201 The Quantum Fourier Transform . . 196 The Quantum Solution . . .2 6. . . . . .3 7. . . . . . . . . . . . . . . . . . . . . . . . 202 Fast Factorisation . . . . . . . . . . . . . 222 Encryption Devices . .2010 229 . 208 The Travelling Salesman Problem .3. . . . . . . . 202 Grover’s Algorithm . .1. . . . . . . . . . . . . 214 219 Deutsch’s Algorithm . . . . . . . . . . . . . . . . . . . . .1 8. . . . . . . . . . . . . . . . . . .8. . . . . . . . . . 200 Shor’s Algorithm . . . . . . . . .2. . . . . . .3. . . . . . . . . .2. . . . . .⃝Riley T. 219 8. . . . . . .2 7. . . . . . . . . . . . .1 Classical .4 Introduction . . . . . . .4 7. . . . . . . .1 7. . . . . .1 Implementation Technologies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 187 Alternative Models of Computation . . . . . . . . . . . . . . . . . .2 7. . . . . . . . . . . . . . . .1 7. . . . . . . . . . . . . . . 214 Quantum Searching . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .0. . . 196 The DeutschJosza Algorithm . . . . . . . . . . .2 7. . . . . .7. .7.1. . . . . . . . . . . . . .
⃝Riley T.2010 .vi Index CONTENTS 237 c The Temple of Quantum Computing . Perry 2004 .
.ucm. Carlos Gon¸ alves who has kindly offered to translate version 1.1 goes to Andreas Gunnarsson. Brian is directly responsible for some parts of this text.es/) for posting version 1. c All the members of the QC4Dummies Yahoo group (http://groups.fis. Without his help this work would never have been completed. who always provided detailed answers to my questions.yahoo.Acknowledgements I would like to thank the following people: Brian Lederer. Waranyoo has been a constant source of support. my supervisor. I’ve also had great fun discussing a variety of different eclectic topics with him via email. and a substantial amount of the other chapters. companionship.0 for review.0 in their blogs. He wrote the section on Bell states. Simply put. Xerxes had some valuable comments about a version 1.0 and found a number of errors.2 is dedicated to Dr Mohamed Barakat who has published his own translation of this book in Arabic! It is fantastic .org/) and QubitNews (http:// quantum. A special thanks to Xerxes R˚ nby. Andreas’ attention to detail is astonishing. Waranyoo Pulsawat. and inspiration. Version 1. some parts of the chapter on quantum mechanics. to whom this version 1. Sean Kaye and Micheal Nielson for mentioning version 1. Most of the credit for the corrections and improved content in version 1. The people at Slashdot (http://slashdot. this version would not have been possible without him. my dear girlfriend. it looks great. com/group/QC4dummies/) and administrators David Morris and David Rickman.1 into Portuguese. So a big thanks to Andreas.1 is dedicated.thanks Dr Barakat.
⃝Riley T. Karol Bartkiewicz. and Slashdotters AC.viii CONTENTS James Hari. Varun Vaidya. Rad Radish. Simon Johnson. Nick Oosterhof.2010 . Birdie 1013. Perry 2004 . James Hollis. Robin Kothari. and s/nemesis c The Temple of Quantum Computing .
on conventional computers. We’ll examine some basic quantum mechanics. and linear algebra). L. allow an exponential amount of parallelism. I. The ﬁeld is a relatively new one that promises secure data transfer. Quantum computers use a speciﬁc physical implementation to gain a computational advantage over conventional computers. Quantum computing combines quantum mechanics. 2000]. information theory. Turing machines.1 What is Quantum Computing? In quantum computers we exploit quantum effects to compute in ways that are faster or more efﬁcient than. Properties called superposition and entanglement may. in some cases. quantum algorithms. information theory. This text describes some of the introductory aspects of quantum computing. basic concepts from computer science (like complexity theory. M. A. physical realisations of those algorithms. and more. or even impossible. & Chuang. elementary quantum computing topics like qubits. 1 . Also.Chapter 1 Introduction 1. special purpose machines like quantum cryptographic devices use entanglement and other peculiarities like quantum uncertainty. and aspects of computer science [Nielsen. and may take component miniaturisation to its fundamental limit. dramatic computing speed increases.
org/people/nielsen/qicss. At certain places in this document. It contains a lot of the background in math. Nielsen and Isaac L. and computer science that you will need. physics. and books which may aid in understanding of some of the concepts in QCQI. sets of lecture notes.⃝Riley T. Nielsen’s lecture notes are currently available at http://www. The majority of the literature that is currently available is hard to understand for the average computer enthusiast. journal entries. which we’ll abbreviate to QCQI.2 Why Another Quantum Computing Tutorial? Most of the books or papers on quantum computing require (or assume) prior knowledge of certain areas like linear algebra or physics. papers. Perry 2004 . So the Temple of Quantum Computing is. 1. This text attempts to teach basic quantum computing from the ground up in an easily readable way. These topics are presented in the following format: Question The topic is presented in bolditalics. c The Temple of Quantum Computing .qinfo.1 The Bible of Quantum Computing Every Temple needs a Bible right? Well there is one book out there that is by far the most complete book available for quantum computing.2 Why Another Quantum Computing Tutorial? 1. a collection of worked examples from various web sites. or interested layman. also written by Nielsen. particularly for those without a strong background in math. The main references for this work are QCQI and a great set of lecture notes. html.2. Bulitko who has managed to condense a large part of QCQI into 14 pages! QCQI may be a little hard to get into at ﬁrst. Chuang. although it is assumed that you know a little about computer programming. topics that could make interesting research topics have been identiﬁed. Quantum Computation and Quantum Information by Michael A.2010 . An honourable mention goes out to Vadim V. in part.
Although information theory can be seen as a part of computer science it is treated separately in this text with its own dedicated chapter. 2. 300 BC) for ﬁnding the greatest common divisor of two numbers. new kinds of circuits. but it turns out that they are. In this chapter we’ll see how quantum effects can give us a new kind of Turing machine. There’s also a little mathematics and notation used in this chapter which is presented in the ﬁrst few sections of chapter 3 and some basic C and Javascript code for which you may need an external reference.1 Introduction The special properties of quantum computers force us to rethink some of the most fundamental aspects of computer science. This is because The quantum aspects of information theory require some of the concepts introduced in the chapters that follow this one.2 History The origins of computer science can at least be traced back to the invention of algorithms like Euclid’s Algorithm (c. There are also much older sources like early 3 . and new kinds of complexity classes. This is important as it was thought that these things were not affected by what the computer was built from. A distinction has been made between computer science and information theory.Chapter 2 Computer Science 2.
The ﬁrst electronic computers were developed in the 1940’s and led Jon Von Neumann.⃝Riley T.1) designed and partially built several programmable computing machines (see ﬁgure 2. memory. Babylonian cuneiform tablets (c.4 for the difference engine built in 1822) that had many of the features of modern computers. Ada Augusta King. c The Temple of Quantum Computing .2010 . ? 2000]. 1912 . Countess of Lovelace. Babbage’s friend. In the early to mid 19th century Charles Babbage. Sadly.1700 BC) that contain clear evidence of algorithmic processes [Gilleland M. So we might say that computer science began in the 19th century. which was invented by Joseph Marie Jacquard (1752 .1954 (ﬁgure 2. control unit. But up until the 19th century it’s difﬁcult to separate computer science from other sciences like mathematics and engineering.1957 (ﬁgure 2.1: Charles Babbage and Ada Byron.1852 (ﬁgure 2. Perry 2004 .3) to develop a generic architecture on which modern computers are loosely based. One of these machines called the analytical engine had removable programs on punch cards based on those used in the Jacquard loom. 1815 . and a computing process.1871 (ﬁgure 2. input/output (IO). J. Modern computer science can be said to have started in 1936 when logician Alan Turing. 1903 . 2000 .2) wrote a paper which contained the notion of a universal computer. Von Neumann architecture speciﬁes an Arithmetic Logic Unit (ALU). a bus. ? 2000].1834) in 1804 [Smithsonian NMAH 1999].1) and the daughter of Lord Byron is considered by some as the ﬁrst programmer for her writings on the Analytical engine. 1791 . The architecture originated in 1945 in the ﬁrst draft of a report on EDVAC [Cabrera.4 History Figure 2. Babbage’s work was largely forgotten until the 1930s and the advent of modern computer science. B.
and components are getting smaller. possibly ending Moore’s law. being made up of a few atoms [Benjamin. S.⃝Riley T. A. This law still holds but is starting to falter. c The Temple of Quantum Computing .2010 . Soon they will be so small.History 5 Figure 2.2: Alan Turing and Alonzo Church. but by fully utilising those effects we can achieve much more. Figure 2.org 2006]. integrated circuits in 1959. Computers increased in power and versatility rapidly over the next sixty years. There are ways in which we can use quantum effects to our advantage in a classical sense. Gordon Moore proposed Moore’s law in 1965. and increasingly intuitive user interfaces. Perry 2004 . & Ekert. the current version of which states that processor complexity will double every eighteen months with respect to cost (in reality it’s more like two years) [wikipedia. ? 2000] that quantum effects will become unavoidable. partly due to the development of the transistor in 1947.3: Jon Von Neumann.
W. A. [Jones. then. His intuition suggested ”yes”. in 1930 he went as far as claiming that there were no unsolvable problems in mathematics [Natural Theology 2004].6 This approach is the basis for quantum computing.2010 .2) independently came up with models of computation. 1995. Turing’s model. 1903 .1 Binary Numbers and Formal Languages Before deﬁning a Turing machine we need to say something about binary numbers.3.1943 (ﬁgure 2.5) asked if there was a universal algorithmic process to decide whether any mathematical proposition was true. 1862 . since this is usually (although not conﬁned to) the format in which data is presented to a Turing machine (see the tape is ﬁgure 2.5) in 1931 by way of his incompleteness theorem which can be roughly summed up as follows: You might be able to prove every conceivable statement about numbers within a system by going outside the system in order to come up with new rules and axioms. 1908 . in 1936 Alan Turing and Alonzo Church.3 Turing Machines In 1928 David Hilbert. 2. These were problems for which there were no algorithmic solutions (an algorithm is a procedure for solving a mathematical problem that is guaranteed to end after a number of steps). was given the names of both these pioneers. ¨ This was promptly refuted by Kurt Godel. as Turing’s model was subsequently called.1995 (ﬁgure 2.1976 (ﬁgure 2. aimed at resolving whether or not mathematics contained problems that were ”uncomputable”. c The Temple of Quantum Computing . the ChurchTuring thesis [Nielsen. but by doing so you’ll only create a larger system with its own unprovable statements.6). now called a called a Turing Machine (TM) is depicted in ﬁgure 2. Wilson. M. Perry 2004 .6. Turing Machines 2. J. 2002]. ?] Then. The thesis that any algorithm capable of being devised can be run on a Turing machine. p.⃝Riley T. It turned out that the models of Turing and Church were equivalent in power.
Perry 2004 .⃝Riley T.2010 . c The Temple of Quantum Computing .Turing Machines 7 Figure 2.4: Babbage’s difference engine.
. Any information can be converted to and from zeros and ones and we call this representation a binary representation. Binary Representation Computers represent numbers in binary form. The decimal 212 when converted to binary becomes 11010100. Perry 2004 .g. as a series of zeros and ones.5: David Hilbert and Kurt Godel.2010 . Example Here are some binary numbers and their decimal equivalents: The binary number. We can convert the binary string to a decimal number D using the following c The Temple of Quantum Computing .⃝Riley T. b2 b1 b0 where n is the number of binary digits (or bits. 1110 in decimal is 14. decimal). . because this is easy to implement in hardware (compared with other forms. with each digit being a 0 or a 1) and b0 is the least signiﬁcant digit.8 Turing Machines ¨ Figure 2. e. The binary numbers (on the left hand side) that represent the decimals 04 are as follows: 0=0 1=1 10 = 2 11 = 3 100 = 4 A binary number has the form bn−1 .
.g.Turing Machines formula: D = 2n−1 (bn−1 ) + . This allows both data and instructions to be stored in computer memory and it allows all of the fundamental logical operations of the machine to be represented as binary operations. .⃝Riley T. Example If = It turns out that the ”power” of a computational model (or automaton) i.} is a langauge over . 10. 001. even machine instructions are in binary format. 1. In simple languages the strings all follow an obvious pattern.. Perry 2004 . we have 0. 2. The language is a subset of the set ∗ of all ﬁnite strings of symbols ∑ from . 3.} c The Temple of Quantum Computing . . . . . 9. 0001. Here is another example: Example Converting the binary number 11010100 to decimal: 9 (2. {0. 1} then the set of all even binary numbers ∑ {0.e. .2010 ∑ . .1) D = 27 (1) + 26 (1) + 25 (0) + 24 (1) + 23 (0) + 22 (1) + 21 (0) + 20 (0) = 128 + 64 + 16 + 4 = 212 We call the binary numbers a base 2 number system because it is based on just two symbols 0 and 1. All data in modern computers is stored in binary format. can be determined by considering a related question: What type of ”language” can the automaton recognise? A formal language in this setting is just a set of binary strings. 110. in decimal which is base 10. the class of algorithm that the model can implement. Formal Languages Turing machines and other computer science models of computation use formal languages to represent their inputs and outputs. We say a language L has an al∑ ∑ phabet . 100. e. . with the language: {01. . . By contrast. + 22 (b2 ) + 21 (b1 ) + 20 (b0 ).
reads.10 Turing Machines Inﬁnite tape 1 0 0 0 1 1 1 0 R/W head Controller State Figure 2. 4.2 Turing Machines in Action A Turing machine (which we’ll sometimes abbreviate to TM) has the following components [Copeland. The controller’s behaviour .made up of cells containing 0.2010 .⃝Riley T. move the tape left or right one square 5. read the current symbol 2.controls the elements of the machine to do the following: 1. If an automaton. Note that this gives us a ∑ alphabet of = {0. c The Temple of Quantum Computing . change state 6. A tape . A read/write head . 3.6: A Turing machine. or overwrites the current symbol on each step and moves one square to the left or right. Then the power of the automaton is gauged by the complexity of the patterns for the languages it can recognise..the way the TM switches states depending on the symbol it’s reading. write a symbol by overwriting what’s already there 4. .3. J. 2.. 2000]: 1. Perry 2004 . 1. 2. A controller . or blank. represented by a ﬁnite state automata (FSA). 1. blank}. the pattern is that we have one or more zeroes followed by a 1. when presented with any string from the language can read each symbol and then halt after the last symbol we say it recognises the language (providing it doesn’t do this for strings not in the language). halt.
Godel. but it was only Turing who found a way of reducing all algorithms to a single one.HALT N/A New Value Direction 1 0 blank N/A Move Right Move Right Move Right N/A 2 . The FSA is represented below in table form (where the states are labelled 1 and 2: 1 for the running state. Church.3 The Universal Turing Machine A Universal Turning Machine (UTM) is a TM (with an in built mechanism described by a FSA) that is capable of reading. but powerful model of computation (essentially the stored program computer) Turing then looked at its limitations by devising a problem that it could not c The Temple of Quantum Computing . State 1 1 1 Value New State 0 1 blank 1 1 2 . a program describing the behaviour of another TM.2010 . The great thing about the UTM is that it shows that all algorithms (Turing ma¨ chines) can be reduced to a single algorithm.⃝Riley T.HALT N/A 2. This reduction in algorithms is a bit like what we have in information theory where all messages can be reduced to zeroes and ones.3. When the UTM halts its tape contains the result that would have been produced by the ordinary TM (the one that describes the workings of the UTM).3. Perry 2004 . The UTM simulates the ordinary TM performing the behaviour generated when the ordinary TM acts upon its data. from a tape. As stated above. and a number of other great thinkers did ﬁnd alternative ways to represent algorithms.Turing Machines The operation of a TM is best described by a simple example: Example Inversion inverts each input bit. and 2 for the halt state).4 The Halting Problem This is a famous problem in computer science. for example: 001 → 110 11 The behaviour of the machine can be represented by a two state FSA. 2. Having discovered the simple.
Is such a machine possible (so asked Turing)? The answer he found was ”no” (look below). When given a number. asked Turing. will actually halt (in a ﬁnite number of steps rather than looping forever or crashing). Then H works on this information and produces a result. can be assigned a truth value. Just as a ”universal truth machine” fails in assigning this funny sentence a truth value (try it). This proof by contradiction only applies to Turing machines. so to does H fail to assign a halting number 1 or 0 to the variant (the design of the latter involving the same ingredients.12 solve. rather than running a given algorithm. and machines that are computationally equivalent.⃝Riley T. as the algorithm description (program) and data that H should work on.2010 . a variant of H itself!! The clue to this ingenious way of thinking came from the liar’s paradox . if we have another UTM that. Perry 2004 . Turing Machines The UTM can run any algorithm.the question of whether or not the sentence: This sentence is false. The next section contains a detailed explanation of the halting problem by means of an example. H can receive a description of the algorithm in question (its program) and the algorithm’s data. Turing called this hypothetical new Turing machine H (for halting machine).that made the sentence problematic). The very concept of H involves a contradiction! He demonstrated this by taking. This can be skipped if you’ve had enough of Turing machines for now. c The Temple of Quantum Computing . What. looks to see whether that algorithm acting on it’s data. Like a UTM. selfreference and negation . It still remains unproven that the halting problem cannot be solved in all computational models. say 1 or 0 it decides whether or not the given algorithm would then halt.
given a new program: function Contradiction(program) { if (Halt(program) == true) { while (1 == 1) {. function Halt(program) { if ( .. J..here is the proof.}}") So it would be possible given these special cases.⃝Riley T. but is it possible for all algorithms to be covered in the . section? No .2010 .Turing Machines The Halting Problem .Code to check if program can halt. one that halts and one that does not: function Halter(input) { alert(’finished’).Code to check if program can halt. } else { return false.. Perry 2004 .}") \\ returns \\ returns true false Halt("function Looper(1)while (1==1) {...} } In our example Halt() would return the following: Halt("function Halter(1){alert(’finished’). 13 The proof is by contradiction.. } } Given two programs. say we could have a program that could determine whether or not another program will halt.Proof by Contradiction The halting problem in Javascript [Marshall.} } else { c The Temple of Quantum Computing . } function Looper(input) { while (1==1) {. 2001].. ) { return true..
circuits. what a modern or conventional computer gives in efﬁciency it loses in transparency (compared with a TM). Gates . We won’t go fully into the architecture of a conventional computer.g. e. 2. } } If Contradiction() is given an arbitrary program as an input then: Circuits • If Halt() returns true then Contradiction() goes into an inﬁnite loop. • Contradiction() halts if Contradiction() goes into an inﬁnite loop (given itself as input).4 Circuits Although modern computers are no more powerful than TM’s (in terms of the languages they can recognise) they are a lot more efﬁcient (for more on efﬁciency see section 2. It is for this reason that a TM is still of value in theoretical discussions.2010 . For this reason we’ll examine conventional (classical) circuits. • If Halt() returns false then Contradiction() halts.which perform logical operations on inputs.5). These operations can be represented by truth tables which specify all of the different combinations of the outputs with respect to the inputs. However some of the concepts needed for quantum computing are related. and gates. Classical circuits are made up of the following: 1. Perry 2004 . we can’t decide algorithmically what the behaviour of Contradiction() will be. Contradiction() here does not loop or halt.⃝Riley T. e. registers.g. If Contradiction() is given itself as input then: • Contradiction() loops inﬁnitely if Contradiction() halts (given itself as input).14 alert(’finished’). Given input(s) with values of 0 or 1 they produce an output of 0 or 1 (see below). in comparing the ”hardness” of various classes of problems. c The Temple of Quantum Computing . However.
⃝Riley T. These are listed below with their respective truth tables.2010 . a x NOT a 0 1 OR returns a 1 if either of the inputs is 1. Perry 2004 .e. The wires are the lines on either side of the gate and the gate reads from left to right (as with all gates and circuits). 3. Wires . The NOT inverts the input bit.made up of cells containing 0 or 1.carry signals between gates and registers.Circuits 2. a b x c The Temple of Quantum Computing . Registers .4. bits. x 1 0 a b OR a 0 1 0 1 b 0 0 1 1 x 0 1 1 1 x AND only returns a 1 if both of the inputs are 1. i. 15 2. The gate part of the diagram is the triangle and circle.1 Common Gates First off we’ll look at the commonly used gates.
Perry 2004 .16 AND a 0 1 0 1 b 0 0 1 1 x 0 0 0 1 Circuits NOR is an OR and a NOT gate combined. a b x NAND a 0 1 0 1 b 0 0 1 1 x 1 1 1 0 XOR returns a 1 if only one of its inputs is 1.2010 . a b x NOR a 0 1 0 1 b 0 0 1 1 x 1 0 0 0 NAND is an AND and a NOT gate combined. a b x c The Temple of Quantum Computing .⃝Riley T.
b).2010 . a circuit also has a truth table. c)).4. AND(NOT(b). which is as follows: f = OR(AND(a. a b f c The circuit shown above has the following truth table: a 0 0 0 0 1 1 1 1 b c f 0 1 0 0 0 1 1 1 0 0 0 1 1 0 1 1 0 0 0 1 1 0 1 1 This circuit has an expression associated with it. c The Temple of Quantum Computing . Perry 2004 .Circuits XOR a 0 1 0 1 b 0 0 1 1 x 0 1 1 0 17 2.⃝Riley T.2 Combinations of Gates Shown below.
e. this means that any circuit.4 Universality Combinations of NAND gates can be used to emulate any other gate (see ﬁgure 2. For this reason the NAND gate is considered a universal gate. no matter how complicated can be expressed as a combination of NAND gates.8). FANIN means that many outputs can be tied together with an OR.4. Perry 2004 . So. 2. The quantum analogue of this is called the CNOT gate.7: FANOUT.18 Circuits Figure 2. 2. FANIN . many inputs) can be tied to one output (ﬁgure 2.7).8: The universal NAND gate.4. and CROSSOVER (unlike quantum circuits) where FANOUT means that many wires (i.⃝Riley T. c The Temple of Quantum Computing .3 Relevant Properties These circuits are capable of FANOUT.2010 . Figure 2. and CROSSOVER means that the value of two bits are interchanged.
The following example uses the bubble sort and quick sort algorithms.1.i ++) for(j = n.i < = n .j > = i + 1.5 Computational Resources and Efﬁciency Computational time complexity is a measure of how fast and with how many resources a computational problem can be solved. We’ll also use the code for the bubble sort algorithm in an example on page 22. In terms of algorithms. we can compare algorithms that perform the same task and measure whether one is more efﬁcient than the other. this is called the principle of invariance.⃝Riley T. if the same algorithm is implemented on different architectures then the time complexities should not differ by more than a constant. Some code for bubble sort is given below. Bubble sort: for(i = 1. Conversely.1]) { Swap(list[j]. but the code for quick sort is not given explicitly.1]).list[j . } } } c The Temple of Quantum Computing . i.e.2010 .Computational Resources and Efﬁciency 19 2. algorithms used to sort a list of numbers. A simple example of differing time complexities is with sorting algorithms.j ) { if (list[j]<list[j . Perry 2004 .
Quick Sort: The quick sort has the following four steps: 1. i.e. Select a pivot point. 2. the number of elements in a list to be sorted. 4. E. 3. Bubble Sort: Each item in a list is compared with the item next to it. consider the following expression: 3n + 2 log n + 12. Suppose we can quantify the computational work involved as function of n.with numbers smaller than the pivot value in one list and numbers larger than the pivot value in the other list. Finish if there are no more elements to be sorted (i.g. The important part of this function is 3n as it grows more quickly than the other terms.1 Quantifying Computational Resources Let’s say we’ve gone through an algorithm systematically and worked out. O(n) time complexity (i. bubble sort.⃝Riley T. they are swapped if required. we ignore the 3). Perry 2004 . We say that the algorithm that generated this result has. 1 or less elements).2010 .5. This process is repeated until all of the numbers are checked without any swaps. 2.e. Repeat steps 1 to 3 for each list generated in step 3. On average the bubble sort is much slower than the quick sort. regardless of the architecture it is running on. The important parts of the function are shown here: c The Temple of Quantum Computing . The list is split into two lists . n grows faster than log n and the constant.20 Computational Resources and Efﬁciency Example Quick sort vs.e. line by line (see the end of this section for an example) how fast it is going to run given a particular variable n which describes the ”size” of the input.
A more formal deﬁnition of Big O notation is as follows: f (n) is O(g(n)) if there exist constants n0 and c that for all n > n0 . for example.⃝Riley T. formally: f (n) = Θ(g(n)) ⇐⇒ O(g(n)) = Ω(g(n)). f (n) is Ω(g(n)) if there exist constants n0 and c that for all n > n0 .e.2010 (2. c The Temple of Quantum Computing .4) . i. 3n ≤ 3n2 so 3n is bounded by the class O(3n2 ) (for all positive n). Finally. it gives us no notion of the average complexity of an algorithm. at worst this algorithm will take approximately n cycles to complete (plus a vanishingly small unimportant ﬁgure). Note that this is the worst case. big Θ is used to show that a function is asymptotically equivalent in both lower and upper bounds. cg(n) ≤ f (n).3) Example 2n is in Ω(n2 ) as n2 ≤ 2n (for all sufﬁciently large n). (2. More formally Big O notation allows us to set an upper bound on the behaviour of the algorithm. f (n) ≤ cg(n). and 12. 2 log n.Computational Resources and Efﬁciency 50 40 30 20 10 0 ¡ 21 3n + 2 log n + 12 3n 2 log n 12 0 10 20 30 40 50 So we’ve split the function 3n + 2 log n + 12 into its parts : 3n. So.2) For a lower bound we use big Ω notation (Big Omega). The class of O(n) contains all functions that are quicker than O(n). This is useful for examining a class of algorithms like those that factorise a number for example. Perry 2004 . (2.
the number of swap n(n − 1) 2 2 The most important factor here is n . and easy.5.g. Example Time Complexity: Quick sort vs. So now we have a precise mathematical notion for the speed of an algorithm. A. time and space).2010 . that is it is bounded by a polynomial in n. what is the least amount of resources required by the best known algorithm for solving the problem. Hard problems grow faster than any polynomial in n. There are many types of resources (e. M. so we say it is generally O(n2 ). the average time complexity is just O(n log n). here is a more indepth example of the average complexity of an algorithm. i. As promised. & Chuang.. If we do the same to the quick sort algorithm. exponentially. operations is: 2. + 1 = complexities are O(n2 ). The main distinction between hard and easy problems is the rate at which they grow. Or put another way. but we are interested in time complexity for now.⃝Riley T. whereas. for example: n2 is polynomial.e. The average and worst case time (n − 1) + (n − 2) + . So we say that O(2n ) is hard or intractable. What we mean by hard is that as we make n large the time taken to solve the problem goes up as 2n . Here our n is the number of elements in a list. L.22 Computational Resources and Efﬁciency Example 4n2 − 40n + 2 = Θ(n2 ) ̸= Θ(n3 ) ̸= Θ(n).2 Standard Complexity Classes Computational complexity is the study of how hard a problem is to compute. I. c The Temple of Quantum Computing . If the problem can be solved in polynomial time. then it is easy. 2n is exponential and hard. Perry 2004 .. 2000]. bubble sort [Nielsen.
org 2004].Computational Resources and Efﬁciency 23 The complexity classes of most interest to us are P (Polynomial) and NP (NonDeterministic Polynomial). • It is not proven that P ̸= NP it is just very unlikely as this would mean that all problems in NP can be solved in polynomial time. • Non deterministic Turing machines (NTMs) differ from normal deterministic Turing machines in that at each step of the computation the Turing machine can ”spawn” copies. or new Turing machines that work in parallel with the original. So we have a witness to a yes instance of the problem. • Witnesses are solutions to decision problems that can be checked in polynomial time. Most problems can be represented as decision problems. checking if 7747 has a factor less than 70 is a decision problem. c The Temple of Quantum Computing . For example. or equivalently. NP means that it probably can’t. P means that the problem can be solved in polynomial time.⃝Riley T. the class NP consists of all those decision problems whose positive solutions can be veriﬁed in polynomial time given the right information. if we ask if 7747 has a factor less than 60 there is no easily checkable witnesses for the no instance [Nielsen. Where: • A decision problem is a function that takes an arbitrary value or values as input and returns a yes or a no. as we shall see later we can only use quantum parallelism indirectly. Perry 2004 . 61 is a factor (61 × 127 = 7747) which is easily checked. Now.2010 . whose solution can be found in polynomial time on a nondeterministic machine [wikipedia. and NP complete means it almost deﬁnitely can’t. It’s a common mistake to call a quantum computer an NTM. More formally: The class P consists of all those decision problems that can be solved on a deterministic sequential machine in an amount of time that is polynomial in the size of the input. M. 2002]. A.
1 for a list of common complexity classes. This was challenged in 1977 by Robert Solovay and Volker Strassen. A. some of which are listed in appendix A. which now relates to a probabilistic Turing machine (PTM).3 The Strong ChurchTuring Thesis Originally. an equal likelihood of writing a 1 or a 0 on to the tape) [TheFreeDictionary. I.1. L.edu/ wiki/Complexity Zoo.5.stanford. 2000]. ? 2004]. this led to a revision of the strong ChurchTuring thesis. any efﬁciency gain due to using a particular model. Randomising the list beforehand ensures the algorithm runs more often in O(n log n). which do give a computational advantage based on the machine’s architecture [Nielsen. A probabilistic Turing machine can be described as: A deterministic Turing machine having an additional write instruction where the value of the write is uniformly distributed in the Turing machine’s alphabet (generally. Although on average quicksort runs in O(n log n) it still has a worst case running time of O(n2 ) if say the list is already sorted. Can we efﬁciently simulate any nonprobabilistic algorithm on a probabilistic Turing machine without exponential slowdown? The answer is ”yes” according to the new strong ChurchTuring thesis: c The Temple of Quantum Computing . & Chuang. who introduced truly randomised algorithms. The PTM has its own set of complexity classes. S. is at most polynomial. 2. So.⃝Riley T. This means that algorithms given the same inputs can have different run times. An example of an algorithm that can beneﬁt from a PTM is quicksort.24 Computational Resources and Efﬁciency See appendix A. M.com 2004]. Perry 2004 . You can also see a larger list of complexity classes online at http://qwiki. the strong ChurchTuring thesis went something like this: Any algorithmic process can be simulated with no loss of efﬁciency using a Turing machine [Banerjee.2010 . We are saying a TM is as powerful as any other model of computation in terms of the class of problems it can solve. and results if necessary.
David Deutsch proposed another revision to the strong Church Turing thesis.9: Richard Feynman. He proposed a new architecture based on quantum mechanics. on the assumption that all physics is derived from quantum mechanics (this is the Deutsch . Intuitively. Any model of computation can be simulated on a probabilistic Turing machine with at most a polynomial increase in the number of elementary operations [Bettelli. More algorithms were developed that seemed to work better on a quantum Turing machine (see below) c The Temple of Quantum Computing . A.2010 .Church Turing principle [Nielsen.⃝Riley T. 2002]). classical) Turing machines. based on Feynman’s ideas. Perry 2004 . M. p.this alluded to a kind of protoquantum computer. S. in fact it gets exponentially harder the more components you have [Nielsen. if the simulator was ”built of quantum components” perhaps it wouldn’t fall behind. the TM simulation can’t keep up with the evolution of the physical system itself: it falls further and further behind. He then demonstrated a simple quantum algorithm which seemed to prove the new revision. 2002].1988 (ﬁgure 2.e. reasoned Feynman. It is hard (timewise) to simulate quantum systems effectively. M. exponentially so. The idea really took shape in 1985 when. 2000. The strong ChurchTuring thesis would seem to have been violated (as the two models are not polynomially equivalent). So such a ”quantum computer” would seem to be more efﬁcient than a TM. Then.2].9) suggested that it would be possible to simulate quantum systems using quantum mechanics . 1918 . He then went on to ask if it was possible to simulate quantum systems on conventional (i. A.Computational Resources and Efﬁciency 25 Figure 2. A new challenge came from another quarter when in the early eighties Richard Feynman.
⃝Riley T.2 for a list of some of them and the relationships between them. and each cell of the tape holds a quantum bit (qubit) which can contain what’s called a superposition of the values 0 and 1. Unlike classical parallelism which requires a separate processor for each value operated on in parallel. Don’t worry too much about that now as it’ll be explained in detail later.e. i. This implies that if a quantum computer has components.6 Energy and Computation 2.see chapter 7). The head and tape of a QTM exist in quantum states. An c The Temple of Quantum Computing . There are a number of complexity classes for QTMs. Question Architecture itself can change the time complexity of algorithms so could there be other revisions? 2.6.5.1 Reversibility When an isolated quantum system evolves it always does so reversibly so that you could at any time determine what an earlier state of the system by using its current state and ”playing the system backwards”. in quantum parallelism a single processor operates on all the values simultaneously. see appendix A. they are not invertible.2 Irreversibility Most classical circuits are not reversible. will have to implement all the logical operations reversibly. This means that they lose information in the process of generating outputs from inputs. what’s important is that a QTM can perform calculations on a number of values simultaneously by using quantum effects.6.26 Energy and Computation rather than a classical one (notably Shor’s factorisation and Grover’s search algorithms . 2. 2.4 Quantum Turing Machines A quantum Turing machine (QTM) is a normal Turing machine with quantum parallelism. if behaving according to quantum mechanics.2010 . Perry 2004 . that perform logical operations then these components. similar to gates.
10).6. in theory.g. example of this is the NAND gate (ﬁgure 2. 2. Theoretically.6.10: An irreversible NAND gate.3 Landauer’s Principle In 1961. when information is lost in an irreversible circuit that information is dissipated as heat [Nielsen. 1927 . IBM physicist Rolf Landauer. which is described next. This result was obtained for circuits based on classical physics. The demon can.Energy and Computation 27 a b a. We have a box ﬁlled with particles with different velocities (shown by the arrows). The second law of thermodynamics (see chapter 4) says that the amount of entropy in a closed system never decreases. M. A good example of the link between reversibility and information is Maxwell’s demon.2010 . 2. 2002].11) a box ﬁlled with gas separated into two halves by a wall. knowing the output is 1 does not allow one to determine the input: it could be 00. to invert the output. Entropy is the amount of disorder in a system or in this case the amount of energy.1999 showed that. Here are a list of steps to understanding the problem: 1. or 01. 10. A. Perry 2004 . E. if we were to build a classical computer with reversible components then work could be done with no heat loss.⃝Riley T. b? Figure 2. and no use of energy! Practically though we still need to waste some energy for correcting any physical errors that occur during the computation.4 Maxwell’s Demon Maxwell’s demon is a thought experiment comprised of (see ﬁgure 2. The wall has a little door that can be opened and closed by a demon. open and close the door in a certain way to actually decrease the amount of entropy in the system. It is not possible in general. c The Temple of Quantum Computing .
11: Maxwell’s Demon. The loss of heat is not important to quantum circuits. The demon makes a temperature difference without doing any work (which violates the second law of thermodynamics). A demon opens and closes a door in the centre of the box that allows particles to travel through it. 6. We can simulate any classical gate with reversible gates. For example. Almost anything can be done in a reversible manner (with no entropy cost). Perry 2004 . 2. a reversible NAND gate can be made from a reversible gate called a Toffoli gate.6. The fast particles end up on the left hand side.2010 . Rolf Landauer and R. Keyes resolved the paradox when they examined the thermodynamic costs of information processing. The demon only opens the door when fast particles come from the right and slow ones from the left.28 Energy and Computation The demon operates this door Figure 2. the operations are reversible until his memory is cleared. Bits in reversible circuits may then go on to c The Temple of Quantum Computing . The demon’s mind gets ”hotter” as his memory stores the results. 4.⃝Riley T. to do computational tasks without dissipating heat. in general.5 Reversible Computation In 1973 Charles Bennett expanded on Landauer’s work and asked whether it was possible. the slow particles on the right. 3.W. 2. but because quantum mechanics is reversible we must build quantum computers with reversible gates. Reversible gates use control lines which in reversible circuits can be fed from ancilla bits (which are work bits). 5.
Energy and Computation
29
become garbage bits that are only there to ensure reversibility. Control lines ensure we have enough bits to recover the inputs from the outputs. The reason they are called control lines is that they control (as in an if statement) whether or not a logic operation is applied to the noncontrol bit(s). E.g. in CNOT below, the NOT operation is applied to bit b if the control bit is on (=1).
2.6.6 Reversible Gates
Listed below are some of the common reversible gates and their truth tables. Note: the reversible gate diagrams, and quantum circuit diagrams were built
A with a LTEX macro package called QCircuit which is available at http://
info.phys.unm.edu/Qcircuit/. Controlled NOT Like a NOT gate (on b) but with a control line, a. b′ can also be expressed as a XOR b. a b •
a′ b′
CNOT a 0 0 1 1 b 0 1 0 1 a′ 0 0 1 1 b′ 0 1 1 0
Properties of the CNOT gate, CNOT(a, b): CNOT(x, 0) : b′ = a′ = a = FANOUT. Toffoli Gate If the two control lines are set it ﬂips the third bit (i.e. applies NOT). The Toffoli gate is also called a controlledcontrolled NOT. c The Temple of Quantum Computing  ⃝Riley T. Perry 2004  2010 (2.5)
30
Energy and Computation
a b c
• •
a′ b′ c′
Toffoli a 0 0 0 0 1 1 1 1 b 0 1 1 0 0 1 1 c 0 0 1 0 1 0 1 a′ 0 0 0 0 1 1 1 1 b′ 0 0 1 1 0 0 1 1 c′ 0 1 0 1 0 1 1 0
0 1
Properties of the Toffoli Gate, TF (a, b, c): TF (a, b, c) = (a, b, c XOR(a AND b)). TF (1, 1, x) : c′ = NOT x. TF (x, y, 1) : c′ = x NAND y. TF (x, y, 0) : c′ = x AND y. TF (x, 1, 0) : c′ = a = a′ = FANOUT. A combination of Toffoli gates can simulate a Fredkin gate. Fredkin Gate If the control line is set it ﬂips the second and third bits. a b c • × × a′ b′ c′ (2.6) (2.7) (2.8) (2.9) (2.10)
c The Temple of Quantum Computing  ⃝Riley T. Perry 2004  2010
Energy and Computation Fredkin a 0 0 0 0 1 1 1 1 b c a′ 0 0 0 0 1 1 1 1 b′ 0 0 1 1 0 1 0 1 c′ 0 1 0 1 0 0 1 1 0 0 0 1 1 0 1 1 0 0 0 1 1 0 1 1
31
Properties of the Fredkin Gate, FR (a, b, c): FR (x, 0, y) : b′ = x AND y. FR (1, x, y) : b′ = c and c′ = b, which is CROSSOVER. FR (x, 1, 0) : c′ = a′ = c = FANOUT, with b′ = NOT x. A combination of Fredkin gates can simulate a Toffoli gate. (2.11) (2.12) (2.13)
c The Temple of Quantum Computing  ⃝Riley T. Perry 2004  2010
32
Energy and Computation
Figure 2.12: A conventional reversible circuit.
2.6.7 Reversible Circuits
Reversible circuits have been implemented in a classical sense, an example of a reversible circuit built with conventional technology is shown in ﬁgure 2.12. Quantum computers use reversible circuits to implement quantum algorithms. Chapters 6 and 7 contain many examples of these algorithms and their associated circuits.
c The Temple of Quantum Computing  ⃝Riley T. Perry 2004  2010
Chapter 3 Mathematics for Quantum Computing
3.1 Introduction
In conventional computers we have logical operators (gates) such as NOT that acts on bits. The quantum analogue of this is a matrix operator operating on a qubit state vector. The mathematics we need to handle this includes: • Vectors to represent the quantum state. • Matrices to represent gates acting on the values. • Complex numbers, because the components of the quantum state vector are, in general complex. • Trig functions for the polar representation of complex numbers and the fourier series. • Projectors to handle quantum measurements. • Probability theory for computing the probability of measurement outcomes. As well as there being material here that you may not be familiar with (complex vector spaces for example), chances are that you’ll know at least some of the math. The sections you know might be useful for revision, or as a reference. This is especially true for the sections on polynomials, trigonometry, and logs which are very succinct.
33
. 3.. If you’re not comfortable with these topics then you may need to study them before continuing on with this chapter. 6x2 + 2x−1 is not a polynomial as it contains a negative power for x. powers. limits. cn are constant coefﬁcients with cn ̸= 0.e. c1 . a cubic. Example ∀ n > 5.2010 . percentages. This includes topics like fractions.34 Polynomials So what’s not in here? There’s obviously some elementary mathematics that is not covered. Perry 2004 . 4t3 − 5 is a polynomial in t of degree 3. Example ∃ n such that f (n) = 4 means there is a value of n that will make f (n) return 4.1) 3. + cn xn where c0 . factorisation.2 Polynomials A polynomial is an expression in the form: c0 + c1 x + c2 x2 + .e. We say that the above is a polynomial in x of degree n. basic algebra. Say if f (n) = (n − 1)2 + 4. Example Different types of polynomials... ∃ means there exists. they are explained below: ∀ means for all. radicals. and simple geometry.⃝Riley T. 3v 2 + 4v + 7 is a polynomial in v of degree 2. a quadratic. c2 .3 Logical Symbols A number of logical symbols are used in this text to compress formulae. i. summations.. c The Temple of Quantum Computing . i. then the n value in question is n = 1. (3. f (n) = 4 means that for all values of n greater than 5 f (n) will return 4..
1 Right Angled Triangles Given the triangle. adj (3. & & & θC & & & & &θ A & & c && a θB b we can say the following: a2 + b2 = c2 . adjacent side.5) cos θA = sin θB = b . Perry 2004 .2) and for the opposite side. b tan θB = b . a (3. c (3. and hypotenuse: sin = opp .⃝Riley T.2010 .Trigonometry Review iff means if and only if. 3. hyp cos = adj .6) c The Temple of Quantum Computing . c cos θB = sin θA = a . Example 35 f (n) = 4 iff n = 8 means f (n) will return 4 if n = 8 but for no other values of n. hyp tan = opp . c (3.4) tan θA = a . c sin θB = b .3) sin θA = a . Pythagorean theorem (3.4 Trigonometry Review 3.4.
For converting degrees to radians: rads = n◦ × π . 270◦ = 3π 2 1 rad = 57◦ . and tan θ: sin−1 = arcsin = θ from sin θ. 1◦ = π 180 45◦ = π 4 90◦ = π 2 ◦ rads. tan−1 = arctan = θ from tan θ.11) 3.9) (3.2 Converting Between Degrees and Radians Angles in trigonometry can be represented in radians and degrees.7) For converting radians to degrees we have: n◦ = 180 × rads .⃝Riley T. 180 = π rads. (3. π (3. If we want to measure larger angles like 247◦ we must determine which quadrant the angle is in (here we don’t consider angles larger than 360◦ ). rads.36 Trigonometry Review 3.8) Some common angle conversions are: 360◦ = 0◦ = 2π rads.4 Angles in Other Quadrants The angles for right angled triangles are in quadrant 1 (i.e. 180 (3.10) (3. Perry 2004 .4.4.3 Inverses Here are some inverses for obtaining θ from sin θ. The following diagram has the rules for doing so: c The Temple of Quantum Computing . 3.4. rads.2010 . cos θ. from 0◦ to 90◦ ). rads. cos−1 = arccos = θ from cos θ.
where x is in radians.4. 1.5 10 5 0 5 10 sin(x) c The Temple of Quantum Computing .5 1 0. Perry 2004 .2010 .5 Visualisations and Identities The functions y = sin(x) and y = cos(x) are shown graphically below.5 0 −0. 3.5 −1 −1.⃝Riley T.Trigonometry Review 37 Change θ to 180◦ − θ Make cos and tan negative No change 90◦ ≤ θ ≤ 180◦ 180◦ ≤ θ ≤ 270◦ 0◦ ≤ θ ≤ 90◦ 270◦ ≤ θ ≤ 360◦ (0◦ ) Change θ to θ − 180◦ Change θ to 360◦ − θ Make sin and cos negative Make sin and tan negative Example Using the diagram above we can say that sin(315◦ ) = − sin(45◦ ) and cos(315◦ ) = cos(45◦ ).
sin(−θ) = − sin θ.5 10 5 0 5 10 Logs cos(x) Finally.2010 (3. blogb x = x. b >= 0. The log of x = 100 to base b = 10 is the power (2) of 10 that gives back 100.⃝Riley T. (3. and b ̸= 1. with: y = logb x and.5 −1 −1.5 Logs The logarithm of a number (say x) to base b is the power of b that gives back the number.14) (3.17) (3. x = by where x >= 0. 102 = 100. i.15) 3. E. cos(−θ) = cos θ.5 1 0. i.13) (3.g.16) .e. the answer to a logarithm is the power y put to a base b given an answer x. So log10 100 = 2.38 1. Put another way. c The Temple of Quantum Computing .12) (3. Example log2 16 = 4 is equivalent to 24 = 16.5 0 −0.e. tan(−θ) = − tan θ. here are some important identities (where sin2 θ = (sin θ)2 and cos2 θ = (cos θ)2 ): sin2 θ + cos2 θ = 1. Perry 2004 .
b ∈ R (the real numbers) where i stands for √ (3. subtraction.6 Complex Numbers A complex number. Division requires using a complex conjugate. z is called complex because it is made of two parts.18) −1. i3 = −i. which had no traditional solution. b) to express this. products. The system of complex numbers is closed in that.2010 . z is a number in the form: z = a + ib where a.1: Representing z = a + ib in the complex plane with coordinates a = 3 and b = 3. The complex num ber z is said to be in C (the complex numbers).e. i6 = −1. i4 = 1. and ratios of complex numbers give back a complex number: i. Sometimes we write z = (a. which is introduced in the next section. i−1 = −i. and multiplication of complex numbers follow the normal rules of arithmetic. Note the imaginary axis which accounts for i. Except for the rules regarding i. 3. i−2 = −1. i2 = −1. i = −1. Here are examples of i itself: √ i−3 = i. sums. the operations of addition. we stay within the system. i5 = i.⃝Riley T. With these operations deﬁned via the examples in the box below. except for division by 0.Complex Numbers Imaginary axis T 39 3 a z ' r b θ E Real axis 3 c Figure 3. a and b. Perry 2004 . i is called an imaginary number and was created to solve problems like x2 + 1 = 0. c The Temple of Quantum Computing .
−1) repeats indeﬁnitely (aside from i itself). Example Basic complex numbers.⃝Riley T. Addition: (5 + 2i) + (−4 + 7i) = 1 + 9i Multiplication: (5 + 2i)(−4 + 3i) = 5(−4) + 5(3)i + 2(−4)i + (2)(3)i2 = −20 + 15i − 8i − 6 = −26 + 7i. θ) = (z.22) √ z∗z (3. θ) where r is the magnitude and θ is called the phase: (r.19) c The Temple of Quantum Computing . (r. z = where z ∗ is the complex conjugate of z: z ∗ = a − ib. (3. r ∈ R and z is the norm (also called the modulus) of z: z = or. Finding Roots: (−5i)2 = 5i2 = 52 i 2 = 25(−1) = −25.40 Complex Numbers So the pattern (−i. θ) = z(cos θ + i sin θ) where θ.1 Polar Coordinates and Complex Conjugates Complex numbers can be represented in polar form.2010 . 1. i. −25 has roots 5i and −5i.6. Perry 2004 .20) (3.21) √ a2 + b2 (3. 3.
Polar Coordinates For polar coordinates (ﬁgure 3.1) we can say that θ is the angle between a line drawn between a point (a. It is not practical to restrict the phase during calculations (we may for example want to add angles) but afterwards we can reduce the phase modulo 2π. The horizontal axis is called the real axis and the vertical axis is called the imaginary axis.⃝Riley T. π) and (2. It’s also helpful to look at the relationships between z. z ∗ . −z ∗ . Example Reduction by modulo 2π. Complex numbers are only unique if the phase is restricted to 0 ≤ θ ≤ 2π. and −z. z ∗ . Perry 2004 .Complex Numbers Imaginary axis T 41 −z ∗ z d s d ' −z d d d d d d d © d E Real axis z∗ c Figure 3. (2.2: z. c The Temple of Quantum Computing .2. b) of length r on the complex plane and the x axis with the coordinates being taken for the complex number as x = a and y = b. These are shown in ﬁgure 3. Two complex numbers may be equivalent when they differ in phase. For two polar representations of complex numbers.2010 . 5π) are equivalent because the phase differs by (2)2π. −z ∗ and z graphically. if the magnitude is the same and the the phase is the same modulo 2π then they are equivalent.
θ) = a + bi (3.⃝Riley T. If a < 0 and b < 0 4.23) where a = r cos θ and b = r sin θ.24) where r = z = √ a2 + b2 and θ is the solution to tan θ = b a which lies in the following quadrant: 1. If a > 0 and b > 0 2. θ) (3. Perry 2004 . converting cartesian to polar form is a little more complicated: a + bi = (r.42 So for converting from polar to cartesian coordinates: Complex Numbers (r. If a > 0 and b < 0. Conversely.2010 . c The Temple of Quantum Computing . If a < 0 and b > 0 3.
Perry 2004 . a = r cos θ = 3 cos 40◦ = 3(0.2010 . Example Convert −1 + 2i to (r.6.6◦ ) .⃝Riley T.Complex Numbers Example Convert (3. 40◦ ) to a + bi. c The Temple of Quantum Computing . r= √ (−1)2 + 22 √ = 5 = 2.2 b a 2 = −1 = −2 tan θ = arctan(−2) = −63. This gives us a = −1 and b = 2.64) = 1. θ).2.77) = 2.4 and subtract that from 180 which gives us θ = 116.3 b = r sin θ = 3 cos 40◦ = 3(0. 3.4◦ Since a < 0 and b > 0 we use quadrant 2 so we negate −63.9i .6◦ and the solution is: −1 + 2i = (2.3 + 1.9 43 z = 2. 116.2 Rationalising and Dividing 1 a+bi is rationalised by multiplying the numerator and denominator by a − bi.
2010 . which can be rewritten as: cos θ = eiθ + e−iθ .25) c The Temple of Quantum Computing .6.29) (3.28) (3. 2 eiθ − e−iθ sin θ = . e−iθ = cos θ − i sin θ. = 29 29 Complex Numbers Division of complex numbers is done by rationalising in terms of the denominator. Perry 2004 .26) (3. 2 3. 3 + 2i 3 + 2i (−2i) = 2i 2i (−2i) −6i − 4i2 = −4i2 −6i + 4 = 4 3 =1− i. This is because: eiθ = cos θ + i sin θ. 2i (3.27) (3.3 Exponential Form Complex numbers can also be represented in exponential form: z = reiθ . The derivation of which is: z = z(cos θ + i sin θ) = r(cos θ + i sin θ) = reiθ . 1 1 (5 − 2i) = 5 + 2i 5 + 2i (5 − 2i) 2 5 − i.⃝Riley T. Example Division of complex numbers.44 Example Rationalisation.
34) (3..1).30) (3.32) (3. eπi3/4 = ei(3π/4) 3π 3π = cos + i sin 4 4 ◦ = cos 135 + i sin 135◦ −1 i =√ +√ 2 2 −1 + i .. To ﬁnd θ.33) Convert 3 + 3i to exponential form. This requires two main steps. r = z = √ = 18. we can use the a and b components of z as opposite and adjacent sides of a right angled triangle in quadrant one (see ﬁgure 3... c The Temple of Quantum Computing . . Perry 2004 .) 2! 4! 3! = cos θ + i sin θ.2010 (3.⃝Riley T. ex = 1 + x + Example which are: 1. 2! 3! 4! θ2 θ4 iθ3 =1− + + i(θ − + . .26) we use a power series exponent (which is an inﬁnite polynomial): x2 x3 + + . √ 32 + 32 (3. e−i2π = 1. which means need to apply arctan. .31) (3. = √ 2 Properties: z ∗ = re−iθ . 3 3 = π 4 then z in exponential Example Convert eπi3/4 to the form: a + bi (also called rectangular form). So given tan−1 form looks like: √ 18eπi/4 .Complex Numbers 45 To prove (3. 2! 3! θ2 iθ3 θ4 eiθ = 1 + iθ − − + − . Find the modulus. 2.35) .
13 20 7 3. a number) by a matrix is a new matrix that is found by multiplying each entry in the given matrix. e.7. Given a scalar c The Temple of Quantum Computing . ] .2010 . So even if you know this material it’ll be useful to revise as they are used so often. Addition Addition can only be done when the matrices are of the same dimensions (the same number of columns and rows). for example: 17 24 5 6 1 8 23 4 14 .46 Matrices 3. the numbers in the matrix are called entries.e.7 Matrices Matrices will be needed in quantum computing to represent gates. Scalar Multiplication The product of multiplying a scalar (i. A matrix is an array of numbers. Given the following 3 matrices: [ MA = [ MB = [ MC = 2 1 3 4 2 1 3 5 2 1 0 3 4 0 ] . Perry 2004 . we can do the same for matrices. operators.1 Matrix Operations Just as we could deﬁne arithmetic operators .⃝Riley T.g: [ MA + MB = 4 2 6 9 ] . and vectors. ] .addition and multiplication for complex numbers.
α(N − O) = αN − αO.41) (3.40) (3. [ ] (2 × 2) + (1 × 3) (2 × 1) + (1 × 4) (2 × 0) + (1 × 0) MB MC = (3 × 2) + (5 × 3) (3 × 1) + (5 × 4) (3 × 0) + (5 × 0) [ ] 7 6 0 .36) (3.38) Distributive law Distributive law (3.2010 Commutative law for addition Associative law for addition (3.43) (3. 47 4 2 6 8 Matrix Multiplication The product of multiplying matrices M and N with dimensions M = m×r and N = r×n is a matrix O with dimension O = m×n.37) Associative law for multiplication (3. (N − O)M = N M − OM.46) (3.44) (3.39) (3. = 21 23 0 Basic Matrix Arithmetic Suppose M . α(N O) = (αN )O = N (αO). The k=1 matrices M and N must also satisfy the condition that the number of columns in M is the same as the number of rows in N .45) (3. (α + β)O = αO + βO. M + (N + O) = (M + N ) + O. N .42) (3.Matrices α=2: αMA = [ ] . (α − β)O = αO − βO. (αβ)O = α(βO). M (N − O) = M N − M O. M (N O) = (M N )O. α(N + O) = αN + αO. (N + O)M = N M + OM.47) (3.48) . and O are matrices and α and β are scalars: M + N = N + M. M (N + O) = M N + M O. Perry 2004 .⃝Riley T. The resulting matrix is found ∑ by Oij = r Mi rNr j where i and j denote row and column respectively. c The Temple of Quantum Computing .
Equivalently a matrix A has an inverse: A−1 where AA−1 = A−1 A = I. for a full explanation of how to calculate an inverse you’ll need to consult an external reference.49) Identity Matrix A matrix multiplied by the identity matrix (corresponding to unity in the ordinary numbers) will not change. (3. (3. An example of an inverse is below.48 Matrices You may have noticed that there is no commutative law for multiplication. (3.50) Inverse Matrix A number a has an inverse a−1 where aa−1 = a−1 a = 1. ] . which follows the same noncommutative multiplication law. [ I= 1 0 0 1 [ MA I = 2 1 3 4 ] . It is not always the case that M N = N M .51) Even with a simple 2×2 matrix it is not a trivial matter to determine its inverses (if it has any at all). Perry 2004 . [ −1 MA = 4 5 −3 5 −1 5 2 5 ] . [ 0= 0 0 0 0 ] .2010 . c The Temple of Quantum Computing . Zero Matrix The special case of a matrix ﬁlled with zeroes. This is important in quantum mechanics.⃝Riley T. Note A−1 only exists iff A has full rank (see Determinants and Rank below).
whichever is smaller.53) .8. doesn’t have an inverse). Determinants and Rank Rank is the number of rows (or columns) which are not linear combinations (see section 3. It’s deter2 minant. c d So now for an example of rank. 2 × 6 − 3 × 4 is 0.e.. then A is invertible iff A has rank n (we say that A has full rank). Determinants of larger matrices can be found by decomposing them into smaller 2 × 2 matrices. given the matrix below. ji Here’s an example: 49 (3. m = n). for example: c The Temple of Quantum Computing . ] [ 2 4 . A matrix has full rank when the rank is the number of rows or columns. MD = 3 6 We can say it has rank 1 because row 2 is a multiple (by 3 ) of row 1. The determinant of a simple 2 × 2 matrix is deﬁned as: [ ] a b det = ad − bc. ﬂipping the values).2010 2 3 (3.52) T MC = 1 4 . if the determinant is 0 the matrix is singular (i.⃝Riley T.Matrices Transpose Matrix AT is the transpose of matrix A if: AT = Aij . In the case of a square matrix A (i. 0 0 For a square matrix like MA you get the transpose by reﬂecting about the diagonal (i. Perry 2004 . A nonzero determinant (see below) determines that the matrix has full rank.e.e. So a nonzero determinant implies the matrix has an inverse and viceversa.6) of other rows.
e. The tail does not have to start at the origin and the vector can move anywhere in the cartesian plane as long as it keeps the same direction and length. ordinary 2D space) ﬁrst.50 Vectors and Vector Spaces det d e f = a · det g h i a b c [ e f h i ] − b · det [ d f g i ] + c · det [ d e g h ] . This can be further extended to more dimensions using n space (Rn ).⃝Riley T.3). For simplicity’s sake our vectors in R all have an initial point at the origin and our coordinates just refer to the terminal point. y) if the tail of the vector starts at the origin (see ﬁgure 3.8. We can make a vector 3D by using another axis (the z axis) and extending into 3 space (R3 ) (see ﬁgure 3. When vectors do not start at the origin they are made up of two points. Vectors in R A vector in R (the real numbers) can be represented by a point on the cartesian plane (x. But it’s helpful to look at simpler vectors in real space (i. c The Temple of Quantum Computing . Perry 2004 . The collection of all the vectors corresponding to all the different points in the plane make up the space (R2 ).54) Determinants. The x and y coordinates that relate to the x and y axes are called the components of the vector. Again.8 Vectors and Vector Spaces 3. Vectors for quantum computing are in complex vector space Cn called n dimensional Hilbert space.7). 3. (3. for a full explanation you’ll need to consult an external reference. like inverses are not trivial to calculate. the initial point and the terminal point.1 Introduction Vectors are line segments that have both magnitude and direction.2010 .
z uz T d d ux x ¡ ¡ ¡ uy ¡d ¡ ¡ d ¡ d ¡ ¡ d¡ ¡ d d u = (ux .⃝Riley T. Perry 2004 .3: Vectors in R2 (i.e. uz ) Ey Figure 3. c The Temple of Quantum Computing . uz . 3) (−3. ordinary 2D space like a table top).2010 . uy . uy . −1) c Figure 3.Vectors and Vector Spaces 51 T (3. 1) ' y d d E (−1.4: A 3D vector with components ux .
⃝Riley T. 7. 8. a = b = c. or dot product.52 T Vectors and Vector Spaces d d d d ' d d d d a d d d d d b E e d s d d c d d d c Figure 3. An important operation is the dot product (used below to get the angle between two vectors): u · v = ux vx + uy vy + uz vz . In computer graphics the distinction is that coordinate systems are measured in world coordinates and vectors are terminal points that are local to that coordinate system (see ﬁgure 3. Perry 2004 .5: Vector examples. Two Interesting Properties of Vectors in R3 Vectors in R3 are represented here by a bolded letter. uy .6). vz ) (two vectors). c The Temple of Quantum Computing .5. d ̸= e ̸= a. (3. 20). vy . This operation takes two vectors and returns a number (not a vector). We can think of some vectors as having local coordinate systems that are offset from the origin.55) The dot (·) here means the inner.2010 . Example Example vectors in R in ﬁgure 3. Let u = (ux . uz ) and v = (vx . 17. Example A point in 5 dimensional space is represented by the ordered 5 tuple (4.
⃝Riley T. 3. √ 3. 1. We also deﬁne a vector subspace as a non empty set of vectors which satisfy the same conditions as the parent’s vector space. u2 ) (3. this is the set containing all column vectors with n complex numbers laid out vertically (the above examples were row vectors with components laid out horizontally). 7 Vectors in C V = Cn is a complex vector space with dimension n. 1. (3. 1) then ∥u∥ = if u = (1.2 Column Notation In C2 for example. u1 u2 ] (3.58) c The Temple of Quantum Computing . 3) then: 2+1+3 cos θ = √ √ 3 14 √ 6 = . Perry 2004 . 1) and v = (2.8.56) if u = (1. [ u⟩ = where u1 = a1 + b1 i and u2 = a2 + b2 i.Vectors and Vector Spaces 53 Knowing the components we can calculate the magnitude (the length of the vector) using Pythagoras’ theorem as follows: ∥u∥ = Example Example √ u x ux + uy uy + uz uz .57) u⟩ can also be represented in row form: u⟩ = (u1 .2010 . the quantum mechanical notation for a ket can be used to represent a vector. 1.
u⟩ + v⟩ = . Vector Addition A sum of vectors can be represented by: u1 + v 1 .63) (3. Scalar Multiplication and Addition Listed here are some basic properties of complex scalar multiplication and addition.8.54 Example Column Notation. Perry 2004 .62) (3.59) (3.2010 . 2 − 3i 3. α(u⟩ + v⟩) = αu⟩ + αv⟩. Example Here’s a more complex example: u⟩ = (1 + i)0⟩ + (2 − 3i)1⟩ [ ] 1+i = .8. (α + β)u⟩ = αu⟩ + βu⟩.61) Distributive law for scalar addition (3. α(u⟩ + v⟩) = αu⟩ + αv⟩. [ 0⟩ = Vectors and Vector Spaces 1 0 ] and. un + v n (3. 3. . v⟩. . αu⟩ = . β) ∈ C and vectors (u⟩. αu1 . w⟩) ∈ Cn . .⃝Riley T. .64) c The Temple of Quantum Computing . αun α(βu⟩) = αβu⟩.3 The Zero Vector The 0 vector is the vector where all entries are 0.60) Associative law for scalar multiplication (3.4 Properties of Vectors in Cn Given scalars (α. 1⟩ = [ 0 1 ] .
u∗ ]. . † is called the adjoint and is introduced in section 3. + αn vn ⟩ c The Temple of Quantum Computing . 1+i The dual of u⟩ is: ⟨u = [(1 − i)∗ . 1 2 n (3.69) The dagger symbol.5 The Dual Vector The dual vector ⟨u corresponding to a ket vector u⟩ is obtained by transposing the corresponding column vector and conjugating its components. . Example The dual of 0⟩. . (3.65) Associative (3. (1 + i)∗ ] = [(1 + i). Perry 2004 .68) Commutative (3. vn ⟩ if u⟩ can be expressed by: u⟩ = α1 v1 ⟩ + α2 v2 ⟩ + .Vectors and Vector Spaces 55 This sum has the following properties: u⟩ + v⟩ = v⟩ + u⟩. .19.67) 3. .66) (3. (1 − i)] 3. . (u⟩ + v⟩) + w⟩ = u⟩ + (v⟩ + w⟩). a bra and we have: ⟨u = u⟩† = [u∗ . . For every u⟩ ∈ Cn there is a corresponding unique vector −u⟩ such that: u⟩ + (−u⟩) = 0. u⟩ + 0 = u⟩.70) . v2 ⟩. This is called. Example Given the vector u⟩ where: [ ] 1−i u⟩ = . 0∗ ].6 Linear Combinations A vector u⟩ is a linear combination of vectors v1 ⟩.8.⃝Riley T.8.2010 (3. . . u∗ .8. ⟨0 = 0⟩† = [1∗ . . in quantum mechanics.
8. υn ⟩ for V in terms of which every vector in V can be written as a linear combination. The row vectors (bras) [1. 0].7 Linear Independence A set of nonzero vectors υ1 ⟩.8. −1]. and w like the following: [x. v. We can represent a linear combination as: u⟩ = n ∑ i=1 Vectors and Vector Spaces αi vi ⟩. = an = 0. [1. 0] i.2010 .8. −1] + [1. (3. and [2. 1.⃝Riley T.. 3. Example Vectors u = [1. 0]. υn ⟩ is linearly independent if: n ∑ i=1 ai υi ⟩ = 0 iff a1 = . and w = [0. 1] = [0.72) Example Linear dependence.. a2 = 1.e there is a linear combination with a1 = 1. a3 = −1 (other than the zero condition above) that evaluates to 0. 1] span R3 because all vectors [x. z] = xu + yv + zw. 0. 2] − [2. αn are complex numbers. y.56 where scalars α1 . Perry 2004 . .. 2]. Most of the time with quantum computing we’ll use a standard basis. α2 . . This is also called an orthonormal basis (see section c The Temple of Quantum Computing . v = [0.. . . y. So they are not linearly independent.. 0. (3.71) 3. .9 Basis A basis is any set of vectors that are a spanning set and are linearly independent.. 3. .. 2] are linearly dependent because: [1. z] in R3 can be written as a linear combination of u.8 Spanning Set A spanning set is a set of vectors υ1 ⟩.. called the computational basis.
Perry 2004 .15).Vectors and Vector Spaces 57 3.5) + 30(0. In C4 we can use 00⟩. Say there are n events and the xth event happens nx times and also we have ∑ x=1 nx = n.25) + 20(0. and 11⟩ for a basis (the tensor product is needed to understand this .2010 .8.8.8. The xth event will occur with the following probability: nx px = (3. 3.28).25) = 20 c The Temple of Quantum Computing .75) A group of salesmen make a number of sales Sales Salesmen 10 20 30 6 12 6 The number of salesmen is n = 6 + 12 + 6 = 24 The probability of a salesman making 20 sales is: p2 = The expectation value ⟨x⟩ is: ⟨x⟩ = ∑ x=1 12 n2 = = 0. In C2 we can use 0⟩ and 1⟩ for the basis.73) A probability of pi = 0 means xi is impossible and a probability of pi = 1 means xpx = n (3.see section 3.74) n This implies the probabilties all sum to 1.10⟩.10 Probability Theory An event xi has a probability pi of occuring which lies in the range: 0 ≤ pi ≤ 1 xi is certain.01⟩.⃝Riley T. We call the average of the probabilites the expectation value which is deﬁned as: ⟨x⟩ = Example ∑ x=1 (3.5 n 24 xpx = 10(0.
√ 2 1 3 √ + 2 3 2 = 1 2 + 3 3 = 1. Perry 2004 . 3 3 First. To ﬁt with the probability interpretation the square of the absolute values of the probability amplitudes must sum to 1: α2 + β2 = 1. when the appropriate measurement is performed (see chapter 4).6% chance of measuring a 1⟩.7.3% chance of measuring a 0⟩ and a 66.76) Example√Determine the probabilities of measuring a 0⟩ or a 1⟩ for √ 1 0⟩ + 2 1⟩.8. Because in quantum mechanics they give the probabilities of projecting the state into a basis state. The state vector in C2 is often written as Ψ⟩ = α0⟩ + β1⟩. which is the angle between two c The Temple of Quantum Computing . α and β in α0⟩ + β1⟩) associated with our basis vectors are called probability amplitudes.3 and (100) = 66. check if the probabilities sum to 1.1.58 Vectors and Vector Spaces 3. (3. but it’s helpful to think of what the inner product gives us in R2 .12 The Inner Product We’ve already met the inner (or dot) product in R2 in section 3.11 Probability Amplitudes We can write a vector as a combination of basis vectors. 0⟩ or a 1⟩. The inner product in quantum computing is deﬁned in terms of Cn . 1 2 ˙ ˙ (100) = 33. The scalars (e.g.8.6 .⃝Riley T.2010 . 3 3 ˙ ˙ So this give us a 33. 3. They do sum to 1 so convert to percentages. In quantum mechanics we use a state vector Ψ⟩.
77) ( u·v ∥u∥∥v∥ ) . α1 . v⟩ = . αn β1 . .2010 and. .Vectors and Vector Spaces T 59 ' I θ E c Figure 3. The dot product in R2 is shown here (also see ﬁgure 3. we can calculate the inner product: (3. . which is deﬁned in terms of a dual. An inner product in Cn combines two vectors and produces a complex number.6): u · v = ∥u∥∥v∥ cos θ and rearranging we get: θ = cos −1 (3. βn β1 . = ⟨u × v⟩ .78) Now we’ll look at the inner product in Cn .. vectors.79) (3.⃝Riley T..80) . u⟩ = .. ∗ ∗ [α1 . c The Temple of Quantum Computing . αn ] . βn = ⟨uv⟩.6: The dot product. Perry 2004 . (3. So given.
88) c The Temple of Quantum Computing .60 Vectors and Vector Spaces An inner product can also be represented in the following format: (u⟩.⃝Riley T. ̸ (3.8. ∀ u⟩[R ∋ ⟨uu⟩ ≥ 0]. and ⟨uv⟩ = 0.81) Example Using the inner product notation from above we can extract a probability amplitude if we use one of the basis vectors as the original vector’s dual: ⟨0(α0⟩ + β1⟩) = [1∗ . [ α β ] =α This is called braket notation. ⟨uαv⟩ = ⟨α∗ uv⟩ = α⟨uv⟩.82) (3. u∗ ] 1 2 [ v1 v2 ] = u∗ v 1 + u∗ v 2 . Perry 2004 . So for C2 the following are equivalent: ([ u1 u2 ] [ . 1 2 (3. ⟨uv⟩2 ≤ ⟨uu⟩⟨vv⟩.83) (3.84) (3. [ ⟨0(α0⟩ + β1⟩) = 1 0 ] [ • α β ] = α. v⟩) = ⟨uv⟩.2010 .13 Orthogonality Orthogonal vectors can be thought of as being ”perpendicular to each other”. v1 v2 ]) = (u⟩.87) 3. Hilbert space is the vector space for complex inner products. ⟨uv + w⟩ = ⟨uv⟩ = ⟨uw⟩. 0∗ ] or using dot product notation. v⟩ = 0. Properties: ⟨uv⟩ = ⟨vu⟩∗ . (3. two vectors are orthogonal iff: u⟩ ̸= 0.85) (3.86) The CauchySchwartz inequality (3. v⟩) = ⟨u × v⟩ = ⟨uv⟩ = [u∗ . If ⟨uu⟩ = 0 then u⟩ = 0.
0∗ ] Example The vectors: [ u⟩ = are orthogonal because: ⟨uv⟩ = ((1. c The Temple of Quantum Computing .Vectors and Vector Spaces Example The vectors: [ u⟩ = are orthogonal because: [1∗ . ∥u⟩∥ = 1. 2 + 2i] −i 1 2 61 1 0 ] and v⟩ = [ ] [ 0 1 ] 0 1 = 0. 1 1 ] and v⟩ = [ 1 −1 ] 1+i 2 − 2i ] and v⟩ = [ −i 1 2 ] ] = 0. 1). (3.2010 (3.89) A unit vector is a vector where its norm is equal to 1. Perry 2004 . Example The vectors: [ u⟩ = are orthogonal because: [ [1 − i.14 The Unit Vector A vector’s norm is: ∥u⟩∥ = √ ⟨uu⟩ .8.90) . (1.⃝Riley T. −1)) = 1 × 1 + 1 × (−1) = 0. 3.
. The basis is called orthonormal because the vectors are of unit length and mutually orthogonal... . . .. . . which here is represented by theˆ(hat) symbol.91) 1 1 1 ˆ⟩ = √ u 2 [ ] 1 1 =√ 2 1 [ ] = 1 √ 2 1 √ 2 1 1 = √ 0⟩ + √ 1⟩. . 1⟩.⃝Riley T.15 Bases for Cn Cn has a standard basis (see 3. We must normalise it by dividing by the norm: ˆ⟩ = u [ Example Normalise u⟩ = First we ﬁnd the norm: [ ∥u⟩∥ = = Now we normalise ∥u⟩∥ to get: [ 1 ] √ [1∗ .. . .. 1⟩......8. 1 0 This is written as 0⟩.2010 . 1 1 ] ] (= 0⟩ + 1⟩). u⟩ . n − 1⟩.92) 0 . . 0 0 (3. Any other vector in the same space can be expanded in terms of 0⟩.9) which is: 0 1 0 1 . Perry 2004 .62 Vectors and Vector Spaces If we want to make an arbitrary vector a unit vector. 1∗ ] 2. There are other c The Temple of Quantum Computing ... 2 2 3. n − 1⟩.7. ∥u⟩∥ (3.
orthonormal bases in Cn and.7: A local coordinate system. We can use an orthonormal basis in R3 to separate world coordinates from a local coordinate system in 3D computer graphics.7 the local coordinate system forms an orthonormal basis. c The Temple of Quantum Computing . √ (0⟩ − 1⟩) 2 2 are often used for quantum computing. it is sometimes convenient to switch between bases. y. In ﬁgure 3. in quantum computing. Example Orthonormal bases 0⟩. 1⟩ and 1 1 √ (0⟩ + 1⟩). In this way we can transform the local coordinates system. It’s useful at this point to consider what an orthonormal basis is in R3 .⃝Riley T. Perry 2004 .2010 . for example the 3D axes (x. The ”ortho” part of orthonormal stands for orthogonal. In this system we deﬁne the position of the local coordinate system in world coordinates and then we can deﬁne the positions of individual objects in terms of the local coordinate system. The ”normal” part refers to normalised (unit) vectors.Vectors and Vector Spaces 63 z T T ¡ ¡ ¡ ¡ ¡ ¡ E Ey x ¡ ¡ ¡ Figure 3. which means the vectors are perpendicular to each other. together with everything in it while leaving the world coordinates system intact. z) are orthogonal.
v3 ⟩. u2 ⟩ = (0. i. . u1 ⟩ ∥u1 ⟩∥ (i. v1 ⟩ = and given vk+1 ⟩ for 1 ≤ k < n − 1: vk+1 ⟩ = uk+1 ⟩ − ∥uk+1 ⟩ − ∑k ∑i=1 k ⟨vi uk+1 ⟩vi ⟩ .93) i=1 ⟨vi uk+1 ⟩vi ⟩∥ Example Given the following vectors in C3 : u1 ⟩ = (i.64 Vectors and Vector Spaces 3. un ⟩ is a basis (any basis will do) for vector space V that has an inner product. √ 6 6 6 u3 ⟩ − ⟨v1 u3 ⟩v1 ⟩ − ⟨v2 u3 ⟩v2 ⟩ v3 ⟩ = ∥u ⟩ − ⟨v1 u3 ⟩v1 ⟩ − ⟨v2 u3 ⟩v2 ⟩∥ ( 3 ) i i = 0. . . i) ﬁnd an orthonormal basis v1 ⟩. . i).√ . 0. √ . vn ⟩ for V by.⃝Riley T. 2 2 v1 ⟩ = 3. i. v2 ⟩. i).2010 .8.16 The Gram Schmidt Method Suppose u1 ⟩.94) u1 ⟩ ∥u1 ⟩∥ (3. and u3 ⟩ = (0. (3. . i. The Gram Schmidt method can be used to produce an orthonormal basis set v1 ⟩. − . .95) c The Temple of Quantum Computing .17 Linear Operators A linear operator A : V → W where V and W are complex vector spaces is deﬁned as: A(αu⟩ + βv⟩) = α(A(u⟩) + β(Av⟩)). . Suppose this basis is not orthonormal.√ 3 3 3 u2 ⟩ − ⟨v1 u2 ⟩v1 ⟩ v2 ⟩ = ∥u ⟩ − ⟨v1 u2 ⟩v1 ⟩∥ ( 2 ) 2i i i = −√ . i) = √ 3 ( ) i i i = √ . .8. . (3. Perry 2004 .
2010 . 1⟩ = 1 0⟩ 3 √ + ] .96) 3.18 Outer Products and Projectors We deﬁne an outer product. (3. 2. 1. apply it to [ A= (√ A 0 1 1 0 √ ] . Perry 2004 . The result of the linear operator u⟩⟨v acting on w⟩ or.8. 0⟩ = [ 1 0 ] . √ Example Given a linear operator A. The result of multiplying u⟩ by ⟨vw⟩.97) c The Temple of Quantum Computing .Vectors and Vector Spaces 65 With dimensions n for V and m for W the linear operator can be represented by an m × n matrix.⃝Riley T. 2 1⟩: 3 [ 0 1 1 0⟩ + 3 ) [ ] (√ ) √ 0 1 2 1 2 1⟩ = 0⟩ + 1⟩ 3 3 3 1 0 [ ] √1 0 1 √3 = 2 1 0 3 √ = √ √ = 1 3 2 3 2 0⟩ + 3 √ 1 1⟩. 3 Properties: ⟨uAv⟩ is the inner product of ⟨u and Av⟩. u⟩⟨v as a linear operator A which does the following: (u⟩⟨v)(w⟩) = u⟩⟨vw⟩ = ⟨vw⟩u⟩. This can be read as. (3.
A projector P on to the subspace Vs = {00⟩. . c The Temple of Quantum Computing .99) (3. + un ⟩⟨un . Given a subspace which is spanned by orthonormal vectors. 01⟩} behaves as follows: P (α00 00⟩ + α01 01⟩ + α10 10⟩ + α11 11⟩) = α00 00⟩ + α01 01⟩.2010 . ∗ ∗ un v 1 u n v 2 Example Take Ψ⟩ = α0⟩ + β1⟩ then: Vectors and Vector Spaces ∗ . In the chapters ahead we will use projectors to deal with quantum measurements. . = 1 2 . 10⟩. . . .100) = u1 ⟩⟨u1  + u2 ⟩⟨u2  + . . 0⟩⟨0Ψ⟩ = 0⟩⟨0(α0⟩ + β1⟩) = 0⟩α = α0⟩.⃝Riley T. u2 vn . u1 vn ∗ . .66 In terms of matrices. u⟩⟨v can be represented by: ∗ ∗ u 1 v 1 u1 v 2 u1 [ ] u 2 v ∗ u2 v ∗ 1 2 u2 v ∗ v ∗ .. . Say we have a vector space V = {00⟩. . {u1 ⟩. ∗ . . . We can represent projectors with outer product notation. 01⟩. (3. . . u2 ⟩ . P projects any vector in V onto Vs (components not in Vs are discarded). 1⟩⟨0Ψ⟩ = 1⟩⟨0(α0⟩ + β1⟩) = 1⟩α = α1⟩. un vn .98) 1⟩⟨1Ψ⟩ = 1⟩⟨1(α0⟩ + β1⟩) = 1⟩β = β1⟩. Perry 2004 . . . . . un ⟩}. . 0⟩⟨1Ψ⟩ = 0⟩⟨1(α0⟩ + β1⟩) = 0⟩β = β0⟩. 11⟩}. . A projection on to this subspace can be represented by a summation of outer products: P = n ∑ i=1 ui ⟩⟨ui  (3.
0 1 [ ] 1 [ ∗ ∗ 0⟩⟨0 = 1 0 0 [ ] 1 0 = .2010 . c The Temple of Quantum Computing .⃝Riley T. as shown in the next example. Perry 2004 . We can also represent a matrix (an operator for example) using outer product notation. Example Representing operators X and Z. but it turns out they are quite handy for quantum computing. These two matrices are deﬁned below. ] [ 1 0 Z= 0 −1 = 0⟩⟨0 − 1⟩⟨1. 0 0 [ ] 0 [ ∗ ∗ 1⟩⟨0 = 1 0 1 [ ] 0 0 = . we can replace the projector notation P with the explicit outer product notation: (00⟩⟨00 + 01⟩⟨01)(α00 00⟩ + α01 01⟩ + α10 10⟩ + α11 11⟩) = α00 00⟩ + α01 01⟩. We’ll be using them frequently in the chapters ahead: [ ] 1 [ ∗ ∗ 0⟩⟨1 = 0 1 0 ] [ 0 1 = . 0 0 [ ] 0 [ ∗ ∗ 1⟩⟨1 = 0 1 1 [ ] 0 0 = . 1 0 [ X= ] ] ] ] ] 0 1 1 0 = 0⟩⟨1 + 1⟩⟨0.Vectors and Vector Spaces 67 So.
Each component u⟩ ⟨u of P is hermitian and P itself is hermitian (see 3.8.98. The completeness relation (3.8. (3. Perry 2004 . and we’ll use M m to represent a measurement. . .⃝Riley T.e. .24).2010 . . . . .102) Later we’ll look at quantum measurements. By 3. . d⟩ in 3. P † = P (Seethenextsectionontheadjoint). d⟩ . k⟩ then V = 1⟩ . Example An adjoint.105) (3.101) Given a subspace Vs = 1⟩ . P 2 = P.106) (3. . . M m = P ) for measurement then the probability of measuring m is: † pr(m) = ⟨Ψ Mm Mm Ψ⟩ . . .101 we can say that this is equivalent to: pr(m) = ⟨Ψ Mm Ψ⟩ .100 and 3.68 Properties: ∑ i Vectors and Vector Spaces i⟩⟨i = I for any orthonormal basis {i⟩}. Q = I − P is called the orthogonal complement and is a projector onto k + 1⟩ .103) (3. [ 1+i 1−i −1 1 ]† = [ 1 − i −1 1+i 1 ] . . k⟩ k + 1⟩ . .19 The Adjoint The adjoint A† is the matrix obtained from A by conjugating all the elements of A (to get A∗ ) and then forming the transpose: A† = (A∗ )T . . 3.104) (3.107) c The Temple of Quantum Computing . (3. If we use a projector (i. .
(A† )† = A. Given. (Au⟩)† = ⟨uA† but not Au⟩ = ⟨uA† .111) (3. 69 (3.Vectors and Vector Spaces Properties: ⟨uAv⟩ = ⟨A† uv⟩. Perry 2004 . v⟩ = [ Av⟩ = [ = ⟨uAv⟩ = 2.110) (3. c The Temple of Quantum Computing . ][ 1 i ] 1 + 2i 1 − 2i ] [ 1 1 ] = 2. (u⟩)† = ⟨u.⃝Riley T.112) (3. (αA + βB)† = α∗ A† + β ∗ B † .113) 1+i 1−i −1 ] 2 0 1 . [ u⟩ = 1 i ] .109) (3. (AB)† = B † A† .2010 .108) (3. 1 − i −1 1+i 1 − 2i 1 + 2i 1 ] . [ A† u⟩ = [ = ⟨A† uv⟩ = [ [ 1 1 ] and A = ][ [ 1+i 1−i −1 1 1 ] 1 ] . Example Example of ⟨uAv⟩ = ⟨A† uv⟩.
Perry 2004 .114) Note: The eigenvectors that match different eigenvalues are linearly independent. more than one eigenvector. Properties: A’s ith eigenvalue λi has eigenvector ui ⟩ iff Aui ⟩ = λi ui ⟩. An eigenspace for λi is the set of eigenvectors that satisﬁes Auj ⟩ = λi uj ⟩.116) (3. We can then solve the characteristic polynomial to ﬁnd all the eigenvalues for A. Solving the characteristic equation gives us the characteristic polynomial of A.70 Vectors and Vector Spaces 3.20 Eigenvalues and Eigenvectors The complex number λ is an eigenvalue of a linear operator A if there exists vector u⟩ such that: Au⟩ = λu⟩ where u⟩ is called an eigenvector of A. c The Temple of Quantum Computing . called the characteristic equation of A: c(λ) = det(A − λI) = 0. here j is the index for eigenvectors of λi . (3. An example is on the next page. An eigenspace is degenerate when it has dimension > 1 i. If A is an n × n matrix.e.⃝Riley T.117) (3. This comes from noting that: Au⟩ = λu⟩ ⇔ (A − λI)u⟩ = 0 ⇔ A − λI is singular ⇔ det(A − λI) = 0.115) (3.118) (3.8. which means we can have an orthonormal set of eigenvectors for an operator A. Eigenvalues of A can be found by using the following equation. there will be n eigenvalues (but some may be the same as others).2010 .
e. If we use the eigenvalue of λ = −1 to determine the corresponding eigenvector λ−1 ⟩ of X we get: [ Xλ−1 ⟩ = −1λ−1 ⟩ ][ ] [ ] 0 1 α −α = 1 0 β −β [ ] [ ] β −α = . n ∑ i=1 aii (3.2010 .8. so after normalisation our eigenvector is: 1 1 λ−1 ⟩ = √ 0⟩ − √ 1⟩. α −β We get α = −β.119) c The Temple of Quantum Computing . the sum of its diagonal entries.21 Trace The trace of A is the sum of its eigenvalues. This is the characteristic polynomial.⃝Riley T. ] [ 0 1 . or: tr(A) = i. 3. 2 2 Notice that we’ve used the eigenvalue λ = −1 to label the eigenvector λ−1 ⟩. The two solutions to λ2 − 1 = 0 are λ = −1 and λ = +1. X= 1 0 [ det(X − λI) = −λ 1 ] 71 1 −λ = λ2 − 1.Vectors and Vector Spaces Example Eigenvalues and eigenvectors of X. Perry 2004 .
Perry 2004 . tr(U † AU ) = tr(A).8.⃝Riley T.131) (3. tr(Au⟩⟨u) = ⟨uAu⟩ if u⟩ is unitary.126) (3.124) Similarity transform for U (3. ] .123) (3. For I we have tr(I) = 2.24 below)..132) (3. tr(αA) = αtr(A). tr(U AU † ) = tr(A).72 Example Trace of X and I [ X= [ I= 0 1 1 0 1 0 0 1 ] .120) (3.130) (3.127) As stated. c The Temple of Quantum Computing . tr(u⟩⟨v) = ⟨uv⟩. Vectors and Vector Spaces tr(X) = 0 + 0 = 0 or the sum of the eigenvalues 1 + (−1) = 0. the trace of A is the sum of its eigenvalues. tr(AB) = tr(BA).. For unit norm u⟩: tr(u⟩⟨u) = tr(u⟩⟨uu⟩⟨u) = ⟨uu⟩⟨uu⟩ = ⟨uu⟩⟨uu⟩ = u⟩4 = 1.128) (3.129) (3. (3. tr(α(A + B)) = αtr(A) + αtr(B).121) (3.2010 . U † AU = λn which also has a trace which is the sum the eigenvalues of A as tr(U † AU ) = tr(A) (see section 3.122) (3. . We can also say that: λ1 . Properties: tr(A + B) = tr(A) + tr(B).125) (3.
135) (3. hermitian.134) .133) The class of normal operators has a number of subsets. These include unitary. The relationships between these operators is shown in ﬁgure 3.2010 (3.8.8: Relationships between operators.⃝Riley T.22 Normal Operators A normal operator satisﬁes the following condition: AA† = A† A. c The Temple of Quantum Computing . and positive operators. Eigenvectors of unitary matrices have a modulus of 1: ∥U u⟩∥ = ∥u⟩∥ ∀ u⟩.23 Unitary Operators Matrix U is unitary (unitary operators are usually represented by U ) if: U −1 = U † or.8.Vectors and Vector Spaces 73 Normal Unitary Hermitian Positive Figure 3. Perry 2004 . U U † = U † U = I. (3.136) (3.8. 3. 3. In the following sections we’ll look at some of the important normal operators.
We’ve seen some of them already. 1 0 1 0 0 1 ] ] [ ][ [ 1 0 0 −i 0 −i .74 Vectors and Vector Spaces Unitary operators have the property that they preserve norm.140) (3.2010 . = ZZ † = Z 2 = 0 1 0 −1 0 −1 Note: I = I † . The Pauli operators are deﬁned as: [ I= [ X= [ Y = [ Z= 1 0 0 1 0 1 1 0 ] . and Z are unitary because: [ ][ ] [ ] 1 0 1 0 1 0 II † = I 2 = = . and Z = Z † .⃝Riley T. ] . X.139) (3. X. where σ1 = σX = X. 0 1 0 1 0 1 [ ][ ] [ ] 0 1 0 1 1 0 XX † = X 2 = = . = YY† =Y2 = 0 1 i 0 i 0 ] ] [ ][ [ 1 0 1 0 1 0 . Y. c The Temple of Quantum Computing . In some texts X. Y = Y † . ] . There are some particularly important operators called the Pauli operators. Perry 2004 . and σ3 = σZ = Z.137) 0 −i i 1 0 0 0 −1 Example I.138) (3. X = X † . they are referred to by the letters I. Y. σ2 = σY = Y. (3. and Z are referred to by another notation. Y. and Z. and are invertible. ] .
(3. Unitary matrices allow for spectral decomposition. Au⟩) > 0 ∀u⟩ in V (all positive eigenvalues).Vectors and Vector Spaces Properties (of unitary operators): U= ∑ j 75 j⟩⟨j. (see section 3. c The Temple of Quantum Computing .8.149) (3. Unitary matrices preserve norm ∥U u⟩∥ = ∥u⟩∥. Unitary matrices are also normal. i (3.141) (3.142) (3. Given an orthonormal basis set {ui ⟩}. Perry 2004 .27). U v⟩) = ⟨uU † U v⟩ = ⟨uv⟩. {U ui ⟩} = {vi } ∑ is also an orthonormal basis with U = vi ⟩⟨ui . Unitary matrices allow for reversal.148) (3. U † (U u⟩) = Iu⟩ = u⟩. Unitary matrices preserve inner product (U u⟩. If(u⟩.⃝Riley T.150) Unitary matrices have eigenvalues of modulus 1.144) (3.143) (U u⟩. U v⟩) = (u⟩.e.146) (3. v⟩) = ⟨uv⟩.2010 . i.145) (3.147) (3.
1 0 1 0 Properties: A = B + iC can represent any operator if B and C are hermitian with C = 0 if A itself is hermitian.155) (3.154) (3.8. (3.152) (3. ⟨uAu⟩ ∈ R and ⟨uAu⟩ ≥ 0. If A is hermitian then A is a positive operator iff for u⟩.157) c The Temple of Quantum Computing . X † = . If A is hermitian then for u⟩.153) 3. .156) The vectors ui ⟩ form an orthonormal set of eigenvectors for A. Example The matrix X is Hermitian because: [ ] [ ] 0 1 0 1 X= =.8. (3.151) The eigenvalues of a hermitian matrix are real numbers and hermitian matrices are also normal (although not all normal matrices need real eigenvalues).. This is the same as saying that A can be transformed to: λ1 .76 Vectors and Vector Spaces 3. (3. λn (3.24 Hermitian and Positive Operators A hermitian matrix A has the property: A = A† . with eigenvalues of λi . If A is positive it has no negative eigenvalues. ⟨uAu⟩ ∈ R..25 Diagonalisable Matrix An operator A is diagonalisable if: A= ∑ i λi ui ⟩⟨ui . Perry 2004 .⃝Riley T.2010 .
2 2 Which expanded is: 1 1 ([⟨00⟩ + ⟨01⟩ + ⟨10⟩ + ⟨11⟩]) − ([⟨00⟩ − ⟨01⟩ − ⟨10⟩ + ⟨11⟩]). we say A and B anticommute if {A. 2 2 2 2 The two vectors are orthogonal (with eigenvalues −1 and +1). B} = 0. Perry 2004 .2010 (3. c The Temple of Quantum Computing . The two normalised eigenvectors for X are: 1 1 1 1 √ 0⟩ − √ 1⟩ and √ 0⟩ + √ 1⟩. A and B commute (AB = BA) if [A.159) (3. Commutator: [A.158) .⃝Riley T. So X is diagonalisable and is given by: 1 1 X = [0⟩ + 1⟩][⟨0 + ⟨1] − [0⟩ − 1⟩][⟨0 − ⟨1].26 The Commutator and AntiCommutator Here is a set of properties for the Commutator and AntiCommutator which relate to commutative relationships between two operators A and B. B} = AB + BA. 2 2 3. B] = AB − BA.8. Anticommutator: {A. [ ][ ] 1 1 1 1 1 √ 0⟩ − √ 1⟩ √ 0⟩ + √ 1⟩ = [⟨00⟩ − ⟨01⟩ + ⟨10⟩ − ⟨11⟩] 2 2 2 2 2 1 = [1 − 0 + 0 − 1] 2 = 0. B] = 0.Vectors and Vector Spaces Example Representing operator X: [ X= 77 0 1 1 0 ] .
HB so: HA = ∑ i λi i⟩⟨i and HB = ′ ∑ i λi i⟩⟨i. 2 [A. Z] = − 1 0 0 −1 0 −1 1 0 [ ] 0 −2 = 2 0 ̸= 0. Properties: AB = [A. B † ]. HB are hermitian. Perry 2004 . c The Temple of Quantum Computing .8.160) i. HB ] is hermitian if HA .162) (3. [HA . So X and Z do not commute. HB ] = 0 if ∃ a set of orthonormal eigenvectors for both HA . ′′ (3. B] = −[B. the same input and output dimension) then there exist unitaries UA and UB . and D a diagonal matrix with nonnegative elements in R such that A = UA DUB .161) (3. Single value decomposition says that if a linear operator A that is a square matrix (i. (3. A]. B]† = [A† . B} . [HA .e. they are both diagonal in a common basis.⃝Riley T.78 Vectors and Vector Spaces Example We test X and Z against the commutator.27 Polar Decomposition Polar decomposition says that any linear operator A can be represented as A = √ √ U A† A (called the left polar decomposition) = AA† U (called the right polar decomposition) where U is a unitary operator.163) (3.164) 3. B] + {A. [A. The simultaneous diagonalisation theorem says that if HA and HB are hermitian.2010 .e. [ ][ ] [ ][ ] 0 1 1 0 1 0 0 1 [X.
8.⃝Riley T. The elements of the smaller vector spaces are combined whilst preserving scalar multiplication and linearity. Perry 2004 . ] [ 0 1 X= 1 0 = +⟩⟨+ − −⟩⟨−.8. we get back X: [ ] [ ] 1 1 1 1 +⟩⟨+ − −⟩⟨− = [11] − [1 − 1] 2 1 2 −1 [ ] [ ] 1 1 1 −1 1 1 = − 2 1 1 2 −1 1 [ ] 0 1 = .167) 3. and −1 Then.29 Tensor Products In a tensor product we have a combination of two smaller vector spaces to form a larger one. a (3. if we expand. ∑ If A is normal then it has a spectral decomposition of a⟩⟨a. [ ] 1 0 Z= 0 −1 = 0⟩⟨0 − 1⟩⟨1.Vectors and Vector Spaces 79 3. X has eigenvectors +⟩ = 1 √ 0⟩ 2 + 1⟩.2010 . 1 0 Properties: A = U DU † where U is a unitary and D is a diagonal operator.166) (3. and −⟩ = 1 √ 0⟩ 2 − 1⟩ and eigenvalues of +1.28 Spectral Decomposition A linear operator is normal (A† A = AA† ) iff it has orthogonal eigenvectors and the normalised (orthonormal) versions {ui } of the eigenvectors can diagonalise the operator: A= ∑ i λi ui ⟩⟨ui . formally: c The Temple of Quantum Computing . (3.165) Example Spectral decomposition of X and Z.
2010 . Perry 2004 . 1⟩ ⊗ 0⟩ = 1⟩0⟩ = 1.170) by . and Y [ ] [ ] 0 1 0 −i X= and Y = . The Kronecker product is deﬁned as: [ A⊗B = [ = ] ⊗ [ ] (3. Example A Kronecker product on Pauli matrices X.⃝Riley T. 0 0 c The Temple of Quantum Computing .168) a b c d x y v w ] a·B b·B c·B d·B ax ay bx av aw bv bw = cx cy dx dy cv cw dv dw where A and B are linear operators.80 Vectors and Vector Spaces If {u⟩} and {v⟩} are bases for V and W respectively then {u⟩ ⊗ v⟩} form a basis for V ⊗ W .169) (3. Example A simple tensor product. v⟩ = uv⟩.171) (3. 1 0 i 0 [ X ⊗Y = [ = 0·Y 1·Y 1·Y ] 0·Y ] ][ 0 −i 0 1 1 0 0 0 i 0 0 −i 0 0 1 = 0 −i 0 i 0 0 0 . (3. We can write this in the following way: u⟩ ⊗ v⟩ = u⟩v⟩ = u. 0⟩ = 10⟩.
αv⟩. NA ⊗ NB will be normal. v⟩) = αu. .⃝Riley T. ⊗ u⟩)k k times.178) (3. For positive operators PA and PB .180) (3. v1 ⟩ + u. 81 (3. PA ⊗ PB will be positive. v2 ⟩.177) (3.172) (3. For linear operators A and B.185) (3. unlike the basic Fourier transform.179) (3. For normal operators NA and NB .184) (3. u1 + u2 . v⟩ = u. v ′ ⟩) = ⟨uu′ ⟩⟨vv ′ ⟩.9 Fourier Transforms The Fourier transform. does not involve calculus and can be directly implemented on computers but is limited to periodic functions. (A ⊗ B)† = A† ⊗ B † .174) (3. u′ ⟩)(v⟩. v⟩ = u1 .9). Perry 2004 .2010 . For unitary operators UA and UB . For hermitian operators HA and HB . The discrete Fourier transform (DFT) is a version of the Fourier transform which.Fourier Transforms Properties: Tensor products are related to the inner product: (uv⟩. uv⟩ ̸= vu⟩.186) (3.182) (3. u′ v ′ ⟩) = (u⟩.175) (3.173) u⟩⊗k = (u⟩ ⊗ . .183) (3. HA ⊗ HB will be hermitian. which is named after Jean Baptiste Joseph Fourier. u. c The Temple of Quantum Computing . The Fourier transform itself is not limited to periodic functions. v⟩ + u2 . (3. v⟩. α(u. v1 + v2 ⟩ = u. 1768 . maps data from the time domain to the frequency domain. UA ⊗ UB will be unitary.1830 (ﬁgure 3. (A ⊗ B)T = AT ⊗ B T .181) (3.176) (3. A ⊗ B(uv⟩) = Au⟩ ⊗ Bv⟩. (A ⊗ B)∗ = A∗ ⊗ B ∗ . ab⟩† = ⟨ab.187) 3.
One way to describe an orthonormal basis is: That which you measure against.5. In fact. For example. an and b0 . . We can represent any periodic. suppose we’ve found a1 = 0. . a1 .2010 . as this is only meant to be a brief introduction to the Fourier series. b1 . . .82 Fourier Transforms Figure 3.9: Jean Baptiste Joseph Fourier. . bn and the number of sines and cosines. a4 = 2 and b2 = 4 and all the rest are 0.1 The Fourier Series Representing a periodic function as a linear combination of sines and cosines is called a Fourier series expansion of the function. We won’t go into the derivation of these coefﬁcients (or how to ﬁnd the number of sines and cosines) here. . The fourier series has the form: ∞ ∞ ∑ a0 ∑ f (t) = + an sin(nt) + bn cos(nt). 3. sin and cos form an orthonormal basis for the time domain based representation of a waveform. then the Fourier series is: f (t) = 0. 2 n=1 n=1 (3. Perry 2004 .5 sin(πt) + 2 sin(4πt) + 4 cos(2πt) which is represented by the following graph: c The Temple of Quantum Computing .9. .188) So if we have a waveform we want to model we only need to ﬁnd the coefﬁcients a0 . The deﬁnition will be enough. . like 0⟩ and 1⟩ forms an orthonormal basis for quantum computing. continuous function as a linear combination of sines and cosines.⃝Riley T.
⃝Riley T.5 sin(πt) 4 2 0 −2 −4 −6 0 1 2 3 4 5 c The Temple of Quantum Computing . Perry 2004 . it’s helpful to look at them graphically: 6 0.Fourier Transforms 8 6 4 2 0 −2 −4 −6 −8 0 1 2 3 4 5 0. Again.2010 .5 sin(πt) + 2 sin(4πt) + 4 cos(2πt) 83 The function f (t) is made up of the following waveforms. and 4 cos(2πt). 2 sin(4πt). 0.5 sin(πt).
⃝Riley T.5 sin(πt) 2 sin(4πt) 4 cos(2πt) 1 2 Cosine Amplitude 0 0 4 Frequency 2 1 2 2 0 1 We can also rewrite the sinusoids above as a sum of numbers in complex. exponential form. Perry 2004 .2010 .84 6 Fourier Transforms 2 sin(4πt) 4 2 0 −2 −4 −6 0 1 2 3 4 5 6 4 cos(2πt) 4 2 0 −2 −4 −6 0 1 2 3 4 5 If we analyse the frequencies and amplitudes of the components of f (t) we get the following results [Shatkay. 1995]: Waveform Sine Amplitude 0. c The Temple of Quantum Computing . H.
Fourier Transforms
85
3.9.2 The Discrete Fourier Transform
The DFT maps from a discrete, periodic sequence tk to a set of coefﬁcients representing the frequencies of the discrete sequence. The DFT takes as input and outputs an array of complex numbers. The number of elements in the array is governed by the sampling rate and the length of the waveform. Formally, The N complex numbers t0 , ..., tN −1 are transformed into the N complex numbers f0 , ..., fN − 1 according to the formula:
N −1 ∑ k=0
fj =
tk e− N
2πi
jk
j = 0, . . . , N − 1.
(3.189)
The DFT is a linear operator with an invertible matrix representation, so we can take the conversion back to its original form using:
N −1 2πi 1 ∑ fj e N kj N j=0
tk =
k = 0, . . . , N − 1.
(3.190)
We have chosen to represent our periodic functions as a sequence of sines and cosines. To use the above formulas they need to be converted to complex, exponential form. Because the sequence we are after is discrete we need to sample various points along the sequence. The sample rate N determines the accuracy of our transformation. With the lower bound on the sampling rate being found by applying Nyquist’s theorem (which is beyond the scope of this paper). Let’s look at doing a DFT on f (t) = 0.5 sin(πt) + 2 sin(4πt) + 4 cos(2πt) and adjust the sampling rate until we get an acceptable waveform in the frequency domain: The graph below is just f (t) = 0.5 sin(πt) + 2 sin(4πt) + 4 cos(2πt) with sampling points at the whole numbers (1, 2, . . . , N ) as you can see if we only sample at this point we get no notion of a wave at all.
c The Temple of Quantum Computing  ⃝Riley T. Perry 2004  2010
86 6
Fourier Transforms
0.5 sin(πt) + 2 sin(4πt) + 4 cos(2πt) 4 2 0 −2 −4 −6 0 2 4 6 8 10 12
Instead of adjusting the sample rate to be fractional, we just have to adjust the function slightly, which just makes the xaxis longer but retains our wave. The function now looks like this: ( ) ( ) ( ) t t t f (t) = 0.5 sin π + 2 sin 4π + 4 cos 2π . 2 2 2 So we are effectively sampling at twice the rate. 6
t t t 0.5 sin(π 2 ) + 2 sin(4π 2 ) + 4 cos(2π 2 )
4 2 0 −2 −4 −6 0 2 4 6 8 10 12
c The Temple of Quantum Computing  ⃝Riley T. Perry 2004  2010
Fourier Transforms
87
Below we show a sampling rate of 50 times the original rate and our waveform looks good, the function now looks like this: ( ) ( ) ( ) t t t f (t) = 0.5 sin π + 2 sin 4π + 4 cos 2π . 50 50 50 8 6 4 2 0 −2 −4 −6 −8 0 50 100 150 200 250
t t t 0.5 sin(π 50 ) + 2 sin(4π 50 ) + 4 cos(2π 50 )
t t t Finally, here is f (t) = 0.5 sin(π 50 ) + 2 sin(4π 50 ) + 4 cos(2π 50 ) after it has been put
through the DFT, it is now in the frequency domain: 50
t t t DFT(0.5 sin(π 50 ) + 2 sin(4π 50 ) + 4 cos(2π 50 ))
40 30 20 10 0
0
20
40
60
80
100
120
Later, in chapter 7, we’ll see how the quantum analogue of the DFT (called the quantum fourier transform) can be used for quantum computing. c The Temple of Quantum Computing  ⃝Riley T. Perry 2004  2010
Chapter 4 Quantum Mechanics
Quantum mechanics is generally about the novel behaviour of very small things. At this scale matter becomes quantised, this means that it can be subdivided no more. Quantum mechanics has never been wrong, it explains why the stars shine, how matter is structured, the periodic table, and countless other phenomena. One day scientists hope to use quantum mechanics to explain everything, but at present the theory remains incomplete as it has not been successfully combined with classical theories of gravity. Some strange effects happen at the quantum scale. The following effects are important for quantum computing: • Superposition and interference • Uncertainty • Entanglement This chapter is broken into two parts. In the ﬁrst part we’ll look brieﬂy at the history of quantum mechanics. Then, in the second part we will examine some important concepts (like the ones above) of quantum mechanics and how they relate to quantum computing. The main references used for this chapter are, Introducing Quantum Theory by J.P. McEvoy and Oscar Zarate, and Quantum Physics, Illusion or Reality by Alastair Rae. Both of these are very accessible introductory books. 89
1564 . this is Galileo’s principle of inertia). 1452 .⃝Riley T. Nicolaus Copernicus.1) and Isaac Newton’s mechanics. optics and mathematics.1: James Clerk Maxwell and Isaac Newton. all nonuniform motion and action is caused by something (uniform motion doesn’t need a cause.1727 (ﬁgure 4. i. Newton’s contributions include work on gravity.1519) by testing their theories with observation and experimentation.1039.1) is arguably the most important scientist of all time due to the large body of work he produced that is still relevant today.1 History 4. they are: • The universe is a giant machine. Perry 2004 . • Determiznism. Alhazen 965 .1 Classical Physics Classical physics roughly means pre20th century physics.1879 (ﬁgure 4. Prior to this. we can say exactly what it has been and what it will be at any time.e.2010 . Classical physics has a number of fundamental assumptions. Isaac Newton. 1831 .2) contributed greatly to the development of the modern scientiﬁc method (we might also include Leonardo Davinci.1543 and Galileo Galilei.1. if a state of motion is known now then because the universe is predictable. 4. • Cause and effect. Two of the most important classical theories are electromagnetism. the uniﬁcation of electricity and magnetism by James Clerk Maxwell. 1642 .90 History Figure 4. 1473 . or prequantum physics.1642 (ﬁgure 4. c The Temple of Quantum Computing .
2 Important Concepts In the lead up to quantum mechanics there are some important concepts from classical physics that we should look at. The ﬁrst major breakthrough was in 1806 when John Dalton. 1766 . It’s all proven. The idea was dismissed as a waste of time by Aristotle. or is it? No. the above assumptions do not hold for quantum mechanics.3).2010 . but they are distinct. Atoms Atoms are deﬁned as indivisible parts of matter ﬁrst postulated by Democritus. thermodynamics.322 BC) but two thousand years later the idea started gaining acceptance. c The Temple of Quantum Computing .⃝Riley T. These are the concepts of atoms.2: Nicolaus Copernicus and Galileo Galilei. These are four equations that describe all electric and magnetic phenomena.370 BC (ﬁgure 4.3) predicted properties of elements and compounds using the atomic concept.History 91 Figure 4. and statistical analysis. • Light is a wave that is completely described by a set of wave equations created by Maxwell. 4. Perry 2004 . (384 .1844 (ﬁgure 4.1. • Particles and waves exist. • We can measure any system to an arbitrary accuracy and correct for any errors caused by the measuring tool. 460 .
Thermodynamics Thermodynamics is the theory of heat energy.3: Democritus and John Dalton. Heat is understood to be disordered energy. if solid. e. Thermodynamics is made up of two laws: here are the first two: three laws. c The Temple of Quantum Computing .⃝Riley T. how fast they are vibrating about their ﬁxed positions in the solid). • The ﬁrst law of thermodynamics In a closed system.92 History Figure 4. the heat energy in a gas is the kinetic energies of all the molecules.4: Hermann von Helmholtz and Rudolf Clausius. Perry 2004 . whenever a certain amount of energy disappears in one place an equivalent amount must appear elsewhere in the system is some form.2010 . The temperature is a measure of how fast the molecules are travelling (if a gas or liquid. Figure 4.g.
2010 .5: Maxwell distribution.4). all parts of the system are at the same temperature).e. This law of conservation of energy was originally stated by Herman Von Helmholtz. 1822 . He introduced a new concept. • The second law of thermodynamics Rudolf Clausius. 1996.⃝Riley T.History 93 a n b c v Figure 4.4) called the previous law the ﬁrst of two laws. c The Temple of Quantum Computing .1894 (ﬁgure 4. A. entropy which in terms of heat transfer is: The total entropy of a system increases when heat ﬂows from a hot body to a cold one. p. Heat always ﬂows from hot to cold [Rae.18]. So this implies that an isolated system’s entropy is always increasing until the system reaches thermal equilibrium (i.1888 (ﬁgure 4. Perry 2004 . 1824 .
94 History Figure 4. 400K.C. Perry 2004 . and are free to move.5.⃝Riley T. a measure of energy and K stands for Kelvin. and c represent molecules at 100K. In the 1870s Ludwig Boltzmann. The v axis denotes velocity. Maxwell. The letters a.1906 (ﬁgure 4.6) generalised the theory to any collection of entities that interact randomly. to measure this disorder we consider the number of conﬁgurations or states that the collection of atoms can be in. the graph’s n axis denotes the number of molecules (this particular graph shows CO2 ).3 Statistical Mechanics In 1859. 4.2010 . b. J. 1844 .1) where k is Boltzmann’s constant k = 1. remember hotter molecules tend to go faster. Here J stands for Joule. If this number is W then the entropy S is deﬁned as: S = k log W (4. which is important for quantum c The Temple of Quantum Computing . So the behaviour of ”large things” could now be predicted by the average statistical behaviour of the their smaller parts. and 1600K respectively.38 × 10−23 J/K. He rewrote the second law of thermodynamics to say: As the energy in a system degrades the system’s atoms become more disordered and there is an increase in entropy.1. a unit of temperature. are independent. The graph is shown in ﬁgure 4.6: Ludwig Boltzmann and Niels Bohr. using the atomic model. came up with a way of statistically averaging the velocities of randomly chosen molecules of a gas in a closed system like a box (because it was impossible to track each one).
The old quantum theory was developed in some part to explain the results of three experiments which could not be explained by classical physics. a statistical improbability that may seem nonsensical but nonetheless the theory must cater for it. and their subsequent explanations are described in the next three sections. They found the frequency distributions to be similar to Maxwell’s velocity distributions. For example. radiation) to escape for observation. Perry 2004 .1.g. they are: • Black body radiation. the element of your electric stove goes from red hot to c The Temple of Quantum Computing . a kind of oven with a little hole for a small amount of heat (light. To determine the temperature of a black body we have to observe the radiation emitted from it. Black Body Radiation A black body absorbs all electromagnetic radiation (light) that falls on it and would appear black to an observer because it reﬂects no light. if we have a box containing a gas a ﬂuctuation could be all particles of the gas randomly clumping together in one corner of the box. These experiments. • The Photoelectric effect. and the ultraviolet catastrophe.1962 (ﬁgure 4. 4. There also remains the probability that a ﬂuctuation can occur.2010 .⃝Riley T. The new quantum theory began in 1925.8) measured the distribution of radiation and energy over frequency in a cavity. This is called old quantum theory. 1885 .6) and ending in about 1924.History 95 mechanics. The colour of the light emitted is dependent on the temperature.1947. E. 1858 . (ﬁgure 4. • Bright Line Spectra. Because the radiation is conﬁned in the cavity it settles down to an equilibrium distribution of the molecules in a gas.4 Important Experiments There are two major periods in the development of quantum theory. the ﬁrst culminating in 1913 with the atomic model of Niels Bohr. Max Planck.
If nature did indeed behave in this way you would get singed sitting in front of a ﬁre by all the ultraviolet light coming out of it.e. f is frequency and h is Planck’s constant which is: h = 0. This means that as the temperature was raised the radiation should keep getting stronger and stronger indeﬁnitely. Classical theory predicted that the energy of the released electron should depend on the intensity of the incident light wave. (4. It didn’t take long for physicists to apply a Maxwell style statistical analysis to the waves of electromagnetic energy present in the cavity.5 The Photoelectric Effect If a light is shone onto certain kinds of material (e. i. Planck imagined that the waves emitted from the black body were produced by a ﬁnite number of tiny oscillators (a kind of precursor to modern atoms).1.2) 4.66260688 × 10−34 J/s. Which ﬁnally gives us the ﬁrst important formula for quantum mechanics: E = hf where E is energy. (4. The results of several experiments had given the correct frequency distributions and it was Max Planck who found a formula that matched the results. Perry 2004 . Eventually he had to divide the energy into ﬁnite chunks of a certain size to ﬁt his own radiation formula. When this effect was examined it was found that the results of the experiments did not agree with classical electromagnetic theory.3) Where J/s = Joules per second.⃝Riley T. However it was found that the energy released was dependent not on intensity (an electron c The Temple of Quantum Computing .2010 .96 History white hot as the temperature increases. the frequency gets higher.00000000000000000000000000000000066260688J/s = 6. so grudgingly he used Boltzmann’s version of the second law of thermodynamics. The difference being is that classical physics saw waves as continuous which means that more and more waves could be packed into a ”box” as the wavelengths get smaller. This was called the ultraviolet catastrophe. fortunately this doesn’t occur so the catastrophe is not in nature but in classical physics which predicted something that doesn’t happen. some metals or semi conductors) then electrons are released. He couldn’t ﬁnd a classical solution.g.
This is called an absorbtion spectrum.1. so the electron is ejected from the metal.6 Bright Line Spectra When a solid is heated and emits white light then.⃝Riley T. with dark regions in between. If a cold gas is placed between a hot solid emitting white light and the prism we get the inverse of the above. Albert Einstein. shown below. would come out no matter how low the intensity was) but on the frequency of the light. Perry 2004 .1955 (ﬁgure 4. c The Temple of Quantum Computing . 4. The spectrum for this. which is called an emission spectrum is shown below. Put simply a light particle hits the metal’s surface and its energy is transferred to an electron and becomes kinetic energy. With different kinds of metals it can be easier or harder for electrons to escape.7) showed that if we look at the light as a collection of particles carrying energy proportional to the frequency (as given by Planck’s law E = hf ) and if those particles can transfer energy to electrons in a target metal then the experimental results could be explained.7: Albert Einstein and Johann Jakob Balmer.History 97 Figure 4. we get a rainbow like spectrum (continuous spectrum) like the following: If we do the same thing with a hot gas emitting light then the spectrum consists of a number of bright lines that have the colours of the rainbow above.2010 . 1879 . if that light is concentrated and broken up into the separate colours by a prism.
7 Proto Quantum Mechanics During the last part of the 19th century it was discovered that a number of ”rays” were actually particles. One of these particles was the electron. c The Temple of Quantum Computing . In a study of cathode ray tubes Thompson showed that electrically charged particles (electrons) are emitted when a wire is heated.8).98 History Figure 4. Perry 2004 . In 1885 Johann Jakob Balmer.8: Max Planck and Joseph J.4) where R is the Rydberg constant of 3. The explanation came in 1913 with Niels Bohr’s atomic model.10). 4.1898 (ﬁgure 4. discovered by Joseph J. These lines are different for each element. and they allow us to determine the composition of a gas even at astronomical distances. by observing its spectrum. Thomson.1.29163 × 101 5 cycles/second and nf and ni are whole numbers. Thomson went on to help develop the ﬁrst model of the atom which had his (negatively charged) electrons contained within a positively charged sphere (ﬁgure 4. 1825 .⃝Riley T. The trouble was that no one knew how to explain the formula.7) derived a formula for the spectral lines of Hydrogen. Which is: ) ( 1 1 − 2 f =R n2 ni f (4.2010 . The hot gas is emitting light at certain frequencies and example three shows us that the cold gas is absorbing light at the same frequencies. 1856 . Thomson.1940 (ﬁgure 4.
2010 .11: Rutherford’s atomic model.9: Ernest Rutherford and Arnold Sommerfeld. c The Temple of Quantum Computing .⃝Riley T.+ + . + very small nucleus  Figure 4.+ +.10: Thomson’s atomic model. Perry 2004 .+ .+ .+ Figure 4. + + .History 99 Figure 4.
n (see ﬁgure 4. if the electron jumped from a stationary state to one of lower energy then the transmission was accompanied by the emission of a photon. Perry 2004 . the shell number.11). 1871 .⃝Riley T. To explain this Niels Bohr assumed that the atom could exist in only certain stationary states . Ernest Rutherford. in 1907.100 History This ﬁrst atomic model was called the Christmas pudding model. c The Temple of Quantum Computing . But this did not happen: atoms were stable. The frequency of the light emitted as a jump was given by Einstein’s formula: f= E h (4. Then the calculated frequencies were found to agree with those observed. so this restored stability to the atom.1937 (ﬁgure 4.stationary because. which was found by ﬁring alpha particles (Helium ions) at gold foil and observing that. called the ground state below which the electron could not jump. He gave us the ﬁrst of several quantum numbers which are useful in quantum computing. subject to centripetal acceleration (the electron is attracted by the positively charged nucleus) would radiate energy and so rapidly spiral in towards the nucleus. However. very occasionally. So Bohr developed a model based on stable orbital shells which only gave a certain number of shells to each atom. These energies of the stationary states could be calculated from classical physics if one additional assumption was introduced: that the orbital angular momentum was an integer multiple of Planck’s constant. vice versa there was absorption of light in going from a lower to a higher energy.12). later. However. developed a new model. even if the electron was orbiting in such a state (and. but the atomic model was thought to still follow the rules of classical physics. despite what electromagnetic theory said. according to classical electromagnetic theory an orbiting electron.2010 . one would bounce back.5) where E is the difference in the energies of the stationary states involved. Then. This model had a tiny but massive nucleus surrounded by electrons (ﬁgure 4.9). In this scheme there was a lowest stationary state. this was questioned by Heisenberg) it would not radiate. Bohr quantised electron orbits in units of Planck’s constant. The new model was like a mini solar system with electrons orbiting the nucleus. and all the atoms of an element emitted the same line spectrum.
9) then proposed a new model with elliptical c The Temple of Quantum Computing . Of particular interest are the ground state at n = 1 and the excited state at n > 1 of an atom. Arnold Sommerfeld. n = 1. ground state n=3 Figure 4.1951 (ﬁgure 4..History 101 .6) where r is the radius of the orbital. etc. A jump between orbitals will emit or absorb radiation by: hf = Ei − Ef (4. h is Planck’s constant. In real terms the value of r is 5. 1868 . Bohr developed a formula for the radius of the electron orbits in a hydrogen atom: ( r= h2 4π 2 mq 2 ) n2 (4. it didn’t quite match up to the spectral line data.12: Bohr’s ﬁrst atomic model.7) 2. Perry 2004 . Although very close.3 nanometres for n = 1. Bohr went on with this model to derive the Balmer’s formula for hydrogen by two postulates: 1. and m and q are the mass and charge of the electron.⃝Riley T.2010 . (4. Quantum angular momentum: ( L=n h 2π ) ..8) where Ei is the initial energy of the electron and Ef is the ﬁnal energy of the electron.
2010 . It was thought. Bohr then introduced quantum number m to explain the Zeeman effect which produced extra spectral lines when a magnetic ﬁeld was applied to the atom (i. It was soon discovered that m could not account for all the spectral lines produced by magnetic ﬁelds. orbits and a new quantum number was added.1. Niels Bohr went on to explain the periodic table in terms of orbital shells with the outer most shell being the valence shell that allows binding and the formation of molecules.e. the direction the ﬁeld was pointing).e.8 The New Theory of Quantum Mechanics In 1909.1958 (ﬁgure 4. Pauli then described why electrons ﬁll the higher energy levels and don’t just occupy the ground state which we now call the Pauli exclusion principle.⃝Riley T. a few years after demonstrating the photoelectric effect. k to deal with the shape of the orbit.13: Wolfgang Pauli and Louis de Broglie.13) hypothesised another quantum number to account for this. But Planck had assumed the energy in the electromagnetic ﬁeld. in the c The Temple of Quantum Computing . Perry 2004 . Wolfgang Pauli. Planck himself had not gone as far as Einstein: he had indeed assumed that the transfer of energy between matter (the oscillators in the walls of the cavity) and radiation was quantised (i. the energy transferred to/from an oscillator occurred in ”grains” less than h times the frequency of the oscillator). so we still use spin up and spin down to describe this property of an electron. 4. 1900 . but not accepted by Pauli that the electron was ”spinning around” and it turns out that Pauli was right but the name stuck.102 History Figure 4. Einstein used his photon hypothesis to obtain a simple derivation of Planck’s black body distribution.
History
103
¨ Figure 4.14: Werner Heisenberg and Erwin Schrodinger. cavity, was continuously distributed, as in classical theory. By contrast, it was Einstein’s hypothesis that the energy in the ﬁeld itself was quantised: that for certain purposes, the ﬁeld behaved like an ideal gas, not of molecules, but of photons, each with energy h times frequency, with the number of photons being proportional to the intensity. The clue to this was Einstein’s observation that the high frequency part of Planck’s distribution for black body radiation (described by Wien’s law) could be derived by assuming a gas of photons and applying statistical mechanics to it. This was in contrast to the low frequency part (described by the RayleighJeans law) which could be successfully obtained using classical electromagnetic theory, i.e. assuming waves. So you had both particles and waves playing a part. Furthermore, Einstein looked at ﬂuctuations of the energy about its average value, and observed that the formula obtained had two forms, one which you would get if light was made up of waves and the other if it was made up of particles. Hence we have waveparticle duality. In 1924, Louis de Broglie, 1892  1987 (ﬁgure 4.13) extended the particle duality for light to all matter. He stated: The motion of a particle of any sort is associated with the propagation of a wave. This is the idea of a pilot wave which guides a free particle’s motion. de Broglie then suggested the idea of electron waves be extended to bound particles in atoms, meaning electrons move around the nucleus guided by pilot waves. So, again a duality, de Broglie waves and Bohr’s particles. de Broglie was able to show that Bohr’s orbital radii could be obtained by ﬁtting a whole number of waves around the nucleus. This gave an explanation of Bohr’s angular moc The Temple of Quantum Computing  ⃝Riley T. Perry 2004  2010
104 mentum quantum condition (see section 4.2.3).
History
The new quantum theory was developed between June 1925 and June 1926. Werner Heisenberg, 1901  1976 (ﬁgure 4.14), using a totally different and simpler atomic model (one that did not use orbits) worked out a code to connect quantum numbers and spectra. He also discovered that quantum mechanics does not follow the commutative law of multiplication i.e pq ̸= qp. When Max Born, 1882  1970 (ﬁgure 4.15) saw this he suggested that Heisenberg use matrices. This became matrix mechanics, eventually all the spectral lines and quantum numbers were deduced for hydrogen. The ﬁrst complete version of quantum mechanics was born. It’s interesting to note that it was not observation, or visualisation that was used to deduce the theory  but pure mathematics. Later we will see matrices cropping up in quantum computing. ¨ At around the same time Erwin Schrodinger, 1887  1961 (ﬁgure 4.14) built on de Broglie’s work on matter waves. He developed a wave equation (for which Ψ is the solution) for the core of bound electrons, as in the Hydrogen atom. It turns out that the results derived from this equation agree with the Bohr model. He then showed that Heisenberg’s matrix mechanics and his wave mechanics were equivalent. ¨ Max Born proposed that Ψ, the solution to Schrodinger’s equation can be interpreted as a probability amplitude, not a real, physical value. The probability amplitude is a function of the electron’s position (x, y, z) and, when squared, gives the probability of ﬁnding the electron in a unit volume at the point (x, y, z). This gives us a new, probabilistic atomic model, in which there is a high probability that the electron will be found in a particular orbital shell. A representation of the ground state of hydrogen is shown in ﬁgure 4.16 and at the places where the density of points is high there is a high probability of ﬁnding the particle. The linear nature of the wave equation means that if Ψ1 and Ψ2 are two solutions then so is Ψ1 + Ψ2 , a superposition state (we’ll look at superposition soon). This probabilistic interpretation of quantum mechanics implies the system is in both states until measured. ¨ Schrodinger was unhappy with the probabilistic interpretation (superposition) and created a scenario that would show it was false. This is called Schr¨ dinger’s o c The Temple of Quantum Computing  ⃝Riley T. Perry 2004  2010
Important Principles for Quantum Computing
105
cat, a paradox, which simply put refers to the situation of a cat being in both states of dead Ψ1 and alive Ψ2 until it is observed. Paul Dirac, 1902  1984 (ﬁgure 4.15) developed a new approach and the braket notation we use for quantum computing (see section 4.2.3). His approach ¨ expanded to a quantum ﬁeld theory, he expanded Schrodinger’s equation, incorporated spin, and Einstein’s relativity, and predicted antimatter. In 1927 Heisenberg made his second major discovery, the Heisenberg uncertainty principle which relates to the position and momentum of a particle. It states that the more accurate our knowledge of a particle’s position, the more inaccurate our knowledge of its momentum will be and vice versa. The uncertainty is due to the uncontrollable effect on the particle of any attempt to observe it (because of the quantum interaction; see 4.25) and perhaps to a to genuine lack of the particle having precise properties. This signalled the breakdown of determinism. Now back to Niels Bohr. In 1927 Niels Bohr described the concept of complementarity: it depends on what type of measurement operations you are using to look at the system as to whether it behaves like a particle or a wave. He ¨ then put together various aspects of the work by Heisenberg, Schrodinger, and Born and concluded that the properties of a system (such as position and momentum) are undeﬁned having only potential values with certain probabilities of being measured. This became know as the Copenhagen interpretation of quantum mechanics. Einstein did not like the Copenhagen interpretation and, for a good deal of time, Einstein kept trying to refute it by thought experiment, but Bohr always had an answer. But in 1935 Einstein raised an issue that was to later have profound implications for quantum computation and lead to the phenomenon we now call entanglement, a concept we’ll look at in a few pages.
4.2 Important Principles for Quantum Computing
The main parts of quantum mechanics that are important for quantum computing are: c The Temple of Quantum Computing  ⃝Riley T. Perry 2004  2010
106
Important Principles for Quantum Computing
Figure 4.15: Max Born and Paul Dirac.
Figure 4.16: Born’s atomic model.
c The Temple of Quantum Computing  ⃝Riley T. Perry 2004  2010
Important Principles for Quantum Computing • Linear algebra. • Superposition. • Dirac notation. • Representing information. • Uncertainty. • Entanglement. • The 4 postulates of quantum mechanics.
107
4.2.1 Linear Algebra
Quantum mechanics leans heavily on linear algebra. Some of the concepts of quantum mechanics come from the mathematical formalism, not thought experiments  that’s what can give rise to counter intuitive conclusions.
4.2.2 Superposition
Superposition means a system can be in two or more of its states simultaneously. For example a single particle can be travelling along two different paths at once. This implies that the particle has wavelike properties, which can mean that the waves from the different paths can interfere with each other. Interference can cause the particle to act in ways that are impossible to explain without these wavelike properties. The ability for the particle to be in a superposition is where we get the parallel nature of quantum computing: If each of the states corresponds to a different value then, if we have a superposition of such states and act on the system, we effectively act on all the states simultaneously. An Example With Silvered Mirrors Superposition can be explained by way of a simple example using silvered and half silvered mirrors [Barenco, A. Ekert, A. Sanpera, A. & Machiavello, C. 1996]. A half silvered mirror reﬂects half of the light that hits it and transmits the other c The Temple of Quantum Computing  ⃝Riley T. Perry 2004  2010
2.17).108 Important Principles for Quantum Computing detector 1 light source half silvered mirror Figure 4. It is tempting to think that the light takes one or the other path. an electron’s spin can be represented as 0⟩ = spin up and 1⟩ as spin down. If another half silvered mirror (ﬁgure 4.17: Uncertainty.2010 .3 Dirac Notation As described in the previous chapter Dirac notation is used for quantum computing. Perry 2004 .19) shows clearly that the photons travel both paths because blocking one path will break the superposition and stop the interference. c The Temple of Quantum Computing . but the interference (like wave interference when two stones are thrown into a pond near each other simultaneously) causes the photon to always be detected by detector 1. 4.18) is placed at this meeting point and if light was just particlelike we would expect that the light would behave as before (going either way with 50% probability). detector 2 half of the light through it (ﬁgure 4. This can be demonstrated by adding in some fully silvered mirrors and bouncing both parts of the superposed photon (which is at this point is in two places at once) so that they meet and interfere with each other at their meeting point. For example. A third example (ﬁgure 4. not the half silvered mirror. but in fact it takes both! It’s just that the photo detector that measures the photon ﬁrst breaks the superposition. If we send a single photon through this system then this gives us a 50% chance of the light hitting detector 1 and a 50% chance of hitting detector 2.⃝Riley T. We can represent the states of a quantum system as kets. so it’s the detectors that cause the randomness.
Important Principles for Quantum Computing 109 detector 1 detector 2 interference light source half silvered mirror fully silvered mirror Figure 4.⃝Riley T. c The Temple of Quantum Computing . detector 1 detector 2 interference light source half silvered mirror fully silvered mirror Figure 4.18: Superposition 1. Perry 2004 .19: Superposition 2.2010 .
4.g. the electron either goes up or down. in say. We have just seen two examples: electron spin and photon direction. with equal probabilities of 1 . But. Two more methods for representing binary information in a way that is capable of exhibiting quantum effects (e. There is a trade off . When we pass a horizontally travelling electron through an inhomogeneous magnetic ﬁeld. If we represent these two states as +⟩ and −⟩ we can say that the up spin electron was in a superposition of the two states +⟩ and −⟩ such that.⃝Riley T. That unknown property’s behaviour is essentially random.2. the effect of a charged particle spinning on its axis.5 Uncertainty The quantum world is irreducibly small so it’s impossible to measure a quantum system without having an effect on that system as our measurement device is also quantum mechanical. If we then repeat this with the up electron it goes up.2010 . if we take the up electron and pass it through a horizontal ﬁeld it comes out on one side 50% of the time and on the other side 50% of the time. An example of this is a particle’s position and velocity: if we know exactly where it is then we know nothing c The Temple of Quantum Computing . or vertical spin and horizontal spin) and if we know one property with a high degree of certainty then we must know almost nothing about the other property.2. the vertical direction. As a result there is no way of accurately predicting all of the properties of a particle. We say the up electron after the ﬁrst measurement is in the state 0⟩ and the down electron is in state 1⟩.the properties occur in complementary pairs (like position and momentum. entanglement and superposition) are: polarisation of photons and nuclear spins.4 Representing Information Quantum mechanical information can be physically realised in many ways. when measured. Perry 2004 . 2 4. To have something analogous to a classical bit we need a quantum mechanical system with two states only. when we make a measurement with the ﬁeld horizontal we project the electron into one or the other of the two states. with the down electron it goes down.110 Important Principles for Quantum Computing The electron can be thought of as a little magnet. We examine various physical implementations of these ”quantum bits” (qubits) in chapter 8.
2. and later became known as entanglement. 1996] and only have well deﬁned state once they are measured. on measuring say. It has been postulated (and currently accepted) that particles in fact DO NOT have deﬁned values for unknown properties until they are measured. c The Temple of Quantum Computing . it was proven that quantum systems do not have local state before measurement). two particles are allowed to interact. This is like saying that something does not exist until it is looked at.e. Perry 2004 . the velocity of one of them (regardless of the distance between them). Although the original hypothesis was later proven wrong (i. A. The reason we say that they communicate instantaneously is because they store no local state [Rae. they then separate and. it has been proven that entangled particles have no local state. This indeterminacy is exploited in quantum cryptography (see chapter 7). The effect they demonstrated was still important. 4. Particles don’t exactly communicate. but there is a statistical correlation between results of measurements on each particle that is hard to understand using classical physics. To become entangled. we can be sure of the value of velocity of the other one (before it is measured).6 Entanglement In 1935 Einstein (along with colleagues Podolski and Rosen) demonstrated a paradox (named EPR after them) in an attempt to refute the undeﬁned nature of quantum systems.⃝Riley T. Entanglement is the ability for pairs of particles to interact over any distance instantaneously. having local state BEFORE measurement. As stated before. some of which we’ll look at later.7. this is explained in section 6. The results of their experiment seemed to show that quantum systems were deﬁned.2010 .Important Principles for Quantum Computing 111 about how fast it is going. Entanglement has applications in a wide variety of quantum algorithms and machinery. Because of this limitation particles can’t be used to transmit classical messages faster than the speed of light as we only know the states upon measurement.
.
& Chuang. A. M. L. At around the same time the quantum complexity classes were developed and the quantum Turing machine was described. I. This became known as Shor’s algorithm.Chapter 5 Quantum Computing 5. The next major breakthrough came in 1994 when Peter Shor described a method to factor large numbers in quantum polytime (which breaks RSA encryption). David Deutsch developed the basis for quantum computing between 1984 and 1985.1. building on this. 2004] so the use of individual citations for these references has been dropped. This section borrows heavily from [Nielsen.1 Introduction Generally we’ll think of a quantum computer as a classical computer with a quantum circuit attached to it with some kind of interface between conventional and quantum logic. 2000] and [Dawar. A. Then in 1996 Lov Grover developed a fast database search algorithm (known as Grover’s algorithm). Since there are only a few things a quantum computer does better than a classical computer it makes sense to do the bulk of the processing on the classical machine.1. 5. The ﬁrst prototypes of quantum computers were also 113 .2 History In 1982 Richard Feynman theorised that classic computation could be dramatically improved by quantum effects.1 Elements of Quantum Computing 5.
Physical implementations of quantum computers improved with a three qubit machine in 1999 and a seven qubit machine in 2000. the value of the bit cannot be in a superposition. but only during the computational phase of a quantum operation.114 Elements of Quantum Computing built in 1996. a qubit can become either: c The Temple of Quantum Computing . It describes qubits. Sanpera.g. When measured. 1998]. Quantum bits.⃝Riley T. C. 5. D. gates. There is no intermediate state between them.e.2010 . In 1997 quantum error correction techniques were developed at Bell labs and IBM. in some cases.3 Bits and Qubits This section is about the ”nuts and bolts” of quantum computing.its just that we can’t get at it. Ekert. The inaccessibility of the information is related to quantum measurement: When we attempt to readout a superposition state holding many values the state collapses and we get only one value (the rest get lost). this state is called a binary digit (or bit for short). can on the other hand be in a state ”between” 0 and 1. The amount of information stored during the ”computational phase” is essentially inﬁnite . & Machiavello. A bit has the following two values: 0 and 1. Quantum computers perform operations on qubits which are analogous to conventional bits (see below) but they have an additional property in that they can be in a superposition. & Ekert. A. Single Qubits Classical computers use two discrete states (e.1. 1996] and a 250 qubit register holds more numbers (superposed) than there are atoms in the universe! [Deutsch. i. and circuits. states of charging of a capacitor) to represent a unit of information. This is tantalising but. or qubits. A. Perry 2004 . A. can be made to work to our computational advantage. A quantum register with 3 qubits can store 8 numbers in superposition simultaneously [Barenco. A.
Once the qubit is measured it will remain in that state if the same measurement is repeated provided the system remains closed between measurements (see chapter 4). There may be.⃝Riley T. The probability that the qubit’s state. it shows only one value (see chapter 4). when measured.1) . a qubit’s state during the computational phase is represented by a linear combination of states otherwise called a superposition state. Here α and β are the probability amplitudes. This is the same as saying a spin particle can be in a superposition state but. will collapse to states 0⟩ or 1⟩ is α2 for 0⟩ and β2 for 1⟩. α0⟩ + β1⟩. Perry 2004 .Elements of Quantum Computing 115 0⟩ or 1⟩ i.2010 (5. we readout 0 or 1. The percentages must add to 100%. In terms of the above it essentially means the same thing as 0 and 1 (this is explained a little further on).e. 0⟩ and 1⟩ are actually vectors. Generally. This the same thing as saying the probabilities add to 100%. In terms of their representation qubits must satisfy: α2 + β2 = 1. The ⟩ symbolic notation is part of the Dirac notation (see chapters 3 and 4). they are called the computational basis states that form an orthonormal basis for the vector space C2 . They can be used to calculate the probabilities of the system jumping into 0⟩ or 1⟩ following a measurement or readout operation. just like a classical bit. say a 25% chance a 0 is measured and a 75% chance a 1 is measured. c The Temple of Quantum Computing . when in a superposition.
5) (5. 1 √ (0⟩ + 1⟩) = +⟩ =  ↗⟩.4) (5. Perry 2004 . These bases are sometimes represented with arrows which are described below.2) The α and β might vary with time as the state evolves during the computation but the sum of the squares of α and β must always must be equal to 1. (5.3) (5. (5.⃝Riley T. Our state vector in the case of one qubit is: Ψ⟩ = α0⟩ + β1⟩. You may ﬁnd these notational conventions being used: 0⟩ =  →⟩. 2 1 √ (0⟩ − 1⟩) = −⟩ =  ↖⟩.116 Elements of Quantum Computing The state vector Ψ⟩ of a quantum system describes the state at any point in time of the entire system. and are referred to as rectilinear and diagonal which can say refer to the polarisation of a photon. and −⟩. which is often shortened to just +⟩. 1⟩ =  ↑⟩. 2 Some examples of measurement probabilities are on the next page.6) c The Temple of Quantum Computing .2010 . Quantum computing also commonly uses 2 1 √ (0⟩ 2 + 1⟩) and 1 √ (0⟩ 2 − 1⟩) as a basis for C .
2 4 The probability of measuring a 1⟩ is: ( 1 )2 1 = . Example More measurement probabilities. 2 2 The probability of measuring a 1⟩ is: ( 1 )2 1 √ = . So. The sign in the middle of the two values can change. 2 2 117 So 50% of the time we’ll measure a 0⟩ and 50% of the time we’ll measure a 1⟩. 2 4 So 75% of the time we’ll measure a 0⟩ and 25% of the time we’ll measure a 1⟩. 1 1 Ψ⟩ = √ 0⟩ + √ 1⟩. α0⟩ + β1⟩ and α0⟩ − β1⟩ have the same output values and probabilities but behave differently during the computational phase. Perry 2004 . 2 2 The probability of measuring a 0⟩ is: ( 1 )2 1 √ = .2010 .Elements of Quantum Computing Example Measurement probabilities. 2 2 The probability of measuring a 0⟩ is: ( √3 ) 2 3 = .⃝Riley T. Formally we say they differ by a relative phase facc The Temple of Quantum Computing . 1⟩} the sign is actually the relative phase of the qubit. which affects the internal evolution of the qubit. √ 3 1 Ψ⟩ = 0⟩ − 1⟩. not the outcome of a measurement. When measuring in the basis {0⟩.
What this means is that if we have a state on n qubits we can put a complex factor in front of the entire state to make it more readable. Example Global phase. 2 π Example More global phase. The other type of phase is called global phase. is determined entirely by the phase. So in the case of the qubits above they differ by a phase factor of 1.118 Elements of Quantum Computing tor. as the global phase factor is not observable. as a complex number. Likewise the relative phase (which ﬁgures in interference effects) is unaffected if α and β are multiplied by a common phase factor.⃝Riley T. 1 Ψ⟩ = (−00⟩ + 01⟩ − 10⟩ + 11⟩). It is called a phase factor because it always has magnitude 1 and so its value. We can also say here that because −i = e−i 2 we have a phase of − π . One reason for this is that the probabilities for the outcomes α and β are unaffected if α and β are each multiplied by the same complex number of magnitude 1. This is best described by an example (below). −i 1 Ψ⟩ = √ 0⟩ + √ 1⟩. 2 2 Remembering that −i × −i = −1 we say the factor at the front of our state vector (−i) is a global phase factor. 2 2 can be rewritten as: Ψ⟩ = −i ( ) 1 i √ 0⟩ − √ 1⟩ . Two states can differ by a global phase factor and still be considered the same.2010 . 2 c The Temple of Quantum Computing . Perry 2004 . 2 can be rewritten as: 1 Ψ⟩ = (−1) (00⟩ − 01⟩ + 10⟩ + 11⟩).
[ ] α β is a vector. The state of a single qubit is a unit vector in C2 . The ket is just a notation for a vector.7) c 1 0 0 1 ] . The Ket ⟩ Part of Dirac’s notation is the ket (⟩). So.1: 2D qubit representations. Perry 2004 .Elements of Quantum Computing 1⟩ T 119 a d d d d ' d E 0⟩ b − 1⟩ Figure 5.8) Two Dimensional Qubit Visualisation Single qubits can be represented in value and relative phase in two dimensions by the diagram in ﬁgure 5. (5.1 which is similar to the way we represent polar coordinates for complex numbers.⃝Riley T.2010 . The graph shows the general form of 2D qubit c The Temple of Quantum Computing . and is written as: α0⟩ + β1⟩ with 0⟩ = and 1⟩ = [ [ ] (5.
The Bloch Sphere The Bloch sphere is a tool with which the state of single qubit can be viewed in three dimensions and is useful for visualising all single qubit operations. Perry 2004 . and z labelling each positive axis: ˆ ˆ ˆ c The Temple of Quantum Computing .⃝Riley T. For this we need three dimensions. This is shown below with the points x. We can say that the state of a single qubit can be written as: θ θ Ψ⟩ = eiγ (cos 0⟩ + eiφ sin 1⟩).9) What’s probably more helpful at this stage is to see where all of the potential states of a qubit lie on the Bloch sphere.10) (5.120 representation where a = 1 √ 0⟩ 2 Elements of Quantum Computing + 1 √ 1⟩ 2 and b = 1 √ 0⟩ 2 − 1 √ 1⟩. 2 This diagram is ok for real numbered values of α and β but cannot accurately depict all the possible states of a qubit. in terms of the angle θ and φ the Bloch sphere looks like this: (5.2010 . 2 2 We can ignore the global phase factor in front so Ψ⟩ becomes: θ θ Ψ⟩ = cos 0⟩ + eiφ sin 1⟩. y . 2 2 So. Three Dimensional Qubit Visualisation .
• Ground and excited states of an atom (i. e. a composite system of qubits. Perry 2004 . here are a few ways this can be done: • Polarisations of a photon.2010 . E. the energy level.Elements of Quantum Computing 121 As stated in chapter 4. the number of qubits. • Nuclear spins.g.⃝Riley T.g. This is because if we have n qubits the number of basis states is 2n . Ions in a trap (see chapter 8). Multiple Qubits The potential amount of information available during the computational phase grows exponentially with the size of the system. forming a quantum register then there are four (= 22 ) c The Temple of Quantum Computing . individual qubits can be physically realised using various quantum two state systems.e.e. or orbital). if we have two qubits. i.e. We now look at the equivalent of a register: i.
Perry 2004 . 01⟩. + αn−1 N − 1⟩ = If N = 2n we require an n qubit register. αN − 1 (5. We don’t have to represent values with 0s and 1s. where ⊗ is the tensor product (see below). Ψ = α0 0⟩ + α1 1⟩ + α2 2⟩ + .e. We actually have 01⟩ = 0⟩ ⊗ 1⟩. Ψ = α0 00000⟩ + α1 00001⟩ + . and 11⟩. We can have up to 32 (= 25 ) basis states in a superposition.14) c The Temple of Quantum Computing .11) Here 01⟩ means that qubit 1 is in state 0⟩ and qubit 2 is in state 1⟩. . .13) Example n = 5 (5 qubits). Like a single qubit. formally for the general case of n qubits this is can be written as: 2n −1 ∑ i=0 αi 2 = 1.122 computational basis states: forming.. etc. 10⟩. (5. α0 α1 α2 . Elements of Quantum Computing 00⟩. (5.⃝Riley T. + α2n −1 11111⟩. probability amplitudes): Ψ⟩ = α0 00⟩ + α1 01⟩ + α2 10⟩ + α3 11⟩. (5. .. i. A qudit has the following format in CN : .2010 . the two qubit register can exist in a superposition of the four states (below we change the notation for the complex coefﬁcients.12) Again all of the probabilities must sum to 1. .
The simplest way to measure a subset of states is shown in the following example with two qubits. we don’t have to get read outs on all the qubits (some can be left unmeasured).15) Partial Measurement We can measure a subset of an nqubit system.2010 . ⊗. 1 1 1 (00⟩ + 01⟩ + 10⟩ + 11⟩) = √ (0⟩ + 1⟩) ⊗ √ (0⟩ + 1⟩).Elements of Quantum Computing Tensor Products 123 A decomposition into single qubits of a multiqubit system can be represented by a tensor product. 2 2 2 A tensor product can also be used to combine different qubits. We’ll ﬁrst consider nonentangled states. (α0 0⟩ + α1 1⟩) ⊗ (β0 0⟩ + β1 1⟩) = α0 β0 00⟩ + α0 β1 01⟩ + α1 β0 10⟩ + α1 β1 11⟩. Example Decomposition using a tensor product.e. (5. c The Temple of Quantum Computing . i. An example is presented on the next page. Perry 2004 .⃝Riley T.
We prepare a quantum system in the following state.2010 .e.124 Elements of Quantum Computing Example measuring the ﬁrst bit in a two qubit system. the probability of qubit two being a 0⟩ is: pr(0) = α0 2 + α2 2 and its post measurement state would be: α 0⟩ + α2 1⟩ √0 ⊗ 0⟩. we project on to the {00⟩. If we measured a 0⟩ the post measurement state is: α0 0⟩ + α1 1⟩ 0⟩ ⊗ √ α0 2 + α1 2 (i. so the probability of it being 0 is: pr(0) = α0 2 + α1 2 and. Perry 2004 .⃝Riley T. if we measured a 1⟩ measured the post measurement state is: α2 0⟩ + α3 1⟩ 1⟩ ⊗ √ . Similarly. α2 2 + α3 2 We can do the same for qubit two. c The Temple of Quantum Computing . 3. the probability of it being 1 is: pr(1) = α2 2 + α3 2 . 2. 01⟩} subspace and the α2 and α3 terms drop out). a nonentangled state would mean that all the probability amplitudes are nonzero: Ψ = α0 00⟩ + α1 01⟩ + α2 10⟩ + α3 11⟩. 1. We now measure. the qubit we are going to measure is bolded. α0 2 + α2 2 This logic can be extended to n qubits.
16) If the outcome is m then the state collapses to: Mm Ψ⟩ √ .2010 . 5 5 c The Temple of Quantum Computing . 5 5 30 5 5 30 This gives us state is: Ψ⟩ = 0⟩ ⊗ √ 2 √5 30 = 1 6 probability of measuring a 0⟩ and a ( ) 1 2 √ 0⟩ + √ 1⟩ 5 5 √5 30 2 = 5 6 prob ability of measuring a 1⟩. 1 2 3 4 Ψ⟩ = √ 00⟩ + √ 01⟩ + √ 10⟩ + √ 11⟩ 30 30 30 30 When we measure qubit one the resulting states would look like this (unnormalised): Ψ⟩ = 0⟩ ⊗ ( ) 1 2 √ 0⟩ + √ 1⟩ 30 30 (5. † ⟨ΨMm Mm Ψ⟩ Example system. 30 30 Now we must make sure that the second qubit is normalised. If we have a system in state Ψ⟩ then outcome m has a probability of: † pr(m) = ⟨ΨMm Mm Ψ⟩.⃝Riley T. so we multiply it by a factor: √ ( ) ( ) 5 1 2 5 3 4 Ψ⟩ = √ 0⟩ ⊗ √ 0⟩ + √ 1⟩ + √ 1⟩ ⊗ 0⟩ + 1⟩. (5.17) Another way of looking at measuring the ﬁrst bit in a two qubit for measuring a 0⟩ and for measuring a 1⟩: ( ) 3 4 Ψ⟩ = 1⟩ ⊗ √ 0⟩ + √ 1⟩ . Perry 2004 .Elements of Quantum Computing 125 Quantum measurement can be described as a set {Mm } of linear operators with 1 ≤ m ≤ n where n is the number of possible outcomes. So if we measure a 0⟩ then our post measurement and if we measure a 1⟩ then our post measurement state is: ( ) 3 4 Ψ⟩ = 1⟩ ⊗ 0⟩ + 1⟩ . For a single qubit with an orhtonormal basis of 0⟩ and 1⟩ we can deﬁne measurement operators M0 = 0⟩ ⟨0 and M1 = 1⟩ ⟨1 (which are also both projectors).
P0 ⊗ I. 30 30 Say we change our measurement basis to {0⟩ .⃝Riley T. If we wanted to measure the probability of the ﬁrst qubit being 1 then we would use P1 ⊗ I.2010 . pr(0) = ⟨ΨP0 ⊗ IΨ⟩ = ⟨Ψ 0⟩ ⟨0 ⊗ IΨ⟩ 1 2 = ⟨Ψ √ 00⟩ + √ 01⟩ 30 30 1 = 6 and this gives us a postmeasurement state of: P0 ⊗ IΨ⟩ Ψ′ ⟩ = √ ⟨ΨP0 ⊗ IΨ⟩ 1 √ 00⟩ + √2 01⟩ √ 30 = 30 = 0⟩ ⊗ = 0⟩ ⊗ 1 6 √1 0⟩ 30 + √ √2 1⟩ 30 ( ) 1 2 √ 0⟩ + √ 1⟩ . 1⟩} then we can represent projectors P0 and P1 as 0⟩ ⟨0 and 1⟩ ⟨1 respectively. 30 30 30 30 We ﬁnd the probability of measuring a 0⟩ by using a projector 00⟩⟨00 + 01⟩⟨01: ( (00⟩⟨00 + 01⟩⟨01) ) 2 3 4 1 √ 00⟩ + √ 01⟩ + √ 10⟩ + √ 11⟩ 30 30 30 30 = (00⟩⟨00 + 01⟩⟨01) Ψ⟩ 1 2 = √ 00⟩ + √ 01⟩. Perry 2004 . 5 5 1 6 c The Temple of Quantum Computing . We measure the probability of the ﬁrst qubit being 0 by using P0 on qubit one and I on qubit two.126 Elements of Quantum Computing Example Measurement of qubit one in a two qubit system using a simple projector.e. 1 2 3 4 Ψ⟩ = √ 00⟩ + √ 01⟩ + √ 10⟩ + √ 11⟩. i.
otherwise we can’t reliably distinguish between two basis states u⟩ and v⟩. this means that they are connected. (5. This can be useful for computational purposes. The unitary transform is called the observable. 2. m ∑ i=1 127 pr(i) = m ∑ ⟨ΨMi† Mi Ψ⟩ = 1 this is i=1 m ∑ i=1 the result of the completeness equation. i. regardless of distance.Elements of Quantum Computing Properties: All probabilities sum to 1. they are: 1.4 Entangled States Subatomic particles can be entangled.18) Note: our basis needs to be orthogonal.1. Measure Ψ⟩. Perry 2004 . First we need to ﬁnd the spectral decomposition of OM (Z for example). which is denoted here by OM . i.⃝Riley T. for OM we have: OM = ∑ m mPm (5. So we need a unitary transform U and Ψ⟩ to perform a measurement. ⟨uv⟩ ̸= 0 means u⟩ and v⟩ are not orthogonal.e.19) where m is each eigenvalue and Pm is a projector made up of Pm = m⟩⟨m. Projective Measurements Projective measurements are a means by which we can accomplish two tasks. Apply a unitary transform to Ψ⟩. 5. Consider the following state (which is not entangled): 1 √ (00⟩ + 01⟩) 2 c The Temple of Quantum Computing .2010 . Mi† Mi = I. Their effect on each other upon measurement is instantaneous.e.
2 2 Upon measuring the ﬁrst qubit (a partial measurement) we get 0 100% of the time and the state of the second qubit becomes: 1 1 √ 0⟩ + √ 1⟩ 2 2 giving us equal probability for a 0 or a 1. Example Consider: 1 √ (00⟩ + 11⟩) . i. This is a distinct advantage over classical computation.2010 . Perry 2004 . The next example show the measurement of a partially entangled state. c The Temple of Quantum Computing .7) we ﬁnd that the results for the qubits are correlated. we get two qubit values for the price of one measurement. Measuring entangled states accounts for the correlations between them.e. 2 When expanded this is: 1 1 √ 00⟩ + 001⟩ + 010⟩ + √ 11⟩.128 it can be expanded to: Elements of Quantum Computing 1 1 √ 00⟩ + √ 01⟩ + 010⟩ + 011⟩.⃝Riley T. 2 2 Measuring the ﬁrst qubit gives us 00⟩ 50% of the time and 11⟩ 50% of the time. So the second qubit is always the same as the ﬁrst. If we try this on an entangled state (in this case an EPR pair or Bell state. This type of correlation can be used in a variety of ways in application to the ﬁrst or second qubit to give us correlations that are strongly statistically connected. see section 6.
3 3 3 129 If we separate out the qubits (tensor decomposition) The state looks like this (unnormalised): ( Ψ⟩ = 0⟩ ⊗ ) 2 1 i2 1⟩ + 0⟩ + 1⟩ ⊗ 0⟩. 5 5 Upon measuring a 1⟩ the state collapses to: Ψ′ ⟩ = 1⟩ ⊗ 0⟩. Upon measurement of 0⟩ the state collapses to: ) 2 1 √ 0⟩ + √ 1⟩ . Input states U1 U2 NM U3 This gives us a simple form of quantum circuit (above) which is a series of operations and measurements on the state of nqubits. in analogy to a conventional circuit.Elements of Quantum Computing Example The following state vector represents an entangled system. 3 3 3 Now we must make sure that the second qubit is normalised. Perry 2004 .⃝Riley T. 5. 3 5 5 ( Ψ ⟩ = 0⟩ ⊗ ′ Now say we measure qubit 1. We now take a register and let gates act on qubits.1. Each operation is unitary and can be described by an 2n × 2n matrix. representing one or more qubits.2010 .5 Quantum Circuits If we take a quantum state. and apply a sequence of unitary operators (quantum gates) the result is a quantum circuit. so we multiply it by a factor: 5 Ψ⟩ = 0⟩ ⊗ 3 √ ( ) 1 i2 2 √ 0⟩ + √ 1⟩ + 1⟩ ⊗ 0⟩. c The Temple of Quantum Computing . 2 i2 1 Ψ⟩ = 01⟩ + 10⟩ + 00⟩.
The quantum equivalent of a NOT gate. quantum circuits are ”one shot circuits” that just run once from left to right (and are special purpose: i. the gates. The only constraint these gates have to satisfy (as required by quantum mechanics) is that they have to be unitary. c The Temple of Quantum Computing .⃝Riley T. Unlike classical circuits which can contain loops. Together. we have a different circuit for each algorithm). has the following form: [ 0 1 1 0 ] . the boxes containing Un are quantum logic gates (or a series of gates) and the meter symbol is a measurement.2010 . after the gate is applied: α′ 2 + β ′ 2 = 1 (5. and output mechanisms implement quantum algorithms. It should be noted that it is always possible to rearrange quantum circuits so that all the measurements are done at the end of the circuit. wires. The matrix acts as a quantum operator on a qubit. U † U = I.130 Elements of Quantum Computing Each of the lines is an abstract wire. This allows for a lot of potential gates. for example. Unitarity implies that the probability amplitudes must still sum to 1. input. Single Qubit Gates Just as a single qubit can be represented by a column vector.20) where α′ and β ′ are the values for the probability amplitudes for the qubit after the operation has been applied. a gate acting on the qubit can be represented by a 2 × 2 matrix. If (before the gate is applied) α2 + β2 = 1 then. The operator’s matrix must be unitary because the resultant values must satisfy the normalisation condition.e. where a unitary matrix is one that satisﬁes the condition underneath. Perry 2004 .
[ σ0 = I = which gives us the following: 0⟩ → I → 0⟩.24) (5.22) (5.27) 0 1 1 0 ] (5.⃝Riley T.21) (5. α0⟩ + β1⟩ → I → α0⟩ + β1⟩. 1⟩ → X → 0⟩.26) (5. α0⟩ + β1⟩ → X → β0⟩ + α1⟩. Pauli X Gate The Pauli X gate is a quantum NOT gate.2010 .25) (5. Perry 2004 .28) The operation of the Pauli X gate can be visualised on the Bloch sphere as follows: c The Temple of Quantum Computing . X [ σ1 = σX = X = which gives us the following: 0⟩ → X → 1⟩. (5. 1⟩ → I → 1⟩.Elements of Quantum Computing 131 Here are some examples: Pauli I Gate This is the identity gate.23) 1 0 0 1 ] (5.
132 Elements of Quantum Computing Here (and in subsequent images) the blue (dark) point is the original state vector and the green (light) point is the state vector after the transformation. Perry 2004 .2010 . changes the relative phase by a factor of 1.33) (5. Z [ σ3 = σY = Z = 1 0 ] (5. α0⟩ + β1⟩ → Y → −βi0⟩ + αi1⟩.e. i.⃝Riley T.31) 0 −i i 0 ] (5.30) (5.32) 0 −1 c The Temple of Quantum Computing . 1⟩ → Y → −i0⟩. Pauli Y Gate Y [ σ2 = σY = Y = which gives us the following: 0⟩ → Y → i1⟩.29) (5. Pauli Z Gate This gate ﬂips a qubit’s sign.
α0⟩ + β1⟩ → Z → α0⟩ − β1⟩. 1⟩ → T → ei 4 1⟩.36) 1 0 0 i ] (5.Elements of Quantum Computing which gives us the following: 0⟩ → Z → 0⟩.39) (5.43) (5.2010 π π (5. If we apply T again we get the same as applying S once. Phase Gate S [ S= which gives us the following: 0⟩ → S → 0⟩.38) (5. α0⟩ + β1⟩ → T → α0⟩ + ei 4 β1⟩.44) (5.37) (5. the Phase gate can be expressed in terms of the T gate (see below): S = T2 π 8 133 (5. Note. Perry 2004 .45) .40) (5.⃝Riley T. α0⟩ + β1⟩ → S → α0⟩ + βi1⟩.34) (5.41) Gate (T Gate) T [ T = 1 0 π ] (5. 1⟩ → Z → −1⟩. c The Temple of Quantum Computing . 1⟩ → S → i1⟩.42) 0 ei 4 which gives us the following: 0⟩ → T → 0⟩.35) (5.
49) 0⟩ − 1⟩ √ 2 Example Using H and Z gates and measuring in the {+⟩. 2 2 The operation of the H gate can be visualised on the Bloch sphere as follows: c The Temple of Quantum Computing . Perry 2004 .47) (5.⃝Riley T. H [ 1 H=√ 2 which gives us the following: 1 0⟩ → H → √ (0⟩ + 1⟩).48) ( ) . 2 ( α0⟩ + β1⟩ → H → α 0⟩ + 1⟩ √ 2 ) +β 1 1 ] (5. −⟩} basis. (1) We can put 0⟩ into state +⟩ by using an H gate: 1 0⟩ → H → √ (0⟩ + 1⟩). We’ll use this gate later for a demonstration of a simple algorithm.134 Hadamard Gate Elements of Quantum Computing Sometimes called the square root of NOT gate.46) 1 −1 (5. 2 (2) We can put 0⟩ into state −⟩ by using an H gate followed by a Z gate : 1 1 0⟩ → H → √ (0⟩ + 1⟩) → Z → √ (0⟩ − 1⟩).2010 . 2 1 1⟩ → H → √ (0⟩ − 1⟩). This gate is one of the most important in quantum computing. (5. it turns a 0⟩ or a 1⟩ into a superposition (note the different sign).
Perry 2004 .2010 . for example a Pauli X gate can be represented by: 1⟩⟨0 + 0⟩⟨1. ⟨11⟩ = 1. When applied to α0⟩ + β1⟩. take the bra part. For the above it’s useful to remember the following: ⟨00⟩ = 1. ⟨01⟩ = 0.⃝Riley T. For each component of the sequence. ⟨u from v⟩⟨u. and the new qubit’s coefﬁcient will be the old qubit’s coefﬁcient for the ket part v⟩. c The Temple of Quantum Computing . ⟨10⟩ = 0. we get: X(α0⟩ + β1⟩) = (1⟩⟨0 + 0⟩⟨1)(α0⟩ + β1⟩) = 1⟩⟨0(α0⟩ + β1⟩) + 0⟩⟨1(α0⟩ + β1⟩) = α1⟩1 + β1⟩0 + α0⟩0 + β0⟩1 = β0⟩ + α1⟩. Instead of doing all that math.Elements of Quantum Computing 135 Outer Product Notation A handy way to represent gates is with outer product notation. just think of it this way.
Now we take the second part. (5. Using the spectral decomposition theorem: I = 1 · 0⟩⟨0 + 1 · 1⟩⟨1 = 0⟩⟨0 + 1⟩⟨1. Further Properties of the Pauli Gates Next we’ll look at the eigenvectors. so for the matrix: [ ] . Finally. α00 α01 α10 α11 The outer product representation looks like: α00 0⟩⟨0 + α01 0⟩⟨1 + α10 1⟩⟨0 + α11 1⟩⟨1.136 Elements of Quantum Computing Example Say we use this method on the Pauli Y outer product representation. and 1 √ (0⟩ 2 − 1⟩) with eigenvalues of 1 and 1 c The Temple of Quantum Computing . i1⟩⟨0 − i0⟩⟨1. Perry 2004 . eigenvalues.50) X has eigenvectors 1 √ (0⟩ 2 + 1⟩).⃝Riley T. . −i0⟩⟨1 and β1⟩ becomes −iβ0⟩ and ﬁnally we get: Ψ⟩ = −iβ0⟩ + iα1⟩. . spectral decomposition.2010 . and outer product representation of the Pauli gates. I has eigenvectors 0⟩. + iα1⟩. the coefﬁcients of outer product representations are the same as the matrix entries. and 1⟩ with eigenvalues of 1 and 1 respectively. When applied to Ψ⟩ = α0⟩ + β1⟩) we’ll see what we get: The ﬁrst part of the outer product notation is i1⟩⟨0 so this means we take the α0⟩ part of Ψ⟩ and convert it to iα1⟩ so our partially built state now looks like: Ψ⟩ = .
and RZ .51) Y has eigenvectors 1 respectively.55) (5. Z = 1 · 0⟩⟨0 + (−1) · 1⟩⟨1 = 0⟩⟨0 − 1⟩⟨1.⃝Riley T.61) . ] [ e−iθ/2 0 RZ = 0 e−iθ/2 = e−iθZ/2 . (5. Rotation Operators There are three useful operators that work well with the Bloch sphere.59) (5. c The Temple of Quantum Computing . ] [ θ θ cos 2 − sin 2 RY = θ θ sin 2 cos 2 = e−iθY /2 . 1 1 1 1 X = 1 · √ (0⟩ + 1⟩) √ (⟨0 + ⟨1) + (−1) · √ (0⟩ − 1⟩) √ (⟨0 − ⟨1) 2 2 2 2 = 1⟩⟨0 + 0⟩⟨1. RY . 2 and 1 √ (0⟩ − i1⟩) 2 with eigenvalues of 1 and 1 1 1 1 Y = 1 · √ (−i0⟩ + 1⟩) √ (i⟨0 + ⟨1) + (−1) · √ (0⟩ − i1⟩) √ (⟨0 + i⟨1) 2 2 2 2 = i1⟩⟨0 − i0⟩⟨1.58) (5.54) (5.Elements of Quantum Computing respectively.52) Z has eigenvectors 0⟩. [ ] θ θ cos 2 −i sin 2 RX = θ θ −i sin 2 cos 2 = e−iθX/2 .53) (5. These are the rotation operators RX . The Pauli matrices are: Unitary (σk )† = I ∀ k. Perry 2004 .56) (5. and 1⟩ with eigenvalues of 1 and 1 respectively. 137 (5.57) (5.2010 (5.60) (5. Hermitian (σk )† = σk ∀ k. 1 √ (−i0⟩ + 1⟩).
Because it is a two qubit gate it is represented by a c The Temple of Quantum Computing . this time with emphasis on quantum computing. a⟩ b⟩ • a⟩ b ⊕ a⟩ In the case of the CNOT gate. Y. this requires that multi qubit gates use a control line. (5. We’ll look again at the reversible gates that were introduced in chapter 2.138 The rotation operators can be rewritten as Elements of Quantum Computing θ θ cos I − i sin Pσ 2 2 where Pσ means a Pauli operator identiﬁed by σ = X.62) In fact if we assume different angles for θ then all single qubit gates can be represented by the product of RY and RZ . Multi Qubit Gates A true quantum gate must be reversible. Perry 2004 . 1 1 √ √ 2 1 1 2 2 So if we apply the gate to state Ψ⟩ = 1⟩ we get the following: [ ][ ] [ ] 1 1 1 √ − √2 − √2 0 2 = 1 1 1 √ √ √ 1 2 2 2 1 1 = − √ 0⟩ + √ 1⟩ 2 2 1 1 = √ 0⟩ − √ 1⟩.2010 . or Z. 2 2 At that last step we multiplied the entire state by a global phase factor of −1.⃝Riley T. Example We can represent RY (90◦ ) by the following matrix: [ ] [ ] 1 1 √ − √2 1 −1 1 2 √ = . the ⊕ is a classical XOR with the input on the b line and the control line a. where the control line is unaffected by the unitary transformation.
70) Example Evaluating (α0⟩ + β1⟩)0⟩ → CNOT → α00⟩ + β11⟩. Perry 2004 .67) (5. 0⟩(α0⟩ + β1⟩) → CNOT → α00⟩ + β01⟩.Elements of Quantum Computing 4 × 4 matrix: 139 0 1 0 0 0 0 0 1 0 0 1 0 which gives the following: 00⟩ → CNOT → 00⟩.63) (5.2010 . (α0⟩ + β1⟩)1⟩ → CNOT → α01⟩ + β10⟩.68) (5.69) (5. 11⟩ → CNOT → 10⟩. 01⟩ → CNOT → 01⟩.66) (5. 1 0 0 0 α α c The Temple of Quantum Computing . so in matrix form we have: 0 1 0 0 0 0 0 0 0 1 β = 0 0 0 1 0 0 β = α00⟩ + β11⟩.65) (5.⃝Riley T.64) (5. 1 0 0 0 (5. (α0⟩ + β1⟩)0⟩ expanded is α00⟩ + β10⟩. 1⟩(α0⟩ + β1⟩) → CNOT → α11⟩ + β10⟩. 10⟩ → CNOT → 11⟩.
H. Laﬂamme. 2002]: [ ] [ 1 0 0 1 NOT2 = I ⊗ X = ⊗ 0 1 1 0 ] [ [ 0 1 0 1 1 0 ] [ = [ 0 1 0 1 1 0 ] (5. Gurvits.77) ] .78) (5. 01⟩ → NOT2 → 00⟩. 01⟩ → I ⊗ X → 00⟩. 11⟩ → I ⊗ X → 10⟩.80) (5. Gubernatis. W.⃝Riley T. (5. Barnum. 10⟩ → I ⊗ X → 11⟩. Ortiz.2010 . Dziarmaga. G.71) 1 0 0 0 0 0 0 1 0 0 1 0 which gives the following: 00⟩ → NOT2 → 01⟩.76) 0 1 1 0 ] (5. & Zurek. shown below: 00⟩ → I ⊗ X → 01⟩.140 Qubit Two NOT Gate Elements of Quantum Computing As distinct from the CNOT gate we have a NOT2 gate. as well as using the NOT2 notation we can use the tensor product of Pauli gates on qubits one and two. 11⟩ → NOT2 → 10⟩. R.81) c The Temple of Quantum Computing . 0 1 0 0 (5. L. 10⟩ → NOT2 → 11⟩.72) (5.H. Perry 2004 .73) (5. D. Viola.75) Although it’s not a commonly used gate it’s interesting to note that the gate can be represented as a Kronecker product of I and X as follows [Knill. Dalvit. E. which just does NOT on qubit two and has the following matrix representation: (5. J. J. 0 1 1 0 So.74) (5. L.79) (5.
and FANOUT. a⟩ b⟩ c⟩ • × × a′ ⟩ b′ ⟩ c′ ⟩ c The Temple of Quantum Computing . a⟩ b⟩ c⟩ • • a′ ⟩ b′ ⟩ c′ ⟩ The Toffoli gate can simulate NAND gates and it can perform FANOUT. FANOUT is easy in classical computing. the Fredkin gate is another three qubit gate. Perry 2004 . NOT. A Toffoli gate can be simulated using a number of H. Fredkin Gate Also introduced in chapter 2. T. but impossible in quantum computing because of the no cloning theorem (see chapter 6).⃝Riley T.2010 . The most important property being that any classical circuit can be emulated by using Toffoli gates. it also has the interesting property that it conserves 1’s.Elements of Quantum Computing Toffoli Gate 141 The Toffoli gate was ﬁrst introduced in chapter 2. which is classical bit copying (but we can’t copy superposed probability amplitudes). and S gates. Here we’ll look at some properties that relate to quantum computing. This gate can simulate AND. CROSSOVER.
No FANIN. and therefore not unitary. No FANOUT. 3.⃝Riley T.1 Common Circuits Controlled U Gate Let U be a unitary matrix. 5. Perry 2004 . which uses an arbitrary number of qubits. They are acyclic (no loops). i. As stated in chapter 2. as FANIN implies that the circuit is NOT reversible. 5.2 Important Properties of Quantum Circuits Quantum circuit diagrams have the following constraints which make them different from classical diagrams.2). All of the above can be simulated with the use of ancilla and garbage bits if we assume that no qubits will be in a superposition (ﬁgure 5. 1. 2.e.2: Garbage and ancilla bits.2. Garbage bits are useless qubits left over after computation and ancilla bits are extra qubits needed for temporary calculations. A controlled U gate is a U gate with a control line. as we can’t copy a qubit’s state during the computational phase because of the nocloning theorem (explained in chapter 6).2010 . if the control qubit is 1⟩ then c The Temple of Quantum Computing .142 Important Properties of Quantum Circuits x Classical circuit f (x) x Quantum circuit ancilla bits f (x) garbage bits Figure 5.
2010 . • 143 U Bit Swap Circuit This circuit swaps the values of qubits between lines. a⟩ b⟩ The circuit can be simpliﬁed to: a⟩ b⟩ Here are some examples: 0⟩ 1⟩ 1⟩ 0⟩ Copying Circuit If we have no superposition then we can copy bits in a classical sense with a CNOT.⃝Riley T. otherwise they are left alone.Important Properties of Quantum Circuits U acts on its data qubits. × × × × 1⟩ 0⟩ 0⟩ 1⟩ × × b⟩ a⟩ • • b⟩ a⟩ • c The Temple of Quantum Computing . Perry 2004 .
The information held in the probability amplitudes α and β is lost. when it is copied it must ﬁrst be measured to be copied. • c The Temple of Quantum Computing . β01 ⟩. Perry 2004 . α00⟩ + β10⟩ → CNOT → α00⟩ + β11⟩. and the individual Bell states as β00 ⟩.2010 . Which is not a copy of the original state because: (α0⟩ + β1⟩)(α0⟩ + β1⟩) ̸= α00⟩ + β11⟩. We’ll represent a Bell state circuit by β.144 a⟩ 0⟩ 0⟩ 0⟩ 1⟩ 0⟩ Important Properties of Quantum Circuits • a⟩ a⟩ 0⟩ 0⟩ 1⟩ 1⟩ • • But when we use a superposition as input: α 0⟩ + β 1⟩ 0⟩ The combined state becomes: (α0⟩ + β1⟩)0⟩ = α00⟩ + β10⟩. β10 ⟩.⃝Riley T. and β11 ⟩. A qubit in an unknown state (as an input) cannot be copied. Bell State Circuit This circuit produces Bell states that are entangled.
Z1⟩ = −1⟩) → √ (00⟩ − 11⟩). They then move apart to an . Perry 2004 . c The Temple of Quantum Computing . 2 1 10⟩ → β → √ (00⟩ − 11⟩) = β10 ⟩. 2 1 01⟩ → β → √ (01⟩ + 10⟩) = β01 ⟩. 2 Superdense Coding It’s possible. Here’s how: 1. 2. Initially Alice and Bob each take one half of an EPR pair. Alice now sends her qubit to Bob via a classical channel. say we start with β00 . 2 1 11⟩ → XZ → √ (01⟩ − 10⟩).⃝Riley T.2010 1 √ (00⟩ 2 1 √ (00⟩ 2 + 11⟩) and + 11⟩). X1⟩ = 0⟩) → √ (10⟩ + 01⟩). 2 1 11⟩ → β → √ (01⟩ − 10⟩) = β11 ⟩. she applies a gate (or gates) to her qubit. by using entangled pairs. 2 1 10⟩ → X(X0⟩ = 1⟩. to communicate two bits of information by transmitting one qubit. This means that Alice has the bolded qubit in Bob has the bolded qubit in arbitrary distance.Important Properties of Quantum Circuits a⟩ H • βxx ⟩ b⟩ 145 1 00⟩ → β → √ (00⟩ + 11⟩) = β00 ⟩. 2 3. Depending on which value Alice wants to send to Bob. 2 1 01⟩ → Z(Z0⟩ = 0⟩. This is described below and the combined state is shown after the gate’s operation with Alice’s qubit shown bolded: 1 00⟩ → I → √ (00⟩ + 11⟩).
2 1 √ (α0⟩ − β1⟩)0⟩ → (H ⊗ I) → 10⟩. 2 1 √ (α0⟩ − β1⟩)1⟩.e. 2 5. 2 So Bob gets the following: 1 √ (α0⟩ + β1⟩)0⟩ → (H ⊗ I) → 00⟩. Now Bob applies an H gate to the ﬁrst bit to collapse the superposition. 2 1 √ (α0⟩ + β1⟩)1⟩. Teleportation Circuit Teleportation is basically the opposite of superdense coding. 2 1 √ (α0⟩ − β1⟩)1⟩ → (H ⊗ I) → 11⟩. 1 √ (α00⟩ + β11⟩) → CNOT → 2 1 √ (α10⟩ + β01⟩) → CNOT → 2 1 √ (α00⟩ − β11⟩) → CNOT → 2 1 √ (α01⟩ − β10⟩) → CNOT → 2 1 √ (α00⟩ + β10⟩) = 2 1 √ (α01⟩ + β11⟩) = 2 1 √ (α00⟩ − β10⟩) = 2 1 √ (α01⟩ − β11⟩) = 2 1 √ (α0⟩ + β1⟩)0⟩. 2 1 √ (α0⟩ + β1⟩) → H → 0⟩. 2 1 √ (α0⟩ + β1⟩)1⟩ → (H ⊗ I) → 01⟩. Bob now uses a CNOT which allows him to ”factor out the second qubit” while the ﬁrst one stays in a superposition. superdense coding takes a quantum state to two classical bits.146 Important Properties of Quantum Circuits 4.2010 . 2 1 √ (α0⟩ − β1⟩)0⟩. 2 Bob can now measure the two qubits in the computational basis and the result will be the value that Alice wanted to send. i.⃝Riley T. 1 √ (α0⟩ − β1⟩) → H → 1⟩. Perry 2004 . Teleportation takes two classical bits to one quantum state. Alice’s circuit Ψ⟩ β00 • H NM NM c The Temple of Quantum Computing .
2 They then move apart to an arbitrary distance. including Bob’s qubit. 2 3. Alice has a qubit in an unknown state: Ψ⟩ = α0⟩ + β1⟩.This is like using (CNOT⊗I) on the combined three qubit system. 2 4. the qubit we want to teleport (or H ⊗ I ⊗ I for the combined system): 1 (α(000⟩ + 100⟩ + 011⟩ + 111⟩) + β(010⟩ − 110⟩ + 001⟩ − 101⟩)). Alice then applies a CNOT. Like superdense coding. This means that Alice has the bolded qubit in 1 √ (00⟩ + 11⟩) 2 and Bob has the bolded qubit in 1 √ (00⟩ + 11⟩). 2 This gives the following combined state (Alice’s qubits are bolded): 1 Ψ⟩ = √ (α000⟩ + α011⟩ + β100⟩ + β111⟩).e. Note . Perry 2004 . initially Alice and Bob each take one half of an EPR pair.2010 .Important Properties of Quantum Circuits Bob chooses one of the following four circuits β00 β00 β00 β00 I X Z X Z Ψ⟩ Ψ⟩ Ψ⟩ Ψ⟩ 147 1. 2. say we start with β00 . 2 c The Temple of Quantum Computing . Which she combines with her entangled qubit: ( (α0⟩ + β1⟩) ) 1 √ (00⟩ + 11⟩) . i.⃝Riley T. 1 √ (α000⟩ + α011⟩ + β110⟩ + β101⟩). Alice then applies an H gate to her ﬁrst qubit.
This can include CNOTs and other single bit operations.3. a 00⟩. 5. 01⟩. (he selects gates based on what Alice tells him) so that the result restores the original qubit. This result resembles the classical result that any boolean function can be implemented with NAND gates. This is helpful because sometimes we are limited in what we can use to build a quantum circuit. Case 10 = α0⟩ − β1⟩ → Z → α0⟩ + β1⟩.⃝Riley T. Bob now may use X and/or Z gate(s) to ﬁx up the phase and order of the probability amplitudes. 6.e. 1 = (00⟩(α0⟩ + β1⟩) + 01⟩(α1⟩ + β0⟩) + 10⟩(α0⟩ − β1⟩) 2 + 11⟩(α1⟩ − β0⟩)). 1 = (00⟩α0⟩ + 10⟩α0⟩ + 01⟩α1⟩ + 11⟩α1⟩ + 01⟩β0⟩ − 11⟩β0⟩ 2 + 00⟩β1⟩ − 10⟩β1⟩). Case 01 = α1⟩ + β0⟩ → X → α0⟩ + β1⟩. Perry 2004 .3 The Reality of Building Circuits There is a general theorem: Any unitary operation on n qubits can be implemented using a set of two qubit operations. Case 11 = α1⟩ − β0⟩ → XZ → α0⟩ + β1⟩. or a 11⟩) to Bob. She then communicates via a classical channel what she measured (i.1 Building a Programmable Quantum Computer Is it Possible to Build a Programmable Quantum Computer Can we build a programmable quantum computer? This means a quantum computer that has an architecture similar to Von Neumann (or Harvard) architecture? No! This is because: c The Temple of Quantum Computing . 10⟩. 5.148 The Reality of Building Circuits Now we rearrange the state to move amplitudes α and β so that we can read the ﬁrst two bits leaving the third in a superposition. 5. Alice now performs measurements on her state to determine which of the above bolded states her qubits are in. Summarised below are the gates he must use: Case 00 = α0⟩ + β1⟩ → I → α0⟩ + β1⟩.2010 .
and the affect those measurements have on that system.⃝Riley T.. while the system is evolving under its own steam .The Four Postulates of Quantum Mechanics 149 Distinct unitary operators U0 . These are introduced here as simple sentences and then explained in more details in the following sections. In a closed quantum system we need a way of describing the state of all the particles within it. 4. Since there are an inﬁnite number of these unitary operators the program register would have to be inﬁnite in size (that is our input to the quantum computer that contains the program) [Nielsen. 5. 5. 3. The ﬁrst postulate gives us a way to do this by using a single state vector to represent the entire system.2010 . Postulate four relates to combining or separating different closed quantum systems using tensor products. The evolution of a closed system is a unitary transform.the state at some stage Ψ′ ⟩ is related to the state at some previous stage (or time) Ψ⟩ by a unitary transform Ψ′ ⟩ = U Ψ⟩. A.. If we were to have a programmable quantum computer our ”program” would consist of one or more unitary operators. 2002] This is called the no programming theorem. M. We will use a state space called a Hilbert space. c The Temple of Quantum Computing .4. This means that we can totally describe the behaviour of a system by using unitary matrices.Un ⟩ [Nielsen.1 Postulate One An isolated system has an associated complex vector space called a state space. M. this would be C2 for a spin system. A.4 The Four Postulates of Quantum Mechanics The theory of quantum mechanics has four main postulates. Perry 2004 .. Say that.Un require orthogonal programs U0 ⟩. . 2002].. Say the state is to be a vector in Cn . 2. The third postulate relates to making measurements on a closed quantum system.no measurement . 1.
t2 )Ψ(t1 )⟩ (5.150 The Four Postulates of Quantum Mechanics The state of the quantum system can be described by a unit vector in this space called a state vector. Example The simplest system we are interested in is a qubit which is in C2 .⃝Riley T. Form including time If we include time (as quantum interactions happen in continuous time): Ψ(t2 )⟩ = U (t1 . Perry 2004 .84) The history of the quantum system does not matter as it is completely described by the current state (this is know as a Markov process). ¨ Note: We can rewrite the above in terms of Schrodinger’s equation. A qubit is a unit vector Ψ⟩ in C. Most of the time we’ll attach an orthonormal basis (like {0⟩.83) ′ (5. We can also say that the process is reversible. Our qubit can be described by: [ ] α Ψ⟩ = α0⟩ + β1⟩ = β here α and β are known as probability amplitudes and we say the qubit is in a quantum superposition of states 0⟩ and 1⟩. 5. t2 ) is a unitary operator than can vary with time. but that is beyond the scope of this paper.2010 . Ψ ⟩ = U Ψ⟩.82) here t1 and t2 are points in time and U (t1 .2 Postulate Two Simple form An isolated (closed) system’s evolution can be described by a unitary transform. 1⟩}).4. because: U † U Ψ⟩ = Ψ⟩. c The Temple of Quantum Computing . (5.
On ⟩}. we have an orthonormal basis A = {e1 ⟩. This is because measurement disturbs the system. ⟨u1 u2 ⟩ ̸= 0) then we can’t reliably distinguish between them on measurement.85) Example If we measure in the computational basis we have: pr(0) = ⟨0Ψ⟩2 = ⟨0(α 0⟩ + β 1⟩)2 = α2 and pr(1) = β2 . (5. . If u1 ⟩ and u2 ⟩ are not orthogonal (i. . . Perry 2004 . V2 .4. .⃝Riley T. . O1 ⟩. ⊕ Vm . en ⟩} where n is the dimension of A. After the measurement the system is in state Oj ⟩. .e. Projectors Suppose we have a larger quantum system which is a combination of smaller systems. .86) . . . i.2010 (5. Vm which are connected in the following way: V = V1 ⊕ V2 ⊕ . .The Four Postulates of Quantum Mechanics 151 5. . . . . On ⟩ is part of or comprised of one or many of the orthogonal subspaces V1 . Then we have a larger quantum system B such that A ⊂ B. .e.3 Postulate Three Simple form This deals with what happens if Ψ⟩ is measured in an orthonormal basis: {O1 ⟩. We’ll measure a particular outcome j with probability: pr(j) = ⟨Oj Ψ⟩2 . . If we measure A what is the effect on B? We can say that O1 ⟩. c The Temple of Quantum Computing . . .
e2 ⟩) ⊕ V2 (e3 ⟩). . Example From the last example. Pm ) to ﬁlter out everything other than the subspace we are looking for (i.2010 . c The Temple of Quantum Computing . Perry 2004 . . projector P1 on V1 (e1 ⟩. O3 ⟩) = V1 (e1 ⟩. everything orthogonal to our subspace V ). .⃝Riley T.e. O2 ⟩. e2 ⟩) gives us: P1 (αe1 ⟩ + βe2 ⟩ + γe3 ⟩) = αe1 ⟩ + βe2 ⟩. We can use projectors (P1 .152 Example The state vector: The Four Postulates of Quantum Mechanics Ψ⟩ = (αO1 ⟩ + βO2 ⟩) + γO3 ⟩ can be rewritten as: V (O1 ⟩. .
γ2 0 c The Temple of Quantum Computing .⃝Riley T. So our separated look like this: Ψ1 ⟩ = √ P1 Ψ⟩ ⟨ΨP1 Ψ⟩ α0⟩ + β1⟩ =√ . . Perry 2004 .The Four Postulates of Quantum Mechanics 153 Formally. pr(2) = ⟨ΨP2 Ψ⟩ α = [α∗ β ∗ γ ∗ ] 0 γ = γ2 . pr(j) = ⟨ΨPj Ψ⟩ leaving the system in the post measurement state: P Ψ⟩ √ j . (5. . α2 + β2 P2 Ψ⟩ Ψ2 ⟩ = √ ⟨ΨP2 Ψ⟩ γ2⟩ =√ . ⟨ΨPj Ψ⟩ Example Given a qutrit Ψ⟩ = α0⟩ + β1⟩ + γ2⟩).88) (5. if P1 . .87) P1 on V1 (0⟩. . Pm is a set of projectors which covers all the orthogonal subspaces of the state space. upon measuring Ψ⟩ we have. 1⟩) and P2 on V2 (2⟩) gives us: pr(1) = ⟨ΨP1 Ψ⟩ = [α∗ β ∗ γ ∗ ] β 0 = α2 + β2 .2010 .
Example If Ψ⟩ = α00 00⟩ + α01 01⟩ + α10 10⟩ + α11 11⟩: For measuring qubit one in the computational basis we get 0⟩ with probability: pr(0) = ⟨ΨP0 ⊗ IΨ⟩ = (α00 00⟩ + α01 01⟩ + α10 10⟩ + α11 11⟩) • (α00 00⟩ + α01 01⟩) = α00 2 + α01 2 . O2 ⟩} then we use the projector with a tensor product with I on the qubit we don’t want to measure. An example is on the next page.2010 . There is another type of measurement called a POVM (Positive Operator Valued Measure) of which projectors are a certain type. the following example uses the tensor product which is also part of postulate 4.g. Perry 2004 . describes the system.154 The Four Postulates of Quantum Mechanics More importantly we can look at partial measurement of a group of qubits. 5.⃝Riley T. 2 (5.89) c The Temple of Quantum Computing . If the system to be measured in the basis {O1 ⟩. e.4.4 Postulate Four A tensor product of the components of a composite physical system. POVMs are beyond the scope of this text. So the state spaces of the individual systems are combined so: Cn ⊗ Cn = Cn . for O2 ⟩ of qubit two we use (I ⊗ P2 ).
The Four Postulates of Quantum Mechanics Example C4 ⊗ C4 = C16 can look like: 155 (ΨA ⟩ = 1⟩ + 2⟩ + 3⟩ + 4⟩) ⊗ (ΨB ⟩ = a⟩ + b⟩ + c⟩ + d⟩) and can be written as: ΨAB ⟩ = 1a⟩ + 1b⟩ + 1c⟩ + .110⟩ + √ √ 0.410⟩. Example Given the following: Ψ⟩ = then.310⟩ + √ 0. Perry 2004 .401⟩.200⟩ + 0. Ψ⟩ → (I ⊗ X) → Ψ⟩ = Ψ⟩ → (X ⊗ I) → Ψ⟩ = √ √ 0.411⟩ c The Temple of Quantum Computing . √ 0. 0. If Bob applies gate U to this system it means I ⊗ U is applied to the joint system.300⟩ + √ √ 0. .311⟩ + 0. Example If Alice has ΨA ⟩ = u⟩ and Bob has ΨB ⟩ = v⟩.211⟩ + √ √ 0.201⟩ + √ 0.⃝Riley T.2010 .101⟩ + 0. if their systems are combined the joint state is: ΨAB ⟩ = u⟩ ⊗ v⟩. .100⟩ + √ 0. + 4d⟩.
.
which has many parallels in conventional information theory. there is a fairly indepth section on Bell states and the chapter ends with some open questions on the nature of information and alternate methods of computation. ”How are you?” and ”Comment allez vous?” express the same meaning. 1916 .1). and quantum cryptology.g. A.1 Introduction Information theory examines the ways information can be represented and transformed efﬁciently [Steane. As with chapter 5 individual references to QCQI have been dropped as they would appear too frequently.Chapter 6 Information Theory 6. E. 157 . Shannon. Conventional information theory relies heavily on the classical theorems of Claude E. In this chapter we’ll look at these and other related topics like quantum error correction.2001 (ﬁgure 6. If we consider information in these terms then it becomes a property like energy that can be transferred from one physical system to another. There are a number of quantum equivalents for the various parts of his classical theorems. This information can be represented in many different ways to express the same meaning. The Information stored on a particular physical medium is not ”tied” to that medium and can be converted from one form to another. as promised. Also. We are interested in quantum information. 1998]. M. All known ways of representing this information must have a physical medium like magnetic storage or ink on paper.
Transmitter .5.1). OR. 1948]. switches.158 History Figure 6. and NOT) on the binary number system.1864 (ﬁgure 6.The noise source can introduce random noise into the signal. Perry 2004 .1) [Shannon C.3 Shannon’s Communication Model To formally describe the process of transmitting information from a source to a destination we can use Shannon’s communication model.The origin of the message. Source of Noise . c The Temple of Quantum Computing .⃝Riley T. 6. 1815 . which itself has a formal deﬁnition (see section 6. The message is sent from the source in its raw form. The components of this are described as follows: Source .1: Claude E. potentially scrambling it.2010 .4). and other components in electronic circuits. The next milestone was in 1948 when Shannon wrote ”the mathematical theory of communication” in which he outlined the concepts of Shannon entropy (see section 6.The transmitter encodes and may compress the message at which point the message becomes a signal which is transported from transmitter to receiver. which is shown in ﬁgure 6. Shannon also deﬁned the most basic unit of information theory . Shannon and George Boole.the bit (binary digit). 6. Earlier Shannon had shown that boolean algebra could be used to represent relays.2 History The history of information theory can be said to have started with the invention of boolean algebra in 1847 by George Boole. Boolean algebra introduced the concept of using logical operations (like AND.2. E.
2: Shannon’s communication model. Each symbol transferred takes a certain amount of time (which is called the channel capacity).1 Channel Capacity A message is chosen from a set of all possible messages and then transmitted. 56.⃝Riley T.g. 6.3. Receiver . Shannon’s name for channel capacity on a binary channel is ”one bit per time period” e. c The Temple of Quantum Computing .Shannon’s Communication Model 159 Source Message Destination Signal Message Transmitter Source of noise Receiver Figure 6. Perry 2004 .The receiver may decode and decompress the signal back into the original message.The destination of the raw message. Destination . 000 bits per second. His expression for capacity is: C = lim log2 N T →∞ T (6.1) where N is the number of possible messages of length T .2010 .
The alphabet that is most commonly used is binary (1 and 0).4.160 Example For binary we have: 2 bits = 4 different messages in 2 time periods. 2002].⃝Riley T. A.34 bit per time period. The way an information source can be modelled is via a probability that certain letters or combinations of letters (words) will be produced by the source. given an unknown book one could.2010 . Perry 2004 . 6. M. Example Another example is morse code. but it could in principle be any series of symbols. predict to a certain degree of accuracy the frequency of words and letters within the book [Nielsen.1 Independent Information Sources An independent and identically Distributed (IID) information source is an information source in which each output has no dependency on other outputs from the source. 3 bits = 8 different messages in 3 time periods. in advance. C= Classical Information Sources log2 N T = 1 bit per time period. An example for this probability distribution would be. 6. If dashes are represented by 1110 and a dot is 10 for this we have: C = 0. so. N (T ) = 2T and. where dashes take longer to transmit than dots.4 Classical Information Sources A source of information produces a discrete set of symbols from a speciﬁc alphabet. and furthermore each output has the same probability of occurring c The Temple of Quantum Computing .
an } with probabilities pr(a1 ). all systems should have the same probabilities for letters to appear in their alphabets. tails}: pr(heads) = 0. (6. Perry 2004 . I. This means that there should be no statistical variation (with a probability of 1) between possible sources. The biased coin has a probability p of heads and a probability of 1 − p of tails.3.3) This source will produce a letter with probability pr(ai ) with no dependency on the previous symbols.e. (not just letters) like ”he” and ”wh” [Nielsen.7 . etc. ∑ Given a language = {heads. Strictly speaking. M. words. 2002] A biased coin is a good example of an IID. c The Temple of Quantum Computing . Shannon suggested that most information sources can be approximated. A.e. . Symbols must be chosen with ﬁxed probabilities. one by one with no dependency on current symbols and preceding choices. . . . Independent information sources are also called zero memory information sources (i.Classical Information Sources each time it is produced [Nielsen. . The reason is that. 161 An IID is an information source with an alphabet (i.2) pr(ai ) = 1 where 0 ≤ pr(ai ) ≤ 1 ∀ i. An information source must be an ergodic source.2010 . . Shannon’s results only hold for a subset of information sources that conform to the following: 1. .⃝Riley T. A. for example a book has correlations between syllables. M. Not many sources are perfect like the above. Example [Nielsen. 2002]. .e a set of symbols or outputs ai ): A = {a1 .pr(an ) such that: n ∑ i=1 (6. Our coin will come up tails 70% of the time. We can measure certain qualities and the source becomes more like an IID (like JUST letter frequency). A. pr(tails) = 0. 2. they correspond to a Markov process). 2002].pr(a2 ). M.
. Length of Codes We deﬁne the size of an alphabet A as A and the length of a word w can be shown with w. . Example A simple coding. D}.⃝Riley T. D → 1111. Perry 2004 . A word. K(an ). Formally. K(a) is a word with letters from B. K : A → B. C. 1}. .162 Classical Redundancy and Compression 6. . When we talk about compression in this section we mean simple algorithmic compression that can be applied to all information sources. C → 1001. B. w = a1 a2 . We often talk about using a coding K to represent our message. i. a coding is a function that takes a source alphabet A to a coding alphabet B. So we encode the word ABBA as: K(ABBA) = 0001 0101 0101 0001.e.5 Classical Redundancy and Compression Compression of data means using less information to represent a message and reconstructing it after it has been transmitted. an in A is found by: K(w) = K(a1 )K(a2 ) . changing the text in a sentence to convey the same meaning or using special techniques to only work on a subset of messages or information sources (like using a simple formula to exactly represent a picture of a sphere). c The Temple of Quantum Computing . B = {0.2010 (6. For every symbol a in the language A. A = {A. This is distinct from say. Possible encodings are: A → 0001. B → 0101.4) .
5. d. Perry 2004 . . e. (6. B = 3. A = {a. 2}.Classical Redundancy and Compression Example A and w. Possible encodings are: a → 0. K(c) = 2. For a source S the entropy is related to the shortest average length coding Lmin (S) by: H(S) ≤ Lmin (S) < H(S) + 1. f → 222.6) Here. 1. c The Temple of Quantum Computing . of a particular source distribution measured in bits by: H(X) = − ∑ i pri log2 pri . f }. b. c. .5) We can ﬁnd the Shannon Entropy. d → 220. e → 221. the frequency with which it is emitted) for a symbol being generated by the source and the summation is a sum over all the symbols i = 1. . Shannon Entropy H(S) is the minimum number of bits needed to convey a message. A = 6. pri is a measure of probability (i. 163 6. .⃝Riley T.e.2010 .1 Shannon’s Noiseless Coding Theorem Shannon demonstrated that there is a deﬁnite limit to how much an information source can be compressed. 2. b → 1. (6. B = {0. c → 20. We get: K(a) = 1. log2 (a log of base 2) means that the Shannon entropy is measured in bits. n generated by the source. K(f ) = 3.
1. D. The minimum entropy is realised when the information source produces a single letter constantly.1) × 3)] = −[−0.9] = 1. weighted coin that always comes up heads or always comes up tails has minimum entropy of 0 bits.2010 .1 log2 0. Perry 2004 . with no dependencies. c The Temple of Quantum Computing . E} of symbols occurring with the following frequency: A = 0. The entropy is: H(X) = −[(0.164 Classical Redundancy and Compression Example Random and dependent sources. B. which is chosen randomly (e. This has Shannon Entropy of 1 2 bit(s) per symbol. Random Each symbol is chosen from the source totally randomly (with A and B having equal probability). this gives us a probability of 1 for that letter.5.1 .2. Dependent Every second symbol is exactly the same as the last.2 + (0. Example We have a language {A. The maximum entropy is realised when we have no information about the probability distribution of the source alphabet (when all symbols are equally likely to occur).5 + (−0. D = 0.9965)] = −[−1.5 log2 0.5 + 0.⃝Riley T.9. C = 0. So we need 2 bits per symbol to convey the message. C. E = 0. B = 0.46438) + (−0. Note a fair coin toss has maximum entropy of 1 bit and a totally unfair. AABBBBAABB).g. A special case of the entropy is binary entropy where the source has just two symbols with probabilities of p and 1 − p like the biased coin toss for example. this source is uncompressible with Shannon Entropy of 1 bit per symbol.2 log2 0.1.
M. but at least the state vector is known as distinct from what it collapses to. vertical (V).Classical Redundancy and Compression 165 6.3 Pure and Mixed States A quantum system is said to be in a pure state if its state is well deﬁned. If the qubits involved are in well deﬁned states (like 0⟩ and 1⟩) a semiclassical coin toss [Nielsen. 2 ( ) 1 H = 1.6 . and diagonal (D). 2 0⟩+1⟩ √ 2 with probability of 1 . and our quantum compression performs better than the Shannon rate H(pr(j)). The question is. 6. is there any difference when we use quantum states? The answer is yes if we use a superposition. For example given a photon and a polariser the photon can be in three states. 2 ( H 1+ 2 1 √ 2 ) = 0. If we make our photon diagonal at 45◦ then we c The Temple of Quantum Computing . 2002] gives us: 0⟩ with probability of 1 . Perry 2004 .⃝Riley T. 2 1⟩ with probability of 1 . 2 If we replace one of these states with a superposition then a ”quantum coin toss” gives us: 0⟩ with probability of 1 .2010 .2 Quantum Information Sources Shannon entropy gives us a lower bound on how many bits we need to store a particular piece of information. horizontal (H). A.5. This does not mean the state vector will always collapse to a known value. Better than Shannon’s rate! Generally a quantum information source produces state: Ψj ⟩ with probabilities pr(j).5.
This is called decoherence. We now look at ρ.4 Schumacher’s Quantum Noiseless Coding Theorem The quantum analogue of Shannon’s noiseless coding theorem is Schumacher’s quantum noiseless coding theorem. but the state of each component qubit is not well deﬁned. The state was well deﬁned before measurement. ρ holds equivalent information to the quantum state Ψ and quantum mechanics can be formulated in terms of ρ as an alternative to Ψ. When closed quantum systems get affected by external systems our pure states can get entangled with the external world. Which is as follows [Nielsen. M. For example.2010 . So the state is not well deﬁned and we call this state mixed. 6. so we call it pure (i. 1 1 D⟩ = √ H⟩ + √ V⟩. Entangled states like Bell states are well deﬁned for the composite system (whole). mixed. leading to mixed states. Perry 2004 . 50% of which are polarised horizontally and 50% vertically. if we have a number of photons.166 Classical Redundancy and Compression have an equal superposition of H and V. The Density Matrix In studying quantum noise it turns out to be easier to work with the density matrix than the state vector (think of it as just a tool. We don’t have this situation if there is no direction in which the result is certain. and if we measure with a polariser in this direction the result is certain). i. not a necessary compoc The Temple of Quantum Computing . we have a well deﬁned angle of polarisation viz 45◦ . This situation is indistinguishable from a photon that is in an entangled state. or in information theory terms. but not the group.5. 2 2 Now if we measure polarisation we have a 50% chance of detecting an H⟩ or a 50% of detecting a V⟩. It is possible to have a well deﬁned (pure) state that is composed of subsystems in mixed states. 2002]: The best data rate R achievable is S(ρ). now we have a mixed state. A. (6.e. noise. Each photon has a well deﬁned state H⟩ or V⟩.e.7) where S is Von Neumann entropy and ρ is the density matrix.⃝Riley T.
The probability of outcome k when a measurement. A. But we can assign an individual density matrix to either subsystem. Perry 2004 . 167 According to Nielsen [Nielsen. ρ= ∑ j (6.If quantum system A is coupled to another quantum system B we can’t always give A a state vector on its own (it is not well deﬁned). Subsystem . 2002] there are three main approaches to the density matrix.It is possible to restate the four postulates of quantum mechanics in terms of the density matrix. as mentioned above.2010 .10) c The Temple of Quantum Computing .⃝Riley T.Classical Redundancy and Compression nent of quantum computing). They are described brieﬂy here: Ensemble . which is described by Pk . the ensemble point of view.8) prj ψj ⟩⟨ψj  (6.This is the basic view of the density matrix which gives us measurement statistics in a compact form. If a measurement is done. subsystem. For example. ρ completely determines the measurement statistics. Fundamental . we can view the statistics generated by an entangled photon as equivalent to that of the corresponding ensemble. The set of all probabilities and their associated state vectors {prj . ψj ⟩} is called an ensemble of pure states. and fundamental approaches. with projectors Pk on a system with density matrix ρ the post measurement density matrix ρk is: Pk ρPk . tr(Pk ρPk ) ρk = (6. Ensemble Point of View Consider a collection of identical quantum systems in states in Ψj ⟩ with probabilities prj .9) is the density matrix. M. is: k = tr(ρPk ) where.
ρ= 2 ∑ j=1 prj ψj ⟩⟨ψj .e.⃝Riley T. 1⟩}. 0 1 Next we’ll have a look at a qubit in an unknown state. c The Temple of Quantum Computing .e. i. measurement probabilities pr(0⟩) = 0 and pr(1⟩) = 1: ρ = 0 · 0⟩⟨0 + 1 · 1⟩⟨1 [ ] [ ] ] ] 1 [ 0 [ =0· +1· 1 0 0 1 0 1 [ ] 0 0 = . i. measurement probabilities pr(0⟩) = 1 and pr(1⟩) = 0: ρ = 1 · 0⟩⟨0 + 0 · 1⟩⟨1 [ ] [ ] ] ] 1 [ 0 [ =1· +0· 1 0 0 1 0 1 [ ] 1 0 = . and the use of a trace over the density matrix given a projector.168 Classical Redundancy and Compression A simple example involving the probabilities for a qubit in a known state is below: Example For a single qubit in the basis {0⟩. 0 0 For Ψ⟩ = 0 · 0⟩ + 1 · 1⟩. For Ψ⟩ = 1 · 0⟩ + 0 · 1⟩.2010 . Perry 2004 .
Classical Redundancy and Compression Example 169 Given measurement probabilities pr(0⟩) = p and pr(1⟩) = 1 − p.e. U Ψ⟩. Perry 2004 . 1⟩} then: pr(0⟩) = tr(ρ0⟩⟨0) ([ ][ ]) p 0 1 0 = tr 0 1−p 0 0 ([ ]) p 0 = tr 0 0 =p+0 = p. say we measure in an orthonormal basis. c The Temple of Quantum Computing . pr(1⟩) = tr(ρ1⟩⟨1) ([ ][ ]) p 0 0 0 = tr 0 1−p 0 1 ]) ([ 0 0 = tr 0 1−p = 0 + (1 − p) = 1 − p. How does a the density matrix evolve? Suppose a unitary transform U is applied to a quantum system: i. {0⟩.⃝Riley T. 0 1−p So. ρ = p0⟩⟨0 + (1 − p)1⟩⟨1 [ ] [ ] ] ] 1 [ 0 [ =p 1 0 + (1 − p) 0 1 0 1 [ ] [ ] 1 0 0 0 =p +1−p 0 0 0 1 [ ] p 0 = .2010 . given a density matrix ρ and a projector P = 0⟩⟨0 we can extract the ﬁnal probability from ρ.
after U is applied. it will be in state U Ψ⟩ with probabilities prj . Initially we have ρ = ∑ j prj ψj ⟩⟨ψj .2010 (6. ρ is a positive matrix. ⟨ψj  = ψj ⟩† goes to (U ψj ⟩)† = ⟨ψj U † . after the evolution occurs.⃝Riley T. So. Perry 2004 . 2 This gives us a what is called completely mixed state and ρ = I . Note that when ψj ⟩ goes to U ψj ⟩.15) . Example [ Given measurement probabilities pr(0⟩) = p and pr(1⟩) = 1 − p ] p 0 then ρ = . including mixed subsystems. we have: ∑ ρ′ = prj U ψj ⟩⟨ψj U † j (6. 0 1−p If X is applied to ρ then: ρ′ = XρX † [ ] 1−p 0 = . 2 Properties: tr(ρ) = 1. Subsystems are described by a reduced density c The Temple of Quantum Computing .11) (6. 0 p Example For Ψ⟩ = 1 √ 00⟩ 2 + 1 √ 11⟩ 2 we have pr(00⟩) = 1 2 and pr(11⟩) = 1 . So. using the ensemble view.170 Classical Redundancy and Compression what is the new density matrix? To answer this.13) ( =U ∑ j ) prj U ψj ⟩⟨ψj  U † = U ρU † . Subsystem Point of View The density matrix can describe any subsystem of a larger quantum system. 2 I ρ′ = U U † 2 I = because U U † = 1.12) (6.14) (6. we can say that if the system can be in states Ψj ⟩ with probabilities trj then.
M. The partial trace is deﬁned as follows: ρA = trB (a1 ⟩⟨a2  ⊗ b1 ⟩⟨b2 ) = a1 ⟩⟨a2 tr(b1 ⟩⟨b2 ) = ⟨b1 b2 ⟩a1 ⟩⟨a2 . Bell states for example have a pure combined state with tr((ρC )2 ) = 1. If a system is in state ρj with a proba∑ bility of prj it has a density matrix of j prj ρj . There’s a simple test we can do to determine is a state is mixed or pure.17) (6. which is to run a trace on that state. i. S: S(ρ) = −tr(ρ log2 ρ). are replaced by a density matrix ρ in Von Neumann entropy. 4. A tensor product gives us the state of a composite system.⃝Riley T.e.Classical Redundancy and Compression 171 matrix. 3. Measuring using projectors Pk gives us k with probability tr(Pk ρ) leaving the system in a post measurement state of ρk = Pk ρPk tr(Pk ρPk ) . Perry 2004 .e. A subsystem’s state can be found by doing a partial trace on the remainder of the system (i.19) .18) Previously we mentioned the difference between pure and mixed states. over the other subsystems making up the system).2010 (6. Instead of using a state vector. The density matrices for the subsystems are ρA and ρB and the overall density matrix is ρC (also referred to as ρAB ). if we get tr(ρ2 ) < 1 then the state is mixed (tr(ρ2 ) = 1 for a pure state).16) trA and trB are called partial traces over systems A and B respectively. Von Neumann Entropy The probability distributions in classical Shannon entropy H. but they have mixed substates. c The Temple of Quantum Computing . Fundamental Point of View In terms of the density matrix the four postulates of quantum mechanics are [Nielsen. we can use the density matrix to describe a quantum system in Hilbert space. 2002]: 1. (6. (6. Changes in a quantum system are described by ρ → ρ′ = U ρU † . 2. A. tr((ρA )2 ) < 1 and tr((ρB )2 ) < 1. We can deﬁne ρA and ρB as: ρA = trB (ρC ) and ρB = trA (ρC ). If we have two subsystems A and B of a system C where A ⊗ B = C.
21) with S(ρ) = 0 meaning a pure state and S(ρ) = log2 d giving us a totally mixed state. S(A) + S(B) ≤ S(AC) + S(BC).20) where λi are the eigenvalues of ρ.26) (6. Properties: S(ρA ⊗ ρB ) = S(ρA ) + S(ρB ). Perry 2004 .24) (6. S(B) > S(BC). If we want to deﬁne the uncertainty of a quantum state before measurement we can use entropy.32) c The Temple of Quantum Computing . namely Schumacher compression. ρB = trA (ρAB ). ρAB = ρA ⊗ ρB . We also use Von Neumann entropy to deﬁne a limit for quantum data compression.29) (6. S(ρA ) = −tr(ρA log2 ρA ).23) (6. which is beyond the scope of this paper.27) (6. ρA = trB (ρAB ). by measuring their Von Neumann entropy and determine if one is more entangled than the other.172 Classical Redundancy and Compression We can also deﬁne the entropy in terms of eigenvalues λi : ∑ S(ρ) = − λi log2 λi i (6. (6.22) (6.33) (6. S(ABC) + S(B(≤ S(AB) + S(BC).25) (6.2010 . (6. For example we could compare two states. S(ρB ) = −tr(ρB log2 ρB ).30) (6.⃝Riley T. S(ρAB ) ≤ S(ρA ) + S(ρB ). given a Hilbert space of dimension d then 0 ≤ S(ρ) ≤ log2 d (6.31) For S(A) + S(B) ≤ S(AC) + S(BC) it holds for Shannon entropy since H(A) ≤ H(AC) and H(B) ≤ H(BC) we get an advantage with Von Neumann entropy with: S(A) > (AC) or. S(ρAB ) ≥ S(ρA ) − S(ρB ).28) (6.
An example of this is that a 011 can equate to 1. • If 1 is transmitted.⃝Riley T. Shannon found a better way. If two bit ﬂips is highly improbable then upon receiving 011 we assume (with a high degree of certainty) that a 1 was sent (as 111) and a single bit was ﬂipped. with x being the number of bits used to encode the original message. We call this a Kx channel coding. such that any information source with entropy less than R can be encoded so as to transmit across the channel with arbitrarily few errors. • If 1 is transmitted. In the case of a binary channel we use repetition. longer encodings are required which increases transmission times. Repetition is inefﬁcient: to make the probability of error occurring lower. Classical Error Correction We’ll consider using binary symmetric channels with an error probability p with p ≤ 0. ”Given a noisy channel there is a characteristic rate R.com ? 2000].g. 6. • If 0 is transmitted. To combat noise we use redundancy. we can use three 1’s to represent a single 1. that way two bits have to be ﬂipped to produce an error. i. we send additional information to offset the noise.Noise and Error Correction 173 It should be noted that quantum mechanics tells us that (6.6 Noise and Error Correction Noisy Channels Noise is randomisation in a channel. above R we get errors” [indigosim. 1 is received with probability p.5 and: • If 0 is transmitted. 1 is received with probability 1 − p. We generally use a greater number of bits than the original message to encode the message with codewords. Perry 2004 . So if there is no noise then R matches the channel capacity C. 0 is received with probability 1 − p. e. 0 is received with probability p.33) cannot be true simultaneously.2010 .e. c The Temple of Quantum Computing .32) and (6.
1 .174 Noise and Error Correction If we have a code (called a binary block code) K of length n it has an information rate of: R(K) = k n (6.34) if it has 2k codewords (k = 1 in the example below).1 Quantum Noise In practice we cannot make perfect measurements and it’s hard to prepare and apply quantum gates to perfect quantum states because real quantum systems are quite noisy. 1 Repetition codes have an information rate of R(K) = n . Perry 2004 . Example A K3 channel coding could be: 0 → 000. 100 → 0. 111 → 1. we have an original message of k bits and we use codewords on n bits. c The Temple of Quantum Computing . but the information R(K3 ) = rate is down to 1 . 001 → 0.6. 110 → 1. 3 So.⃝Riley T.2010 . 011 → 1. 101 → 1. This means. 1 → 111. Repetition Codes Using repetition codes we have a greater chance of success by increasing the number of coding bits for a bit to be transmitted and averaging the result bits. bit ﬂips in 1 out of 3 bits in codeword are ﬁxable. 3 So our information rate is: 6. 010 → 0. With a channel decoding of: 000 → 0.
Example A qubit’s amplitudes and relative phase get ﬂipped: a0⟩ + b1⟩ → b0⟩ − a1⟩. Example A qubit’s relative phase gets ﬂipped: a0⟩ + b1⟩ → a0⟩ − b1⟩. 3.2 Quantum Error Correction Quantum error correction codes have been successfully designed. No Cloning. we might have a change of phase: α0⟩ + β1⟩ → α0⟩ + eiθ β1⟩. E. c The Temple of Quantum Computing . many types of error can occur on a single qubit (not just a bit ﬂip as with a classical circuit). but the area still remains a hot topic. The fact that they are quantum gives us a number of extra problems: 1. how do we apply majority logic to recover the qubits?). Perry 2004 . Below are some simple examples of quantum errors. for classical states (states not in a superposition) this is easy: 0⟩ → 000⟩.Noise and Error Correction 175 6. 1⟩ → 111⟩. 2.⃝Riley T.6. Example A qubit’s amplitudes get ﬂipped: a0⟩ + b1⟩ → b0⟩ + a1⟩.2010 .g. Some scientists still believe that quantum computing may be impossible due to decoherence which is external inﬂuences destroying or damaging quantum states. Continuous errors. We use quantum error correction codes in place of classical ones. Quantum Repetition Code A quantum repetition code is the analogue of a classical repetition code. Measurement destroys quantum information (so if we used a repetition code.
i. it prevents us from having: Ψ⟩ → Ψ⟩Ψ⟩Ψ⟩ which expanded would be: (α0⟩ + β1⟩) ⊗ (α0⟩ + β1⟩) ⊗ (α0⟩ + β1⟩). α0⟩ + β1⟩ → α000⟩ + β111⟩ which. Perry 2004 . A simple circuit for this encoding scheme is shown below: Ψ⟩ 0⟩ 0⟩ • • Ψ′ ⟩ So if we made our input state α0⟩ + β1⟩ then we would get: α 0⟩ + β 1⟩ 0⟩ 0⟩ • • α 000⟩ + β 111⟩ ↑ ψ1 ⟩ ↑ ψ2 ⟩ ↑ ψ3 ⟩ The diagram shows the stages in the evolution of Ψ⟩ as the CNOT gates are c The Temple of Quantum Computing .2010 .⃝Riley T.e. expanded is: α000⟩ + 0001⟩ + 0010⟩ + 0011⟩ + 0100⟩ + 0101⟩ + 0110⟩ + β111⟩.176 Noise and Error Correction The no cloning theorem won’t allow us to make copies of qubits in a superposition. So what we do is to encode our superposed state into the following entangled state: Ψ⟩ = α0⟩ + β1⟩ → α0⟩0⟩0⟩ + β1⟩1⟩1⟩ = Ψ′ ⟩ or.
e.⃝Riley T. The measurements M1 and M2 cause a readout of 01 on lines 4 and 5.Noise and Error Correction applied. α000⟩ + β111⟩ → I ⊗ I ⊗ X → α001⟩ + β110⟩. the Ψi ⟩ are as follows: ψ1 ⟩ = α000⟩ + β100⟩. Note that we are assuming that an error has occurred AFTER the encoding and BEFORE we input the state to this circuit. ψ2 ⟩ = α000⟩ + β111⟩. ψ2 ⟩ = α00100⟩ + β11000⟩. ψ4 ⟩ = (α001⟩ + β110⟩) ⊗ 0⟩1⟩.2010 . We determine that there’s been an error by entangling the encoded state with two ancilla qubits and performing measurements on the ancilla qubits. 177 Fixing Errors The following circuit detects an amplitude ﬂip (or bit ﬂip) which is the equivalent of XΨ⟩ on Ψ⟩. ψ3 ⟩ = α00101⟩ + β11001⟩. Perry 2004 . ψ2 ⟩ = α000⟩ + β101⟩. For example noise can ﬂip qubit three. • α001⟩ + β110⟩ 0⟩ 0⟩ ↑ ψ1 ⟩ ↑ ψ2 ⟩ Error Correction • • • _ _ _ 76 54 01 1 M 23 76 54 01 23 M2 _ _ _ R • • α000⟩ + β111⟩ Error Syndrome ↑ ψ3 ⟩ ↑ ψ4 ⟩ ↑ ψ5 ⟩ ψ1 ⟩ = α001⟩ + β110⟩. i. So now we feed 01 (called the error syndrome) into our error correction (or recovery) circuit R which does the following to α001⟩ + β110⟩: c The Temple of Quantum Computing . We then adjust our state accordingly based on the results of the measurements as described in the table below.
⃝Riley T. We get a problem though if we have a relative phase error.g.g. e. 110⟩ → 111⟩ ﬂip qubit 2. Again remember that any errors that do happen. This circuit will ﬁx a single bit ﬂip in our three qubit repetition code. 011⟩ → 111⟩ So we apply a qubit ﬂip to line 3 giving: ψ5 ⟩ = α000⟩ + β111⟩.178 M1 0 0 1 1 M2 0 1 0 1 Action Noise and Error Correction no action needed. decoded is: α0⟩ + β1⟩ → α0⟩ − β1⟩.: α000⟩ + β111⟩ → α000⟩ − β111⟩ which.e.g. e. i. which we can do with the following circuit: α 0⟩ + β 1⟩ 0⟩ 0⟩ • • H H H The error correction circuit for a relative phase ﬂip is almost exactly the same as the error correction circuit for an amplitude ﬂip. 101⟩ → 111⟩ ﬂip qubit 1. we just add in some Hadamard gates at the start to deal with the superpositions we generated with the initial encoding (shown immediately above).g. All that remains is to decode Ψ⟩ to return to our original state. 111⟩ → 111⟩ ﬂip qubit 3.2010 . Perry 2004 . It turns out we have to change our encoding method to deal with a relative phase ﬂip. happen between the encoding and the circuit we are about to introduce: c The Temple of Quantum Computing . e. e.
ψ2 ⟩ = (α 001⟩ + β 110⟩) 00⟩ . and is our ﬁrst real QECC (Quantum Error Correction Code).2010 . 1⟩} basis. A third encoding circuit produces a Shor code which is a nine qubit code that has enough information for us to be able to apply both types of error correcting circuits. Perry 2004 . It should be noted that these errors are deﬁned in terms of the {0⟩. Since the rest of the circuit is the same we get the output of R being: α 000⟩ + β 111⟩ as before. But we still have a problem because the circuit above cannot detect a amplitude ﬂip. a relative phase ﬂip can be ﬁxed with HZH and an amplitude ﬂip with X. If our input state is: ψ1 ⟩ = α + + −⟩ + β − − +⟩ then. c The Temple of Quantum Computing . This is the same as ψ2 ⟩ in the bit ﬂip case. If we use the {+⟩.⃝Riley T.Noise and Error Correction Error Correction • 179 H H H 0⟩ 0⟩ ↑ ψ1 ⟩ • • • R _ _ _ 76 54 01 23 M 1 ↑ ψ2 ⟩ Error Syndrome 76 54 01 23 M2 _ _ _ • • Suppose we have a phase ﬂip on line 2. −⟩} basis then the phase ﬂip circuit above ﬁxes a bit ﬂip and vice versa. In terms of single qubits. The circuit is presented below.
1990 proved in 1964 that there could be no local hidden variables.2010 . In the following description of his proof consider the fact that we can measure the spin of a particle in several different directions which can be thought of as measuring in different bases. Einstein used this as an argument against the notion that particles had no deﬁned state until they were measured (i. Shor. Steane).180 Ψ⟩ • • 0⟩ 0⟩ 0⟩ Bell States H • • H 0⟩ 0⟩ • • 0⟩ H 0⟩ 0⟩ • • The Shor code is one of many QECCs. CSS codes are part of a more general group of QECCs called Stabiliser codes.7 Bell States As mentioned in chapter 4 the EPR experiment showed that entangled particles seem to communicate certain quantum information instantly over an arbitrary distance upon measurement.e. During this section we’ll refer to Einstein’s position as EPR and the quantum mechanical position as QM. 1928 . 6. c The Temple of Quantum Computing . another example is the Steane code. Perry 2004 . These both in turn are CSS codes (Calderbank. John Bell.⃝Riley T. he argued that they had ”hidden variables”).
Perry 2004 .⃝Riley T. in the EPR view. then what happens at 2 will involve both directions (we imagine that a measurement at 1. Whereas. in some direction. For the purposes of our example we’ll begin by deﬁning the following entangled state: 1 1 ΨA ⟩ = √ 01 12 ⟩ − √ 11 02 ⟩. Alice and Bob. be determined by the value particle 2 carries away at emission and the direction at observer 2. (6. If we allow the directions to be different it is possible to get a empirically testable difference. respectively). as QM says. say. is dependent on the angle between the two directions . who observe particles 1 and 2. what happens at observer 2 cannot in any way involve the direction at observer 1: what happens at observer 2 will. 2 2 which will become important later.1 Same Measurement Direction To see that same direction measurements cannot lead to a testable difference ﬁrst imagine that there are two separated observers. what happens at observer 2 is dependent on what happens at observer 1. causes state collapse so that particle 2 ”points” in the antiparallel direction to 1 and is then measured in observer 2’s direction.g.Bell States 181 Bell takes a system of two entangled spin particles being measured by two remote observers (observers 1 and 2.35) We’ve introduced the notation 01 12 ⟩ to distinguish between qubits 1 and 2. The intuition for this is that if. 6. if the observers measure spin in the same direction (e. Let each measure the spin of the particle that ﬂies towards them. the probability for an outcome.2010 . If they both measure in the same direction.7. He shows that.see below). z) there is no empirical difference between the results predicted by the two positions (QM or EPR). spin up or spin down. who run many trials of the EPR experiment with spin particles. and the latter is dependent on the direction at 1. say z. at most. then the results might be represented as follows: Alice z 1 0 Bob z 0 1 50% 50% Frequency c The Temple of Quantum Computing .
The intuition for this might go as follows. as before. The randomness here is due to initial conditions (emission). but simply because the 1 is the value the particle had all along (which the measurement reveals).2 Different Measurement Directions Bell’s innovation was to realise that a difference will occur if we bring in different measurement directions. Alice’s measurement has ”produced” a 1 (spin down) in the a direction on particle 2 (to take the ﬁrst case). upon Alice’s measurement of 1. and we have: either 01 12 ⟩ or 11 02 ⟩. This causes a collapse. Perry 2004 . either 01 12 ⟩ or 11 02 ⟩ with 50% probability for Alice measuring 0 or 1. This explains the result by saying that. This says the particles actually have well deﬁned values at the moment they are emitted. and these are (anti)correlated and randomly distributed between 01 and 10 over repeated trials.182 Bell States We soon realise that we can’t use this case to discriminate between the two positions. 6.7.2010 . To work out what happens according to QM we have to express 12 ⟩ in terms of a c The Temple of Quantum Computing . or vice versa) and Bob’s measurement outcome on 2 is completely determined (relative to the outcome on 1) and will be the opposite of Alice’s outcome. When Alice measures 0 Bob measures 1 not because Alice’s measurement has ”produced” anything. the state vector superposition ΨA ⟩ collapses into one or other of the two terms. QM position.⃝Riley T. Start with ΨA ⟩ and allow Alice to measure particle 1 in the a direction. not to collapse. EPR position. But then we no longer have a superposition (Alice’s measurement has ”produced” a 0 on particle 1 and a 1 on particle 2. Suppose there are two directions a(= z) and b. Bob now measures particle 2 in the b direction. Either way we have the same prediction.
3 Bell’s Inequality It turns out we need three directions. 2 183 (6. when θ = 0 (the case when b = z) we get −2 ⟩ (= 1⟩ in that case). or 0 with 1. But this can’t happen in a realist local view as. espoused by EPR. the events at Bob’s end are beyond the reach of the events at Alice’s end (locality). we should get a detectable difference.37) The signiﬁcant point is that. b. they will observe correlation: 1 with 0. because: 1. we will actually take the case where these directions are all in the plane. there is no requirement for correlation. The spin values of the particles are determined at the moment of emission.36) where +2 ⟩ means spin up along the b axis. 6. and are not ”produced” at some later moment as a result of an act of measurement (realism). So reasons Bell. the direction of Alice’s measurement is entering into (inﬂuencing) what happens for Bob. 2. for 02 ⟩: ( ) ( ) θ θ 02 ⟩ = cos +2 ⟩ − sin −2 ⟩. Likewise.38 we have: √ 3 12 ⟩ = +2 ⟩ + 1/2−2 ⟩. Perry 2004 . QM View If we put θ = 120 into 6. say a and b. as above. and c.7. If θ = 90 (the case as before. perpendicular to line of ﬂight. since θ is the angle between a and b. for example (as in row 3 below). and Alice and Bob might both observe 1. So allow Alice and Bob to measure in three possible directions labelled a. by construction. and at 120◦ to one another.Bell States b basis. However. This looks right. If b is at angle θ to a this turns out to be: ( ) ( ) θ θ 12 ⟩ = sin +2 ⟩ + cos −2 ⟩ 2 2 when b = x) we get 1 √ . 2 2 (6. if they measure in different directions.⃝Riley T. When Alice and Bob measure in the same direction. say a and a. The rat is cornered: by bringing different directions of measurement into it.2010 . 2 c The Temple of Quantum Computing .
We conclude: 1 the probability of different outcomes is 2 . On the other hand. as in classical physics). Perry 2004 .184 Bell States This tells us that Alice having measured 0 in the a direction (as in 6. Randomly change the directions of measurement. so that each combination occurs 100 times. Suppose we now run 900 trials.e. Bob now measures + in the b (ie spin up or 0) direction with probability the b direction (i. except that (to ﬁt in with what is observed) the measured value will always be ”spin up” (0) or ”spin down” (1). ie Alice chooses b. To try to account for this we say that.2010 . to be different D (eg 01) is 1 . 4 4 if the directions are the same the probability for different outcomes (D) is 1. In general we have: If the directions are different the probability for outcomes to be the same S (eg 00) is 3 .⃝Riley T. 4 3 4 and − in The net result is that we Alice a 0 0 Equivalent results will be obtained in other pairs of different directions (eg bc. Bob c) since the angles between such directions are always the same. and not some intermediate value (so the measured values cannot be regarded as the projection of a spin vector in 3D space onto the direction of the magnetic ﬁeld. The results must go as: aa Outcome S Outcome D 0 ab ac ba bb 0 bc ca cb cc 0 75 75 75 75 75 75 100 25 25 25 100 25 25 25 100 The net result is that S occurs 450 times and D 450 times. spin down or 1) with probability have: Bob Probability b 0 1 3 4 1 4 1 .37). EPR View We assume each particle carries a ”spin value” relative to each possible direction (as in classical physics). at the moment of c The Temple of Quantum Computing .
But note that it would seem strange to account for the inﬁnity of shadow length’s by saying the stick had an inﬁnity of components . each particle leaves with an ”instruction” (the particle’s property. depending on the angle of the sun!). Suppose particle 1 has the assignment A=0.one for each possible direction (a. or key.or ”instructions” specifying what shadow should appear. must have two values: either A=0. Interestingly. b. if A=0 for particle 1 then A=1 for particle 2 etc. C=0. b. the spins are not correlated if we measure in different directions (in this case if the measurements were in the a and b directions the result would be 00). or component) . which we call the A component. c). We can then lay out the possible assignments of component values. But we can have A=0 for particle 1 and B=0 for particle 2 since. C=1.this would destroy the aa correlation. dependent on measurement direction. or A=1. sense that the measurement just discovers or reveals what is already there). the corresponding property. The A. which determines the measurement outcome (as noted above. ie 100. They can be randomly assigned except that.which determines the measured outcome in that direction (in the conventional. Since the measurement in the a direction can discover two possible values. empirically. as follows: c The Temple of Quantum Computing . This doesn’t constitute a problem in classical physics where we have spin behaving like a magnetic needle: the inﬁnity of possible observed components of the magnetic moment. ie 011.⃝Riley T. see below).C values are set for each particle at the time of emission and carried off by them. B=0. to obey conservation. Perry 2004 . B=1. we immediately know what the components for particle 2 must be: A=1. we have B=0 or B=1. or hidden variable. and C=0 or C=1.Bell States 185 emission. c) in which it can be measured . 0 or 1.B.2010 . (It might seem we need an inﬁnity of these properties to cater for the inﬁnity of possible measurement directions. prequantum. is no more mysterious than the inﬁnity of shadow lengths projected by a stick dependent on the sun’s direction. we cannot allow randomness in the act of measurement . This is necessary if the two particles are going to give anticorrelated results for the case where we do same direction measurements in each direction (a. the only possible randomness that can occur is in the assignment of initial component values at the moment of emission. Likewise. etc .
by allowing Alice’s abc values to run over the 8 binary possibilities. Hence the overall outcome is 11. as follows. if Nature chooses row 7 (above). But it allows for all possibilities in different directions: e. Perry 2004 .i. a 1 0 1 0 1 0 1 0 b c a 0 1 0 1 0 1 0 1 1 1 1 1 0 1 0 1 1 0 1 0 0 0 0 0 Bob b c 0 0 0 0 1 0 1 0 0 1 0 1 1 1 1 1 The table respects the rule that measurements in the same direction must be correlated (this is how the entries are generated . we have no choice). as agreed). We are assuming that the particles ﬂy off with their assignments and the measurements simply reveal these (no disturbance to worry about. We can now complete the table of outcomes: c The Temple of Quantum Computing . For example. So in each case we can tell the outcome. 4.2010 . 6. we can have Alice ﬁnding 1 in the a direction going with Bob ﬁnding 1 in this direction (rows 3 and 7) or 0 (rows 1 and 5). 5. 8. And there are nine possible combinations of measurement directions (the experimenters’ choice). 7. There are only eight possible assignments of properties (Nature’s choice). measures it in the a direction. and gets 1.g. ie 100 and the experimenters choose ab then the outcome is completely determined as S.e. and gets 1. Alice gets a 100 particle. Suppose we consider the above 900 trials from the realist perspective.⃝Riley T. 3. We are now closing in. ie S. measures it in the b direction. 2.186 Bell States Alice Row 1. for each case the correlation rule immediately determines the corresponding Bob entries . Bob gets a 011 particle.
Cryptology Alice’s particle aa 111 011 101 001 110 010 100 000 D D D D D D D D ab D S S D D S S D ac ba D S D S S D S D D S S D D S S D bb D D D D D D D D bc D D S S S S D D ca D S D S S D S D cb D D S S S S D D cc D D D D D D D D
187
What is the probability of different outcomes D? If Alice receives a particle with equal components (eg 111) this probability is always 1. If Alice receives a particle with unequal components (eg 011) the probability is always
5 9
(look
along the row for 011: D occurs 5 times out of 9. We don’t know the statistics of the source: how often particles of the 8 various kinds are emitted. But we can conclude that the overall probability for D is: 5 pequal + punequal . 9 Since both p’s must be positive we conclude: the probability for different outcomes is greater than
5 9
This is an example of a Bell inequality. Contradiction! If we compare the two conclusions we have a contradiction. QM says the probability should be 1 ; realism says it should be greater than 2
5 9
so QM wins!
6.8 Cryptology
Now a proven technology, quantum cryptography provides total security between two communicating parties. Also, the unique properties of quantum computers promise the ability to break classical encryption schemes like Data Encryption Standard (DES) and RSA. The ﬁeld of quantum cryptology has two important subﬁelds, they are: c The Temple of Quantum Computing  ⃝Riley T. Perry 2004  2010
188 1. Cryptography  The use of secure codes. 2. Cryptanalysis  Code breaking.
Cryptology
We’ll concentrate on cryptography in this chapter. Later, in chapter 7 we look at Shor’s algorithm, which can be used to break RSA encryption.
6.8.1 Classical Cryptography
Secret codes have a long history  dating back to ancient times, one famous ancient code is the Caesar cipher which simply shifts each letter by three. A → D, B → E, X → A. (6.38)
This is not very secure as it’s easy to guess and decrypt. Modern codes use a key. A simple form of key is incorporated into a code wheel, an example of which follows. Example An example of a code wheel with the key: ABCDEF is described below: Key Shift By Message Encoding A 1 Q R B 2 U W C 3 D D 4 R E 5 T Y F 6 U A A 1 N B 2 E C 3 R D 4 D H E 5 E J F 6 S Y
A N
M C O
With time secret keys and their respective codes got more complicated, culminating in modern codes, e.g. codes called DES and IDEA were implemented with typically 64 and 128 bit secret keys. There is another kind of key, a public key. Public key encryption (e.g. RSA 1976 Difﬁe Hellman) uses a combination of a public and a secret key. In a public key encryption scheme a public key encrypts a message but cannot decrypt it. This is done by a secret decryption key known only to the owner. Surmising the decryption key from public (encryption) key requires solving hard (time complexity wise) problems. Some codes are stronger than others, for example the DES and IDEA secret c The Temple of Quantum Computing  ⃝Riley T. Perry 2004  2010
Cryptology
189
key codes are stronger than Caesar cipher codes. Possibly the strongest code is the onetime PAD. A onetime PAD is a key that is large as the message to be sent (for example a random binary ﬁle) and the sender and receiver both have a copy of this key. The PAD is used only once to encrypt and decrypt the message. The problem with onetime PADs is that the key needs to be transmitted every time and eavesdroppers could be listening in on the key. Quantum key distribution resolves this issue by providing perfectly secure key distribution.
6.8.2 Quantum Cryptography
Modern classical public key cryptographic systems use a trap door function with security based on mathematical assumptions, notably that it is difﬁcult to factor large integers. This assumption is now at risk from Shor’s algorithm. The main advantage of quantum cryptography is that it gives us perfectly secure data transfer. The ﬁrst successful quantum cryptographic device was tested in 1989 by C.H. Bennet, and G. Brassard [Castro, M. 1997]. The device could translate a secret key over 30 centimetres using polarised light, calcite crystal(s), and other electrooptical devices. This form of cryptography does not rely on a trap door function for encryption, but on quantum effects like the nocloning theorem. A simple example of the nocloning theorem’s ability to secure data is described below. After that we’ll look at why it’s impossible to listen in on a quantum channel, and ﬁnally we’ll examine a method for quantum key distribution. Quantum Money Stephen Wiesner wrote a paper in 1970 (unpublished until 1983) in which he described uncounterfeitable quantum bank notes [Braunstein, S. L. & Lo, H. K. 2000]. Each bank note contains a unique serial number and a sequence of randomly polarised photons (90◦ , 180◦ , 45◦ , and 135◦ ). The basis of polarisation is kept secret (either diagonal or rectilinear). The bank can verify the validity of a note by matching a serial number with known (only known by the bank) polarisations. This enables the bank to verify the polarisations without disturbing the quanc The Temple of Quantum Computing  ⃝Riley T. Perry 2004  2010
190
Cryptology
tum system (see the example below). Finally, the counterfeiter can’t counterfeit the note due to the no cloning theorem. Remember, the no cloning theorem says that given an unknown quantum state it is impossible to clone that state exactly without disturbing the state. Example Let’s say the bank receives a bank not with serial number 1573462. The bank checks its ”quantum bank note archive” to ﬁnd the polarisations for bank note 1573462. The banks’ records give the following: 1573462 = {H, H, 135◦ , V, 45◦ }. {H, H, 135◦ , V, 45◦ } is a record of the note polarisations, but our copy protection system does not distinguish between H and V or 135◦ and 45◦ . Because the photons are not in superpositions relative to the basis we measure in (as speciﬁed by the serial numbers) the bank doesn’t disturb the states upon measurement. The bank only determines the basis of each photon, which is {0⟩, 1⟩}, (rectilinear) or {+⟩, 1⟩}, (diagonal). It should be noted that states are always superpositions if we don’t say what the basis is. Because the counterfeiter does not know the basis of each polarised photon on the quantum bank note, he must measure using a random basis. He could, theoretically measure each one and recreate it if he knows the basis by which to measure each one. The chances of the counterfeiter
1 2
randomly measuring in the correct basis decrease by a has the harder it is to counterfeit.
for each successive
polarised photon on the note. So the more polarised photons the bank note
Quantum Packet Snifﬁng Quantum packet snifﬁng is impossible  so the sender and receiver can be sure that noone is listening in on their messages (eavesdropping). This phenomena is due to the following properties of quantum mechanics: 1. Quantum uncertainty, for example given a photon polarised in an unknown state (it might be horizontally (180◦ ), vertically (90◦ ), at 45◦ , or at 135◦ ) we can’t tell with certainty which polarisation the photon has without measuring it. c The Temple of Quantum Computing  ⃝Riley T. Perry 2004  2010
Cryptology 2. The no cloning theorem.
191
3. Disturbance (information gain), if a measurement is done (distinguishing between two nonorthogonal states) the signal is forever disturbed. 4. Measurements are irreversible, any non orthogonal state will collapse randomly into a resultant state  losing the premeasurement amplitudes. Quantum Key Distribution We can ensure secure communications by using onetime pads in conjunction with quantum key distribution. The main drawback for classical onetime pads is the distribution of encryption/decrytion keys, this is not a problem for quantum cryptography as we can transfer key data in a totally secure fashion. Quantum key distribution (QKD) is a means of distributing keys from one party to another, and detecting eavesdropping (it is inspired by the quantum money example). An unusually high error rate is a good indicator of eavesdropping. Even with a high error rate the eavesdropper cannot learn any useful information. It should be noted that this method does not prevent Denial of service (DOS) attacks. An example follows on the next page.
c The Temple of Quantum Computing  ⃝Riley T. Perry 2004  2010
c The Temple of Quantum Computing . Alice randomly polarises photons at 45◦ . 90◦ .these are sent to Bob over a quantum channel (which is secure due to quantum effects. 4. 3. A. Bob does measurements on the photons. Alice and Bob check for quantum errors to gauge whether or not an eavesdropper (Eve) was listening. Also for each bit he records the measurement result as a 1 for 135◦ or 180◦ or 0 for 45◦ or 90◦ polarisations. On a normal (insecure channel) Alice tells Bob which bits Bob used the right polarisation on (which he also communicates over the classical channel). i. The following steps allow a totally secure (in terms of eavesdropping) transfer of the key (later we need to encrypt the message and send it via a classical channel). so each bit transferred must only be represented by one qubit. he randomly uses either a rectilinear (180◦ /90◦ ) or diagonal polarising ﬁlter (45◦ /135◦ ).135◦ .2010 . 1.⃝Riley T. • Eve could shave off some of the light if each bit is represented by more than one photon. if the key exchange’s error rate is higher than that (which means Eve may have been listening) then they resend the message. Perry 2004 . But they need a way to avoid Eve eavesdropping on their conversation on the key channel [Ekert. and records which one was used for each bit. Comments The following can be said about the key exchange: • Eve can’t clone the bit and send it on. Alice and Bob decide on an acceptable error rate. her measurements put Bob’s bits in a new random state. no eavesdropping). 2.192 Cryptology Example Alice and Bob want to use a key based encryption method. they communicate on two channels. • Eve could do an DOS attack by constantly measuring on the key channel. 1993].e. and 180◦ . One channel is used to transmit the encrypted message and another is used to transmit the encryption key.
the ﬁrst QKD system which is based in concepts similar to the above. 6.2010 .Alice and Bob can prevent this by shrinking down their key. Question Is there a universal computation model? or will there always be some phenomena which is not well understood that has the potential to be exploited for the purposes of computation? c The Temple of Quantum Computing . • In 1984 Bennet and Brassard developed BB84. Some disciplines cannot currently be described by quantum mechanics. like relativity and complexity theory (or chaos theory). Perry 2004 .Alternative Models of Computation 193 • Eve could listen to a small number of bits and hope to be unnoticed .⃝Riley T.9 Alternative Models of Computation There are other candidates for physical phenomena to enhance computational power. a method of mutual key generation.
.
com 2004]. This is extremely important for cryptography. These algorithms have been designed to give special advantages over their classical counterparts. or partially borrow from. For example. Most known quantum algorithms have similarities to. which means that no polynomial solution exists that covers all instances of the problem. Another example is Grover’s database search algorithm which provides a quadratic speedup when searching a list of N items. discrete logarithms. Over the past twenty years a number of algorithms have been developed to harness the unique properties offered by quantum computers. This takes the classical value of a linear search from O(N ) time to O(N 2 ) time [TheFreeDictionary.0. Some properties of Shor and Grover type algorithms are: • Shor type algorithms use the quantum Fourier transform. and order ﬁnding (all variations on a theme). These include: factoring.1 Introduction Quantum algorithms are ways of combining unitary operations in a quantum system to achieve some computational goal.Chapter 7 Quantum Algorithms 7. 195 1 . the hidden subgroup problem. where that classical equivalent is roughly exponential. RSA relies on factorisation being intractable. • Grover type search algorithms can be used for applications like fast database searching and statistical analysis. these two algorithms. Shor’s algorithm (1995) gives the factorisation of arbitrarily large numbers a time complexity class of O((log N )3 ).
2010 . To do this efﬁciently we need to look at many values simultaneously. or a qubit. In this chapter we’ll look at Deutsch’s algorithm.1.1. the DeutschJosza algorithm. Perry 2004 . in which case we would get: f (1) = 0 and f (0) = 0 or f (0) = 1 and f (1) = 1. where one to one means: f (1) = 1 and f (0) = 0 or f (0) = 1 and f (1) = 0.1 The Problem Deﬁned We have a function f (x) where f (x) : {0. The other alternative is that f (x) is not one to one (i. either a 0 or a 1). The problem it solves is not an important one. This means that f (x) takes a bit (either a 0 or a 1) as an argument and returns a bit (again. The circuit for determining some property of a function is called an oracle. 7. Therefore both the input and output of this function can be represented by a bit. 7. but its simple nature makes it good for demonstrating the properties of quantum superposition.⃝Riley T. and Grover’s algorithm.e. 1} → {0.196 Deutsch’s Algorithm There are also hybrid algorithms like quantum counting that combine elements from both. As with chapters 5 and 6 individual references to QCQI have been dropped.1 Deutsch’s Algorithm Deutsch’s algorithm is a simple example of quantum parallelism. Shor’s algorithm.2 The Classical Solution The solution is as follows: c The Temple of Quantum Computing . not the results of those functions given particular inputs. 7. 1} with a one bit domain. It’s important to note that the thing that quantum computers do well is to test global properties of functions. We want to test if this function is one to one (balanced). it is constant). and more esoteric algorithms like quantum simulators.
Perry 2004 . via superposition. y = f (1). ψ2 ⟩ Apply H gates to the input registers so our state vector is now: 0⟩ + 1⟩ √ Ψ⟩ = 2 [ ][ ] 0⟩ − 1⟩ √ . Can we do better with a quantum computer? 7. 3. ψ1 ⟩ The qubits x and y have been set to the following (we call x the query register and y the answer register): x = 0⟩. x 0⟩ y 1⟩ H Uf H ↑ ψ1 ⟩ ↑ ψ2 ⟩ ↑ ψ3 ⟩ x y ⊕ f (x) H ↑ ψ4 ⟩ H Below are the steps ψ1 ⟩ to ψ4 ⟩ we need to solve the problem quantum mechanically. This is made up of three operations. y = 1⟩.2010 . x = f (0). and y seems c The Temple of Quantum Computing . 2 ψ3 ⟩ Uf acts on qubits x and y. 2.⃝Riley T.1. speciﬁcally we use Ψ⟩ → Uf → x⟩ y ⊕ f (x)⟩.3 The Quantum Solution The quantum circuit below performs the ﬁrst two steps in the classical solution in one operation. involving two function evaluations: 1. z = x ⊕ y.Deutsch’s Algorithm 197 iff f (0) ⊕ f (1) = 1 the function is one to one (where ⊕ is equivalent to XOR). After some algebraic manipulation the result ends up in x.
Ψ⟩ = ±f (0) ⊕ f (1)⟩ 2 Up until now y has been useful to us. for f (0) ̸= f (1) we get: [ ] 0⟩ − 1⟩ √ Ψ⟩ = ±1⟩ 2 and for f (0) = f (1): [ ] 0⟩ − 1⟩ √ Ψ⟩ = ±0⟩ . c The Temple of Quantum Computing . and if x = 1 the function is balanced. We can just do a partial measurement on x and discard y as garbage.2010 . it does not matter whether it is positive or negative for the result of this circuit (global phase factors have no signiﬁcance). For f (0) ̸= f (1) (balanced) we get: [ ][ ] 0⟩ − 1⟩ 0⟩ − 1⟩ √ √ Ψ⟩ = ± 2 2 and for f (0) = f (1) (constant): [ ][ ] 0⟩ − 1⟩ √ . ψ4 ⟩ x is sent through the H gate again.198 unchanged (see the example below). The H gate.⃝Riley T. now we don’t care about it as x holds the result. 2 [ ] 0⟩ − 1⟩ √ → H → 1⟩. Perry 2004 . combining both cases: ] [ 0⟩ − 1⟩ √ . 2 At this point our state is. 2 Deutsch’s Algorithm 0⟩ + 1⟩ √ Ψ⟩ = ± 2 Note: The ± at the start of the state is just a result of internal calculations. If x = 0 then the function is constant. as well as turning a 1 or a 0 into a superposition will take a superposition back to a 1 or a 0 (depending on the sign): ] 0⟩ + 1⟩ √ → H → 0⟩. 2 [ So at step 4.
2004]. 1 ⊕ 0 = 1.Deutsch’s Algorithm Example 199 There’s only four possible combinations for f (x) .1. we’ll look at 1 √ [0⟩ 2 1 + 1⟩] √2 [0⟩ − 1⟩] our state at ψ3 ⟩ two here.⃝Riley T.2010 . and two pairs of sunglasses [Stay. 2 Keeping in mind that 0 ⊕ 0 = 0. Perry 2004 . M. The mirc The Temple of Quantum Computing . The sunglasses (in a certain conﬁguration) polarise light initially into a nonorthogonal state (a superposition) then back again. Given our state at ψ2 ⟩ is will look like the following: [ ][ ] 0⟩ + 1⟩ 0 ⊕ f (x)⟩ − 1 ⊕ f (x)⟩ √ √ Ψ⟩ = 2 2 1 = (0⟩ 0 ⊕ f (0)⟩ − 0⟩ 1 ⊕ f (0)⟩ + 1⟩ 0 ⊕ f (1)⟩ − 1⟩ 1 ⊕ f (1)⟩). At ψ4 ⟩ we put our entire state through H ⊗ H and get 01⟩ for the constant function and 11⟩ for the balanced one. 1 ⊕ 1 = 0. and 0 ⊕ 1 = 1 we’ll start with the constant function f (0) = 0 and f (1) = 0: 1 Ψ⟩ = (0⟩ 0 ⊕ 0⟩ − 0⟩ 1 ⊕ 0⟩ + 1⟩ 0 ⊕ 0⟩ − 1⟩ 1 ⊕ 0⟩) 2 1 = (00⟩ − 01⟩ + 10⟩ − 11⟩) 2 ][ ] [ 0⟩ + 1⟩ 0⟩ − 1⟩ √ √ .4 Physical Implementations In theory A simple quantum computer implementing Deutsch’s algorithm can be made out of a cardboard box. three mirrors. 7. it is a global phase factor and we can ignore it. 2 2 Notice that (1) has been moved outside of the combined state. = 2 2 Now for a balanced function f (0) = 1 and f (1) = 0: 1 Ψ⟩ = (0⟩ 0 ⊕ 1⟩ − 0⟩ 1 ⊕ 1⟩ + 1⟩ 0 ⊕ 0⟩ − 1⟩ 1 ⊕ 0⟩) 2 1 = (01⟩ − 00⟩ + 10⟩ − 11⟩) 2 1 = (− 00⟩ + 01⟩ + 10⟩ − 11⟩) 2 1 = (−1) (00⟩ − 01⟩ − 10⟩ + 11⟩) [2 ][ ] 0⟩ − 1⟩ 0⟩ − 1⟩ √ √ = −1 .
200 The DeutschJosza Algorithm rors within the box reﬂect the light in a certain way depending on their conﬁguration (at different angles depending on the type of function you want to simulate). and has been successfully implemented.2010 .⃝Riley T. Deutsch’s algorithm can of course be executed on any quantum computer architecture. 7.2 The DeutschJosza Algorithm The DeutschJosza algorithm is an extension of Deutsch’s algorithm which can evaluate more than one qubit in one operation. 7. in 2001 the algorithm was run on an NMR computer (see chapter 8) [Dorai. Arvind. A torch is then shone into the box. if we use a special optical device to send just one photon into the box and we have a sensitive photo detector at the other end then we have an architecture that is a theoretically more efﬁcient oracle than any classical computer. 2001]. Perry 2004 . Now. A.2. Due to the relatively small number of qubits that can be currently made to work together many of the other quantum algorithms have not been satisfactorily tested. K. that is: is f (x) the same (constant) for all inputs? Or is f (x) equal to 1 for half the input values and equal to 0 for the other half (which means it is balanced)? c The Temple of Quantum Computing . Kumar. ?. if not then it is constant. For example. if light comes out the function is balanced. We can extend it to evaluate any number of qubits simultaneously by using an nqubit query register for x instead of a single qubit.1 The Problem Deﬁned The problem we are trying solve is slightly different to the one presented in Deutsch’s algorithm.
2.2 The Quantum Solution The circuit looks like this: x 0⟩ y 1⟩ ↑ ψ1 ⟩ /n H ⊗n Uf H ↑ ψ2 ⟩ ↑ ψ3 ⟩ x y ⊕ f (x) H ↑ ψ4 ⟩ H ⊗n The input (x) and output (y) registers have an H gate for each qubit in the register.The DeutschJosza Algorithm 201 7. This is denoted by H ⊗n and the /n notation just means n wires for n qubits. . Now the rule is simple: if any of the qubits in the query (x) register are 1⟩ then the function is balanced. . ψ2 ⟩ Apply H gates to both the x and y registers so our state vector is now: [ ] 2n−1 1 ∑ 0⟩ − 1⟩ √ Ψ⟩ = √ x⟩ . This leaves us with a set of output qubits and a 1 in the answer register. This time we use Ψ⟩ = Uf Ψ2 ⟩ 0⟩ = x1 . by deﬁnition.⃝Riley T.e. xn ⟩ y ⊕ f (x)⟩ to evaluate f (x). ψ4 ⟩ x is sent through H ⊕n and y through an H gate also. 2n x=0 2 ψ3 ⟩ Uf acts on registers x and y (remember y is just a single qubit because the result of evaluating f is. Ψ⟩ = x1 . y = 1⟩. x2 . . just a 0 or 1). c The Temple of Quantum Computing . . otherwise it is constant. . . ψ1 ⟩ The registers x and y have been set to the following: x = 0⟩⊗n . . xn ⟩ 1⟩ . i. x2 . Here are the steps ψ1 ⟩ to ψ4 ⟩ we need to solve the problem quantum mechanically. Perry 2004 . .2010 .
3. 2 2 2 At ψ4 ⟩ we put our entire state through H ⊗ H ⊗ H and get 101⟩ meaning that our function is balanced.202 Shor’s Algorithm Example Here’s an example with a two qubit query register for the balanced function f with f (00) = 0. f (10) = 1. 2 2 2 We are now ready to examine our state at ψ3 ⟩: [ ][ ][ ] 0⟩ + 1⟩ 0⟩ + 1⟩ 0 ⊕ f (x)⟩ − 1 ⊕ f (x)⟩ √ √ √ Ψ⟩ = 2 2 2 [ ][ ] 00⟩ + 01⟩ + 10⟩ + 11⟩ 0 ⊕ f (x)⟩ − 1 ⊕ f (x)⟩ √ √ = 4 2 1 = √ (00⟩ 0 ⊕ f (00)⟩ − 00⟩ 1 ⊕ f (00)⟩ + 01⟩ 0 ⊕ f (01)⟩ 8 − 01⟩ 1 ⊕ f (01)⟩ + 10⟩ 0 ⊕ f (10)⟩ − 10⟩ 1 ⊕ f (10)⟩ + 11⟩ 0 ⊕ f (11)⟩ − 11⟩ 1 ⊕ f (11)⟩) 1 = √ (000⟩ − 001⟩ + 010⟩ − 011⟩ + 101⟩ − 100⟩ + 111⟩ − 110⟩) 8 1 = √ (000⟩ − 001⟩ + 010⟩ − 011⟩ − 100⟩ + 101⟩ − 110⟩ + 111⟩) 8 ][ ] [ 00⟩ + 01⟩ − 10⟩ − 11⟩ 0⟩ − 1⟩ √ √ = 4 2 [ ][ ][ ] 0⟩ − 1⟩ 0⟩ + 1⟩ 0⟩ − 1⟩ √ √ √ = . The DFT takes a series of N complex numc The Temple of Quantum Computing .2010 . Perry 2004 . after the H gates we get: [ ][ ][ ] 0⟩ + 1⟩ 0⟩ + 1⟩ 0⟩ − 1⟩ √ √ √ Ψ⟩ = . So at state ψ1 ⟩ we have: Ψ⟩ = 001⟩ . f (01) = 0. 7.⃝Riley T.1 The Quantum Fourier Transform The quantum analogue of the discrete Fourier transform (see chapter 4) is the quantum Fourier transform (QF T ).3 Shor’s Algorithm 7. Then at state ψ2 ⟩. and f (11) = 1.
. 2n n (7.⃝Riley T... XN −1 and produces a series complex numbers Y0 . Perry 2004 . E. The QF T is deﬁned as follows: Given a state vector Ψ⟩: Ψ⟩ = 2n−1 ∑ x=0 αx x⟩ (7..2010 .g. X0 . YN −1 ..1) The main advantage of the QF T is the fact that it can do a DFT on a superposition of states. This can be done on a superposition like the following: 1 √ (00⟩ + 01⟩ − 10⟩ − 11⟩) 4 or a state where the probability amplitudes are of different values..2) (7.. . so the previous state could have been written as: 1 √ (1⟩ + 3⟩ − 7⟩).Shor’s Algorithm 203 bers. + βN −1 N − 1⟩.3) where n is the number of qubits. 3 The QF T is a unitary operator. In fact we use the inverse quantum fourier transform (QF T † ) for Shor’s algorithm. (7. the following state has probability amplitudes of 0 for the majority of its basis states: 1 √ (001⟩ + 011⟩ − 111⟩). and is reversible. the QF T takes a state vector: Ψ⟩ = α0 0⟩ + α1 1⟩ + .4) We can also represent the QF T as a matrix: c The Temple of Quantum Computing .. Similarily. .. QF T Ψ⟩ is deﬁned as: Ψ ⟩ = QF T Ψ⟩ = ′ 2n−1 2n−1 ∑∑ x=0 y=0 αx e2πixy/2 √ y⟩ . X1 . 3 It’ll helpful over the next few sections to use integers when we are describing states with a large number of qubits. Y1 . + αN −1 N − 1⟩ and performs a DFT on the amplitudes of Ψ⟩ giving us: Ψ⟩ = β0 0⟩ + β1 1⟩ + ..
. ω 2(2 n −1) .6) where Mxy = e2πixy/2 . Now using the summations.. . . .. 1 n n n .. 1 ω2 n −1 n −1) n ω 2(2 ω 3(2 −1) . Examples follow on the next two pages.204 Shor’s Algorithm 1 √ n 2 1 1 1 1 .7) Next we’ll look at two examples using the matrix representation of the QF T .. .0/2 = e0 = 1 ...2010 . 1 ω ω2 ω3 . . ... . . n . .1. n −1 1 ω2 ω4 ω6 .5) 1 ω2 where ω = e2πi/2 . √ e2πi·0·1/2 = e0 = 1 e2πi·1·1/2 = e2πi/2 = ω 2n . ω (2 How do we get this matrix? To make it easier to understand we’ll identify the important part of the summation we need for the matrix representation (which we’ll label Mxy ): 2n−1 2n−1 ∑∑ x=0 y=0 n n 2 αx e2πixy/2 1 ∑ √ y⟩ = √ 2n 2n x=0 n−1 (2n−1 ∑ y=0 ) Mxy αx y⟩ (7. Perry 2004 . (7. . . .⃝Riley T. . c The Temple of Quantum Computing . . .. . n −1)(2n −1) (7... here are a few values of x and y for Mxy : n n e2πi·0·0/2 = e0 = 1 e2πi.. . .
so we get: ] [ ][ 2 √ 1 1 1 5 Ψ′ ⟩ = √ 1 iπ √ 2 1 e 5 [ ] 1 2 √ + √10 10 = eπi √2 + √ 10 10 [ ] = = √1 10 3 1 = √ 0⟩ + √ 1⟩ .2010 . We’ll use the matrix representation. 5 5 Find. Given: 2 1 Ψ⟩ = √ 0⟩ + √ 0⟩ . 2 1 eiπ This matrix is actually just an H gate (since eiπ = −1). which is: [ ] 1 1 1 √ . Ψ′ ⟩ = QF T Ψ⟩ . 10 10 + √2 10 √3 10 −1 √ 10 205 c The Temple of Quantum Computing . Perry 2004 .⃝Riley T.Shor’s Algorithm Example A simple one qubit QF T .
Perry 2004 .206 Example A two qubit QF T . 1 1 eπi/4 eπi2/4 eπi3/4 Ψ ⟩ = √ 4 1 eπi2/4 eπi4/4 eπi6/4 1 =√ 4 1 =√ 4 = 1 1 1 1 0 0 1 √ 2 1 √ 2 2 √ 8 2−1+i 4 1−i √ √ 8 2+1+i 4 √ 1 eπi3/4 eπi6/4 eπi9/4 1 1 √ +0+0+ √ 2 2 1 1 √ + 0 + 0 + √ eπi3/4 2 2 1 1 √ + 0 + 0 + √ eπi6/4 2 2 1 1 πi9/4 √ +0+0+ √ e 2 2 1 1 √ +0+0+ √ 2 2 1 √ + 0 + 0 + −1+i √ 2 2 1 −i √ +0+0+ √ 2 2 1 √ + 0 + 0 + 1+i √ 2 2 √ 2 = √ 00⟩ + 8 2−1+i 1−i 01⟩ + √ 10⟩ + 4 8 √ 2+1+i 11⟩ .⃝Riley T. 2 2 Find. Given: 1 1 Ψ⟩ = √ 00⟩ + √ 11⟩ .2010 . Ψ′ ⟩ = QF T Ψ⟩ . 4 c The Temple of Quantum Computing . The matrix representation is: 1 1 1 1 1 1 eπi/4 eπi2/4 eπi3/4 √ 4 1 eπi2/4 eπi4/4 eπi6/4 1 eπi3/4 eπi6/4 eπi9/4 So Ψ′ ⟩ is: ′ Shor’s Algorithm .
.3. c The Temple of Quantum Computing . Rn . Public key encryption systems like RSA algorithm rely on the fact that it’s hard to factorise large numbers.8) 1 e2πi/2 For n qubits we use gates R2 .2010 . .2 Fast Factorisation Finding unknown factors p and q such that p × q = 347347 is very slow compared to the reverse problem: calculating 129 × 156. Given an integer N we know n = pq where p and q are large prime numbers we want to calculate p and q. if we could ﬁnd the factors we could use the information provided in the public key to decrypt messages encrypted with it.Shor’s Algorithm How Do we Implement a QFT? As stated before.⃝Riley T. Perry 2004 . a one qubit QF T has the following rather simple circuit: H A three qubit QF T has a more complicated circuit: H S • • gates (Rk . (7. We don’t yet know fast algorithms for factorising on classical machines but we do now know (thanks to Shor) a fast factorisation algorithm we can run on a quantum computer. 7. For more information on generic QF T circuits you’ll need to consult an external reference like QCQI.see below) where: [ Rk = 1 0 k 207 T H S • H × × We can extend this logic to n qubits by using H and n − 2 different rotation ] . In terms of RSA our task is simple.
mod 55 = 4. c The Temple of Quantum Computing .3 Order Finding To factorise N we reduce the problem of factorisation to order ﬁnding. 13 mod 55 has a period of 20. This means that the list of powers of x. So r = 20. . The ”quantum” part gives us the period r in polynomial time by using a process called phase estimation. mod 55 = 13. The intuition is that quantum computers might be good at this because of quantum parallelism: their ability to compute many function values in parallel and hence be able to get at ”global properties” of the function (as in Deutsch’s algorithm). x2 . mod N will repeat with a period that is less than N . that is: given 1 < x < N the order of x mod N is the smallest value of r where r ≥ 1 and xr mod N = 1. i. . Perry 2004 . x. . Phase estimation attempts to determine an unknown value γ of an eigenvalue e2πiγ of an eigenvector u⟩ for some unitary U . mod 55 = 1. 1. . . We won’t worry about explicitly understanding phase estimation as Shor’s algorithm has a number of speciﬁc steps that makes learning it unnecessary. Example Say we have N = 55 and we choose x to be 13. x4 . We’re trying to ﬁnd the period of a periodic function. 130 131 132 .208 Shor’s Algorithm 7. Once we have the order r we can apply some further classical calculations to it to obtain a factor of N .e.⃝Riley T. x3 . The calculation of xi mod N can be done in polynomial time and thus can be done on a classical computer.3. Why? Because it turns out there’s a close connection between ﬁnding the factors and ﬁnding the period of a periodic function. 1320 mod 55 = 1.2010 .
11 . We simply split the fraction into its whole and fractional parts. Perry 2004 . The Continued Fractions Algorithm The continued fractions algorithm allows us to calculate an array of integers to represent a fraction. and repeat the process until we have no fractional parts left. 2] which is a four element array (that took four steps) that represents Now we’ll look at the fast factorisation algorithm. the continued fractions algorithm.. 2 11 =1+ 9 9 1 =1+ 9 2 =1+ 1 1+ 1 9 2 1 1+ 1 4+ 1 2 . Here’s an example: Example Convert 11 9 to integer array representation.⃝Riley T. A necessary component of Shor’s algorithm. is introduced. 1. 4. 9 c The Temple of Quantum Computing . we end up with the following list: [1.Shor’s Algorithm 209 Before we look at the circuit for Shor’s algorithm.. =1+ So. store the whole part.2010 .
register 1 needs to be t qubits in size where 2N ≤ t (this is to reduce the chance of errors in the output. given a number N to be factored. It’s simple. and there seems to be some contention in the reference material as to what this lower bound should be). We apply the quantum order ﬁnding algorithm. 4. we ﬁnd gcd(3. N ). to return a factor f where f > 1. c The Temple of Quantum Computing . Perry 2004 ..g. 3. so return 3. E. In this step we test if gcd(x. ψ1 ⟩ Initialise register 1.⃝Riley T. We can test if two numbers share a common divisor efﬁciently on a classical computer. 15) = 3. If N is divisible by 2 then return f = 2.210 The Fast Factorisation Circuit and Algorithm 0⟩ 0⟩ 0⟩ 0⟩ 1⟩⊗n H . This is where the quantum computer comes in. NM QF T † NM NM NM / n Uf NM ↑ ψ1 ⟩ ↑ ψ2 ⟩ ↑ ψ3 ⟩ ↑ ψ4 ⟩ ↑ ψ5 ⟩ The algorithm presented here is similar to Shor’s algorithm.. that is their greatest common divisor (gcd) is 1. Before we start we need to deﬁne the size of the input registers. which is L qubits in size to 1⟩⊗L . N = 15 if x = 3. H H H • 1 Uf 2 Uf 3 Uf Shor’s Algorithm • • • .. For a ≥ 1 and b ≥ 2 if N = ab then return f = a (we can test this classically). . . which is t qubits in size to 0⟩⊗t and register 2. if it is then we return f = gcd(x... N ) > 1. 2. The algorithm is as follows: 1.. Randomly choose an integer x where 1 < x < N .2010 . . . and uses the QF T introduced earlier. There is an efﬁcient classical algorithm to test if numbers are coprime. Register 2 needs to be L qubits in size where L is the number of qubits needed to store N .
211 ψ4 ⟩ We measure register 2. N ). If the result is not 1 or N then return f as it is a factor. Perry 2004 . Over the next two pages we’ll look at a couple of worked examples of Shor’s algorithm. ψ6 ⟩ (not shown) Now we apply the continued fractions algorithm to and the number of steps it takes will be the period r. 5. ψ3 ⟩ Apply Uf R2 = xR1 mod N to register 2: ⟩ ∑2t−1 Ψ⟩ = √12t r2 =0 R1 ⟩ xR1 mod N . Ψ⟩ 2t c The Temple of Quantum Computing .2010 . because it is entangled with register 1 and our state becomes subset of the values in register 1 that correspond with the value we observed in register 2.⃝Riley T.Shor’s Algorithm ψ2 ⟩ Create a superposition on register 1: ∑2t−1 Ψ⟩ = √12t r1 =0 R1 ⟩ 1⟩. ψ5 ⟩ We apply QF T † to register 1 and then measure it. otherwise the algorithm has failed and we have to start again. With the result r ﬁrst test if r is even the see if xr/2 ̸= −1 mod N then calculate f =gcd(xr/2 ±.
15) = 3 and gcd(72 + 1.. 3. √ 1 (0⟩ 2048 + 1⟩ + 1⟩ 7⟩ 4⟩ 13⟩ 1⟩ 7⟩ ψ4 ⟩ We Measure R2 and randomly get a 4 leaving Ψ⟩ in the following post measurement state: R1 R2 2⟩ 4⟩ 6⟩ 4⟩ 10⟩ . so we get Ψ⟩ = 2⟩ + . Perry 2004 . 1024. 2.. ̸= −1 mod N . N is not even. 512... So we try gcd(72 − 1. 1536 2048 ψ6 ⟩ The result from the continued fractions algorithm for 5. ψ2 ⟩ Create a superposition on register 1. . N ̸= ab so continue. The state above is actually an entangled state that looks like (R2 is bolded): Ψ⟩ = √ 1 (000000000010100⟩ + 000000000110100⟩ + . Shor’s Algorithm 4.212 Example Find the factors for N = 15 1. . 15) = 1 so continue. . r is even and satisﬁes r 2 is 4. by testing that 3 × 5 = 15 = N we see we have now found our factors. . c The Temple of Quantum Computing . or 1536 with a probability of 1 .2010 . 512 ψ5 ⟩ After applying QF T † we get either 0. ψ1 ⟩ Initialise both the registers so the combined state becomes Ψ⟩ = 000000000001111⟩. continue. 4⟩ . . + 2047⟩) 15⟩. 4 Say we observe 1536. . Now... . 15) = 5. t = 11 qubits for register 1 and L = 4 qubits for register 2.⃝Riley T. We choose x = 7 gcd(7.) . it’s just convenient to think of them separately. Remember that both registers are actually part of the same state vector. ψ3 ⟩ applying xR1 mod 15 gives us the following: R1 R2 0⟩ 1⟩ 2⟩ 3⟩ 4⟩ 5⟩ 6⟩ 4⟩ 7⟩ 13⟩ 8⟩ 1⟩ 9⟩ 10⟩ 7⟩ 4⟩ .
. . + 8189⟩ 28⟩) . ψ3 ⟩ applying xR1 mod 55 gives us the following: R1 R2 0⟩ 1⟩ 1⟩ 13⟩ 2⟩ 4⟩ . . We choose x = 13 gcd(13. 4. 28⟩ . + 8191⟩) 63⟩. . . 55) = 11. So we try gcd(1310 − 1. .Shor’s Algorithm Example Find the factors for N = 55 213 1 & 2.. 2⟩ √ 1 (0⟩ 8192 + 1⟩ + ψ4 ⟩ We Measure R2 and randomly get a 28 leaving Ψ⟩ in the following post measurement state: R1 R2 9⟩ 28⟩ 29⟩ 28⟩ 49⟩ . with both registers) looks like this: Ψ⟩ = √ 1 (9⟩ 28⟩ + 29⟩ 28⟩ + 49⟩ 28⟩ + .. . 55) = 1 so continue. so we get Ψ⟩ = 2⟩ + . ψ2 ⟩ Create a superposition on register 1.4%). 3. Now.2010 . 410 ψ5 ⟩ After applying QF T † we observe 4915 (the probability of observing this is 4. c The Temple of Quantum Computing . r is even and satisﬁes r 2 4915 8192 is 20. Perry 2004 . . . ψ1 ⟩ Initialise both the registers so the combined state becomes Ψ⟩ = 0000000000000111111⟩. .⃝Riley T. by testing that 5 × 11 = 55 = N we see we have now found our factors. 8189⟩ 28⟩ So the state vector (ie. ψ6 ⟩ The result from the continued fractions algorithm for 5. 15) = 5 and gcd(1310 + 1. ̸= −1 mod N . 8192⟩ . so continue. N is not even and N ̸= ab . t = 13 qubits for register 1 and L = 6 qubits for register 2.
given a number of interconnected cities. with certain distances between them. Given a database table with N elements (it is best if we choose an N that is approximately 2n where n is the number of qubits) with an index i.2 Quantum Searching For the purpose of explaining Grover type algorithms we’ll use an unsorted database table as an example. Suppose we have M √ different solutions for k then the time complexity for Grover’s algorithm is O( M ). Put simply. N 7. . Our table is shown below: 0 1 2 . element 1 element 2 element 3 N − 1 element N Suppose there are M solutions where 1 < M ≤ N .4.4. . Perry 2004 . 7.214 Grover’s Algorithm 7. c The Temple of Quantum Computing . The most commonly given examples of search algorithms that can beneﬁt from a quantum architecture are shortest route ﬁnding algorithms and algorithms to ﬁnd speciﬁc elements in an unsorted database.1 The Travelling Salesman Problem An example of shortest route ﬁnding is the travelling salesman problem.⃝Riley T.2010 . Is there a route of less than k kilometres (or miles) for which the salesman can visit every city? With Grover’s algorithm it is possible to complete to search for a route of less √ than k kilometres in O( N ) steps rather than an average of N (which is O(N )) 2 steps for the classical case.4 Grover’s Algorithm Grover’s algorithm gives us a quadratic speed up to a wide variety of classical search algorithms.
2010 . ↑ ψ4 ⟩ ↑ ψ5 ⟩ ↑ ψ6 ⟩ G NM The steps for the algorithm for M = 1 are as follows: ψ2 ⟩ Initialise qubits states. Perry 2004 . .. i. as shown below: x⟩ q⟩ → O → q ⊕ f (x)⟩ (7..e.⃝Riley T. The search algorithm can actually be made up of several oracles.. f (x) = 0 otherwise. . The oracle circuit looks like this: x⟩ q⟩ /n Uf q ⊕ f (x) As with the Deutsch Josza algorithm if we set q to 1⟩ and then put it through an H gate the answer appears in the x⟩ register and q⟩ appears the same after the calculation so we end up with: x⟩ → O → (−1)f (x) x⟩ . q⟩ is a qubit and O is the oracle. . x is a marked solution to the problem. Typically there are extra work qubits leading into the oracle that may behave as ancilla qubits. c The Temple of Quantum Computing .10) The function f (x) contains the logic for the type of search we are doing. 0⟩ .. The oracles functions are very similar to the Deutsch Josza algorithm. f (x) = 1 if x is a solution.Grover’s Algorithm 215 In a similar way to Deutsch’s algorithm we use an oracle to decide if a particular index.9) here x⟩ is a register. The circuit for Grover’s algorithm is shown below: 0⟩ /n H ⊗n 0⟩ w⟩ / ↑ ψ1 ⟩ ↑ ψ2 ⟩ G 0⟩ ↑ ψ3 ⟩ G . (7. This is called an oracle’s workspace (represented by w).
ψ2 ⟩ We put x⟩ into a superposition: N −1 1 ∑ x⟩ → √ x⟩. N x=0 ψ3 ⟩ → ψ5 ⟩ Each G is called a Grover iteration that performs the oracle and a conditional phase ﬂip on x⟩ which ﬂips the sign on all qubits except for 0⟩ (denoted by CPF below). This is done after collapsing the superposition on x⟩ via H ⊗n . If we had M > 1 we would randomly measure one of the possible solutions. After the phase ﬂip is completed the x⟩ register is put back into a superposition. as we have M = 1 the register x⟩ will contain the only solution.216 Grover’s Algorithm u⟩ T ! ¡ G3 ψ⟩ ¡ G2 ψ⟩ ¡ ¡ ¡ ¡ G1 ψ⟩ ¡ ¨ B ¨ ¡ ¨¨ ¡ ¨¨ ¨ ¡ ¡ ¨¨¨ ¡ ¨ ¨ ¨ ¡ E v⟩ Figure 7.1: Visualising grover’s algorithm. Perry 2004 .⃝Riley T. Each G looks like the following: x⟩ q⟩ W ⟩ / /n x⟩ → (−1)f (x) x⟩ H ⊗n CPF H ⊗n √ For M = 1 we will need to apply G ⌈π 2n /4⌉ times. ψ6 ⟩ Finally we measure.2010 . c The Temple of Quantum Computing .
ψ2 ⟩ x⟩ and w⟩ go through their H gates giving us x⟩ = 10⟩ + 11⟩] and w⟩ = 1 √ [0⟩ 2 1 √ [00⟩ 4 + 01⟩ + − 1⟩]. We have only one solution so M = 1 and our function. and f (3) = 0. a grover iteration. With each individual rotation being done by G.12) The operation of Grover’s algorithm can be seen if ﬁgure 7.11) (7. so Ψ⟩ = 001⟩. ψ5 ⟩ Now x⟩ = 00⟩. f (2) = 0. which gives us N = 4. This is like saying the element we are looking for is at index i = 0. c The Temple of Quantum Computing . f (x) has a marked solution at x = 0. N − M ̸= 217 (7. The steps for the algorithm are as follows: ψ1 ⟩ We initialise x⟩ and w⟩. which we put through an H gate at the same time as the qubits in x⟩ initially go through their respective H gates (we’ll ignore oracle qubit q for this example). f (1) = 0. These are the results returned by an oracle call: f (0) = 1. ψ3 ⟩ A single grover iteration is all we need to rotate x⟩ to match u⟩ (the marked solution) so we jump straight to ψ5 ⟩. ψ6 ⟩ Measuring register x⟩ gives us a 0.Grover’s Algorithm Visualising Grover’s Algorithm We can deﬁne the superposition of solutions to Grover’s algorithm as: 1 ∑ u⟩ = √ x⟩ M = and the superposition of values that are not solutions as: v⟩ = √ ∑ 1 x⟩ .2010 . The size of register x⟩ is 2 qubits. A simple exmample follows: Example Suppose we have an index size of 4.⃝Riley T.1 as a series of rotations of Ψ⟩ from v⟩ to u⟩. We also have a workspace of 1 qubit (which we set to 1⟩). Perry 2004 .
.
At tens of nanometres (which we are close to now) electrons can tunnel between parts of a circuit. & Chuang. A. 2000] there 219 . A. H. 8. chips also tend to get faster. M. S.1) with transistors a fraction of a micron wide. but a warning for those expecting detail . Computer power doubles every few years (according to Moore’s law) and we’ll soon reach the threshold below which transistors will not work because of quantum effects. As they get smaller. Currently we are still limited to tens of qubits and hundreds of gates with implementations being slow and temperamental.2 Physical Realisation We’ll take a quick look at physical realisations here. so transistor technology may not be able to shrink much further [Benjamin. then in 2000 Ray LaFlemme built a seven qubit quantum computer. 2000]. ? 2000].this section is mainly here for completeness and is strictly an introduction. I.1 Introduction Today’s manufacturing methods can make chips (ﬁgure 8. with scientists even talking about using cups of coffee and small amounts of chloroform to build a working quantum computer [Blume. & Ekert.Chapter 8 Using Quantum Mechanical Devices 8. In 1998 Neil Gershenfeld (MIT) built a three qubit device. According to Nielsen and Chuang [Nielsen. L. The architectures of these machines vary.
How we control of the evolution of the circ The Temple of Quantum Computing .1: A silicon chip [Benjamin. the stronger the qubit implementation can interact with the environment. E. Perry 2004 . 2. and 10−6 seconds for a quantum dot (a kind of artiﬁcial atom). ? 2000]. are four basic requirements for the physical implementation of a quantum computer. because of the nuclear spin’s weak interactions with the ”outside world”.⃝Riley T. 10−3 seconds for an electron’s spin.220 Physical Realisation Figure 8. whereas ﬂying qubits are most likely to be used for communication.The biggest problem facing quantum computing is the ﬁckle nature of the minute components they work with. & Ekert. E. There are several considerations for implementing qubits. Qubits can be implemented in various ways. There are two types of qubits. S. nuclear spins give us much slower ”clock speed” than electron spins. one consideration is high decoherence times (low stability). Control of unitary evolution . Another consideration is speed. and photon polarisation. ground and excited states of atoms. like the spin states of a particle.g. They are: 1. Qubit implementation . material qubits like the stationary ones described above and ﬂying qubits (usually photons).g. A.2010 . the faster the computer. Stationary qubits are most likely to be used to build quantum hardware.
& Williams. 6.J. stable qubits.E.2. P. quantum error correction needs a constant supply of preinitialised.This is the easiest type of quantum computer to understand. C.Physical Realisation cuits. In practice. Kuhn. all of which. Gates can be represented by beamsplitters. ? 2000]. Divenco [Divincenzo. Another issue is that measurement techniques are less than perfect. . c The Temple of Quantum Computing . 221 3. • Optical photon computer . Perry 2004 .1 Implementation Technologies There are many theoretical ways to implement a quantum computer. Initial state preparation (qubits) .⃝Riley T. and the fact that photons are hard to control as they move at the speed of light. we also need to consider if the measurement is a non destructive measurement.⟩. A universal set of quantum gates. which for example leaves the qubit in the state which can be used later for initialisation.2010 . 8. D. We need to do this in a way that does not disturb other parts of our quantum computer. There remain other problems with single photon detection (which is very hard to do). We need a way of measuring the state of our qubits.R. David P. . 2003] has suggested two more ”fundamental requirements”: 5. E. Also. We need to be able to initialise qubits to values like 000 . Two of the important methods are listed below [Black. One of the ways qubits can be represented is by the familiar polarisation method. so we have to consider ”copying” values of the output qubits and averaging the results. at present suffer from poor scalability. Measurement of the ﬁnal state(s) . Decoherence times need to be much longer than quantum gate times.P. Measurement is done by detecting individual photons and initial state preparation can be done by polarising photons. although there are new methods that use entanglement to combat this problem.Setting the values of initial qubits. D.Measuring qubits. This is not just for initial values of a circuit. photons do not interact well with the environment.g. 4.
To explain these in detail is beyond the scope of this text and there are many more implementation technologies like ion traps (a number of ions.tuwien. Each element resonates at a different frequency so we can manipulate different spins by producing a radio wave pulse at the correct frequency. electrons on liquid helium. Perry 2004 . 2004]. SQUIDS (superconducting quantum interference devices).2010 . and induced voltages are used for measurement.3 Quantum Computer Languages Even though no quantum computer has been built that hasn’t stopped the proliferation of papers on various aspects of the subject.(Bernhard Omer) C like syntax and very complete. This spin is ”rotated” by the radio pulse (the amount of which depends on the amplitude and direction). 8.(Paolo Zuliani and others) Resembles a functional programming lan¨ guage and claims to be better than Bernhard Omer’s QCL because QCL does not include probabilism and nondeterminism.NMR uses the spin of an atomic nucleus to represent a qubit. Spins are prepared by magnetising. Many such papers have been written deﬁning language speciﬁcations. ¨ • QCL . has no notion of program reﬁnement. and harmonic oscillators. Some quantum languages are listed below [Glendinning.at/∼oemer/qcl.ac. We are not limited to using atoms as they can be combined to form a macroscopic liquid with same state spins for all the component atoms. Accessible at http: //tph.zuliani/ . and sized radio pulses. A computation is made up of a series of timed.ox. c The Temple of Quantum Computing . trapped in a row in a magnetic ﬁeld). Several atomic spins can be combined chemically in a molecule.⃝Riley T. • qGCL . Chemical bonds between spins are manipulated by a magnetic ﬁeld to simulate gates. Currently it is thought that NMR will not scale to more than about twenty qubits.ac. Accessible via http://web.uk/oucl/work/paolo.html . I. optical lattices. A seven qubit computer has been made from ﬁve ﬂuorine atoms whose spins implement qubits. and only allows standard observation.comlab.222 Quantum Computer Languages • Nuclear magnetic resonance .
com/) is pictured in ﬁgure 8. Knill) Not actually a language.Encryption Devices 223 Figure 8. Accessible at http://arxiv.2010 .org/abs/quant ph/0201082 . • Conventions for Quantum Pseudo Code . is there any existing work? Maybe just a speciﬁcation? 8.eskimo. Accessible at www. Perry 2004 . Question It seems odd that there is no implementation of quantum BASIC. • Quantum C .4 Encryption Devices The ﬁrst encryption devices using the quantum properties discussed previously have been released. a quantum key distribution unit developed by id Quantique (which can be found at http://www.ps .(Stephen Blaha) Currently just a speciﬁcation. Whether or not they become commercial success may affect the future of the ﬁeld as a whole. but a nice way to represent quantum algorithms and operations.com/∼knill/cv/reprints/knill :qc1996e. with a notion of quantum assembler. For example.2: id Quantique’s QKD device. c The Temple of Quantum Computing .⃝Riley T.(E.2 and another encryption device was recently released by MagiQ.idquantique.
.
the set of languages accepted by deterministic Turing machines in t(n) = 2p(n) time. 225 . PEXP . NPcomplete . NP . NPI (NP intermediate) .the set of languages in NP but not in NPcomplete.a decision problem in NP is NPcomplete if all other problems in NP are reducible to it. coNP . EXP .edu.umbc.the set of languages rejected by nondeterministic Turing machines in polynomial time.the set of languages accepted by nondeterministic Turing machines in polynomial time.edu 2003]: P .Appendix A Complexity Classes A. NEXP .the set of languages accepted by deterministic Turing machines in polynomial time. Most of these deﬁnitions are copied verbatim from [cs.the set of languages accepted by deterministic Turing machines in t(n) = 2cn time.the set of languages accepted by nondeterministic Turing machines in t(n) = 2cn time.1 Classical Here is a summary of some of the main complexity classes.
226 Classical NPEXP . BPP . the set of languages accepted by zero probability of error polynomialtime Turing machines. PSPACE . Perry 2004 .the set of languages accepted by random probabilistic polynomialtime Turing machines (one sided probability).which is the amount of space (storage) required by the algorithm.2010 .the set of languages accepted by deterministic Turing machines in polynomial space. The ﬁnal set of classes refer to probabilistic Turning machines: PP .the set of languages accepted by nondeterministic Turing machines in polynomial space. in polynomial time. c The Temple of Quantum Computing . A. M.⃝Riley T.the set of languages accepted by nondeterministic Turing machines in t(n) = 2p(n) time. I.RP intersection coRP.the set of languages accepted by bounded probabilistic polynomialtime Turing machines (balanced probability).the set of languages accepted by probabilistic polynomialtime Turing machines (not proved random = pseudo random). The next set of classes relate to space complexity . that have at least one accepting computation on any input.the set of languages accepted by nondeterministic Turing machines. RP . LOGSPACE .the set of languages accepted by RP machines with accept and reject probabilities reversed. NPSPACE . 2000]: • L ⊆ P ⊆ NP ⊆ PSPACE ⊆ EXP. UP . L. ZPP . coRP . & Chuang.the set of languages accepted by unambiguous nondeterministic Turing machines. NLOGSPACE .the set of languages accepted by deterministic Turing machines in logarithmic space. Some of the main classes are related in the following way [Nielsen.
Some of the quantum complexity classes are related in the following way [Nielsen. 2000]: • It is known that polynomial quantum algorithms are in PSPACE.2 Quantum Some of the quantum complexity classes are listed below.Quantum • Factoring is thought to be in NPI and not proven to be in NPcomplete. BQP . I. with P ⊂ QP. • It is thought that NPcomplete problems cannot be solved by QTMs in polynomial time but NPI problems can. & Chuang. 2002]: QP . A. • Space hierarchy theorem: SPACE(f (n)) ⊂ SPACE(f (n) log(f (n))). I. ZQP .the problem can be solved by a QTM in polynomial time at worst with 2 probability greater than 3 . 227 • Graph isomorphism is thought to be in NPI and not proven to be in NPcomplete.e.2010 .⃝Riley T. Perry 2004 .the problem can be solved by a QTM without errors in polynomial time. with ZP ⊂ ZQP.the problem can certainly be solved by a QTM in polynomial time at worst. in 1 3 of cases the computer may return an erroneous result. M. These deﬁnitions are copied verbatim from [Meglicki. • Time hierarchy theorem: TIME(f (n)) ⊂ TIME(f (n) log2 (f (n))). L. A. also BPP ⊆ BQP. c The Temple of Quantum Computing . Z.
.
S.pdf [Accessed 4 July 2004] Barenco. S.edu 1999. A. arizona.iitd. Introduction to Quantum Algorithms [Online]. A Short Introduction to QuantumScale Computing.com/unbound/digicult/dc20000503. Reimagining the Cosmos. 2001. In the Beginning was the Bit.htm [Accessed 4 July 2004] 229 . 2000.in/\∼suban/quantum/lectures/ lecture1. S. 2000. February 17 Banerjee.gov/∼black/Papers/ quantumCom. [Online]. html [Accessed 4 July 2004] Bettelli. ? 2004. Quantum Computation and Information Theory . Available: sra. C. A. Available: http://www.it/people/serafini/quantumcomputing/seminars/20001006slides.cse. D.pdf [Accessed 7 December 2004] Blume. 1996. Kuhn. A Short Introduction to Quantum Computation [Online].R. Available: http://www. New Scientist. C. & Williams.edu/quantum/Library/qmlecture1.org/library/intros/nano/nano.html [Accessed 30 June 2004] Benjamin. Available: http://www. ? 2000. ? 2000.org/library/ intros/comp/comp.J. A.E. Available: http://www. Quantum Computing and Communication [Online]. theatlantic. H.ps [Accessed 5 December 2004] Black. Sanpera. A. C. Ekert. & Ekert. & Machiavello.nist. Lecture 1 [Online]. P.Qubit.Lecture 1 [Online].Bibliography Arizona.htm [Accessed 5 December 2004] Baeyer. H.consciousness. Available: http://www. itc. Available: http://hissa. [Online].ernet.qubit.
L. Designing Encodings [Online].cs.umbc.uk/Teaching/current/QuantComp/ [Accessed 4 July 2004] Dorai. Available: http://www.J. Quantum Computing .edu 2003.ac.uk/∼nd/surprise 97/journal/ vol1/mjc5/ [Accessed 4 July 2004] Copeland.doc.ac. Available: http://www.ernet. A.edu/∼tevans/VonNeuma.shtml [Accessed 7 Decem ber 2004] Dawar. Kumar. S. 2004.pdf [Accessed 4 July 2004] Designing Encodings ? 2000. K. Implementation of a Deutschlike quantum algorithm utilising entanglement at the twoqubit level on an NMR quantuminformation processor [Online].salem. Available: http://www.html [Accessed 9 August 2004] cs.htm Deutsch. V.iisc. On Quantum Computing and AI (Notes for a Graduate Class). & Ekert.cl. Do I Invest in Quantum Communications Links For My Company? [Online]. 2001. ? 2000.csee.ic. D.Lectures. Canada. ?. K.indigosim. John von Neumann and von Neumann Architecture for Computers [Online]. Scalable Quantum Computers .2010 . M. March c The Temple of Quantum Computing . A.umbc. 1998. What is a Turing Machine? [Online].V. 1997.cam.ualberta. 2000. alanturing. Available: http://eprints. Physics World. Bulitko. 2000.edu/help/theory/classes.net/turing archive/pages/ReferenceArticles /WhatisaTuringMachine. Available: http://www. [Online]. Wiley Press. Arvind.mass. Complexity Class Brief Deﬁnitions [Online].htm [Accessed 9 September 2004] Castro. Available: http: //www. Available: www. 1st edn.⃝Riley T. B. H. 2002.Paving the Way to Realisation. Perry 2004 . & Lo. A. [Online].in/archive /00000300/01/Deutsch. Quantum Computation.edu. pdf [Accessed 10 December 2004] Cabrera.ca/∼bulitko/qc/schedule/qcssnotes. J.com/tutorials/communication/t3s2. Available: http: //www.230 BIBLIOGRAPHY Braunstein.
Laﬂamme. 2002.2010 . G. 2004. ? 2000. UK. J.htm [Accessed 9 September 2004] Glendinning. 1993. M. Lecture 6 [Online]. Available: http://www.arizona.univie. D.ac. [Online]. consciousness. Jan 16 Forbes. Quantum Keys for Keeping Secrets. 1991. E.BIBLIOGRAPHY 231 Divincenzo. Available: http://pages.shtml [Accessed 4 July 2004] Hameroff. Dziarmaga. Big Square Roots [Online]. 2003. Skills in Mathematics Volumes 1 and 2. ? 2003. Rae H. Available: http://www. ? edn. Barnum. Quantum Programming Languages and Tools. S.P.edu/Quantum/week6. Forbes.arizona. The Physical Implementation of Quantum Computation. c The Temple of Quantum Computing . S. ?.com/bigsqrt. Theory of Computation [Online].htm [Accessed 30 June 2004] Jones. S. & Zarate.P. 2001. Introduction to Quantum Information Processing Marshall. Introductory Lectures [Online]. and Rae. Gubernatis. Perry 2004 . ? 2003. I. Available: http:// www. Morton. Gurvits. Gilleland. Wilson. W.⃝Riley T. Ekert.edu/Quantum/ [Accessed 30 June 2004] Hameroff. Ortiz. 2002. Icon Books. A. Morton. & Conrad. J. quantph/0002077. 2nd edn. New Scientist. Auckland. & Zurek. 0. 2nd edn. An Incomplete Education .vcpc. 13 April.H. J. Introducing Quantum Theory.edu/∼jbm04747/courses/fall2001/cs10/lectures/Computation /Computation. Viola. D. W. Consciousness at the Millennium: Quantum Approaches to Understanding the Mind. L. J. 1995.at/∼ian/hotlist/qc/programming. Consciousness at the Millennium: Quantum Approaches to Understanding the Mind. vol. M. H. Dalvit. J.consciousness. L. M. merriampark.html [Accessed 9 August 2004] McEvoy. Available: http://www. ? Knill. pomona. R.
E.html [Accessed 10 December 2004] Smithsonian NMAH 1999.html [Accessed 30 June 2004] Rae.txt [Acc The Temple of Quantum Computing .belllabs.edu/B679/node27.org/people/nielsen/qicss. Searle.indiana.html [Accessed 7 December 2004] Natural Theology 2004. Ask the Astronomer (Question) [Online].html [Accessed 29 April 2006] Shatkay. 1990. 2004. L.A Primer [Online]. Z. Cambridge Press. 1948. Odenwald. Available: http:// citeseer. A. Available: http://beige. 2000. Deutsch’s algorithm with a pair of sunglasses and some mirrors [Online]. Jacquard’s Punched Card [Online].qinfo.ist.html [Accessed 30 June 2004] Nielsen. 1995. The Fourier Transform . Available: http://www . pp.cs. 1996. A Mathematical Theory of Communication [Online]. H. C. Shannon. Is the Brain’s Mind a Computer Program.edu/gen/recording/jacquard1. I. M. Cambridge Press.2010 .acusd. 2nd edn. 2002. 2025. A.astronomycafe.ac.edu/shatkay95fourier.nz/∼msta039/deutsch. Quantum Physics: Illusion or Reality?. Available: http://cm.ucs. Eight Introductory Lectures on Quantum Information Science [Online]. J. January. & Chuang. UK. Goedel [Online].naturaltheology.html Nielsen. Available: http://www. 2002.net/Synopsis/s26Goedel. Available: http: //history.net/qadir/q971.html [Accessed 9 September 2004] Stay. UK. R.⃝Riley T. 1997.psu. Scientiﬁc American. Quantum Complexity and Quantum Algorithms [Online]. S. M. Quantum Computation and Quantum Information. A.auckland. Perry 2004 . 3rd edn. M. Available: http: //www.232 BIBLIOGRAPHY Meglicki. Available: http://www.com/cm/ms/what/shannonday/paper.
1 http://www.thefreedictionary.stand.4 aima.mathe. 117173 TheFreeDictionary. A New Kind of Science.⃝Riley T.edu/cover.inzine. Available: http:// en.thefreedictionary.org/wiki/Complexity classes P and NP [Accessed 3 November 2004] Wolfram. Available: http:// encyclopedia. vol.3 http://wwwgroups.uk/∼history/Mathematicians /Turing.BIBLIOGRAPHY cessed 4 July 2004] 233 Steane.com/groversalgorithm [Accessed 4 July 2004] TheFreeDictionary.com/Probabilistic+Turing+machine [Accessed 3 December 2004] wikipedia.asp?art=8491 Figure 2. Grover’s Algorithm [Online].dcs.wikipedia.2 http://www.htm http://www.html Figure 2.tufreiberg. 61 pp. Rept.cs. 1st edn. S.ac.Phys.Prog.com 2004.berkeley.ac. A. Complexity classes P and NP [Online].de/∼dempe/schuelerpr neu/babbage.html Figure 2.org 2004. Quantum Computing.dcs. 2002. M.html c The Temple of Quantum Computing . Wolfram Media.com 2004. USA Image References Figure 2. Probabilistic Turing machine [Online].stand.es/cursos/tco/ http://wwwgroups.. 1998. Perry 2004 .2010 .sk/article. Available: http://encyclopedia.uk/∼history/Mathematicians /Von Neumann.us.cs.
edu/schools/hum sci/physics/whatis/biography /dalton.ac.uk/∼history/Mathematicians /Copernicus.ac.ac.bg.org/filozofija/graph/democritus.htm Figure 4.UGent.elis.stand.dcs.dcs.dcs.12 http://www.edu/events/caltech nobel/ Figure 2.ac.ac.uk/∼history/Mathematicians/Maxwell.phy.html http://wwwgap.uk/∼history/Mathematicians/Newton.6 http://wwwgap.stand.eatonline.3 http://www.ac.svarog.html http://wwwgap.html http://wwwgroups.uk/∼history/Mathematicians/Godel.slcc.html c The Temple of Quantum Computing .html Figure 3.caltech.stand.dcs.html Figure 4.html Figure 4.html http://wwwgap.dcs.2010 .uk/∼history/PictDisplay/Helmholtz.html Figure 2.dcs.ac.stand.ac.be/ELISgroups/solar/projects/computer.stand.stand.234 Figure 2.jpg http://www.html Figure 4.2 http://wwwgap.html Figure 4.dcs.ac.dcs.uk/∼history/Mathematicians /Boltzmann.stand.⃝Riley T.net/english/education/biographies/clausius\.dcs.yu/web projects/giants/hilbert.ac.5 BIBLIOGRAPHY http://www.uk/∼history/Mathematicians/bohr.html http://www.9 http://pr.4 http://wwwgap.9 http://wwwgap.uk/∼history/PictDisplay/Galileo.stand.stand.1 http://wwwgap.uk/∼history/PictDisplay/Fourier. Perry 2004 .
mcs.stand.1 http://www.dcs.htm Figure 4.html http://wwwgap.7 235 http://wwwgap.org/EducationalServices/chemach/ans/er.uk/∼history/Mathematicians/Born.html Figure 4.2 http://www.ac.ac.stand.dcs.dcs.standrews.html Figure 4.ac.html Figure 8.dcs.1 http://wwwhistory.ac.stand.dcs.stand.uk/∼history/PictDisplay/Einstein.org/oldsite/intros/nano/nano.15 http://wwwgap.stand.com/ c The Temple of Quantum Computing .dcs.html Figure 6.2010 .qubit.uk/history/PictDisplay /Shannon.idquantique.stand.uk/∼history/PictDisplay/Boole.dcs.html http://wwwgap.html Figure 4.stand.stand.13 http://wwwgap.ac.stand.dcs.uk/∼history/Mathematicians /Sommerfeld.8 http://wwwgap.uk/∼history/PictDisplay/Balmer.stand.uk/∼history/Mathematicians/Planck.org/MAZZAR/thinkquest/History/Thomson.trinityprep.html http://wwwgap.9 http://www.html http://wwwgap.uk/∼history/PictDisplay/Pauli.14 http://wwwgroups.html Figure 4.html http://wwwgap.ac.ac.ac.uk/∼history/PictDisplay/Dirac.uk/∼history/Mathematicians /Schrodinger.html http://www.uk/∼history/PictDisplay/Born.dcs.uk/∼history/Mathematicians/Broglie.ac.html http://wwwgap.ac.⃝Riley T.dcs.dcs.ac.BIBLIOGRAPHY Figure 4.chemheritage. Perry 2004 .html Figure 8.ac.stand.
.
68 Alhazen. 21 Atoms. Johann Jakob. Charles. 188 CauchySchwartz inequality. 77 Aristotle. 55 Braket notation. 70 Characteristic polynomial. 162 Classical registers. 9 Babbage. 97 Adjoint. 95 Black body radiation. 189 Bright line spectra. 28 Big Ω notation. 138 Code wheel. Niels. 94 Caesar cipher. 158 Boolean algebra. 14 Classical complexity classes. 4 Ancilla bits. 95 Channel capacity. Rudolf .Index Absorbtion spectrum. 21 Big O notation. 36 AntiCommutator. 95 Bloch sphere. 8 Black body. 90 Classical redundancy and compression. 164 Binary numbers. 173 Bit swap Circuit. 120 Bohr. 15 Angles in other quadrants. 104 Bra. 28. 21 Big Θ notation. George. 144 Bell states. 4 Balmer. 60 Cause and effect. 8 Binary symmetric channels.. 19 237 . 15 Clausius. 90 Analytical engine. 6 Classical circuits. 180 Bennet. 29. 225 Classical Cryptography. 56 BB84. 91 Asymptotically equivalent. 97 Bubble sort. Max. 100 Church.H. 160 Classical physics. 6 Binary representation. 53 Commutative law of multiplication. 77 Boole. 91 Automaton. 93 CNOT gate.. Ludwig. 6 ChurchTuring thesis. 142 AND gate. 128. Charles. 14 Classical information sources. 95 Boltzmann’s constant. 104 Commutator. 158 Born. G. 173 Column notation. 98 Basis. Alonzo. 159 Characteristic equation. 143 Bits. 60 Brassard. 94 Boltzmann. 70 Christmas pudding model. 90 Cavity. 15 Classical wires. 193 Bell state circuit. 173 Classical gates. 189 Bennett. 21 Binary entropy. 188 Classical error correction. C. 188 Codewords.
55 ¨ Godel’s incompleteness theorem. 36 Copenhagen interpretation. 25 Deutsch’s algorithm. 70 Einstein. 81 Fredkin gate. 29. Kurt. 220 Controlled U gate. 91 Density matrix. 90 Garbage bits. 81 Dot product. 18 Fast factorisation. 6 Galilei. 39 Complex plane. 57 Exponential form. 171 Fourier series. 105 Discrete fourier transform. Paul. 167 Entangled states. 76 Dirac. 209 Continuous spectrum. 142 FANIN.2010 . 68 Complex conjugate. 40 Complex number. 18 Cryptology. 10 First law of thermodynamics. 220 For all. 6 ¨ Godel.238 Completely mixed state. Albert. 103 Decision problem. Louis. 210 Fast Factorisation circuit.Church . 180 de Broglie. 81 Fourier. 59 Dual vector. 127 Entanglement. 28 Control of unitary evolution. 200 Diagonal polarisation. 141 Frequency domain.⃝Riley T. 166. 142 Conventions for quantum pseudo code. 44 INDEX Four postulates of quantum mechanics. 171 c The Temple of Quantum Computing . 149. 143 CROSSOVER. 210 Feynman. 81 Full rank. 92 Fluctuation. 111 EPR pair. Richard. 166 Determinant. 18 FANOUT. 30. 41 Complex vector space. 70 Eigenvalue. Nicolaus. 19 Constant coefﬁcients. 90 Copying circuit. 97 Electromagnetism. 52. 225 Computational basis. 95 Flying qubits. 34 Formal languages. 207 Fast Factorisation algorithm. 90 Electron. 97 Ensemble point of view. 116 Diagonalisable matrix. 223 Converting between degrees and radians. 49 Fundamental point of view. 23 Decoherence. 49 Determinism. 70 Eigenvector. 128. Galileo. 196 Deutsch. 97 Control lines.Turing principle. 170 Completeness relation. 70 Degrees. 93 EPR. 175 Degenerate. 98 Emission spectrum. 25 Finite state automata. 177 Excited state. Jean Baptiste Joseph. 111 Entropy. 9 Eigenspace. 56 Computational Resources and Efﬁciency. David. 105 Copernicus. 23 Deutsch . 90 Deterministic Turing machines. 34 Continued fractions algorithm. 25 DeutschJosza algorithm. 82 Fourier transform. 36 Democritus. 187 CSS codes. 53 Complexity classes. 101 Expectation value. 180 Error syndrome. Perry 2004 .
27 Landauer. 73 Normalise. 52. 5 Multi qubit gates. 23 NOR gate. 162 Linear combination. 105 Heisenberg. 58 Interference. 159 Message Source. 5 Moore. 107 Intractable.⃝Riley T.2010 . 6 id Quantique. 50. 48 If and only if. Joseph Marie. 221 Non deterministic Turing machines. 39 Imaginary axis. 28 King. 134 Haltig problem. 95 Newton. Perry 2004 . 195 Inverse matrix. 38 Logical symbols.W. 90 Newtonian mechanics. 55 MagiQ. 4 New quantum theory. 64 Linearly independent. 94 Ket. 221 Message Destination. 223 Identity matrix. 215 Grover’s algorithm. 40 Moore’s law. 160 Initial point. 41 Independent and identically distributed. 4 Kronecker product.. 165 Modulus. 203 Invertible. 46 Matrix arithmetic. 158 Mixed states. 16 Neumann. 4 Joule. 46 Matrix addition. 138 Mutual key generation. 62 NOT gate. Rolf. 119 Keyes. 118 Global properties of functions. 73.INDEX Global phase. Von. 159 Message Receiver. 193 NAND gate. 46 Matrix entries. 90 Measurement of ﬁnal states. 50 Inner product. 53. 16 Norm. 46 Matrix multiplication. 113 Hadamard gate. 111 Logarithms. Issac. 47 Maxwell’s demon. 149 Noisy channels. R. 140 Linear operator. 15 NOT2 gate. 8 Length of codes. 196 Gram Schmidt method. 64 Ground state. 40 Normal operator. Lov. David. 94 Kelvin. 93 Hermitian operator. 35 Imaginary. 60 Hilbert. Jon Von. Werner. James Clerk. 173 Non destructive measurement. 90 No programming theorem. 215 Markov process. Ada Augusta. 23 Nondeterministic polynomial time. 214 Grover. 76 Hilbert space. 26 Jacquard. 100 Grover workspace. 150 Matrices. 158 Message Transmitter. 56 Local state. 27 Least signiﬁcant digit. 22. 11 Heisenberg uncertainty principle. 104 Helmholtz. 27 Maxwell. 48 Inverse quantum fourier transform. 223 Marked solution. 80 Landauer’s principle. 34 239 c The Temple of Quantum Computing . Gordon.
191 Quantum logic gates. 62 Outer product. 208 Orthogonal. 188 Pure states. 175 Quantum searching. 40 Polarisation of photons. 202 Quantum fourier transform circuits. 222 qGCL. 60 Orthonormal basis. 151 Public key encryption. 189 Optical photon computer. 23 Nuclear Magnetic Resonance. 165 Quantum key distribution. 117 Repetition. 96 π 8 INDEX Programmable quantum computer. 116 Reduced density matrix. 189 Quantum noise. 34 Positive operator. 103 Rectilinear polarisation. 222 Nuclear spins. 36 Rank. 114 Quantum C.⃝Riley T.240 NP. 20 Radians. 102 Period. 19 Probabilistic complexity classes. 130 Quantum mechanics. 49 Rationalising and dividing complex numbers. 96 Polar coordinates. 123 Partial measurement. 23 Partial Measurement. 165 Pythagorean theorem. 25 Qubit implementation. 110 Polynomial time. 222 Quantum cryptography. 110 Observable. 154 Principle of invariance. 41 Polar decomposition. 208 Phase gate. 89 Quantum money. 214 Quantum Turing machine. 222 Quantised. 74 Pauli. 58 Probability distribution. 208 Order ﬁnding. 173 gate. 160 c The Temple of Quantum Computing . 133 Planck’s constant. 220 Quantum fourier transform. 123 Pauli exclusion principle. 220 Qubit initial state preparation. 223 Quantum circuits. 43 RayleighJeans law. 15 Oracle. 95 Onetime PAD. 135 P. 148 Projective measurements. 25 Polynomials. 221 OR gate. 73. 127 Projectors. 189 Quantum dot. 227 Quantum computer languages. 102 Pauli gates. 129 Quantum complexity classes. 221 Qubits. 100 Quantum packet snifﬁng. 66. Perry 2004 . 226 Probabilistic Turing machine. 196 Order. 208 Phase estimation.2010 . 131. 127 Old quantum theory. 190 Quantum repetition code. Wolfgang. 89 Quantum bits. 174 Quantum numbers. 136 Pauli operators. 207 Quantum information sources. 114 Quick sort. 76 POVMs. 65 Outer product notation. 35 QCL. 133 Photoelectric effect. 170 Relative phase. 22 Polynomially equivalent. 24 Probability amplitudes. 127. 78 Polar form.
111 Statistical mechanics. 56 Spectral decomposition. Stephen.2010 . 163 Shannon’s communication model. 101 Source of Noise. 158 Spanning set. 73 Universal computer. 146 Tensor product. 46 ¨ Schrodinger’s cat. Claude E. 134 Stabiliser codes. 166 Second law of thermodynamics. 189 Wire. 29. 14 Turing Machine. 110 Unit vector. 54 Vectors. 78 Single qubit gates. 49 Sommerfeld. 102 Square root of NOT gate. 38 orem. 113 Shortest route ﬁnding. 188. 4 Universal Turning Machine. 34 Thermodynamics. 4 Uncertainty. 93 Shannon Entropy. 79. 157 Shor code. 28 Reversibly. 158 Shannon’s noiseless coding theorem. Joseph J. 16 Zero matrix.Trigonometry. 28 Reversible gates. 11 Vector addition. 137 RSA. 130 Witnesses. 166. 107 Teleportation circuit. 163 Shannon. 189 Travelling salesman problem. 172 Superdense coding. 35 Trigonometry identities. Alan. 202 Shor. 92 Thomson. Ernest. 58. Arnold. Peter. 130 Single value decomposition. 50 There exists. 174 Reversible circuits. 54 Vector scalar multiplication and addition. 46 Scalar multiplication by a matrix. 98 Scalar.⃝Riley T. 103 Wiesner. 161 Zero vector. 145 Superposition. 141 Trace. 78 Singular. 81 Toffoli gate. 49 Trap door function.INDEX Repetition codes. 61 Unitary operator. 23 XOR gate. 98 Time domain. 171 c The Temple of Quantum Computing . 180 Strong ChurchTuring thesis. 54 Truth tables. 35 Rotation operators. 36 241 Schumacher’s quantum noiseless coding the. 180 State vector. 6 Turing. 214 Trigonometric inverses. 123 Terminal point.. 104 Schumacher compression. 94 Steane code. 24 subsystem point of view. Erwin. 26 Right angled triangles. 48 Zero memory information sources. 50 Visualising grover’s algorithm. 104 ¨ Schrodinger. 116 Statistical correlation. 217 Von Neumann architecture. 179 Shor’s algorithm. 195. 71 Transpose matrix. 214 Simultaneous diagonalisation theorem. 79 Spin. 32 Reversible computation.. Perry 2004 . 4 Von Neumann entropy. 207 Rutherford. 170 Wien’s law. 100 Rydberg constant.