Professional Documents
Culture Documents
Full Ebook of Quantum Computers Theory and Algorithms 1St Edition Belal Ehsan Baaquie Online PDF All Chapter
Full Ebook of Quantum Computers Theory and Algorithms 1St Edition Belal Ehsan Baaquie Online PDF All Chapter
https://ebookmeta.com/product/principles-of-superconducting-
quantum-computers-1st-edition-daniel-d-stancil/
https://ebookmeta.com/product/machine-learning-with-quantum-
computers-2nd-edition-francesco-petruccione/
https://ebookmeta.com/product/primary-mathematics-3a-hoerst/
https://ebookmeta.com/product/sustainability-accounting-
education-regulation-reporting-and-stakeholders-1st-edition-
ataur-belal/
https://ebookmeta.com/product/algorithms-in-bioinformatics-
theory-and-implementation-1st-edition-gagniuc-paul-a/
https://ebookmeta.com/product/quantum-reality-theory-and-
philosophy-2nd-edition-jonathan-allday/
https://ebookmeta.com/product/fundamentals-of-quantum-computing-
theory-and-practice-venkateswaran-kasirajan/
https://ebookmeta.com/product/mastering-quantum-mechanics-
essentials-theory-and-applications-barton-zwiebach/
Belal Ehsan Baaquie
Leong-Chuan Kwek
Quantum
Computers
Theory and Algorithms
Quantum Computers
Belal Ehsan Baaquie · Leong-Chuan Kwek
Quantum Computers
Theory and Algorithms
Belal Ehsan Baaquie Leong-Chuan Kwek
Helixtap Technologies Centre for Quantum Technologies
Singapore, Singapore National University of Singapore
Singapore, Singapore
© The Editor(s) (if applicable) and The Author(s), under exclusive license to Springer Nature
Singapore Pte Ltd. 2023
This work is subject to copyright. All rights are solely and exclusively licensed by the Publisher, whether
the whole or part of the material is concerned, specifically the rights of translation, reprinting, reuse
of illustrations, recitation, broadcasting, reproduction on microfilms or in any other physical way, and
transmission or information storage and retrieval, electronic adaptation, computer software, or by similar
or dissimilar methodology now known or hereafter developed.
The use of general descriptive names, registered names, trademarks, service marks, etc. in this publication
does not imply, even in the absence of a specific statement, that such names are exempt from the relevant
protective laws and regulations and therefore free for general use.
The publisher, the authors, and the editors are safe to assume that the advice and information in this book
are believed to be true and accurate at the date of publication. Neither the publisher nor the authors or
the editors give a warranty, expressed or implied, with respect to the material contained herein or for any
errors or omissions that may have been made. The publisher remains neutral with regard to jurisdictional
claims in published maps and institutional affiliations.
This Springer imprint is published by the registered company Springer Nature Singapore Pte Ltd.
The registered company address is: 152 Beach Road, #21-01/04 Gateway East, Singapore 189721,
Singapore
Preface
Quantum theory introduces a fundamentally new framework for thinking about nature
and entails a radical break from the paradigm of classical physics. In spite of the fact
that the shift of paradigm from classical to quantum mechanics has been ongoing
for more than a century, a complete conceptual grasp of quantum mechanics has till
today proved elusive. According to leading quantum theorist Richard Feynman, ‘It
is safe to say that no one understands quantum mechanics’ [1].
The idea of quantum computers was pioneered by Yuri Manin (1980) and Richard
Feynman (1981) when they discussed simulations that could not be carried out by a
classical computer—but only by a quantum computer. Feynman discussed the ideas
of quantum gates and quantum computers in [2]. In 1983, David Deutsch made a
crucial advance by proposing that the quantum qubit is the natural generalization
of the bit of classical computers [3]. The field over the last two decades has seen
phenomenal growth, and the development of a practical quantum computer is poised
to be game-changing technology of the twenty-first century.
This book is divided into the following four parts. The introduction in Part I gives
a more detailed discussion of these four parts.
1. The topics in Part I have been chosen to introduce non-specialists and newcomers
to this field.
2. Part II discusses in great detail some of the important special cases that illustrate
the workings of a quantum algorithm.
3. Part III discusses relatively more advanced topics as well as some important
applications of quantum algorithms.
4. The last part is a discussions of some of the general features of quantum
algorithms.
Hopefully, after reading this book, one can have a rudimentary understanding of
quantum algorithms.
v
vi Preface
References
vii
Contents
1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.1 Interview on Quantum Computers . . . . . . . . . . . . . . . . . . . . . . . . . . 4
References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
Part I Fundamentals
2 Binary Numbers, Vectors, Matrices and Tensor Products . . . . . . . . . 13
2.1 Binary Representation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
2.2 Linear Vector Space . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
2.3 N -Dimensional Complex Linear Vector Space . . . . . . . . . . . . . . . . 18
2.4 Matrices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
2.5 Properties of N × N Matrices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
2.5.1 Hermitian Conjugation . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
2.6 Tensor (Outer) Product . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
2.7 Square Matrices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
2.8 Dirac Bracket: Vector Notation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
2.9 Tensor and Outer Product: Strings and Gates . . . . . . . . . . . . . . . . . 31
2.9.1 3-Bits String . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
3 Classical Gates and Algorithms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
3.1 Classical Algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
3.2 Classical Gates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
3.3 2-Bits String Gates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
3.4 XOR Reversible Gate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
3.4.1 X OR : 3-Bits String . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
3.5 3-Bits String: Toffoli Gate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
3.6 Unitary AND, NAND and NOT Gates for 3-Bits . . . . . . . . . . . . . . 52
3.7 Unitary OR and NOR Gates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
3.8 Classical Binary Addition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
3.9 Half-Adder . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
3.10 Full-Adder . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
ix
x Contents
Part IV Summary
19 Efficiency of a Quantum Computer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 285
19.1 Quantum Algorithms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 285
19.2 Memory and Speed of Quantum Computations . . . . . . . . . . . . . . . 288
19.3 Where Does Quantum Computation Take Place? . . . . . . . . . . . . . . 290
19.4 Conclusions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 292
References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 293
Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 295
About the Authors
xv
xvi About the Authors
© The Author(s), under exclusive license to Springer Nature Singapore Pte Ltd. 2023 1
B. E. Baaquie and L.-C. Kwek, Quantum Computers,
https://doi.org/10.1007/978-981-19-7517-2_1
2 1 Introduction
The focus of this introductory book is on the theoretical and algorithmic aspects
of quantum computers. A few algorithms are employed to illustrate the main ideas in
quantum algorithms. The main aim of this introductory text is to clarify precisely why
a quantum computer is so much more powerful than any possible classical computer.
The ideas that underpin a quantum computer are explained with a minimum
recourse to advanced mathematics, and wherever possible, quantum algorithm are
stated in a non-mathematical language. The physics of how to create a quantum
computer, the hardware, has been eschewed as it is not essential for understanding
the logic of quantum algorithms. This is similar to using a laptop without knowing
anything about electrical engineering.
The field of quantum computers is an emerging technology, and quantum algo-
rithms are codes that can vastly speed up information processing, far outpacing
currently used classical computers. Classical computers refer to computers that are
constructed with electronics circuits and are based on the existing paradigm of com-
puter science. Quantum computers have potential applications in a vast number of
fields, such as cryptography, manufacturing, information and communications tech-
nology, finance, autonomous vehicles, pharmaceuticals, energy, logistics, artificial
intelligence and so on. In recent years, there is hardly a day that goes by without
some articles touching on the potential importance of quantum computers, as well
as on the intense competition among various companies and countries that are trying
to take the lead in developing a practical quantum computing device.
What has really caught the imagination of the public at large is the term ‘quantum
advantage’. This is a project to develop programmable quantum codes that can solve
problems that a classical computer, including the fastest of the supercomputers, can
never beat or solve—even in principle, since for a classical computer, to solve these
computational problems would need a time longer than the age of the Universe. On
October 23, 2019, the Associated Press reported that ‘Google’s leaked paper showed
that its quantum processor, Sycamore, finished a calculation in three minutes and
20 s—and that it would take the world’s fastest supercomputer 10,000 years to do
the same thing’.1 Although this claim was contested by IBM and other groups, what
is clear is that it is just a matter of time that some form of quantum advantage (or
quantum supremacy) is established. On October 28, 2021, the mantle of quantum
advantage was claimed by Pan Jianwei and his group, with their quantum computing
system of ‘Jiuzhang’ carrying out large-scale photonic Gaussian Boson Sampling (a
model for quantum computing) machine 100 trillion times faster than the world’s
fastest existing supercomputer.2 Quantum advantage will probably be claimed by
other groups in the future as quantum computing is a rapidly evolving field.
All computing devices are based on the principles of quantum mechanics; in
particular, semiconductors run on the principles of quantum mechanics. The term
quantum computer does not refer to the hardware of a computer. Instead, it refers
1 https://www.marketwatch.com/story/google-touts-quantum-computing-milestone-2019-10-23.
The result has since been published [1].
2 https://english.cas.cn/newsroom/cas_media/202110/t20211028_289325.shtml#::text=Dec
%2005%2C%202020,tackle%20within%20a%20reas....
1 Introduction 3
Part III discusses some of the possible applications of quantum algorithms. Option
pricing is discussed in some detail as one expects that the first major application
of quantum algorithms are going to be in finance. Solving linear equations using
the HHL algorithm is discussed as well as quantum error correction and hybrid
algorithms.
Part IV is a summary of the subject, with a general analysis of some of the key
features and novel aspects of a quantum computer.
There are many references on quantum computers, both advanced and introduc-
tory, and the following are a few of them [2–9].
3 https://futureoffinance.biz/2021/07/13/where-quantum-computers-are-now-and-where-they-
are-going-next/.
1.1 Interview on Quantum Computers 5
Fig. 1.1 Interview on quantum computer’s prospects. Published with permission of © Belal E.
Baaquie and L. C. Kwek. All Rights Reserved
Baaquie: The USA has invested US$1.2 billion in 2019 over five years, and China
is not far behind. The Singapore government has invested US$70 million in 2020 on
a one-year horizon. Venture capital has invested US$300 million in 2020 compared
to US$4 million in 2005: PsiQuantum has received US$215 million in investments
and Rigetti has received US$190 million. Why? Governments are probably driven
by geostrategic considerations, whereas venture capital investments show that the
market thinks a breakthrough in quantum computing applications is close.
Hobson: Quantum computers do not always give the right answer. Is that a fun-
damental problem or an engineering problem?
Baaquie: The error in a quantum algorithm is a fundamental engineering problem
that is linked to noise. For example, error correction can be achieved for a classical
computer by sending three bits of 0 and 1 instead of a single bit; on receiving three
bits, the average of the three bits is taken to correct for possible errors. There is also a
phase (sign) that is carried by qubits when they are superposed and could flip its sign
and needs to be corrected. So a quantum qubit would need 3×3 = 9 qubits for error
6 1 Introduction
4 https://www.visualcapitalist.com/global-debt-to-gdp-ratio/.
8 1 Introduction
events that for a portfolio are highly unlikely. The quantum computer can compute
the probability of the occurrence of these outliers—a computation that is beyond
the computing power of classical computers. Outliers are not important for arbitrage
but rather for risk management. Outliers can be useful for detecting financial fraud
as well, since the occurrence of a fraud would most likely violate the computed
likelihood of outliers.
The second application is arbitrage opportunities, based on the development of
advanced pricing models that can spot arbitrage opportunities. The options market,
in 2021, had a notional value of over US$600 trillion (with actual value of US$12
trillion) and to scan this market in real-time needs the computing power of a quantum
computer. There are many other fields of finance where quantum algorithms can make
a difference, such as the credit rating of customers, risk management and so on.
Hobson: Why is business so slow to invest in quantum computing?
Baaquie: The horizon of when one can get returns is not clear. Once there is a win-
ning application, it will open the floodgates for benefits to end-users and businesses—
and will lead to massive investment in this game-changing technology.
Hobson: Quantum computers can complete calculations that would otherwise be
impossible. What are the implications of that for current cryptographic methods?
Baaquie: The Sycamore (IBM 54 qubits) performed a calculation in 200 s that
would have taken the best supercomputers 10,000 years. So, clearly, the quantum
computer can perform computations that no classical computer can ever perform. A
quantum computer would need about 20 million qubits and eight hours (rather than
requiring 1 billion qubits as previously theorized) to break the 2048 RSA code, so
it is still quite a distant possibility. Shor’s algorithm has the potential to completely
overpower all classical encryption, but maybe not in the immediate future.
Hobson: Quantum computing has a flavor of the Manhattan Project about it. What
geopolitical concerns does it foster?
Baaquie: Quantum computers will impact all military technology, cybersecurity,
secure communications and so on. So leading nations in the world probably consider
quantum computers to be a strategic asset that needs to be mastered at any economic
cost.
Hobson: Does quantum computing create a risk that humanity is overwhelmed
by a Superintelligence?
Baaquie: Yes, surprisingly enough, quantum computers do pose a serious risk
to humanity for the following reason. Artificial intelligence (AI) is premised on
analyzing patterns in big data and then making predictions and taking decisions.
Technologies such as autonomous vehicles, cyberwarfare and so on will be greatly
enhanced by combining AI with quantum computers.
There are two kinds of AI algorithms. The first is artificial narrow intelligence
(ANI), which can carry out a task assigned to it such as driving an autonomous
vehicle. The second is artificial general intelligence (AGI), which can do a wide
range of tasks and can also decide by itself what task it will carry out. For example,
consider an AGI-empowered robotic soldier. This machine will decide on who lives
and who dies on the battlefield and maybe even off the battlefield. At present, AGI is
comparable to human intelligence, so human beings can create devices to manage and
References 9
References
1. Frank Arute, Kunal Arya, Ryan Babbush, Dave Bacon, Joseph C Bardin, Rami Barends, Rupak
Biswas, Sergio Boixo, Fernando GSL Brandao, David A Buell, et al. Quantum supremacy
using a programmable superconducting processor. Nature, 574(7779):505–510, 2019
2. Le Bellac Michel (2006) A short introduction to quantum information and computation.
Cambridge University Press, UK
3. Bernhardt Chris (2019) Quantum Computing for Everyone. MIT Press, USA
4. Kaye Phillip, Laflamme Raymond, Mosca Michele (2007) Introduction to Quantum Comput-
ing. Cambridge University Press, USA
5. McMahon David (2008) Quantum computing explained. MIT Press, USA
6. N. David Mermin. Quantum Computer Science. Cambridge University Press, UK, 2007
7. Michael A (2012) Nielsen and Isaac L. Chuang. Quantum Computation and Quantum Infor-
mation. Cambridge University Press, UK
8. Rieffel Eleanor G, Polak Wolfgang H (2011) Quantum Computing: A Gentle Introduction.
MIT Press, USA
9. Zygelman Bernard (2018) A First Introduction to Quantum Computing and Information.
Springer, UK
Part I
Fundamentals
Chapter 2
Binary Numbers, Vectors, Matrices
and Tensor Products
In this part of the book, we briefly reviewed the general mathematical framework
behind gates, bits and qubits. These topics form a recurring theme, and they are
employed in all the derivations of this book.
A fundamental bit of classical computers is a binary set {0, 1}, called a binary
number, and it is represented by two-dimensional vectors belonging to a linear vector
space; the n-bits are represented by vectors that are elements of an n-dimensional
vector space, which is isomorphic to the n-dimensional Euclidean space E n . With
this description, a quantum state built from n-bits (see discussion in Chap. 6) is an
element of a complex linear vector space, with vectors having a unit norm and is
called a Hilbert space.
All gates, both classical and quantum are in general N × N square matrices, with
the matrices having some special features. Tenor product of matrices and vectors is a
way of combining gates and bits and is discussed with especial emphasis on square
matrices. Tenor product of vectors of single bits can be used to form a system with
many bits.
A vector in this book is usually denoted by bold face notation v, as is the case in
most linear algebra textbooks. In quantum mechanics and for quantum computers, the
Dirac notation is used in which v ≡ |v. The Dirac notation for vectors and matrices
is discussed to foreground the use of this notation in the rest of the chapters. The
results of linear algebra are briefly reviewed using the conventional vector notation
based on v. A detailed mapping from v to |v is then discussed so that readers who
not familiar with the Dirac notation have clear idea of the mapping.
This chapter reviews the properties of binary numbers, vector space, matrices and
tensor products. The derivations are based on [1].
© The Author(s), under exclusive license to Springer Nature Singapore Pte Ltd. 2023 13
B. E. Baaquie and L.-C. Kwek, Quantum Computers,
https://doi.org/10.1007/978-981-19-7517-2_2
14 2 Binary Numbers, Vectors, Matrices and Tensor Products
Binary notation is based on representing all real numbers using the base 2 instead
of the decimal expansion that uses the base 10. If effect, all real numbers can be
represented by a series of 0’s and 1’s with an expansion similar to the decimal
expansion. As will become clear in this chapter, an arbitrary real number can always
be represented by
· · · 1000111010.00101010110111 · · ·
The input and output of an algorithm are strings of symbols. All symbols can be
mapped to the real numbers, and all real numbers are then represented by strings of
binary number 0’s and 1’s.
Every number has a binary expansion, similar to the usual expansion that has the
base 10. For example, consider the number 203; its base 10 expansion is given by
203 = 128 + 64 + 8 + 2 + 1 = 1 × 27 + 1 × 26 + 0 × 25
+ 0 × 24 + 1 × 23 + 0 × 22 + 1 × 21 + 1 × 20
→ 11001011 : Binary representation (2.1)
Hence, in the binary representation, the number 203 is equal to 11001011. For a
general integer x that needs n binary bits, the leading (largest) binary term is x1 , and
the last term is xn . Hence, one has the following binary representation
x = x1 x2 x3 · · · x j · · · xn−1 xn
xi = 0 ⇒ x = 0
xi = 1
n
⇒x= 2n− j = 2n−1 + 2n−2 · · · + 2n−i + · · · + 21 + 20
j=1
= 2n − 1
Hence, the range of the integer x that can represent n-bits is given by
0 ≤ x ≤ 2n − 1 (2.3)
x = 0, 1, 2, · · · , 2n − 1
Hence, one can label the different binary strings by an integer x with range
0 ≤ x ≤ 2n − 1
For n bits, the number of different binary strings of length n is given by 2n ; a typical
n-bits binary strings are represented by Dirac’s ket vectors
For example,
For example
1 1 1 1
0 · 1011 = 1 · + 0 · 2 + 1 · 3 + 1 · 4 = 0.5 + 0.125 + 0.0625 = 0.6875
2 2 2 2
Note that
2m x = integer + 0 · xm+1 · · · xn
x = 0 · x1 x2 · · · xm · · ·
2k x = x1 x2 . . . xk .xk+1 xk+2 . . . xm . . .
= x1 x2 . . . xk + 0.xk+1 xk+2 . . . xm . . . . . .
= integer + 0.xk+1 xk+2 . . . xm . . . (2.6)
The result above is required for phase estimation and quantum Fourier Transform,
and is discussed in Chap. 8.
An arbitrary real number has the binary decimal expansion given by
x1 x2 · · · xk .xk+1 xk+2 · · · xn
Using the results given above, one has the following binary decimal expansion of
203.6875
0 0 1 1
⊕ 0 1 0 1
− − − −
0 1 1 10
Equivalently
0 ⊕ 0 = 0 ; 0 ⊕ 1 = 01 ; 1 ⊕ 0 = 01 ; 1 ⊕ 1 = 10 ;
Note there is a carry of 1 for the addition of 1 ⊕ 1 = 10, similar to ordinary arithmetic
with base 10. Using the above rules, we obtain the following binary addition
2.2 Linear Vector Space 17
Binary addition is discussed in great detail in Sect. 3.8 and its quantum general-
ization in Sect. 7.4 since the arithmetic operation reveals a lot of general features of
classical and quantum algorithms.
One can think of the vector w as the result of starting with vector u, with its base at
the origin, and then placing the vector v on the tip of vector u; the resulting vector
w starts at the origin, which recall is the origin of vector u, and ends at the tip of
vector v. In component notation, let
a c
u= ; v=
b d
(u + v) + w = u + (v + w) = u + v + w
• Scalar multiplication: for a real or complex number λ, one has a new vector w
given by
w = λv
Two vectors u, v having the same number of components can be combined using
the procedure of a scalar product; for the two-dimensional vectors, we have
∗
u† · v = a ∗ c + b∗ d = v† · u
n
∗
u† · v = u i∗ vi = v† · u
i=1
n
|u|2 = u† · u = u i∗ u i > 0 (2.9)
i=1
Note δn−m is the Kronecker delta function and has only integer arguments.
The basis states are linearly independent since
N
ai ei = 0 ⇒ ai = 0 for all i
i=1
The linear span of ei is all linear combinations of the basis vectors and covers the
entire space E N . To represent an arbitrary vector x in E N , the following notation is
used
⎡ ⎤
x(1)
⎢ .. ⎥
⎢ . ⎥
⎢ ⎥
x=⎢ ⎥ †
⎢ x(i) ⎥ ; ei · x = x(i) (2.13)
⎢ .. ⎥
⎣ . ⎦
x(N )
N
N
x= x(i)ei ; x† = x ∗ (i)ei†
i=1 i=1
N
N
N
x† · y = x ∗ (i)y( j)(ei† · e j ) = x ∗ (i)y( j)δi− j = x ∗ (i)y(i)
i, j=1 i, j=1 i=1
20 2 Binary Numbers, Vectors, Matrices and Tensor Products
A Hilbert space for N -dimensional linear vector space is defined to be the collec-
tion of N -dimensional vectors that have unit norm, namely
N
|u|2 = u† · u = u i∗ u i = 1 ; u ∈ Hilbert space (2.14)
i=1
The Hilbert space consists of vectors that lie of the N -dimensional sphere S N . For
N = 2, Hilbert space is the circle S 1 , and for N = 3, it is the two-dimensional surface
of a sphere S 2 .
2.4 Matrices
In general, a matrix is an array that consists of M-rows, that are arranged horizontally,
and N columns, arranged vertically. A typical M × N matrix A is given below.
⎡ ⎤
a11 a12 . . . a1N
⎢ a21 a22 . . . a2N ⎥
A=⎢
⎣ ...
⎥
⎦
a M1 a M2 . . . a M N
The individual entries of the matrix, denoted by amn , are the elements of the matrix.
The elements can be real or complex numbers. For matrix A, there are in total M N
elements.
A particular row for matrix A consists of N elements; for example, the second
row is given by
a21 a22 . . . a2N
One can think of a row as the transpose of a vector. Similarly, each column is given
by M elements and can be thought of as vector of length M. The second column for
matrix A is given by ⎡ ⎤
a12
⎢ a22 ⎥
⎢ ⎥
⎣ ... ⎦
a M2
2.4 Matrices 21
v(M)
One can see that v is equivalent to a M-dimensional vector and all vectors, in fact,
are special cases of matrices.
The following are some of the properties of matrices. Let A, B be M × N matrices.
Then
•
(A + B)v = Av + Bv
In components
N
N
N
[(A + B)v]i = (A + B)i j v( j) = Ai j v( j) + Bi j v( j)
j=1 j=1 j=1
(A + B) = A + B ⇒ (A + B)i j = Ai j + Bi j
The rule for matrix multiplication is that each row on the left, one by one multi-
plies, each column on the right, one by one. This is the same rule that was obtained
earlier in multiplying a matrix into a vector. The result depends on the dimensions
of the matrices. The rules obtained for the 2 × 2 matrices generalize to the case of
multiplying any two matrices.
Let A be a square M × M matrix and B be a M × L matrix, as given below
22 2 Binary Numbers, Vectors, Matrices and Tensor Products
⎡ ⎤ ⎡ ⎤
a11 a12 . . . a1M b11 b12 . . . b1L
⎢ a21 a22 . . . a2M ⎥ ⎢ ⎥
A=⎢ ⎥ ; B = ⎢ b21 b22 . . . b2L ⎥
⎣ ... ⎦ ⎣ ... ⎦
a M1 a M2 . . . a M M b M1 b N 2 . . . b M L
In vector notation
L
Bv = w ⇒ w(i) = bi j v( j) ; i = 1, . . . , M
j=1
The rest of the discussion will treat only N × N square matrices, as these matrices
play a specially important role in many problems. Let A, B, C be N × N square
matrices and let v be an N -dimensional vector.
• Matrix multiplication is not commutative and is given by
(AB)i j = Aik Bk j ⇒ AB = B A
k
Then
7 −5 9 17
AB = = BA = ⇒ AB − B A = 0
−8 23 4 21
(ABC)† = C † B † A† (2.17)
((A† )† ) = A
(v)† = v† ; ((v)† )† = v
Transforming the basis states can be obtained by analyzing the effect of a linear
transformation on the dual basis states e† . The change of volume is identical since both
24 2 Binary Numbers, Vectors, Matrices and Tensor Products
the vector and its dual provide an equivalent description of the linear transformation.
The dual basis vectors are transformed by the Hermitian conjugate of the linear
transformation given by
A† : C2 → C2
To express a matrix in terms of the basis states, one needs to evaluate the tensor
product of the basis states. Recall the scalar product of two vectors has been defined
by v† w. One can also define the tensor product or outer product of two vectors (and
of matrices in general). The outer product is defined by the symbol w ⊗ v† , with the
explicit component wise representation given by
⎡ ⎤
⎤ ⎡ w1 v1 w1 v2 . . . w1 v N
w1 ⎢ ⎥
⎢ w2 ⎥ ⎢ ... ⎥
⎢
w⊗v =⎣
† ⎥ v v
⊗ 1 2 . . . v ⎢
N ≡⎢ w v w v . . . w v
i N ⎥
⎥
... ⎦ i 1 i 2
⎣ ... ⎦
wN
w N v1 w N v2 . . . w N v N
For x y-basis states, one has the following four outer products
1 10 1 01
e1 ⊗ e†1 = ⊗ 10 = †
; e1 ⊗ e2 = ⊗ 01 =
0 00 0 00
and
0 00 0 00
e2 ⊗ e†1 = ⊗ 10 = †
; e2 ⊗ e2 = ⊗ 01 =
1 10 1 01
2.6 Tensor (Outer) Product 25
The tensor product of the basis states yields a basis for the 2 × 2 matrix since each
position in the matrix corresponds to one matrix with a nonzero entry only at that
position. For the N -dimensional case of E N , define the tensor product of any two
basis vectors by
ei ⊗ e†j ; i, j = 1, . . . , N
Note that
ei ⊗ e†j = e†j ⊗ ei ; i, j = 1, . . . , N
The fact that the tensor product of the basis vectors is sufficient to represent any
vector of of E N requires that the basis states must satisfy the completeness equation
given by
N
ei ⊗ ei† = I N ×N (2.19)
i=1
N
N
v = Iv = ei ⊗ (ei† · v) = vi ei (2.20)
i=1 i=1
where
vi = ei† · v : components of v
Note that
e†I Ae J = Ai j (e†I · ei ) ⊗ (e†j · e J ) = Ai j δ I −i δ J − j = A I J
ij ij
v
A 1 = Ai j ei ⊗ e†j · v(k)ek = Ai j ei vk δ j−k
v2
ij k i jk
= Ai j v j ei = wi ei (2.22)
ij i
where
w1 a a v1
w= wi ei = = Av = 11 12 (2.23)
w2 a21 a22 v2
i
Note that unlike the case of the ordinary product of two matrices, the order of the
tensor product of two matrices is not reversed under Hermitian conjugation and is
given by the following
†
A ⊗ B = A† ⊗ B †
2.7 Square Matrices 27
A number of properties of square matrices are given in Table 2.1. Based on these
properties, special square matrices can be defined that occur in many applications in
economics and finance.
Let A be a complex valued N × N square matrix. Suppose A is an invertible
matrix. The following are some of the matrices related to A, and given in the Table 2.1.
• Transpose: AiTj = A ji
• Complex conjugate: Ai∗j = (A ji )∗
• Hermitian conjugate: Ai†j = (Ai∗j )T = A∗ji
• Inverse:
1
Ai−1
j =
A ij
The following are some special N × N square matrices that have far-reaching appli-
cations.
• Symmetric matrix: S T = S ⇒ SiTj = S ji = Si j
• Hermitian matrix: H † = H ⇒ Hi†j = H ji∗ = Hi j
• Orthogonal matrix: O T O = I ⇒ O −1 = O T
• Unitary matrix: U † U = I ⇒ U −1 = U †
All quantum gates are unitary matrices, and hence, only these are of relevance for
quantum algorithms. The inverse of a unitary matrix U is U −1 = U † , and hence find-
ing the inverse, which requires major computational procedures for general matrices,
is trivial and almost available automatically. In drawing quantum circuits, the matrix
U † is sometimes replaced by its equivalent U −1 for notational convenience.
28 2 Binary Numbers, Vectors, Matrices and Tensor Products
Consider, for generality, a complex valued vectors v, wi that are represented by the
ket vector
v = |v ; wi = |wi
There is no need to make the symbol v, wi boldface inside the ket since the notation
makes it clear that it is a vector. Hermitian conjugation yields the dual bra vector that
is given by
v† = v|
ei = |i ; ei† = i|
u† = a ∗ v† + b∗ w† ⇒ u| = a ∗ v| + b∗ w|
where
v(i) = i|v
The two possible values {0, 1} of the classical bit, in Dirac’s notation, can be
represented by the two-dimensional column vectors. The two possible values of a
bit are represented by what are called ket vectors and their transpose, called bra
vectors, in the following manner:
1 0
|0 = ; |1 = : 0| = [1 0] ; 1| = [0 1] (2.26)
0 1
Note the important fact that each string is determinate, with each position in the ket
and bra vector having a definite value of either 0 or 1. Note that arithmetic operations
on bits is not the addition of the vectors that are used to represent binary numbers.
The representation of binary numbers in Eq. 2.26 is by a two-dimensional vector
that belongs to a two-dimensional linear vector space, which is the two-dimensional
Euclidean space E 2 . The n-binary numbers can be represented by an n-dimensional
vector, which is an element on the n-dimensional Euclidean space E 2 .
In Dirac’s notation, the scalar product is given by
Furthermore
The outer product is another notation for the tensor product and given by
u ⊗ v† = |u v|
Ai j = i|A| j (2.29)
30 2 Binary Numbers, Vectors, Matrices and Tensor Products
Note that the Dirac notation is a major innovation for the field of linear algebra
[2]. The ith component of the vector v is denoted by a subscript in ordinary vector
notation by v(i) and the i jth component of the matrix A is denoted by a subscript in
ordinary matrix notation by Ai j . In Dirac’s notation, the component label i and i j of
a vector and a matrix, respectively, are elevated to be on par with the vector and the
matrix itself, and are represented by bra and ket vectors. In particular
This notation brings much greater clarity on the use of indices since these are
being combined and transformed in most linear algebra calculations.
Matrix multiplication, using j|k = δ j−k , is given by
AB = Ai j Bk |i j|k | = Ai j Bk |iδ j−k |
ij kl ij kl
= Ai j B jk |i k| = Cik |i k| ; Cik = Ai j B jk (2.30)
i jk ik j
⇒ AB = C
N
N
I= e I ⊗ e†I = |I I | (2.31)
I =1 I =1
N
N
I= v I ⊗ v†I = |v I v I | (2.32)
I =1 I =1
N
N
S= λ I v I ⊗ v†I = λ I |v I v I | (2.33)
I =1 I =1
|e I = U † |v I ; e I | = v I |U ⇒ U|e I = |v I ; e I |U † = v I | (2.34)
2.9 Tensor and Outer Product: Strings and Gates 31
N
N
U SU =
†
λI eI ⊗ e†I = λ I |I I |
I =1 I =1
N
N
S= λ I U|e I e I |U † = λ I |v I v I | (2.35)
I =1 I =1
N
N
S =
2
λ I λ J |v I v I |v J v J | = λ2I |v I v I | (2.36)
I,J =1 I =1
N
Sn = λnI |v I v I | (2.37)
I =1
N
F(S) = F(λ I )|v I v I | (2.38)
I =1
In particular
N
exp(S) = exp(λ I )|v I v I | (2.39)
I =1
Starting from the single bit and gates acting on a single bit, the mathematics of
tensor and outer products allow us to construct n-bit strings and gates acting on these
multiple bit strings.
Consider a single bit; using Dirac’s notation, the bit is given by
1 0
|0 = ; |1 =
0 1
32 2 Binary Numbers, Vectors, Matrices and Tensor Products
Multiple bits are represented by the tensor product of the classical single bit. Tenor
products are a way of combining vectors and matrices to form other matrices.
For example, a 2-bit string is represented by the tensor product of two vectors and
is given by the following ⎡ ⎤
ac
a c ⎢ ad ⎥
⊗ =⎢ ⎥
⎣ bc ⎦
b d
bd
Using Dirac’s notation, the tensor product of two ket vectors is given by
⎡ ⎤
ac
a c ⎢ ad ⎥
|u = ; |v = ⇒ |u ⊗ |v = ⎢ ⎥
⎣ bc ⎦
b d
bd
Hence, 2-bit strings have a representation in terms of two 1-bits given as follows
⎡ ⎤
1
1 1 ⎢0⎥
|00 = ⊗ ⎢
=⎣ ⎥
0 0 0⎦
0
⎡ ⎤ ⎡ ⎤ ⎡ ⎤
0 0 0
⎢1⎥ ⎢0⎥ ⎢0⎥
|01 = ⎢ ⎥ ⎢ ⎥ ⎢ ⎥
⎣ 0 ⎦ ; |10 = ⎣ 1 ⎦ ; |11 = ⎣ 0 ⎦ (2.40)
0 0 1
Gates that act on a 2-bits string input are represented by the tensor product of the
matrices in the following manner. The NOT gate X acting on the n-bit string classical
string |c⊗n is given by a n-fold tensor product of matrices X ⊗n and given by
2.9 Tensor and Outer Product: Strings and Gates 33
X ⊗n ≡ X ⊗ X
· · · ⊗ X
n times
For the case of n = 2, the NOT gate acting on a 2-bit string is given as follows
⎡ ⎤
0 0 0 1
01 01 ⎢0 0 1 0⎥
X ⊗2 =X⊗X= ⊗ =⎢
⎣0
⎥ (2.41)
10 10 1 0 0⎦
1 0 0 0
To check the matrix notation and our intuition about the gates, one can check
whether the gate X ⊗2 does indeed reverse the value of the binary bits. The NOT gate
on a 2-bit string has the following action
Let |c, c = 0, 1 represent one classical bit {0, 1}. The n-bits strings {0, 1}n are
given by the n-fold tensor product and yields
Le Guerrier blessé.
Le guerrier blessé est étendu sur la plage de Faaa, près de
Papeete.
Il attend la mort et il chante :
« Vent de Hauïti qui souffles de la montagne, tu m’as souvent
caressé dans d’autres moments alors que j’étais joyeux et plein de
force ; aujourd’hui je goûte ta douceur qui accroît ma tristesse.
» Vent de Hauïti, pourquoi n’as-tu pas des bras pour me soutenir
et me porter où tu avais l’habitude de me voir ? Tu ne me trouveras
plus peut-être au milieu des miens.
» Vent de Hauïti, remplace-moi quand je ne serai plus là ; souffle
doucement et sèche les larmes de mes parents désolés.
» Et toi, montagne qui m’as connu dans mon enfance, qui m’as
vu grandir, tu sais aussi que j’étais un homme de la montagne, car je
t’ai défendue avec courage.
» Petite rivière où je me suis si souvent assis et rafraîchi, après
mes courses dans la montagne, tu as été douce et bonne pour moi.
Je me sens mourir et je pense que je ne te verrai plus…
» Ia ora na ! »
Je livre ce morceau aux critiques littéraires qui ont pour habitude
d’analyser la poésie, les pauvres ! N’est-il pas vrai qu’il y a là
quelque chose de primitif, d’antique, de grand, et j’ajoute, pour parler
la langue du jour, quelque chose de vécu ?
Il ne faudrait pas croire que le Tahitien, citoyen français comme
vous et moi mais non soumis aux obligations de la loi militaire, ait
perdu toute vertu guerrière ! En dépit d’une déchéance dont il n’est
pas tout à fait l’auteur responsable, l’indigène serait encore un bon
soldat ; on en a fait l’épreuve quand il s’est agi d’aller réprimer les
velléités insurrectionnelles des Marquises. Les volontaires se
présentèrent en foule à Papeete, on les arma, mais ils n’eurent pas
un coup de fusil à tirer et s’en affligèrent. Aujourd’hui, si un péril de
guerre se montrait, on les verrait accourir pour défendre la France,
leur patrie.
La poésie non plus n’est pas morte. Voici une petite pièce
composée par mon ami Poroï, membre du conseil privé de la
Colonie, un personnage, s’il vous plaît !
TE MIHI FENUA !
(Le Regret du Pays natal.)
Ua tufaa te na i Vairaharaha
Le partage de la pluie est à Vairaharaha ;
Pu hai hau mai te matai
Le vent souffle doucement
Haumaru ote fenua nei
Le rafraîchissement de la terre.
Eo mai hoi te oto ia oe
Le regret de Toi (Te Fana) me pénètre
Na tae hoi te manao
Et pourtant ma pensée est venue
Ima ia oe e Mataiea
Sur toi, ô Mataiea !
Eriro atoa hoi ia oe
Car sur toi seront aussi
Tau manao e tau aroha
Ma pensée et mon amour.