Quantum Computing Fundamentals Programming
Quantum Computing Fundamentals Programming
Editor-in-Chief
Mark Taub
Executive Editor
James Manly
Development Editor
Christopher A. Cleveland
Managing Editor
Sandra Schroeder
Project Editor
Mandie Frank
Copy Editor
Bart Reed
Indexer
Cheryl Ann Lenser
Proofreader
Donna Mulder
Technical Reviewers
Izzat Alsmadi, Renita Murimi
Editorial Assistant
Cindy Teeters
Designer
Chuti Prasertsith
Compositor
codeMantra
Credits
Cover ZinetroN/Shutterstock
Figure Number Credit Attribution
Figure 12-1A Screenshot © Microsoft Corporation
Figure 16-1 Screenshot of Microsoft QDK for Visual Studio Code ©
Microsoft 2021
Figure 16-2 Screenshot of New Q# Program in Visual Studio Code ©
Microsoft 2021
Figure 16-3 Screenshot of Save Program in Visual Studio Code ©
Microsoft 2021
Figure 16-4 Screenshot of QDK Samples © Microsoft 2021
Figure 16-5 Screenshot of Q# Random Number Generator ©
Microsoft 2021
Figure 16-6 Screenshot of Q# Open Statements © Microsoft 2021
Figure 16-7 Screenshot of Operation
QuantumPseudoRandomNumberGenerator © Microsoft
2021
Figure 16-8 Screenshot of Operation RandomNumberInRange ©
Microsoft 2021
Figure 16-9 Screenshot of Operation SampleRandomNumber ©
Microsoft 2021
Figure 16-10 Screenshot of Open Statements in Grover’s Algorithm
Code © Microsoft 2021
Figure 16-11 Screenshot of ReflectMarked © Microsoft 2021
Figure 16-12 Screenshot of ReflectUniform © Microsoft 2021
Figure 16-13 Screenshot of Additional Functions for Grover’s
algorithm © Microsoft 2021
Figure 16-14 Screenshot of Entry Point for Grover’s Algorithm ©
Microsoft 2021
Figure 16-15 Screenshot of NumberofIterations Function © Microsoft
2021
Figure 16-16 Screenshot of Beginning of Deutsch-Jozsa © Microsoft
2021
Figure 16-17 Screenshot of Deutsch-Jozsa Entry Point © Microsoft
2021
Figure 16-18 Screenshot of IsConstant Function © Microsoft 2021
Figure 16-19 Screenshot of Remaining Functions for Deutsch-Jozsa ©
Microsoft 2021
Figure 16-20 Screenshot of Entanglement © Microsoft 2021
Figure 17-1 Screenshot of Quantum Inspire Editor © 2021 Quantum
Inspire
Figure 17-2 Screenshot of Two Qubits © 2021 Quantum Inspire
Figure 17-3 Screenshot of CNOT Gate © 2021 Quantum Inspire
Figure 17-4 Screenshot of Hadamard Gate © 2021 Quantum Inspire
Figure 17-5 Screenshot of Multiple Gates © 2021 Quantum Inspire
Figure 17-6 Screenshot of Start a New Project © 2021 Quantum
Inspire
Figure 17-7 Screenshot of New Project Editor © 2021 Quantum
Inspire
Figure 17-8 Screenshot of Error Correction © 2021 Quantum Inspire
Figure 17-9 Screenshot of Grover’s Algorithm © 2021 Quantum
Inspire
Figure 17-10 Screenshot of Grover’s Algorithm Results © 2021
Quantum Inspire
Figure 17-11 Screenshot of Deutsch-Jozsa Algorithm © 2021 Quantum
Inspire
Unnumbered Screenshot of CNOT Gate Symbol © 2021 Quantum
Figure 17-1 Inspire
Dedication
As always, I dedicate my work to my wonderful wife Teresa. A quote from
my favorite movie is how I usually thank her: “What truly is logic? Who
decides reason? My quest has taken me to the physical, the metaphysical,
the delusional, and back. I have made the most important discovery of my
career—the most important discovery of my life. It is only in the mysterious
equations of love that any logic or reasons can be found. I am only here
tonight because of you. You are the only reason I am. You are all my
reasons.”
Table of Contents
Preface
Part I Preparatory Material
Chapter 1: Introduction to Essential Linear Algebra
1.1 What Is Linear Algebra?
1.2 Some Basic Algebra
1.2.1 Groups, Rings, and Fields
1.3 Matrix Math
1.3.1 Matrix Addition and Multiplication
1.3.2 Matrix Transposition
1.3.3 Submatrix
1.3.4 Identity Matrix
1.3.5 Deeper Into the Matrix
1.4 Vectors and Vector Spaces
1.5 Set Theory
1.6 Summary
Test Your Skills
Chapter 2: Complex Numbers
2.1 What Are Complex Numbers?
2.2 Algebra of Complex Numbers
2.3 Complex Numbers Graphically
2.4 Vector Representations of Complex Numbers
2.5 Pauli Matrices
2.5.1 Algebraic Properties of Pauli Matrices
2.6 Transcendental Numbers
2.7 Summary
Test Your Skills
Chapter 3: Basic Physics for Quantum Computing
3.1 The Journey to Quantum
3.2 Quantum Physics Essentials
3.2.1 Basic Atomic Structure
3.2.2 Hilbert Spaces
3.2.3 Uncertainty
3.2.4 Quantum States
3.2.5 Entanglement
3.3 Summary
Test Your Skills
Chapter 4: Fundamental Computer Science for Quantum Computing
4.1 Data Structures
4.1.1 List
4.1.2 Binary Tree
4.2 Algorithms
4.2.1 Sorting Algorithms
4.3 Computational Complexity
4.3.1 Cyclomatic Complexity
4.3.2 Halstead Metrics
4.4 Coding Theory
4.5 Logic Gates
4.5.1 AND
4.5.2 OR
4.5.3 XOR
4.5.4 Application of Logic Gates
4.6 Computer Architecture
4.7 Summary
Test Your Skills
Chapter 5: Basic Information Theory
5.1 Basic Probability
5.1.1 Basic Probability Rules
5.2 Set Theory
5.3 Information Theory
5.3.1 Theorem 1: Shannon’s Source Coding Theorem
5.3.2 Theorem 2: Noisy Channel Theorem
5.3.3 Information Entropy
5.3.4 Information Diversity
5.4 Quantum Information
5.5 Summary
Test Your Skills
Part II Basic Quantum Computing
Chapter 6: Basic Quantum Theory
6.1 Further with Quantum Mechanics
6.1.1 Bra-Ket Notation
6.1.2 Hamiltonian
6.1.3 Wave Function Collapse
6.1.4 Schrödinger’s Equation
6.2 Quantum Decoherence
6.3 Quantum Electrodynamics
6.4 Quantum Chromodynamics
6.5 Feynman Diagram
6.6 Summary
Test Your Skills
Chapter 7: Quantum Entanglement and QKD
7.1 Quantum Entanglement
7.2 Interpretation
7.2.1 The Copenhagen Interpretation
7.2.2 The Many-Worlds Interpretation
7.2.3 Decoherent Histories
7.2.4 Objective Collapse Theory
7.3 QKE
7.3.1 BB84 Protocol
7.3.2 B92 Protocol
7.3.3 SARG04
7.3.4 Six-State Protocol
7.3.5 E91
7.3.6 Implementations
7.4 Summary
Test Your Skills
Chapter 8: Quantum Architecture
8.1 Further with Qubits
8.2 Quantum Gates
8.2.1 Hadamard Gate
8.2.2 Phase Shift Gates
8.2.3 Pauli Gates
8.2.4 Swap Gates
8.2.5 Fredkin Gate
8.2.6 Toffoli Gates
8.2.7 Controlled Gates
8.2.8 Ising Gates
8.2.9 Gottesman–Knill Theorem
8.3 More with Gates
8.4 Quantum Circuits
8.5 The D-Wave Quantum Architecture
8.5.1 SQUID
8.6 Summary
Test Your Skills
Chapter 9: Quantum Hardware
9.1 Qubits
9.1.1 Photons
9.1.2 Electron
9.1.3 Ions
9.1.4 NMRQC
9.1.5 Bose-Einstein Condensate Quantum Computing
9.1.6 GaAs Quantum Dots
9.2 How Many Qubits Are Needed?
9.3 Addressing Decoherence
9.3.1 Supercooling
9.3.2 Dealing with Noise
9.3.3 Filtering Noise
9.4 Topological Quantum Computing
9.4.1 Basic Braid Theory
9.4.2 More on Braid Theory
9.4.3 More on Topological Computing
9.5 Quantum Essentials
9.5.1 Quantum Data Plane
9.5.2 Measurement Plane
9.5.3 Control Processor Plane
9.6 Quantum Networking
9.6.1 Tokyo QKD
9.6.2 Beijing-Shanghai Quantum Link
9.6.3 Micius Satellite
9.6.4 Distributed Quantum Computing
9.7 Summary
Test Your Skills
Chapter 10: Quantum Algorithms
10.1 What Is an Algorithm?
10.2 Deutsch’s Algorithm
10.3 Deutsch-Jozsa Algorithm
10.4 Bernstein-Vazirani Algorithm
10.5 Simon’s Algorithm
10.6 Shor’s Algorithm
10.6.1 The Quantum Period-Finding Function
10.7 Grover’s Algorithm
10.8 Summary
Test Your Skills
Part III Quantum Computing and Cryptography
Chapter 11: Current Asymmetric Algorithms
11.1 RSA
11.1.1 RSA Example 1
11.1.2 RSA Example 2
11.1.3 Factoring RSA Keys
11.2 Diffie-Hellman
11.2.1 Elgamal
11.2.2 MQV
11.3 Elliptic Curve
11.3.1 ECC Diffie-Hellman
11.3.2 ECDSA
11.4 Summary
Test Your Skills
Chapter 12: The Impact of Quantum Computing on Cryptography
12.1 Asymmetric Cryptography
12.1.1 How Many Qubits Are Needed?
12.2 Specific Algorithms
12.2.1 RSA
12.2.2 Diffie-Hellman
12.2.3 ECC
12.2.4 Symmetric Ciphers
12.2.5 Cryptographic Hashes
12.3 Specific Applications
12.3.1 Digital Certificates
12.3.2 SSL/TLS
12.3.4 Public Key Infrastructure (PKI)
12.3.5 VPN
12.3.6 SSH
12.4 Summary
Test Your Skills
Chapter 13: Lattice-based Cryptography
13.1 Lattice-Based Mathematical Problems
13.1.1 Shortest Integer Problem
13.1.2 Shortest Vector Problem
13.1.3 Closest Vector Problem
13.2 Cryptographic Algorithms
13.2.1 NTRU
13.2.2 GGH
13.2.3 Peikert’s Ring
13.3 Solving Lattice Problems
13.3.1 Lenstra-Lenstra-Lovász (LLL)
13.4 Summary
Test Your Skills
Chapter 14: Multivariate Cryptography
14.1 Mathematics
14.2 Matsumoto-Imai
14.3 Hidden Field Equations
14.4 Multivariate Quadratic Digital Signature Scheme (MQDSS)
14.5 SFLASH
14.6 Summary
Test Your Skills
Chapter 15: Other Approaches to Quantum Resistant Cryptography
15.1 Hash Functions
15.1.1 Merkle-Damgaard
15.1.2 SWIFFT
15.1.3 Lamport Signature
15.2 Code-Based Cryptography
15.2.1 McEliece
15.2.2 Niederreiter Cryptosystem
15.3 Supersingular Isogeny Key Exchange
15.3.1 Elliptic Curves
15.3.2 SIDH
15.4 Summary
Test Your Skills
Part IV Quantum Programming
Chapter 16: Working with Q#
16.1 Basic Programming Concepts
16.1.1 Variables and Statements
16.1.2 Control Structures
16.1.3 Object-Oriented Programming
16.2 Getting Started with Q#
16.3 Grover’s Algorithm
16.3.1 Grover’s Algorithm Reviewed
16.3.2 The Code for Grover’s Algorithm
16.4 Deutsch-Jozsa Algorithm
16.4.1 Deutsch-Jozsa Algorithm Reviewed
16.4.2 The Code for Deutsch-Jozsa Algorithm
16.5 Bit Flipping
16.6 Summary
Test Your Skills
Chapter 17: Working with QASM
17.1 Basic Programming Concepts
17.1.1 Instructions
17.1.2 Commands
17.2 Getting Started with QASM
17.3 Quantum Error Correction
17.4 Grover’s Algorithm
17.4.1 Grover’s Algorithm Reviewed
17.4.2 The Code for Grover’s Algorithm
17.5 Deutsch-Jozsa Algorithm
17.5.1 Deutsch-Jozsa Algorithm Reviewed
17.5.2 The Code for the Deutsch-Jozsa Algorithm
17.6 Summary
Test Your Skills
Appendix: Answers to Test Your Skills Questions
Index
Preface
Writing a book is always a challenging project. But with a topic like
quantum computing, it is much more so. If you cover too much, the reader
will be overwhelmed and will not gain much from the book. If you cover
too little, you will gloss over critical details. With quantum computing,
particularly a book written for the novice, it is important to provide enough
information without overwhelming. It is my sincere hope that I have
accomplished this.
Clearly some readers will have a more robust mathematical background
than others. Some of you will probably have some experience in quantum
computing; however, for those of you lacking some element in your
background, don’t be concerned. The book is designed to give you enough
information to proceed forward. Now this means that every single chapter
could be much larger and go much deeper. In fact, I cannot really think of a
single chapter that could not be a separate book!
When you are reading a section that is a new concept to you, particularly
one you struggle with, don’t be concerned. This is common with difficult
topics. And if you are not familiar with linear algebra, Chapter 1,
“Introduction to Essential Linear Algebra,” will start right off with new
concepts for you—concepts that some find challenging. I often tell students
to not be too hard on themselves. When you are struggling with a concept
and you see someone else (perhaps the professor, or in this case the author)
seem to have an easy mastery of the topic, it is easy to get discouraged. You
might think you are not suited for this field. If you were, would you not
understand it as readily as others? The secret that no one tells you is that all
of those “others,” the ones who are now experts, struggled in the beginning,
too. Your struggle is entirely natural. Don’t be concerned. You might have
to read some sections more than once. You might even finish the book with
a solid general understanding, but with some “fuzziness” on specific details.
That is not something to be concerned about. This is a difficult topic.
For those readers with a robust mathematical and/or physics background,
you are likely to find some point where you feel I covered something too
deeply, or not deeply enough. And you might be correct. It is quite difficult
when writing a book on a topic such as this, for a novice audience, to find
the proper level at which to cover a given topic. I trust you won’t be too
harsh in your judgment should you disagree with the level at which I cover
a topic.
Most importantly, this book should be the beginning of an exciting journey
for you. This is the cutting edge of computer science. Whether you have a
strong background and easily master the topics in this book (and perhaps
knew some already) or you struggle with every page, the end result is the
same. You will be open to a bold, new world. You will see the essentials of
quantum mechanics, understand the quantum computing revolution, and
perhaps even be introduced to some new mathematics. So please don’t get
too bogged down in the struggle to master concepts. Remember to relish the
journey!
Register your copy of Quantum Computing Fundamentals on the InformIT
site for convenient access to updates and/or corrections as they become
available. To start the registration process, go to informit.com/register and
log in or create an account. Enter the product ISBN (9780136793816) and
click Submit. Look on the Registered Products tab for an Access Bonus
Content link next to this product, and follow that link to access any
available bonus materials. If you would like to be notified of exclusive
offers on new editions and updates, please check the box to receive email
from us.
Acknowledgments
There are so many people who made this book possible. Let me start with
Professor Izzat Alsmadi (Texas A&M–San Antonio) and Professor Renita
Murimi (University of Dallas) who were gracious enough to provide
technical review of each and every chapter. Chris Cleveland was the lead
editor, and I must confess, I am not the easiest person to edit. His patience
and careful eye for detail were essential to this book. I also want to thank
Bart Reed for his work in copy editing. All the people working on this book
have done an extremely good job helping me create a book that can be clear
and accurate for the reader to learn this challenging topic.
About the Author
Dr. Chuck Easttom is the author of 31 books, including several on
computer security, forensics, and cryptography. His books are used at more
than 60 universities. He has also authored scientific papers (more than 70 so
far) on digital forensics, cyber warfare, cryptography, and applied
mathematics. He is an inventor with 22 computer science patents. He holds
a Doctor of Science in cyber security (dissertation topic: a study of lattice-
based cryptographic algorithms for post-quantum computing). He also has a
Ph.D. in Technology, focusing on nanotechnology (dissertation title: “The
Effects of Complexity on Carbon Nanotube Failures”) and a Ph.D. in
Computer Science (dissertation title: “On the Application of Graph Theory
to Digital Forensics”). He also has three master’s degrees (one in applied
computer science, one in education, and one in systems engineering). He is
a senior member of the IEEE and a senior member of the ACM
(Association of Computing Machinery) as well as a member of IACR
(International Association of Cryptological Research) and INCOSE
(International Council on Systems Engineering). He is also a distinguished
speaker of the ACM and a distinguished visitor of the IEEE Computer
Society. He currently is an adjunct lecturer for Georgetown University.
Part I: Preparatory Material
Chapter 1
One of my favorite books for the person with a weak background in math
who would like to learn more, Mathematics for the Nonmathematician by
Morris Kline, says this: “Reasoning about numbers—if one is to go beyond
the simplest procedures of arithmetic—requires the mastery of two
facilities, vocabulary and technique, or one might say, vocabulary and
grammar. In addition, the entire language of mathematics is characterized
by the extensive use of symbolism. In fact, it is the use of symbols and of
reasoning in terms of symbols which is generally regarded as marking the
transition from arithmetic to algebra, though there is no sharp dividing
line.”
Let us attempt to bring these seemingly diverse definitions into a coherent
working definition you can use in this chapter. Algebra is a study of
symbols and the rules for how they relate. Those symbols are sometimes
actual numbers (integers, real numbers, etc.) and sometimes abstract
symbols that represent a broad concept. Consider this simple equation:
a2 = a * a
This use of abstract symbols allows us to contemplate the concept of what it
means to square a number, without troubling ourselves with any actual
numbers. While this is a terribly simple equation, it illustrates the
usefulness of studying concepts apart from concrete applications. That is
one use of algebra. Of course, it can be used for concrete problems and
frequently is.
You can derive a number system based on different properties. Elementary
algebra taught to youth is only one possible algebra. Table 1.1 outlines
some basic properties that might or might not exist in a given number
system.
Axiom Signification
Associativity of addition u + (v + w) = (u +
v) + w
Commutativity of addition u+v=v+u
Associativity of multiplication u (v * w) = (u * v)
w
Commutativity of multiplication u*w=w*u
Distributivity of scalar multiplication with respect a(u + v) = au + av
to vector addition
Distributivity of scalar multiplication with respect (a + b)v = av + bv
to field addition
While Table 1.1 summarizes some basic properties, a bit more explanation
might be in order. What we are saying with the associativity property of
addition is that it really does not matter how you group the numbers, the
sum or the product will be the same. Commutativity is saying that changing
the order does not change the sum or product. An interesting point is that
when dealing with matrices, this does not hold. We will explore that later in
this chapter. Distributivity means that the value outside the parentheses is
distributed throughout the parentheses.
You are undoubtably accustomed to various types of numbers, such as
integers, rational numbers, real numbers, etc. These are all infinite;
however, these are not the only possible groupings of numbers. Your
understanding of algebra will be enhanced by examining some elementary
concepts from abstract algebra.
Before we continue forward, we should ensure that you are indeed
comfortable with integers, rational numbers, etc. A good starting point is
with the natural numbers. These are so called because they come naturally.
That is to say that this is how children first learn to think of numbers. These
are often also called counting numbers. Various sources count only the
positive integers (1, 2, 3, 4, …) without including zero. Other sources
include zero. In either case, these are the numbers that correspond to
counting. If you count how many pages are in this book, you can use
natural numbers to accomplish this task.
The next step is the integers. While negative numbers may seem perfectly
normal to you, they were unheard of in ancient times. Negative numbers
first appeared in a book from the Han Dynasty in China. Then in India,
negative numbers first appeared in the fourth century C.E. and were
routinely used to represent debts in financial matters by the seventh century
C.E. Now we know the integers as all whole numbers, positive or negative,
along with zero: −3, −2, −1, 0, 1, 2, 3, ….
After the integers, the next type of number is the rational numbers. Rational
numbers were first noticed as the result of division. A mathematical
definition of rational numbers is “any number that can be expressed as the
quotient of two integers.” However, one will quickly find that division of
numbers leads to results that cannot be expressed as the quotient of two
integers. The classic example comes from geometry. If you try to express
the ratio of a circle’s circumference to its radius, the result is an infinite
number. It is often approximated as 3.14159, but the decimals continue on
with no repeating pattern. Irrational numbers are sometimes repeating, but
they need not be. As long as a number is a real number that cannot be
expressed as the quotient of two integers, it is classified as an irrational
number.
Real numbers are the superset of all rational numbers and all irrational
numbers. It is likely that all the numbers you encounter on a regular basis
are real numbers, unless of course you work in certain fields of mathematics
1.2.1.1 Groups
A group is an algebraic system consisting of a set, an identity element, one
operation, and its inverse operation. Let us begin with explaining what an
identity element is. An identity element is simply some number within a set
that you can use to apply some operation to any other number in the set, and
the other number will still be the same. Put more mathematically,
a*I=a
where * is any operation that we might specify, not necessarily
multiplication. An example would be with respect to the addition operation,
zero is the identity element. You can add zero to any member of any given
group, and you will still have that same number. With respect to
multiplication, 1 is the identity element. Any number multiplied by 1 is still
the same number.
There are four properties any group must satisfy:
Closure: Closure is the simplest of these properties. It simply means
that an operation performed on a member of the set will result in a
member of the set. This is what was discussed a bit earlier in this
section. It is important that any operations allowed on a particular set
will result in an answer that is also a member of the set.
Associativity: The associative property just means that you can
rearrange the elements of a particular set of values in an operation
without changing the outcome. For example, (2 + 2) + 3 = 7. Even if I
change the order and instead write 2 + ( 2 + 3), the answer is still 7.
This is an example of the associative property.
Identity: The identity element was already discussed.
Invertibility: The invertibility property simply means that a given
operation on a set can be inverted. As we previously discussed,
subtraction is the inversion of addition; division is the inversion of
multiplication.
Think back to the example of the set of integers. Integers constitute a group.
First, there is an identity element, zero. There is also one operation
(addition) and its inverse (subtraction). Furthermore, you have closure. Any
element of the group (any integer) added to any other element of the group
(any other integer) still produces a member of the group (the answer is still
an integer).
1.2.1.2 Abelian Group
Now that you have the general idea of a group down, it’s time to move on to
discuss specific types of groups. The first and easiest to understand is an
abelian group or commutative group has an additional property. That
property being the commutative property: a + b = b + a if the operation is
addition. Commutativity means ab = ba if the operation is multiplication.
This commutative requirement simply means that applying the group
operation (whatever that operation might be) does not depend on the order
of the group elements. In other words, whatever the group operation is, you
can apply it to members of the group in any order you wish. To use a trivial
example, consider the group of integers with the addition operation. Order
does not matter:
4+2=2+4
Therefore, the set of integers with the operation of addition is an abelian
group. As you can see, abelian groups are a subset of groups. They are
groups with an additional restriction: the commutative property.
1.2.1.4 Rings
A ring is an algebraic system consisting of a set, an identity element, two
operations, and the inverse operation of the first operation. That is the
formal definition of a ring, but it might seem a bit awkward to you at first
read and therefore warrants a bit more explanation.
A ring is essentially just an abelian group that has a second operation.
Previously, you learned that the set of integers with the addition operation
form a group, and furthermore they form an abelian group. If you add the
multiplication operation, then the set of integers with both the addition and
the multiplication operations form a ring.
Note that you only have to have the inverse of the first operation. Therefore,
if we consider the set of integers with addition as the first operation and
multiplication as the second operation, we do have a ring. As an example, 4
+ 5 = 9, which is still an integer (still in the ring). However, so is 4 − 5 =
−1. The answer is still an integer, thus still in the ring. With multiplication,
we don’t need the inverse (division) to always yield an integer, but any two
integers multiplied together, such as 4 * 5 = 20, will always yield an integer.
1.2.1.5 Fields
A field is an algebraic system consisting of a set, an identity element for
each operation, two operations, and their respective inverse operations. You
can think of a field as a group that has two operations rather than one, and it
has an inverse for both of those operations. It is also the case that every
field is a ring, but not every ring will necessarily be a field. For example,
the set of integers is a ring, but not a field, if you consider the operations of
addition and multiplication. The inverse of multiplication, division, won’t
always yield an integer.
A classic example of a field is the field of rational numbers. Each number
can be written as a ratio (i.e., a fraction), such as x/y (x and y could be any
integers you like), and the additive inverse is simply −x/y. The
multiplicative inverse is just y/x. Fields are often used in cryptography, and
you will see them again in Chapter 11, “Current Asymmetric Algorithms,”
Chapter 13, “Lattice-Based Cryptography,” and Chapter 15, “Other
Approaches to Post-Quantum Cryptography.”
1.3 Matrix Math
Before delving into matrix math, you need to understand what a matrix is.
A matrix is a rectangular arrangement of numbers in rows and columns.
Rows run horizontally, and columns run vertically. The dimensions of a
matrix are stated as m × n, where m is the number of rows and n is the
number of columns. Here is an example:
A matrix is just an array that is arranged in columns and rows. Vectors are
simply matrices that have one column or one row. The examples in this
section focus on 2 × 2 matrices, but a matrix can be of any number of rows
and columns; it need not be a square. A vector can be considered a 1 × m
matrix. A vector that is vertical is called a column vector, and one that is
horizontal is called a row vector. Matrices are usually labeled based on
column and row:
The letter i represents the row, and the letter j represents the column. A
more concrete example is shown here:
This notation is commonly used for matrices including row and column
vectors.
There are different types of matrices, the most common of which are as
follows:
Column matrix: A matrix with only one column.
Row matrix: A matrix with only one row.
Square matrix: A matrix that has the same number of rows and
columns.
Equal matrices: Two matrices are considered equal if they have the
same number of rows and columns (the same dimensions) and all their
corresponding elements are exactly the same.
Zero matrix: Contains all zeros.
Each of these has a role in linear algebra, which you will see as you proceed
through the chapter.
We begin with
1*2+2*1=6
1*2+2*3=8
3*2+1*1=7
3*2+1*3=9
The final answer is
Now you can see why, as previously stated, you can multiply two matrices
only if the number of columns in the first matrix is equal to the number of
rows in the second matrix.
It is important to remember that matrix multiplication, unlike traditional
multiplication (with scalar values), is not commutative. Recall that the
commutative property states the following: a * b = b * a. If a and b are
scalar values, then this is true; however, if they are matrices, this is not the
case. For example, consider the matrix multiplication shown in Equation
1.1.
Now if you simply reverse the order, you can see that an entirely different
answer is produced, as shown in Equation 1.2.
This example illustrates the rather important fact that matrix multiplication
is not commutative.
To transpose it, the rows and columns are switched, creating a 2 × 3 matrix.
The first row is now the first column. You can see this in Equation 1.4.
If you label the first matrix A, then the transposition of that matrix is
labeled AT. Continuing with the original matrix being labeled A, a few
properties of matrices need to be described, as outlined in Table 1.2.
Property Explanation
(AT)T = If you transpose the transposition of A, you get back to A.
A
(cA)T = The transposition of a constant, c, multiplied by an array, A,
cAT is equal to multiplying the constant c by the transposition of
A.
(AB)T = Multiplying A by B and then transposing the product is
BTAT equal to B transposed multiplied by A transposed.
(A + B)T Adding the matrix A and the matrix B and then transposing
the sum is equal to first transposing A and B and then adding
= AT + those transpositions.
BT
AT = A If a square matrix is equal to its transpose, it is called a
symmetric matrix.
Table 1.2 is not exhaustive; rather, it is a list of some of the most common
properties regarding matrices. These properties are not generally
particularly difficult to understand; however, there is an issue with why you
would apply them. What do they mean? All too often, introductory linear
algebra texts focus so intensely on helping a student to learn how to do
linear algebra that the meaning behind operations is lost. Let us take just a
moment to explore what transpositions are. A transposition is rotating about
the diagonal. Remember that matrices can be viewed graphically. Consider
a simple row matrix:
[1 2 4]
Transposing that row matrix creates a column matrix:
Think of a vector as a line in some space. For now, we will limit ourselves
to 2D and 3D space. You can then think of a matrix as a transformation on a
line or set of lines.
1.3.3 Submatrix
A submatrix is any portion of a matrix that remains after deleting any
number of rows or columns. Consider the 5 × 5 matrix shown in Equation
1.5.
EQUATION 1.5 5 × 5 Matrix
Suppose you remove the second column and second row, as shown in
Equation 1.6.
You are now left with the matrix shown in Equation 1.7.
Now consider the identity matrix. It must have the same number of columns
and rows, with its main diagonal set to all 1s and the rest of the elements all
0s. The identity matrix looks like this:
If you multiply the original matrix by the identity matrix, the product will
be the original matrix. You can see this in Equation 1.8.
Note
Wolfram MathWorld defines a vector space as follows: “A vector space V
is a set that is closed under finite vector addition and scalar
multiplication.” Another way of putting this is, a vector space is a
collection of objects (in our case, integers) called vectors, which may be
added together and multiplied (“scaled”) by numbers, called scalars.
The next step is to get the lower-left corner square matrix, as shown in
Equation 1.12.
As with the first one, this one forms a very nice 2 × 2 matrix. Now what
shall we do with these 2 × 2 matrices? The formula is actually quite simple
and is shown in the Equation 1.13. Note that “det” is simply shorthand for
determinant.
We take the first column and multiply it by its cofactors, and with a bit of
simple addition and subtraction, we arrive at the determinant for a 3 × 3
matrix. A more concrete example might be useful. Let us calculate the
determinant for this matrix:
This leads to
Finding the angle from the cosine is straightforward; you probably did this
in secondary school trigonometry. However, even with just the dot product,
we have some information. If the dot product is 0, then the vectors are
perpendicular. This is because the cos θ of a 90° angle is 0. The two vectors
are referred to as orthogonal.
Recall that the length of a vector is also called the vector’s norm. If that
length/norm is 1, it is the unit vector. This leads us to another term we will
see frequently later in this book. If two vectors are both orthogonal (i.e.,
perpendicular to each other) and have unit length (length 1), the vectors are
said to be orthonormal.
Essentially, the dot product is used to produce a single number, a scalar,
from two vertices or two matrices. This is contrasted with the tensor
product. In math, a tensor is an object with multiple indices, such as a
vertex or array. The tensor product of two vector spaces V and W, V ⊗ W,
is also a vector space.
Another special type of matrix is a unimodular matrix. Unimodular matrices
are also used in some lattice-based algorithms. A unimodular matrix is a
square matrix of integers with a determinant of +1 or −1. Recall that a
determinant is a value computed from the elements of a square matrix. The
determinant of a matrix A is denoted by |A|.
Cyclic lattices are also used in some cryptographic applications. A cyclic
lattice is a lattice that is closed under a rotational shift operator. A more
rigorous definition follows:
A Lattice L ⊆ Zn is cyclic if ∀ x ∈ L: rot(x) ∈ L.
The symbols here might be a bit confusing to some readers. The symbol ⊆
means “a subset of.” So, we are saying this lattice is a subset of the integers
(Z). It is cyclic if there exists (∀) some x in the lattice that when rotated is
still in the lattice.
Eigenvalues are a special set of scalars associated with a linear system of
equations (i.e., a matrix equation), sometimes also known as characteristic
roots, characteristic values, proper values, or latent roots. To clarify,
consider a column vector we will call v. Then also consider an n × n matrix
we will call A. Then consider some scalar, λ. If it is true that
Av = λv
then we say that v is an eigenvector of the matrix A and that λ is an
eigenvalue of the matrix A.
Let us look a bit closer at this. The prefix eigen is actually a German word
that can be translated as “specific,” “proper,” “particular,” etc. Put in its
most basic form, an eigenvector of some linear transformation, T, is a
vector that when T is applied to it does not change direction; it only
changes scale. It changes scale by the scalar value λ, the eigenvalue. Now
we can revisit the former equation just a bit and expand our knowledge of
linear algebra:
T(v) = λv
This appears precisely like the former equation, but with one small
difference: the matrix A is now replaced with the transformation T. Not
only does this tell us about eigenvectors and eigenvalues, it tells us a bit
more about matrices. A matrix, when applied to a vector, transforms that
vector. The matrix itself is an operation on the vector! Later in this book,
you will see these transformations used quite frequently, particularly in
reference to logic gates for quantum computers. So make certain you are
quite familiar with them before proceeding.
Let us add something to this. How do you find the eigenvalues and
eigenvectors for a given matrix? Surely it is not just a matter of trial and
error with random numbers. Fortunately, there is a very straightforward
method—one that is actually quite easy, at least for 2 × 2 matrices. Consider
the following matrix:
= (5 − λ)(5 − λ) − 18
= 10 − 7 λ + λ2 − 18 = 0
λ2 − 7 λ − 8 = 0
This can be factored (note that if the result here cannot be factored, things
do get a bit more difficult, but that is beyond our scope here):
(λ − 8)( λ + 1) = 0
This means we have two eigenvalues:
λ1 = 8
λ2 = −1
For a 2 × 2 matrix, you will always get two eigenvalues. In fact, for any n ×
n matrix, you will get n eigenvalues, but they may not be unique.
Now that you have the eigenvalues, how do you calculate the eigenvectors?
We know the following:
You can work out the other eigenvector for the second eigenvalue on your
own using this method.
The main point that you saw in the previous section is that one can do math
with these vectors as if they were numbers. You can multiple two vectors
together; you can also multiply a vector by a scalar. Scalars are individual
numbers, and their name derives from the fact that they change the scale of
the vector. Consider the scalar 3 multiplied by the first vector shown in this
section:
You simply multiply the scalar by each of the elements in the vector. We
will be exploring this and other mathematical permutations in more detail in
the next section, but let us address the issue of why it is called a scalar now.
We are viewing the data as a vector; another way to view it would be as a
graph. Consider the previous vector [1,3,2] on a graph, as shown in Figure
1.1.
FIGURE 1.1 Graph of a vector
Figures 1.1 and 1.2 might appear identical, but look closer. In Figure 1.2 the
x value goes to 9, whereas in Figure 1.1 the x value only goes to 3. We have
scaled the vector. The term scalar is used because it literally changes the
scale of the vector. Formally, a vector space is a set of vectors that is closed
under addition and multiplication by real numbers. Think back to the earlier
discussion of abstract algebra with groups, rings, and fields. A vector space
is a group. In fact, it is an abelian group. You can do addition of vectors,
and the inverse. You also have a second operation scalar, multiplication,
without the inverse. Note that the first operation (addition) is commutative,
whereas the second operation (multiplication) is not.
So, what are basis vectors? If you have a set of elements E (i.e., vectors) in
some vector space V, the set of vectors E is considered a basis if every
vector in the vector space V can be written as a linear combination of the
elements of E. Put another way, you could begin with the set E, the basis,
and through a linear combinations of the vectors in E, create all the vectors
in the vector space V. As the astute reader will have surmised, a vector
space can have more than one basis set of vectors.
What is linear dependence and independence? You will see these terms a
great deal later in this book as we discuss quantum computing. In the theory
of vector spaces, a set of vectors is said to be linearly dependent if one of
the vectors in the set can be defined as a linear combination of the others; if
no vector in the set can be written in this way, then the vectors are said to be
linearly independent.
A subspace is a subset of a vector space that is a vector space itself; for
example, the plane z=0 is a subspace of R3 (it is essentially R2). We’ll be
looking at Rn and subspaces of Rn.
Intersection: If you have two sets, A and B, elements that are in both
A and B are the intersection of sets A and B, symbolized as A ∩ B. If
the intersection of set A and B is empty (i.e., the two sets have no
elements in common), then the two sets are said to be disjoint, as
illustrated in Figure 1.4.
FIGURE 1.4 Intersection of A and B
Difference: If you have two sets, A and B, elements that are in one set
but not both are the difference between A and B. This is denoted as A
\ B. This is shown in Figure 1.5.
FIGURE 1.5 A \ B
1.6 Summary
In this chapter you have learned the basic principles of linear algebra—just
enough to enable you to understand the rest of this book. A few other
mathematical details of linear algebra will be introduced as needed, but
provided you fully understand this chapter, you can proceed. This chapter
covered basic algebra, matrix mathematics, dot products, vector length,
orthogonality, vector norms, and vector spaces. While this provides only an
elementary introduction to linear algebra, it is important that you fully
understand these concepts before proceeding.
Review Questions
1. You have a set of numbers that has two operations, with the inverse of
only one of those operations. The set is not necessarily commutative.
What is the best description for this set?
a. Group
b. Abelian group
c. Ring
d. Field
2. Solve this equation:
a.
b.
c. 18
d. 15
3. What is the dot product of these two vectors?
a. 11
b. 10
c. 28
d. 0
4. Solve this determinant:
a. 8
b. 6
c. 0
d. 5
5. Solve this determinant:
a. 11
b. 12
c. 15
d. 10
6. What is the dot product of these two vectors?
a. 65
b. 17
c. 40
d. 15
7. What is the length of this vector?
a. 4.12
b. 2.64
c. 3.46
d. 4.56
8. What is the product of these two matrices?
a.
b.
c.
d.
9. Are these two vectors orthogonal?
a. Yes
b. No
10. Write the identity matrix for this matrix:
Chapter 2
Complex Numbers
Chapter Objectives
After reading this chapter and completing the quiz, you will be able to
do the following:
Understand complex numbers
Calculate complex conjugates
Represent complex numbers graphically
Work with vector representations of complex numbers
Understand Pauli matrices
Just as linear algebra is central to understanding quantum physics and
quantum computing, so are complex numbers. There are some sources that
attempt to explain quantum physics and quantum computing without
complex numbers. To some extent they succeed, at least in conveying a
generalized understanding of quantum phenomena; however, quantum
physicists and those working with quantum computing use complex
numbers. If you are to proceed past a general layman’s understanding, then
you must have an understanding of complex numbers.
These are all rational numbers. Now what about numbers that cannot be
represented in this form? There is an interesting story regarding irrational
numbers that might or might not be true. Supposedly, Hippasus discovered
that the square root of 2 cannot be presented as a fraction. Pythagoras
believed numbers to be absolute and would not accept irrational numbers.
There are various different versions of the story, but all end in Hippasus
being thrown into the sea to drown by his fellow Pythagoreans for
suggesting irrational numbers. While mathematicians today might still
engage in vigorous debate over mathematics, it rarely raises to the level of
homicide.
The whole body of irrational numbers and rational numbers includes the
previous sets of integers, zero, and negative numbers—and all of this
together forms the set we call real numbers. This brings us to the advent of
imaginary numbers. I am sure you are aware that a negative number when
squared gives a positive product, such that −22 = 4, −32 = 9, and −42 = 16.
This leads to a bit of a conundrum if one wants to know the square root of a
negative number. The classic example is to inquire as to the square root of
−1. We know it is not 1, because 12 = 1. We know it is not −1, because −12
= 1. This led to the creation of a new set of numbers, termed imaginary
numbers. The number i is defined as the . This is shown in the
following equation:
Imaginary numbers work just as real numbers do. If you see the expression
2i, that denotes 2 * . It should also be noted that the name imaginary
number is unfortunate. It makes it seem as if these are just made up and
have no use. As you will see later in this book, they do have uses,
particularly in quantum physics. These numbers do indeed exist, and you
will see them used later in this book. They are often used in quantum
physics and quantum computing.
Complex numbers are simply real and imaginary numbers together in an
expression. The following is an example of a complex number:
3 + 4i
There is the real number 3, combined with the imaginary number 4i, or 4 *
. Let us put this a bit more formally. A complex number is a
polynomial with real coefficients and i for which i2 + 1 = 0 is true. You can
perform all the usual arithmetic operations with complex numbers that you
have performed with real numbers (i.e., rational numbers, irrational
numbers, integers, etc.).
While any symbol can be used to denote number groups, certain symbols
have become common. Table 2.1 summarizes those symbols.
Symbol Description
N N denotes the natural numbers. These are also sometimes
called the counting numbers. They are 1, 2, 3, etc.
Z Z denotes the integers. These are whole numbers (−1, 0, 1, 2,
etc.). Integers are the natural numbers combined with zero and
the negative numbers.
Q Q denotes the rational numbers (ratios of integers). Rational
numbers are any number that can be expressed as a ratio of
two integers. Examples are 3/2, 17/4, and 1/5.
P P denotes the irrational numbers. An example is √2.
R R denotes the real numbers. This includes the rational
numbers as well as the irrational numbers.
i i denotes the imaginary numbers. These are numbers whose
square is a negative. An example is √−1 = 1i.
Therefore:
(a + bi)(c + di)
= ac + adi + cbi + bdi2
It is beneficial to examine a few concrete examples to ensure this concept is
thoroughly understood. Let’s begin with this:
(2 + 2i)(3 + 2i)
= (2 * 3) + (2 * 2i) + (2i * 3) + (2i * 2i)
= 6 + 4i + 6i + 4i2
= 6 + 10i + 4i2
= 6 + 10i + −4 (remember that i2 = −1)
= 2 + 10i
Let’s examine one more example before moving on:
(3 + 2i)(2 − 2i)
= (3 * 2) + (3 * −2i) + (2i * 2) + (2i * −2i)
= 6 + −6i + 4i + −4i2
= 6 − 2i − 4i2
= 6 − 2i + 4
= 10 − 2i
The next step would naturally seem to be to move on to division. However,
before we do that, we must first explore another concept: the complex
conjugate. This is something you will use frequently later in this book.
Fortunately, it is very simple. The complex conjugate has the same real and
imaginary parts, but with an opposite sign for the imaginary portion. Table
2.2 provides several examples to ensure you understand this concept.
Now we can divide complex numbers. The first step is to multiply the
numerator and denominator by the complex conjugate of the denominator.
In general, this looks like what you see in Equation 2.1.
EQUATION 2.1 Multiplying by the Complex Conjugate
Now recall that when we multiply, we use the FOIL method, so this
becomes what is shown in Equation 2.2.
The first thing you should note is that by multiplying by the complex
conjugate, we have removed the imaginary factor from the denominator.
There is only one thing left to do, and that is put this into the form a + bi.
Thus, we now have
So, at this point you should be able to add, subtract, multiply, divide, and
find the complex conjugate of complex numbers. You have the basic
algebraic skills for complex numbers.
The x-axis is used for real numbers, and the y-axis for imaginary numbers.
This is fairly easy to use. A pure real number such as 3 would simply
appear on the x-axis as shown in Figure 2.3.
FIGURE 2.3 Plotting the number 3
For complex numbers, one simply combines the x- and y-coordinates. Thus,
something like 3 + 2i would be represented as shown in Figure 2.5.
FIGURE 2.5 Plotting the number 3 + 2i
32 = 9
i2 = −1
Thus, 2i2 = −2
If you look at the graph, this actually seems intuitively correct. That appears
to be about the length of the vector. It must also be noted that |z| is always a
nonnegative number. Thus, if the formula leads to a negative answer, then
the positive should be used. Consider this example:
4 + 4i
This is shown in a graph in Figure 2.6.
which is 2.
Because |z| is always positive and always a real number, we say that
|z| = 2
Again, if you look at the graph, this makes intuitive sense. It seems like it
would be a little less than 3, and indeed it is.
It should be noted that when we use this plane for describing complex
numbers, it is referred to as either the complex plane or the z-plane. Some
sources will refer to this plane as an Argand diagram because this method
of representing complex numbers was proposed independently by Caspar
Wessel in 1797 then by Jean Pierre Argand in 1806. Wessel’s use of this
representation was not widely known until much later, which is why the
name Argand diagram is used and not Wessel diagram.
Now that we can get the absolute value of z, or to use proper notation, |z|,
we are ready to discuss plotting the distance between points. Consider a
point defined by the complex number 3 + 1i and a point defined by the
complex number 1 + 4i, as shown in Figure 2.7.
What is the distance between these two points? In general, the form of these
numbers is z1 = a1 + b1i and z2 = a2 + b2i. In this case, z1 = 3 + 1i and z2 = 1
+ 4i. The distance is merely the absolute value | (a1 − a2) + (b1 − b2)i |.
This is expressed similarly to what we did previously, as follows:
Thus, in our specific example, this would be the following (notice we are
not worried about the i itself, just the real coefficient):
FIGURE 2.7 Plotting two points
The first thing to address is why we dropped the actual i and just dealt with
the coefficient. That is because we are simply plotting coordinates on an x,
y or Cartesian coordinate system. You can label −4 as −4i or anything you
wish (−4m, −4d, etc.) and it does not alter the coordinates. The next thing is
to contemplate why we are doing this. Well, let’s add just a little bit to our
diagram by drawing a line from the origin (0, 0) to each of our points, as
illustrated in Figure 2.8.
This is almost a triangle—just one side is missing. We can fill that in with a
dashed red line, as you see in Figure 2.9.
FIGURE 2.9 Completing the triangle
Thus, in our specific example, this would be the following (notice we are
not worried about the i itself, just the real coefficient):
These two examples should provide with you a general idea of how this
process works. If you need them, there are practice problems at the end of
this chapter. At this point, as we are exploring graphical representations, it
is appropriate to return to a previous concept—that of complex conjugates.
Consider the complex number 4 + 1i. Graphically represented, it appears as
shown in Figure 2.10.
FIGURE 2.10 Plotting the number 4 + 1i
This is actually quite simple. The real portion is on the top, with the
coefficient of i on the bottom. Put in general terms:
Now recall previously we computed the distance between two complex
numbers:
z1 = 7 + 3i
z2 = 2 − 2i
Let us think about these each as vectors stemming from the origin O, like
so:
Now our goal is to find a vector that connects the point at OZ1 to OZ2. In
general terms that will be
OZ1 − OZ2
Using our specific vectors, we have
Recall matrix and vector addition and subtraction from Chapter 1; this is
really rather easy:
Now we need to take the magnitude of that vector. Recall that when we did
this before, we considered
This time it is virtually the same, but our vector already is a1 − a2 over b1 −
b2. So, what we need is simpler:
That is the same answer when we calculated this in the previous method!
This is, of course, quite important. The two methods can both work only if
they provide the same answer. Quantum physics and quantum computing
deal quite a bit with vector representations, so this is a critical technique to
understand.
Vector form also works quite well when integrated with a graphical
representation. Consider two complex numbers, which we will call z1 and
z2. These form a vector from the origin to the point. We can call those
vectors v1 and v2. Now let us be a bit more concrete. We will define z1 as 4
+ 1i and z2 as 2 + 3i. The line going from the origin to each of these points
defines a vector, as seen in Figure 2.12.
FIGURE 2.12 Plotting two complex points
The vector sum can be calculated using the parallelogram law. The
parallelogram law states that the sum of the squares of the lengths of the
four sides of a parallelogram equals the sum of the squares of the lengths of
the two diagonals. You might comment that we don’t have the two
diagonals. However, we do have the two sides, which will also give us the
other two sides, as shown in Figure 2.13.
FIGURE 2.13 The parallelogram law
If instead you simply add the vectors, z1 = 4 + 1i and z2 = 2 + 3i, you get
x = (4 + 2) y = (1i + 3i)
for a point of z3 = 6 + 4i. Even a casual examination of the parallelogram in
Figure 2.13 shows that this is precisely the point we find.
There are two other parameters that describe the vector from the origin to
any number z. These are r and θ of the point z and are called the polar
coordinates. The r is the distance from the origin to z and the θ is the angle
of inclination. That angle is always measured counterclockwise from the
positive real axis. This gives us more information regarding the coordinates
of a complex number via the following equations:
x = r cos θ y = sin θ
From the Pythagorean theorem, it should also be clear that
Let’s look at one of the Pauli matrices to see this in a more concrete form:
That demonstrates the transposition, but where does the conjugate come in?
Recall earlier in this chapter we explored complex conjugates.
A square matrix is unitary if its conjugate transpose is also its inverse. Put
in another way, a unitary matrix is a complex generalization of an
orthogonal matrix. Unitary matrices are characterized by the following
property for a matrix A:
AAT = ATA = I
Consider the following Pauli matrix:
Well, if you take the complex conjugate (simply changing the sign for the
imaginary portion), you get the following:
This simplifies to
The matrix is unchanged.
Okay, the basic mechanics of these matrices don’t seem too difficult. Now
let us look a bit more into the why. These three matrices are named after the
physicist Wolfgang Pauli, and they occur in the Pauli equation, which takes
into account the spin of a particle with an external electromagnetic field.
The actual Pauli equation we won’t be exploring just yet, but for those
readers who are curious, Equation 2.7 demonstrates it.
Don’t panic—you won’t need to understand this now. A few chapters from
now, much of it will actually make sense to you.
One of the interesting facts about Pauli matrices is that they form a basis for
the vector space of 2 × 2 Hermitian matrices. Recall from Chapter 1 that a
basis vector means that this means that all the 2 × 2 Hermitian matrices can
be written as some linear combination of the Pauli matrices.
Allow me to introduce you to a new mathematical symbol, in connection
with Pauli matrices. It is possible to write all three Pauli matrices in a
compacted expression, shown in Equation 2.8.
You already know what the symbol i represents, the , but you might not
be familiar with the symbol δ, which represents the Kronecker delta. The
Kronecker delta is a fascinating function. It is named after the
mathematician Leopold Kronecker. It is a function of two variables. If the
variables are equal, then the function returns 1. If the functions are not
equal, then the function returns 0. This is expressed a bit more formally in
Equation 2.9.
Note that the Kronecker delta must always have two arguments. That is
how it determines what to return. In Equation 2.8, you saw the Pauli
matrices expressed as a single expression. Recall there are three Pauli
matrices. Substitute either 1, 2, or 3 for the a in Equation 2.8 and you will
have one of the Pauli matrices. Let’s do this by substituting a = 2. That
gives us what you see in Equation 2.10.
Then, using the Kronecker delta with the inputs shown, you then get what is
shown in Equation 2.11.
1. The dot product is symmetric, which means the order of the dot
product does not matter.
2. It is linear in its first argument, which means that given any scalars a
and b and any vectors x1, x2, and y, then (ax1 + bx2) * y = ax1 * y +
bx2 * y.
3. For any x that is an element of the vector space (the Hilbert vector
space), the inner product of x with itself is positive definite (i.e., the
inner product is > 0).
All this is a bit simplified, but it is sufficient for you to understand the
essentials of both Hilbert spaces and inner products. Let us expand a bit on
point 1. The inner product satisfies specific conditions. The inner product
must have conjugate symmetry. The inner product of two elements in the
Hilbert space is the complex conjugate of the two elements in the opposite
order.
An inner product is a generalization of the dot product. It allows you to
multiply two vectors together and produce a scalar. In practice, there is not
really any difference between dot product and inner product, at least insofar
as calculating either is concerned. Dot products are usually used in
reference to only real numbers. If complex numbers are used or you are
dealing with non-Euclidean spaces, then the term inner product is normally
used.
det = (0 * 0) − (1 * 1) = −1
det = (0 * 0) − (−i * i) = −1
det = 0 − (−i2)
det = 0 − (1)
det = −1
det = (1 * −1) − (0 * ))
det = −1
This is an interesting property of Pauli matrices. What about the
eigenvalues and eigenvectors of the Pauli matrices? Recall from Chapter 1
that eigenvalues are a special set of scalars associated with a linear system
of equations. Given a matrix A and some scalar λ, if it is true that
Av = λv
then we say that v is an eigenvector of the matrix A and that λ is an
eigenvalue of the matrix A. So, consider one of the Pauli matrices:
We start with finding the eigenvalue λ, which will be a value that satisfies
the formula
det (A − λI) = 0
where A is the matrix in question.
Let us begin by taking our original matrix and subtracting λ from the
diagonal:
The vector is what we are trying to find. We can start by taking either
the upper or lower row, so let’s use the lower:
1x + 0y = −y
x = −y
Let us begin with the left side. We multiple row 1 by the vector:
Now the same for row 2:
This gives us .
Let us check to see if that matches the right side:
So, we have found the eigenvalues and one of the eigenvectors of one of the
Pauli matrices. Now let’s work out the other eigenvector for this particular
Pauli matrix:
We again start by taking either the upper or lower row; let’s use the lower.
This gives us
1x + 0y = y
which is simplified to
x=y
That gives us .
Now the right side:
2.7 Summary
This chapter began with the basics of complex numbers, including how
complex numbers originated. You learned how to do basic algebraic
functions with complex numbers. Then working with graphical
representations of complex numbers was covered. The next topic was
vector representation. Both graphical and vector representations are very
common in quantum physics and quantum computing, so it is quite
important that you understand these concepts.
A section of this chapter was devoted to Pauli matrices. This topic is central
to understanding quantum computing. You must absolutely ensure you are
comfortable with the material on Pauli matrices before moving on. There
was also a brief discussion of transcendental numbers.
Review Questions
1. Add the following two complex numbers:
(3 + 2i) (2 + 3i)
2. What is the product of (4 + 2i)(2 + 2i)?
3. What is the product of (2 + 2i)(−2 + 3i)?
4. Divide (6 + 4i) by (2 + 2i).
5. Given the two complex numbers (3 + 2i) and (4 + 4i), what is the
distance between them?
6. Which of the following statements accurately describes the Kronecker
delta?
a. It returns a 1 if the two inputs are equal, and a zero otherwise.
b. It returns a 0 if the two inputs are equal, and a 1 otherwise.
c. It calculates the distance between two complex numbers.
d. It calculates the distance between two points on a graph.
7. Calculate the determinant of the following Pauli matrix:
Light is shown through the single slit, then on to the double slit. When the
target is reached, the two light sources (one from each of the slits in the
double slit) exhibit an interference pattern. The target will show stripes that
become wider as the target is moved further from the two slits. At the time,
this seemed to settle the question of whether light was a particle or a wave.
The light appeared to be clearly a wave, and not a particle (or corpuscle, as
it was then called). Essentially, the thought was that if light was a particle,
then one would expect the pattern on the opposite side to match the shape
and size of the slit. The appearance of an interference pattern seemed to
demonstrate light was a wave.
Further variations of the double-slit experiment began to shed some light on
the situation. First, it was noted that when waves/particles were sent
through the double slit one at a time, they certainly appeared as dots, or
particles, on the target. This can be done by simply closing one of the slits.
However, as more were sent through the slits, a wave pattern emerged. This
type of experiment has been done with photons, electrons, and other
particles. Essentially, it led to the idea that light is both a particle and a
wave. This is also true for other subatomic particles. The concept is often
referred to as wave-particle duality. We will return to this concept a bit later
in this chapter.
The history of quantum mechanics also includes some questions that may
seem a bit obscure today. One of those issues was the study of black body
radiation. This topic was very important in the 1800s. A black body is an
opaque, nonreflective object. The radiation is the thermal radiation (heat) in
and around such a black body. A perfect absorber absorbs all
electromagnetic radiation incident to it; such an object is called a black
body. Obviously, such an object is hypothetical, as no object can perfectly
absorb energy.
When any object is heated, that heat has specific wavelengths. Those are
inversely related to the intensity. As a body is heated and the temperature
rises, the wavelength shortens; thus, the light changes colors. Measuring
black body radiation led to results that did not seem to match existing
theories. This was particularly true at higher frequencies.
Balfour Stewart performed experiments comparing the radiation emitted
from polished plates versus lamp-black surfaces, using the same
temperature for both. He used a galvanometer and a microscope to read the
radiated energy. In his paper he did not mention wavelengths or
thermodynamics. He claimed that the heat radiated did so regardless of the
surface being lamp black or reflective. Ultimately he was in error.
In 1859, Gustav Kirchoff proved that the energy emitted from a black body
depends only on the temperature of the black body and the frequency of the
energy absorbed. He developed the rather simple formula shown in
Equation 3.1.
E = J (T,v)
EQUATION 3.1 Kirchoff’s Black Body Energy
ε = hv
EQUATION 3.2 Quantum Energy
This formula states that the energy elements (ε) are proportional to the
frequency (v) multiplied by Planck’s constant (h). Planck’s constant is a
very small number, and we will explore it in more detail later in this
chapter. Planck’s constant, and the subsequent formula, was created from
his attempt to derive a mathematical formula that accurately predicted the
observed spectral distribution of the radiation from a black body.
Furthermore, Planck defined Planck’s law of black body radiation. The
formula is shown in Equation 3.3.
Note
For the reader who has a strong mathematical background and wants a
more rigorous discussion of relativity and quantum physics, Randy
Harris’s Modern Physics, Second Edition, published by Pearson, is a good
choice.
As was discussed earlier, this is not quite accurate. First, it must be noted
that the electrons don’t orbit like planets around a star. What we call an
atomic orbital is really a mathematical function that calculates the
probability of finding an electron in a particular region around the nucleus.
This brings us to a very important fact about quantum physics. Much of
what we find in the subatomic world is probabilistic, not deterministic. We
will return to this concept later in this chapter; in fact, it will come up
throughout this book. The probability of finding an electron depends on the
orbital and the energy levels. The orbitals themselves are regions of the
probability of finding an electron. The energy levels are given integer
values 1, 2, 3, and 4.
Each electron is described by four numbers. The first is n, which is the
principal quantum number. Next is l, which is the orbital quantum number
(sometimes called the orbital angular momentum quantum number). Then
comes m, which is the magnetic quantum number, and ms, which is the
electron spin quantum number. The letter n, the principal quantum number,
is sometimes referred to as the shell. The l is sometimes also called the
azimuthal quantum number. The value of l can be any number from 1 to n −
1. So, if n = 2, then l = 1. This number will tell you the shape of the orbital.
Remember, this shape determines an area of probability for finding an
electron, not a path, such as a planet orbiting a star.
The orbitals (the l value) have letters to define them. They are the s, p, d,
and f orbitals. The s orbital is drawn as a sphere, but bear in mind this is just
the area of the probability of finding an electron. Figure 3.3 shows the s
orbital.
FIGURE 3.3 The s orbital
This is l = 0. Now there can be s subshells or orbitals in any shell. So, there
can be an n =1 s subshell, an n = 2 s subshell, etc.
For l = 1 (which happens if n is at least 2), the orbital begins to look a bit
strange. It has a dumbbell-like shape, as illustrated in Figure 3.4.
The d orbital can also appear as two lobes going through a torus—or put
more colloquially, a dumbbell going through a donut. There are variations
of this based on the ml values. Figure 3.6 shows the “donut” shape.
Why is this a Cauchy sequence? Well, let us examine it a bit closer. First,
select any i > 0. Now choose an N, such that 2−N < i. Next, consider n and
m that are > than N. Then
This might still not be completely clear to some readers. Consider a visual
representation of a Cauchy sequence, as shown in Figure 3.8.
3.2.3 Uncertainty
Now we come to a very conceptually difficult part of quantum mechanics:
the Heisenberg uncertainty principle. Essentially, this principle states that
the more you know about one property of a subatomic particle, the less you
know about a related property. This principle was introduced in 1927 by
Werner Heisenberg. While the principle applies to any property of a
protocol, it is most often stated as ‘the more precisely you know the
position of a given particle, the less precisely you can know its momentum’.
The reverse is also true: the more precisely you know the momentum, the
less precisely you can know the position. The practical effect of this is that
you can never know with certainty the precise position and momentum of a
given particle at a specific point in time.
This concept does not fit well into our understanding of the world. As I sit
at my desk, I can take any object in my office and know precisely its
position and momentum. You might think that those objects are all
stationary, and unless something has gone very wrong, they are. However, I
can apply that to moving objects. As I watch my dog walk across the floor,
I can quite easily measure precisely his position and momentum at any
given instant. This is simply how our everyday world works, but in the
subatomic world, things operate in a quite counterintuitive manner. In fact,
if you will forgive me for being so informal in my writing, the quantum
world is frankly bizarre. Although there are many things we know about it,
for some things we “don’t know why.” We just know that countless
experiments have verified them.
Now that you have a generalized idea of the Heisenberg uncertainty
principle, let’s explore a bit more rigorous treatment of the concept.
Consider this formula:
Note
For those readers wanting just enough quantum physics to understand the
basics of quantum computing, you now have sufficient information on the
Heisenberg uncertainty principle. For those who want more information,
you can continue with the rest of this section.
One way to compute this is to use smaller and smaller rectangular slices of
it, summing up the areas of those slices, as shown in Figure 3.10.
FIGURE 3.10 Approximating the area of a curve
As you get progressively narrower rectangles and sum their areas, your total
area of the curve becomes more accurate. Now computing an integral does
not actually involve adding up progressively narrower rectangles. In fact, it
is because of integrals that one does not have to do that. However, that is
the concept. The integral symbol is followed by the function one wishes to
compute the integral of. This takes us back to what is remaining in the
Fourier transform, shown in Equation 3.5.
Therefore, the facts of quantum mechanics make sense only when states
(such as momentum and position) are represented as vectors. It is not that
physicists chose to use linear algebra to describe quantum states; it is rather
that such states are naturally best described by linear algebra.
The values could be represented as vectors (1,0) or (0,1). However, in the
field of quantum physics, it is typical to use a notation known as bra-ket
notation. The right part is the ket; this is a vector usually shown as | ψ . The
left half is termed the bra, denoted as ϕ |. Yes, this means bracket.
The term bra on one side and ket on the other were deliberately chosen to
make the word braket, or bracket. This notation was introduced by Paul
Dirac and is often known as Dirac notation. It is also common to see
representations such as α | ψ .
Quantum states have coefficients. These coefficients are complex numbers
(recall the discussion on complex numbers in Chapter 2). These coefficients
are time-dependent, meaning they change with time. Now, taking this a bit
further and bringing our attention back to both Heisenberg and the wave-
particle duality, quantum objects (for want of a better term) are in a state of
superposition of different states. The possible different states are denoted by
Φn. A number Pn represents the probability of a randomly selected system
being in the state Φn.
This should provide you a bit better understanding of quantum states. This
will be important for later chapters discussing quantum bits, or qubits.
Another fact, which will also have significance for quantum computing, is
that measuring or observing a state changes the state. This is completely
contrary to what you find in your everyday world. Certainly, measuring
one’s weight does not change it, regardless of however much one might
wish it were so.
This section provided you with a general understanding of quantum states.
This will be sufficient for you to understand our discussions in later
chapters regarding qubits. Bear in mind that much of quantum physics is
counterintuitive. So, if some of this seems just a bit odd to you, that is
actually a good sign that you indeed understand it.
3.2.5 Entanglement
This particular facet of quantum physics may be the oddest yet. In fact,
Albert Einstein famously called it “spooky action at a distance.” In this
section, I will not be able to provide you with the “why” of entanglement.
That is because we simply do not know the “why.” Whoever can fully
explain this is certainly a candidate for a Nobel Prize; however, countless
experiments have confirmed it is true.
Entanglement begins with two particles being generated in such a way that
the quantum state of each particle is inextricably linked to the other. Before
we continue this description, it is very important that you realize that this is
not some theoretical concept. Entanglement has been rigorously verified in
countless independent experiments.
If one particle in an entangled pair has a spin that is clockwise, the other
particle in the pair will have a counterclockwise spin. A 1935 paper by
Albert Einstein, Boris Podolsky, and Nathan Rosen described this process
as what would become known as the EPR paradox. Einstein insisted that
this meant there must be some issue with our understanding of quantum
physics. The EPR paradox involves a thought experiment. In the
experiment, one considers a pair of entangled particles. The issue in the
paper was that if these particles are so entangled that their states are
complementary, then altering the state of the first particle could
instantaneously change the state of the other particle. This would,
essentially, mean information regarding the state of the first particle was
transmitted instantly to the second particle. The theory of relativity tells us
that nothing can travel faster than the speed of light. In the alternative, the
state of the second particle must be set before any measurement of either
particle is taken. This was counter to both theory and experiment, which
demonstrates that particles are in a state of superposition until measured,
and then the wave function collapses into a single state. Thus, a paradox
exists.
The EPR paradox was the subject of much debate in physics and numerous
papers. In 1951, David Bohm published a paper proposing a variation of the
EPR thought experiment. Bohm’s ideas can be expressed mathematically, as
shown in Equation 3.8, using math you have already explored previously in
this book.
The h with a bar is the reduced Planck constant discussed earlier. The
matrices given are the Pauli matrices discussed in previous chapters. The
Sx, Sy, and Sz are the spins in the x-, y- and z-axes. Bohm went on to use
this basic math to explore the states of two entangled particles. However,
despite the apparent paradox, numerous experiments have confirmed
entanglement.
In 2013, researchers created two pairs of entangled photons and proved that
their polarization was correlated regardless of distance in space or time.
This is yet another experiment demonstrating that entanglement is true,
even if we don’t know why. As late as 2015, experiments were still being
conducted that confirmed entanglement.
Essentially, entangled particles are treated not as individual particles but
rather as a whole. The state of this composite system is the sum or
superposition of the product states of each local constituent. There are
various ways particles become entangled. Subatomic particle decay is one
such way. What we find consistently is that if we separate two entangled
particles, then measure a property of one particle, such as spin, and then
measure the other particle’s property, the two will be complementary. They
are inextricably entangled.
There have been several different proposed explanations for entanglement.
None have been verified. It is beyond the scope of this chapter or this book
to more fully explore entanglement, but keep in mind that the fact of
entanglement has been experimentally verified numerous times. However,
we can briefly review some of the proposed explanations, even those that
may have fallen out of favor in the physics community.
The hidden variables hypothesis contends that the particles actually have
some hidden variables that, right at the moment the particles are separated,
determine the outcome of properties such as spin. This would mean that
there really is no nonlocality, simply variables we don’t know about.
Einstein was a proponent of this idea. However, no experiments have given
any evidence to support this.
It is also known that entanglement occurs naturally. For example, in multi-
electron atoms, the electron shells always consist of entangled electrons. So
entanglement is not just the result of physicists experimenting with nature;
it is how nature actually works.
3.3 Summary
In this chapter, we have covered some difficult topics; however, these are
the bare minimum you need to understand quantum computing. Therefore,
it is important that you fully understand the material in this chapter before
proceeding. Some readers, particularly those without a mathematical or
physics background, might need to review this chapter more than once, and
even return to the previous two chapters, before going forward.
The general history of quantum physics is important to provide context. The
two most important concepts from that history are black body radiation and
wave-particle duality. A general understanding of Hilbert spaces is also
going to aid in understanding later material in this book. Understanding the
Heisenberg uncertainty principle is also important. The most critical topic
from this chapter is quantum states. Understanding quantum states, as well
as the symbolism used, is critical to understanding quantum computing.
Qubits are essentially data stored in quantum states.
Chapter 6, “Basic Quantum Theory,” delves more deeply into quantum
mechanics. It is important that you have a basic understanding of the
material in this chapter before moving on to Chapter 6. This chapter
provides a basis, along with Chapters 1 and 2, for forming a deeper
understanding of quantum physics and thus quantum computing.
Review Questions
1. Which of the following is the best description of light?
a. It is a particle or corpuscle.
b. It is a wave.
c. It is neither particle nor wave.
d. It is both a particle and a wave.
2. What is the reason for the term quantum in quantum physics?
a. Particles have specific energy states rather than a continuum of
states.
b. The energy of a particle is quantifiable.
c. The state of a particle can be quantified.
d. The physics is highly mathematical (i.e., quantifiable).
3. Which of the following is the best description of the Pauli exclusion
principle?
a. No two fermions can occupy the same subshell at the same time.
b. No two fermions can occupy the same state within a quantum
system at the same time.
c. No two fermions can occupy the same energy level at the same
time.
d. No two fermions can occupy the same shell at the same time.
4. Which of the following is the best description of electrons in the p
subshell?
a. There can be up to six electrons in any configuration.
b. There must be up to six electrons, but they can be in any
configuration.
c. There can be up to six electrons, but they must all have the same
spin.
d. There can be up to six electrons, in pairs, and each pair has an
opposite spin.
5. What is a Cauchy sequence?
a. A sequence that converges to an element in the vector space
b. A sequence of quantum states
c. A sequence that shows quantum entanglement
d. A sequence of vectors that define the vector space
6. What type of mathematical function extracts frequencies in a wave
function?
a. The Pauli exclusion principle
b. Cauchy sequences
c. Fourier transforms
d. Integrals
7. Which of the following best describes an eigenstate?
a. It is another name for an eigenvalue.
b. It is the combination of an eigenvalue and eigenvector.
c. It is the current state of the eigenvector.
d. It is an eigenvector corresponding to an operation.
8. What does the symbol denote?
a. The ket side of the notation
b. The bra side of the notation
c. The current state of the particle
d. The wave function
9. What does the following equation describe?
4.1.1 List
A list is one of the simplest of data structures. It is a structure consisting of an
ordered set of elements, each of which may be a number, another list, etc. A list is
usually denoted something like you see here:
(a, b, c, d, ...)
Many other data structures are some sort of extension of this basic concept. A list can
be either homogenous or heterogeneous. That simply means that the elements in the
list can all be the same type or not. If you have a background in set theory, this
should look very familiar to you. A list is just a set.
The most common implementation of a list, in most programming languages, is the
array, and in most programming languages, an array is usually homogenous (i.e., this
means all elements of the array are of the same data type). It should be noted that
several object-oriented programming languages offer a type of list known as a
collection, which is heterogeneous (i.e., elements of that list may be of diverse data
types).
To add data to a list, you simply append it to the end or insert it at a given point based
on the index number. To remove data, you reference a specific index number and get
that data. This just happens to be one major weakness with a list: it can quickly
become disordered. The reason is that you can insert items anywhere in the list and
remove them anywhere. Even if the list is perfectly sorted, adding items at random
intervals can introduce informational entropy.
The ideal place to use a list is when you simply need to store data and the order of
processing the data in or out of storage is not important. A list is an appropriate data
structure to use, especially if your situation specifically requires that you be able to
add and remove data at any point in the storage mechanism, rather than in a particular
sequence.
The most common types of lists are linked lists. That simply means that each item is
linked to the next item. There are also double-linked lists wherein each item is linked
to the item before it and the item after it. Figure 4.1 displays the basic structure of a
single linked list.
link->key = key;
link->data = data;
return length;
}
4.1.1.1 Queue
A queue is simply a special case of a list, and it stores data in the same way that a list
does. It is also often implemented as simply an array. The difference between a list
and a queue is in the processing of the data contained in either data structure. A
queue has a more formal process for adding and removing items than the list does. In
a queue, data is processed on a first-in, first-out (FIFO) basis. Often there is some
numerical pointer designating where the last data was input (often called a tail) and
where the last data was extracted (often called a head). Putting data into the queue is
referred to as enqueueing, and removing it is called dequeuing. Figure 4.2 shows the
queue structure.
FIGURE 4.2 The queue
Clearly, the head and tail must also be moving in some direction. This is usually via a
simple increment method (simply the ++ operator in C, C#, and Java). That would
mean that in Figure 4.2, they are moving to the right. The queue is a relatively simple
data structure to implement. Here is a C-like pseudo-code example of a queue
implemented in a class:
string dequeue()
{
return stringarray[tail]; tail++
}
With a queue, data is added and removed in a sequential fashion. This is very
different from a list, where data may be added at any point in the list. With the queue,
data is always added at the next spot in the sequence and processed similarly;
however, two problems immediately present themselves with the queue. The first
problem is how to handle the condition of reaching the end of the queue. The usual
answer to this is to create what is known as a circular queue. When the head (or tail)
reaches the end of the queue, it simply starts over at the beginning. Referring to
Figure 4.2, this would mean that if the head or tail reaches the end, it is simply
repositioned back to the beginning. In code, you would add to the previous code
sample something similar to this pseudo-code:
if (head==20) head = 0;
and
if (tail == 20 ) tail = 0
This still leaves us with the second problem: what happens if the head is adding new
items faster than the tail is processing them? Without proper coding, the head will
overtake the tail, and you will begin overwriting items in the queue that have not
been processed; ergo, they are lost and will never be processed. This means you will
be adding items to a space in the queue that already contains unprocessed data, and
that unprocessed data will simply be lost. The answer to this problem is to stop
allowing new items to be added whenever the head catches up to the tail. This should
be communicated to the end user via a “queue is full” message.
Of course, there is another option, other than the circular queue, and that is the
bounded queue. A bounded queue is simply one that can only contain a finite amount
of data. When that limit is reached (i.e., when you reach the end of the queue), the
queue is done. Clearly, this implementation of the queue is somewhat limited, and
you will encounter it much less frequently than the unbounded queue (i.e., any queue
that does not have an arbitrary, finite limit, such as the circular queue).
The queue is a very efficient data structure, and you will find it implemented in many
diverse situations. The most common place to encounter a queue is with a printer.
Printers usually have a queue in which print jobs are stored while awaiting
processing. And, of course, they utilize circular queues. If you overload that queue,
you will get a message telling you the print queue is full. If your programming
problem requires orderly and sequential processing of data on a first-in, first-out
basis, then the queue is an ideal data structure to use.
4.1.1.2 Stack
The stack is a data structure that is a special case of the list. With the stack, elements
may be added to or removed from the top only. Adding an item to a stack is referred
to as a push, and removing an item is referred to as a pop. In this scenario, the last
item added must be the first one removed, which is also known as last in, first out
(LIFO). A good analogy is to consider a stack of plates. Because the last item in is
the first out, this data structure does not require a pointer. You can see the stack
described in Figure 4.3.
The problem with this particular data structure is the LIFO processing. If you have
accumulated a number of data items and must get to one of the first you put on the
stack, you will first need to process all of the subsequent items. For this reason, a
stack is primarily used when a few items need to be stored for a short period of time.
You will find stacks in temporary memory storage. It is probably worthwhile to
compare LIFO with FIFO (first in, first out). The FIFO data structure requires that
the first item put in also be the first one out. This is similar to the stack, but the
popping and pushing take place on different ends. This is shown in Figure 4.4.
As was mentioned, certain computer memory structures and the CPU registers will
often use stacks. However, their method of LIFO makes them poor choices for many
standard data-processing situations. For example, if a network printer utilized a stack
rather than a queue, it would always attempt to process the last job first. Because new
jobs are continually being added, it would be entirely possible for the first job sent to
the printer to wait hours, if not days, to be printed. Clearly, that would be
unacceptable.
Here is code for the stack with an entire class for all the operations of the stack:
if(!isempty()) {
data = stack[top];
top = top - 1;
return data;
} else {
printf("Could not retrieve data, Stack is empty.\n");
}
}
bool isfull() {
if(top == MAXSIZE)
return true;
else
return false;
}
int peek() {
return stack[top];
}
}
Each of the items (B*, C*, etc. ) in the boxes is a pointer to the next item in the
linked list. The * notation is the same the C and C++ languages use to denote
pointers. Note that when item X is inserted between item A and item B, item A’s
pointer must also be changed so that it now points to X rather than to B. The same
situation occurs if an item is deleted. This problem is minimized, however, if items
are always added or removed in a sequential fashion, such as FIFO.
4.1.1.4 Double-Linked List
A double-linked list is a data structure wherein each item has a pointer (or link) to the
item in front of it and the item behind it. This data structure is the logical next step
after the linked list. It is highly efficient in that any data point has links to the
preceding and succeeding data points. The source code is virtually identical to that of
a linked list. It simply has two pointers: one for the preceding item and one for the
succeeding item. This sort of data structure is highly efficient.
Note there is also a special form of the double-linked list called a circularly linked
list, where the first and last nodes are linked together. This can be done for both
single- and double-linked lists. To traverse a circularly linked list, you begin at any
node and follow the list in either direction until you return to the original node.
Viewed another way, circularly linked lists can be seen as having no beginning or
end. This type of list is very useful for managing buffers.
The circularly linked version of the double-linked list makes it ideal for the printer
buffer. It allows the printer buffer to have every document aware of the documents on
either side. This is because it has a double-linked list (each item has a pointer to the
previous item and the next item) and its final item is linked back to the first item.
This type of structure provides an unbroken chain of items.
Whatever method you use to implement the double-linked list (circular, etc.), it has
the same complication as the linked list. When you insert or delete an item, you must
update any other items that have pointers to the item you deleted or the space you are
inserting the item into. The only difference between a double-linked list and a single-
linked list is that when you insert or delete an item in a double-linked list, you must
update the pointers on either side of that item, rather than only one pointer (either
preceding or next). A double-linked list is shown in Figure 4.6.
One common use of binary trees is binary search trees. You can see in Figure 4.7 that
each item in the binary tree has child items that are related to the parent node. This is
exactly the context in which binary trees are most useful (i.e., when there is a strong
parent-child relationship between items).
The binary tree is the structure, and the binary search tree is a sorted binary tree that
provides for searching. There are actually a wide range of different tree types. The
binary tree is just a common example.
4.2 Algorithms
Before we can begin a study of algorithms, we must first define what one is. An
algorithm is simply a systematic way of solving a problem. A recipe for an apple pie
is an algorithm. If you follow the procedure, you get the desired results. Algorithms
are a routine part of computer programming and an integral part of computer science.
In fact, it was an algorithm that demonstrated that quantum computers would disrupt
cybersecurity and cryptography. Peter Shor developed Shor’s algorithm, which
demonstrated that a quantum computer could factor an integer into its prime factors
in polynomial time. We will discuss Shor’s algorithm in some detail later in this
book. We will also be discussing other quantum algorithms, and in Chapter 16,
“Working with Q#,” and Chapter 17 “Working with QASM,” you will have the
opportunity to program quantum algorithms. If you wish to go deeper into algorithms
than this section does, there are some excellent books about algorithms available
from Pearson (the publisher of this book), including the following:
Algorithms, Fourth Edition, by Robert Sedgewick, Princeton University
An Introduction to the Analysis of Algorithms, Second Edition, Robert
Sedgewick, Princeton University
It is not enough to simply have some algorithm to accomplish a task. Computer
science seeks to find the most efficient algorithm. Therefore, it is also important that
we have a clear method for analyzing the efficacy of a given algorithm. When
considering any algorithm, if the desired outcome is achieved, then clearly the
algorithm worked. However, the real question is, how well did it work? If you are
sorting a list of ten items, the time it takes to sort the list is not of particular concern.
However, if your list has one million items, then the time it takes to sort the list, and
hence the algorithm you choose, is of critical importance. Fortunately, there are well-
defined methods for analyzing any algorithm.
When analyzing algorithms, we often consider the asymptotic upper and lower
bounds. Asymptotic analysis is a process used to measure the performance of
computer algorithms. This type of performance is based on the complexity of the
algorithm. Usually this is a measure of either the time it takes for an algorithm to
work or the resources (memory) needed. It should be noted that one usually can only
optimize time or resources, but not both. The asymptotic upper bound is simply the
worst-case scenario for the given algorithm, whereas the asymptotic lower bound is
the best case.
Some analysts prefer to simply use an average case; however, knowing the best case
and worst case can be useful in some situations. In simple terms, both the asymptotic
upper bound and lower bound must be within the parameters of the problem you are
attempting to solve. You must assume that the worst-case scenario will occur in some
situations.
The reason for this disparity between the asymptotic upper and lower bounds has to
do with the initial state of a set. If one is applying a sorting algorithm to a set that is
at its maximum disorder, then the time taken for the sorting algorithm to function will
be the asymptotic upper bound. If, on the other hand, the set is very nearly sorted,
then one may approach or achieve the asymptotic lower bound.
Perhaps the most common way to formally evaluate the efficacy of a given algorithm
is Big O notation. This method is a measure of the execution of an algorithm, usually
the number of iterations required, given the problem size n. In sorting algorithms, n is
the number of items to be sorted. Stating some algorithm f(n) = O(g(n)) means it is
less than some constant multiple of g(n). The notation is read, “f of n is big oh of g of
n.” This means that saying an algorithm is 2N means it will have to execute two
times the number of items on the list. Big O notation essentially measures the
asymptotic upper bound of a function. Big O is also the most often used analysis.
Big O notation was first introduced by the mathematician Paul Bachmann in his 1892
book Analytische Zahlentheorie. The notation was popularized in the work of another
mathematician named Edmund Landau. Because Landau was responsible for
popularizing this notation, it is sometimes referred to as a Landau symbol.
Omega notation (Ω) is the opposite of Big O notation. It is the asymptotic lower
bound of an algorithm and gives the best-case scenario for that algorithm. It gives
you the minimum running time for an algorithm.
Theta notation (Θ) combines Big O and Omega notation to give the average case
(average being the arithmetic mean in this situation) for the algorithm. In our
analysis, we will focus heavily on the Theta notation, also often referred to as the Big
O running time. This average time gives a more realistic picture of how an algorithm
executes.
Now that we have some idea of how to analyze the complexity and efficacy of a
given algorithm, let’s take a look at a few commonly studied sorting algorithms and
apply these analytical tools. The algorithms selected in this section are among the
most common. If you took a course in algorithm analysis, you would have
encountered these.
if(first<last){
pivot=first;
i=first;
j=last;
while(i<j){
while(number[i]<=number[pivot]&&i<last)
i++;
while(number[j]>number[pivot])
j--;
if(i<j){
temp=number[i];
number[i]=number[j];
number[j]=temp;
}
}
temp=number[pivot];
number[pivot]=number[j];
number[j]=temp;
quicksort(number,first,j-1);
quicksort(number,j+1,last);
}
}
This now tells us that the greatest common denominator of the two initial numbers,
gcd(2322, 654), is equal to the gcd(654, 360).
These are still a bit unwieldy, so let us proceed with the algorithm:
This tells us that the gcd(654, 360) is equal to the gcd(360, 294).
The following steps continue this process until there are simply no further steps to
go:
Metric Value
n1 Number of distinct operators
n2 Number of distinct operands
N1 Total number of occurrences of operators
N2 Total number of occurrences of operands
n1* Number of potential operators
n2* Number of potential operands
Using these metrics, Halstead arrived at some relatively simple formulas for
calculating software complexity.
Program length: N = N1 + N2
Program vocabulary: n = n1 + n2
Volume: V = N × log2n
Difficulty:
Effort: E = D × V
While the mathematics presented are quite simple, the concepts are effective and
useful. As one example, the program length is a function of the total number of
occurrences of operators added to the total number of occurrences of operands. This
approach to software complexity captures the essence of what is important in a
program. It is capturing the point where activity takes place (the operands and
operators). The effort calculation is also quite effective: the volume of code
multiplied by the difficulty of the code. This, in turn, is predicated in the difficulty
calculation, which is based on operators and operands.
4.5.1 AND
To perform the AND operation, you take two binary numbers and compare them one
place at a time. If both numbers have a 1 in both places, then the resultant number is
a 1. Otherwise, the resultant number is a 0, as you see here:
1 1 0 0
1 0 0 1
____________
1 0 0 0
4.5.2 OR
The OR operation tests to determine if there is a 1 in either or both numbers in a
given place. If so, then the resultant number is 1. Otherwise, the resultant number is
0, as you see here:
1 1 0 0
1 1 0 1
____________
1 1 0 1
4.5.3 XOR
The XOR operation tests if there is a 1 in a number in a given place, but not in both
numbers at that place. If it is in one number but not the other, then the resultant
number is 1. Otherwise, the resultant number is 0, as you see here:
1 1 0 1
1 0 0 1
____________
0 1 0 0
The term XOR means “exclusively OR” rather than and/or. XORing has a very
interesting property in that it is reversible. If you XOR the resultant number with the
second number, you get back the first number, and if you XOR the resultant number
with the first number, you get the second number:
0 1 0 0
1 0 0 1
____________
1 1 0 1
Two inputs lead to a single output. This is done with a simple truth table, much like
the one shown in Table 4.2.
Thus, what the AND gate does is take in two bits as input and perform the binary
AND operation on them. It then ends out the output.
The OR gate is quite similar. The ANSI/IEEE symbol is shown in Figure 4.9.
The two inputs lead to a single output. This is accomplished using a truth table, much
like the one you saw in the previous table, only with the binary OR operation instead
of AND (see Table 4.3).
Of course, there is also an XOR gate for the “exclusive or” operation. This is
sometimes referred to as an EOR gate or an EXOR gate. Figure 4.10 shows the
ANSI/IEEE symbol for the XOR gate.
The two inputs lead to a single output. This is accomplished using a truth table much
like the ones you saw in the previous two tables, only with the binary XOR operation
being used rather than AND or OR (see Table 4.4).
TABLE 4.4 Truth Table for XOR
These three are simple logic gates, based on the basic three binary operations;
however, there are many variations. A very common gate used is the NAND gate,
which is a NOT-AND gate. Basically, it outputs false, only when all of the inputs are
1 (true). There are many systems using NAND gates. Figure 4.11 shows the
ANSI/IEEE symbol for the NAND gate.
The truth table for this one essentially says that if it is NOT an AND value (i.e., not
both values a 1), then output 0 (see Table 4.5).
The NAND gate is very important because any Boolean function can be implemented
using some combination of NAND gates. Another gate that has this property is the
NOT-OR (or NOR) gate. Figure 4.12 shows the ANSI/IEEE symbol for a NOR gate.
Because either NOR gates or NAND gates can be used to create any Boolean
function, they are called universal gates.
You might be wondering how explicitly 1s and 0s are implemented in circuitry. A
common method is for a high voltage value to be a 1, and low to be a 0. So, you can
see how ultimately mathematical operations are reduced to electricity flowing
through logic gates and binary operations being performed on them.
The Hadamard gate is one of the more common logic gates utilized by a quantum
computer. We will discuss these gates and others in more detail in later chapters.
However, a brief introduction here provides a contrast to classical logic gates. The
Hadamard gate acts on a single qubit and is a one-qubit version of the quantum
Fourier transform. It is often denoted by the Hadamard matrix shown in Equation 4.1.
Hadamard matrices are named after the mathematician Jacques Hadamard. They are
square matrices whose rows are orthogonal. They are used in quantum computing to
represent a logical gate, the Hadamard gate.
section .text
_start: mov rax, 1 ; system call for write
mov rdi, 1 ; file handle 1 is stdout
mov rsi, message ; address of string to output
mov rdx, 13 ; number of bytes
syscall ; invoke system to write
mov rax, 60
xor rdi, rdi ; exit code 0
syscall ; invoke system to exit
section .data
message: db "Hello, World", 10 ; note the newline at the end
The reason for this apparent complexity is that the programmer has to literally move
data onto and off of specific CPU registries. Programming assembly gives one a
really good understanding of CPU architecture.
Microarchitecture deals with how a processor is actually organized. This is the
computer engineering of the processing chip, and it generally leads to diagrams such
as the one shown in Figure 4.13.
The image in Figure 4.13 is a very simplified CPU architecture, but it is useful for
getting the general idea of microarchitecture. The idea is to design the various
processing pathways. In Figure 4.13, we see just the general overview of the CPU.
Memory is mapped out similarly, as are the various components of a moth-erboard,
including the bus. The bus is the communication pathway for data transfer inside of a
computer.
When designing computers, one has a number of factors to consider. Power
requirements, capacity, and latency are three such factors. Computer performance is
often measured by instructions per cycle (also called instructions per clock). This is
the mean number of instructions that can be executed each clock cycle. The clock
signal oscillates between a high state and a low state, thus the need to use the
arithmetic mean to measure it. Taking the instructions per cycle and multiplying that
by the clock rate (cycles per second, measured in Hertz) will produce the number of
instructions per second a processor handle.
This is relevant to quantum computing; as we will see in later chapters, the design of
quantum computers is a critical element of quantum computing. The two major
divisions we will explore later in this book (particularly in Chapter 8, “Quantum
Architecture”) are adiabatic quantum computing and gate-based quantum computing.
These two different approaches to architecture are significant in the advance of
quantum computing.
4.7 Summary
This chapter provided an overview of the fundamental concepts of computer science.
Perhaps the most important topic in this chapter to help you understand quantum
computing is logic gates. A close second is the topic of algorithms. Ensure that you
completely understand both before proceeding. However, we also reviewed the
basics of computer architecture and examined data structures. There was also a brief
coverage of computational complexity. All of these topics will help you understand
the quantum computing topics we will explore in later chapters.
Algorithm analysis and data structures are critical to quantum computing as well as
classical computing. Understanding basic computer architecture is also important to
understanding any form of computing, and you cannot really understand quantum
logic gates without some understanding of classical logical gates. The material in this
chapter will provide a foundation for understanding quantum architecture and
quantum logic gates.
Review Questions
1. With a structure that’s a list of data, where is data added?
a. In a sequential fashion
b. At the top
c. Anywhere
d. At the bottom
2. With a queue, how is data added?
a. In a sequential fashion
b. At the top
c. Anywhere
d. At the bottom
3. Which algorithm analysis method gives the best case of the algorithm?
a. Omega
b. Big O
c. Theta
d. Cyclomatic complexity
4. Which algorithm analysis method gives the average case of the algorithm?
a. Omega
b. Big O
c. Theta
d. Cyclomatic complexity
5. Which sorting algorithm is the slowest?
a. Bubble sort
b. Quick sort
c. Merge sort
d. It depends on the implementation.
6. Which of the following logic gates is most commonly used in computers?
a. NAND
b. OR
c. AND
d. XOR
7. The following symbol is used for which gate?
a. NAND
b. OR
c. AND
d. XOR
8. Which gate will output false only when all the inputs are true (1)?
a. AND
b. OR
c. XOR
d. NAND
9. Why are NOR and NAND gates referred to as universal gates?
a. They are so widely used.
b. They are not; XOR is the universal gate.
c. They can be used to create any Boolean function.
d. They are used in all architectures.
10. The ______________ defines data types, registers, addressing, virtual memory,
and other fundamental features of the computer.
a. complex instruction set
b. microarchitecture
c. instruction register
d. Instruction Set Architecture
Chapter 5
So, if two events are independent and event A has a probability of .45 and
event B has a probability of .85, then the probability of both events
occurring is .45 * .85 = .3825.
Independent events are events whose probability has no relationship at all.
Put another way, two events are independent if the following are true
(conversely, the following statements are true if the two events are
independent):
P (A|B) = P(A)
P (B|A) = P(B)
Conditional probability refers to the likelihood of an event occurring, given
some other event occurring. The likelihood of event A occurring, given
event B has occurred, is equal to the probability of the intersection of event
A and event B divided by the probability of event B. This is shown in
Equation 5.4.
This rule obviously is not referring to situations where event B must follow
event A, but where event A can lead to event B. For example, if it is cold,
there is a certain probability that I will wear a jacket, but it does not
absolutely follow that I will wear a jacket.
These are basic rules of probability. Information theory, as you will see,
depends on probability, and as we have discussed in previous chapters,
quantum physics is probabilistic rather than deterministic.
Items a, b, and c are in set A. Items f, g, and h are in set B. Items d and e are
in both sets A and B. All the items, a through h, are in the union of sets A
and B.
The intersection of two sets is the overlap of the two sets. If you have two
sets, A and B, elements that are in both A and B are the intersection of sets
A and B, symbolized as A ∩ B. Figure 5.2 illustrates this.
Many sets may have subsets. Let us consider set A as all integers < 10. Set
B is a subset; it is all prime numbers < 10. Set C is a subset of A; it is all
odd numbers <10. Set D is a subset of A; it is all even numbers less than 10.
We could continue this exercise making arbitrary subsets, such as E = {4,
7}, F = {1, 2, 3}, etc. The set of all subsets for a given set is called the
power set for that set.
Sets also have properties that govern the interaction between sets. The most
important of these properties are listed here:
Commutative law: The intersection of set A with set B is equal to the
intersection of set B with set A. The same is true for unions. Put
another way, when considering intersections and unions of sets, the
order in which the sets are presented is irrelevant. That is symbolized
here:
a. A ∩ B = A ∩ B
b. A ∪ B = A ∪ B
Associative law: Basically, if you have three sets, and the
relationships between all three are all unions or all intersections, then
the order does not matter. This is symbolized as follows:
a. (A ∩ B) ∩ C = A ∩ (B ∩ C)
b. (A ∪ B) ∪ C = A ∪ (B ∪ C)
Distributive law: The distributive law is a bit different from the
associative law, and order does not matter. The union of set A with the
intersection of sets B and C is the same as taking the union of A and B
intersected with the union of A and C. This is symbolized here:
a. A ∪ (B ∩ C) = (A ∪ B) ∩ (A ∪ C)
b. A ∩ (B ∪ C) = (A ∩ B) ∪ (A ∩ C)
De Morgan’s laws: These laws govern issues with unions and
intersections and the complements thereof. These are more complex
than the previously discussed properties. Essentially, the complement
of the intersection of set A and set B is the union of the complement
of A and the complement of B. The symbolism of De Morgan’s laws
is shown here:
a. (A ∩ B)c = Ac ∪ Bc
b. (A ∪ B)c = Ac ∩ Bc
These are the basic elements of set theory. Combined with probability, you
should have the foundation to go deeper into information theory, which we
will do in the following sections.
The symbol pi denotes the probability of the occurrence of the ith category
of the symbol in the string being examined. The symbol H denotes the
Shannon entropy. The value is given in bits, thus log2. This formula allows
you to calculate the information entropy (i.e., Shannon entropy) in a given
message.
For two variables or two messages that are independent, their joint entropy
is the sum of the two entropies. That formula is shown in Equation 5.6.
If the two variables are not independent, but rather variable Y depends on
variable X, then instead of joint entropy, you have conditional entropy. That
formula is shown in Equation 5.7.
This formula requires a bit of basic calculus. If you will recall in Chapter 4,
“Fundamental Computer Science for Quantum Computing,” we gave a brief
description of integrals, and any reader with even a single semester of
calculus will recognize the limit.
As was discussed earlier, information theory has developed since Claude
Shannon. Another type of information is Fisher information, which
measures the amount of information in an observable variable X about an
unknown parameter θ of some distribution that models X.
Note
Concept Formula
Shannon information entropy
Joint entropy
Conditional entropy
Mutual information
Differential entropy
In Equation 5.10, pi denotes the proportion of symbols that are part of the
class of the ith class of symbol in the string. H' symbolizes the Shannon
diversity index (also referred to as the Shannon-Weaver diversity index).
This is shown in Equation 5.11.
H0(A)≔logb|A|
EQUATION 5.12 Hartley Entropy
H2(X) = –logP (X = Y)
EQUATION 5.14 Collision Entropy
s (p) = −tr(p ln p)
EQUATION 5.16 The von Neumann Entropy Formula
The p represents the density matrix, which describes the state of a quantum
system. Remember that quantum systems are probabilistic; therefore, the
density matrix is describing the statistical state of the system. The tr
represents the trace, which in linear algebra is the sum of the elements on
the main diagonal, going from the upper left to the lower right of the
matrix. The von Neumann entropy is used in a variety of different
applications in quantum information theory, particularly to describe the
entropy of entanglement. Chapter 7 discusses entanglement in more detail.
Another such example is the conditional relative entropy. This is a measure
of the distinguishability of two quantum states. The states are represented
by matrices, and the formula is shown in Equation 5.17.
s (A|B)p
EQUATION 5.17 Conditional Quantum Entropy
5.5 Summary
Information theory is important for understanding quantum computing. In
this chapter, you were introduced first to basic probability and set theory.
Then you were given a tour of information theory, which applies probability
and set theory. The most important concepts from this chapter are how to
calculate probabilities and information entropy. You will find these
concepts revisited later in a quantum context. We also covered some basic
concepts of quantum information theory.
Review Questions
1. You are concerned about the probability of two independent events
occurring. Event A has a probability of .5, and event B has a
probability of .2. What is the probability of both occurring?
a. .7
b. .1
c. .6
d. 1
2. If events A and B are mutually exclusive, and event A has a
probability of .25 and event B has a probability of .3, what is the
probability of A or B?
a. .55
b. .075
c. .475
d. .3
3. If events A and B are not mutually exclusive and event A has a
probability of .25 and event B has a probability of .3, what is the
probability of A or B?
a. .55
b. .075
c. .475
d. .3
4. Given A = {1, 3, 5, 7, 9}, the symbolism for the number 4 is which of
the following?
a. 4∈A
b. 4∉A
c. 4∪A
d. 4∩A
5. Given set A is the set of all fruit and set B is the set of all red foods,
what best describes apples?
a. The union of A and B.
b. The intersection of A and B.
c. B is an element of A.
d. A and B are disjoint.
6. When 3 bits of data are sent through a CAT 6 cable, what is the
transmitter?
a. The cable
b. The sending computer
c. The electrical current
d. The switch
7. This theorem essentially states that even if there is noise, you can
communicate digital information. This best describes which of the
following?
a. Information entropy
b. Source coding theorem
c. Noisy channel theorem
d. Rényi entropy
8. For two variables or two messages that are independent, how their
joint entropy is calculated?
a. Adding the two entropies
b. Multiplying the two entropies
c. Adding the two entropies and dividing by the conditional
entropy
d. Multiplying the two entropies and dividing by the conditional
entropy
9. What does the following formula describe?
a. Joint entropy
b. von Neumann entropy
c. Rényi entropy
d. Shannon entropy
10. ______________ describes the state of a quantum system.
a. No-teleportation theorem
b. No-cloning theorem
c. The trace
d. A density matrix
Part II: Basic Quantum Computing
Chapter 6
6.1.2 Hamiltonian
It is important that you be introduced to the Hamiltonian. A Hamiltonian is
an operator in quantum mechanics. It represents the sum of the kinetic and
potential energies (i.e., the total energy) of all the particles in a given
system. The Hamiltonian can be denoted by an H, <H>, or . When one
measures the total energy of a system, the set of possible outcomes is the
spectrum of the Hamiltonian. The Hamiltonian is named after William
Hamilton. As you may surmise, there are multiple different ways of
representing the Hamiltonian. In Equation 6.1, you see a simplified version
of the Hamiltonian.
The represents the kinetic energy, and the represents the potential
energy. The T is a function of p (the momentum), and V is a function of q
(the special coordinate). This simply states that the Hamiltonian is the sum
of kinetic and potential energies. This particular formulation is rather
simplistic and not overly helpful. It represents a one-dimensional system
with one single particle of mass, m. This is a good place to start
understanding the Hamiltonian. Equation 6.2 shows a better formulation.
Let us examine this formula to understand it. The simplest part is V(x),
which simply represents potential energy. The x is the coordinate in space.
Also rather simple to understand is the m, which is the mass. The as
you will recall from Chapter 3, is the reduced Planck constant, which is the
Planck constant h (6.626 × 10−34 J⋅s) / 2π. The ∂ symbol indicates a partial
derivative. For some readers, this will be quite familiar. If you are not
acquainted with derivatives and partial derivatives, you need not master
those topics to continue with this book, but a brief conceptual explanation is
in order. It should also be noted that there are many other ways of
expressing this equation. You can see an alternative way at
https://support.dwavesys.com/hc/en-us/articles/360003684614-What-Is-the-
Hamiltonian-.
With any function, the derivative of that function is essentially a
measurement of the sensitivity of the function’s output with respect to a
change in the function’s input. A classic example is calculating an object’s
position with respect to change in time, which provides the velocity. A
partial derivative is a function of multiple variables, and the derivative is
calculated with respect to one of those variables.
So, you should now have a general conceptual understanding of the
Hamiltonian. Our previous discussion only concerned a single particle. In a
system with multiple particles (as are most systems), the Hamiltonian of the
system is just the sum of the individual Hamiltonians, as demonstrated in
Equation 6.3.
EQUATION 6.3 Hamiltonian (Another View)
Let us delve a bit deeper into the Hamiltonian. Any operator can be written
in a matrix form. Now recall our discussion of linear algebra in Chapter 1.
The eigenvalues of the Hamiltonian are the energy levels of the system. For
the purposes of this book, it is not critical that you understand this at a deep
working level, but you should begin to see intuitively why linear algebra is
so important for quantum physics.
It also is interesting to note the relationship between the Hamiltonian and
the Lagrangian. First, it is necessary to define the Lagrangian. Joseph-Louis
Lagrange developed Lagrangian mechanics in 1788. It is essentially a
reformulation of classical mechanics. Lagrangian mechanics uses the
Lagrangian function of the coordinates, the time derivatives, and the times
of the particles.
In Hamiltonian mechanics, the system is described by a set of canonical
coordinates. Canonical coordinates are sets of coordinates on a phase space,
which can describe a system at any given point in time. You can, in fact,
derive the Hamiltonian from a Lagrangian. We won’t delve into that topic in
this chapter, but the interested reader can learn more about that process, and
other details about the Hamiltonian, at the following sources:
https://scholar.harvard.edu/files/david-morin/files/cmchap15.pdf
https://www.damtp.cam.ac.uk/user/tong/dynamics/four.pdf
https://authors.library.caltech.edu/89088/1/1.5047439.pdf
ψ>=Σici|ϕi
EQUATION 6.5 Wave Function
This is not as complex as it seems. The Greek letter psi (ψ) denotes the
wave function. The Σ symbol is a summation of what is after it. The φi
represents various possible quantum states. The i is to enumerate through
those possible states, such as φ1, φ2, φ3, etc. The ci values (i.e., c1, c2, c3,
etc.) are probability coefficients. The letter c is frequently used to denote
these because they are represented by complex numbers.
Recall from Chapter 1 that if two vectors are both orthogonal (i.e.,
perpendicular to each other) and have a unit length (length 1), the vectors
are said to be orthonormal. The bra-ket 〈φi|φj 〉 forms an ortho-normal
eigenvector basis. This is often written as follows:
〈φi|φj〉 = δij.
The symbol δ is the Kronecker delta, which is a function of two variables. If
the variables are equal, the function result is 1. If they are not equal, the
function result is 0. This is usually defined as shown in Equation 6.6.
EQUATION 6.6 Kronecker Delta
Now let us discuss the actual process of the wave collapse. Remember that
for any observable, the wave function is some linear combination of the
eigenbasis before the collapse. When there is some environmental
interaction, such as a measurement of the observable, the function collapses
to just one of the base’s eigenstates. This can be described in the following
rather simple formula:
| ψ → |ϕi
But which state will it collapse to? That is the issue with quantum
mechanics being probabilistic. We can say that it will collapse to a
particular eigenstate |φk〉 with the Born probability (recall we discussed this
earlier in this chapter) Pk = |ck|2. The value ck is the probability amplitude
for that specific eigenstate. After the measurement, all the other possible
eigenstates that are not k have collapsed to 0 (put a bit more
mathematically, ci ≠ k = 0).
Measurement has been discussed as one type of interaction with the
environment. One of the challenges for quantum computing is that this is
not the only type of interaction. Particles interact with other particles. In
fact, such things as cosmic rays can interact with quantum states of
particles. This is one reason that decoherence is such a problem for
quantum computing.
Don’t let this overwhelm you. All of the symbols used have already been
discussed, and I will discuss them again here to refresh your memory.
Given that we are discussing a time-dependent version of the Schrödinger
equation, it should be clear to most readers that the t represents time.
Remember that the ∂ symbol indicates a partial derivative. So, we can see in
the denominator that there is a partial derivative with respect to time. The ,
you will recall from Chapter 3 and from earlier in this chapter, is the
reduced Planck constant, which is the Planck constant h (6.626 × 10−34 j *
s) / 2π. The ψ symbol we saw earlier in this chapter. You may also recall
that the symbol Ĥ denotes the Hamiltonian operator, which is the total
energy of the particles in a system.
Before we examine the implications of the Schrödinger equation, let us first
examine another form of the equation. You can see this in Equation 6.8.
You already know that the ∂ symbol indicates a partial derivative. The 2
superposed above it means this is a second derivative (i.e., a derivative of a
derivative). For those readers who don’t have a solid calculus background,
or who don’t recall their calculus, a second derivative is actually common.
A first derivative tells you the rate of change for some function. A second
derivative tells you the rate of change for that rate of change that you found
in the first derivative. Probably the most common example is acceleration.
Speed is the change in position with respect to time. That is the first
derivative. Acceleration is the change in speed, which is a second
derivative. The ψ symbol denotes the wave function, which you should be
getting quite familiar with by now. Another symbol you are familiar with is
the h, for Planck’s constant. Note in this form of the Schrödinger equation
that it is the Planck constant, not the reduced Planck constant. The E is the
kinetic energy, and the V is the potential energy of the system. The X is the
position.
Remember that in the subatomic world, we have the issue of wave-particle
duality. The Schrödinger equation allows us to calculate how the wave
function changes in time.
Now, much of this you already know. Refreshing your memory a bit, ψ is
the wave function, is the reduced Planck constant, and m is mass. We
have also discussed second derivatives and partial differential equations
previously in this book. The c is the velocity of light in centimeters per
second. I think you can already see some connection between this and
Einstein’s famous E = mc2. I have yet to explain one other symbol, ∇. This
one actually shows up frequently in quantum physics. This is the Laplace
operator, sometimes called the Laplacian. It is sometimes denoted by ∇ ∇
and sometimes by ∇2. The definition of the Laplacian might seem a bit
confusing to you. It is a second-order differential operator defined as the
divergence of the gradient. In this case, the term gradient is a vector
calculus term. It refers to a scalar-valued function f of several variables that
is the vector field. The Laplacian of that vector field at some point is the
vector whose components are partial derivatives of the function f at point p.
Hopefully, this general explanation did not leave you totally confused.
Recall from the introduction that you need not master all of the
mathematics presented in this chapter. Just make sure you understand the
general idea. So what is that general idea? The Klein-Gordon equation is a
relativistic wave function that describes the motion for the field, as it varies
in time and space.
The Dirac equation for the spin is also a relativistic wave function. It
describes particles such as electrons and quarks. It should be noted that
electrons and quarks are the particles that constitute ordinary matter and are
known as fermions. We will have much more to say about quarks in the
section on quantum chromodynamics. The spin number describes how
many symmetrical facets a particle has in one full rotation. Thus, a spin of
1/2 means the particle has to be rotated twice (i.e., 720 degrees) before it
has the same configuration as when it started. Protons, neutrons, electrons,
neutrinos, and quarks all have a spin of 1/2, and that is enough for you to
move forward with the rest of this book. However, for some readers, you
not only want to see more of the math, but by this point in this text you
have become accustomed to it. So, in the interest of not disappointing those
readers, Equation 6.11 presents the Dirac equation as Paul Dirac originally
proposed it.
Again, you see the now-familiar partial differential symbol, the reduced
Planck constant, and the wave function—all of which should be quite
familiar to you by now. You also see mc2, and I anticipate most readers
realize this is mass and the velocity of light, just as it is in E = mc2. In this
equation, the x and t are space and time coordinates, respectively. The p
values that are being summed (p1, p2, and p3) are components of the
momentum. The symbols α and β are 4 × 4 matrices. These are 4 × 4
matrices because they have four complex components (i.e. using complex
numbers). Such objects are referred to in physics as a bispinor.
After our rather extensive excursions into the math of QED, let us complete
this section with a return to the essential facts of QED. Electrodynamics, as
the name suggests, is concerned with electricity. However, quantum
electrodynamics provides a relativistic explanation of how light and matter
interact. It is used to understand the interactions among electrically charged
elementary particles, at a fundamental level. It is a very important part of
quantum physics.
Evidence for the existence of quarks was first found in 1968 at the Stanford
Linear Accelerator Center. Since that time, experiments have confirmed all
six flavors of quarks. Therefore, these are not simply hypothetical
constructs, but the actual building blocks of hadrons, and have been
confirmed by multiple experiments over several decades. As one example, a
proton is composed of two up quarks and one down quark. The gluons
mediate the forces between the quarks, thus binding them together.
The next somewhat whimsical nomenclature comes with the concept of
color charge. This has no relation at all to the frequency of light generating
visible colors. The term color, along with the specific labels of red, green,
and blue, is being used to identify the charge of a quark. However, this term
has had far-reaching impact. That is why the study of the interaction
between quarks and gluons is referred to as chromodynamics.
There are two main properties in QCD. The first is color confinement. This
is a result of the force between two color charges as they are separated.
Separating the quarks in a hadron will require more energy the further you
separate them. If you do indeed have enough energy to completely separate
the quarks, they actually spontaneously produce a quark-antiquark pair, and
the original hadron becomes two hadrons.
The second property is a bit more complex. It is called asymptotic freedom.
In simple terms, it means that the strength of the interactions between
quarks and gluons reduces as the distance decreases. That might seem a bit
counterintuitive. And as I stated, it is complex. The discoverers of this
aspect of QCD—David Gross, Frank Wilczek, and David Politzer—
received the 2004 Nobel Prize in Physics for their work.
Therefore, if you wish to draw two electrons with opposite spin, colliding
and producing a photon, you can use Feynman diagrams without any math,
as demonstrated in Figure 6.2.
This is just a very brief introduction to Feynman diagrams, but you will find
these useful as you learn more about quantum interactions.
6.6 Summary
This chapter explored many concepts. It is really an extension of Chapter 3
and the application of some of the elements of Chapter 1. This is likely to
be one of the more difficult chapters for many readers, and it is strongly
suggested that you read it more than once. While many topics were
explored, some are absolutely critical for your understanding of quantum
computing. The bra-ket notation is used throughout quantum computing, so
ensure you are quite comfortable with it. Hamiltonians also play a
prominent role in quantum computing. Quantum decoherence is actually a
substantial impediment to the progress of quantum computing. To fully
understand decoherence, you need to understand the wave function and
associated equations. Quantum electrodynamics and quantum
chromodynamics were presented to help round out your basic introduction
to quantum theory. However, those two topics are a bit less critical for you
to move forward with quantum computing.
Test Your Skills
Review Questions
1. Why does the reduced Planck constant use 2 π?
a. 2 π denotes the radius of the atom.
b. 2 π is 360 degrees in radians.
c. 2 π accounts for quantum fluctuations.
d. 2 π is a derivative of Einstein’s universal constant.
2. In quantum mechanics, what does the Greek letter psi represent?
a. The Hamiltonian
b. The reduced Planck constant
c. The wave function
d. Superposition of states
3. What would be most helpful in determining the probability of finding a
particle at a given point?
a. Born’s rule
b. Hamiltonian
c. Reduced Planck constant
d. Wave function
4. Which of the following is the most accurate description of the wave
function collapse?
a. The various possible quantum states coalesce into a single
quantum state.
b. The probabilities coalesce to a single actuality based on an
observer.
c. The bra-ket 〈φi|φj 〉 forms an orthonormal eigenvector basis.
d. The superposition of possible eigenstates collapses to a single
eigenstate based on interaction with the environment.
5. When using the Kronecker delta and inputting two eigenstates that are
the same, what will be the output?
a. The sum of the eigenstates
b. 1
c. The superposition of the eigenstates
d. 0
6. Schrödinger’s equation is used to describe what?
a. Superposition of eigenstates
b. Eigenstates
c. The wave function
d. The Hamiltonian operator
7. What equation is most closely related to the decoupling that occurs
during decoherence?
a. Hamiltonian
b. Schrödinger equation
c. Wigner function
d. Klein-Gordon
8. Which of the following is a wave function related to quantum
electrodynamics that describes the motion for the field as it varies in
time and space?
a. Hamiltonian
b. Schrödinger equation
c. Wigner function
d. Klein-Gordon
9. What is a bispinor?
a. A 4 × 4 matrix with complex components
b. Superposition of two eigenstates
c. The product of the Dirac equation
d. The product of the Wigner function
Chapter 7
Why are the two particles entangled? Well, recall that in the previous
chapters we explored the wave function in some detail. This sort of action
was what Einstein termed “spooky action at a distance.” Based on this and
related phenomena, he believed quantum mechanics must be incomplete.
Along with Boris Podolsky and Nathan Rosen, Einstein wrote a paper on
what became known as the EPR paradox.
In their paper “Can Quantum-Mechanical Description of Physical Reality
Be Considered Complete?”, Einstein, Podolsky, and Rosen argued that
quantum mechanics was simply incomplete and that there were additional
elements of reality that simply were not addressed in quantum theory. In
their paper, they posited a thought experiment. In this experiment, there is a
pair of particles in an entangled state (it does not matter what particles are
selected). If you measure one of the particles (for example, its momentum),
then the measurement of the second particle would have a predictable
outcome. This instantaneous effect of one entangled particle on another was
disturbing, as relativity tells us that nothing can travel faster than the speed
of light, and entangled particles seem to communicate information
instantaneously, which is faster than the speed of light. The EPR paradox is,
in essence, that the second entangled particle either is in instantaneous
communication with the first particle (thus violating relativity) or already
has a definite state before measurement, which violates all we know about
quantum mechanics. Another term for entangled is to refer to the particles
as being in a singlet state (a common state).
The EPR paradox gave rise to the concept of nonlocality in quantum
mechanics: If two entangled particles can affect one another
instantaneously, over presumably any distance, then the quantum state was
not confined to the locality of either particle. I believe if you reflect on this
for a time, you will realize that not only is this counterintuitive, it is counter
to all classical physics.
The EPR paradox was fuel for a great deal of theoretical physics. In 1961,
David Bohm proposed a variation of the EPR thought experiment. In
Bohm’s version, the measurements have only discrete ranges of possible
outcomes. Here are some good references for more detail on Bohm’s work:
https://www.nature.com/articles/milespin11
http://philsci-archive.pitt.edu/3222/1/epr.pdf
One answer to the EPR paradox was to posit that there were hidden
variables we simply had not discovered. There are actually multiple “local,
hidden variable” theories. Each of them posits some underlying,
inaccessible variables that account for quantum entanglement and/or the
probabilistic nature of quantum mechanics.
To understand Bohm’s modification of the EPR paradox, assume that one
has prepared a pair of spin-1/2 particles in the entangled spin singlet state,
as is shown in Equation 7.1.
Also, |↑〉, |↓〉 is an orthonormal basis of the spin state space. A measurement
of the spin of one of the particles along a given axis yields either the result
“up” or the result “down.” If you measure the spin of both particles along
some given axis, then quantum theory predicts that the results obtained will
be the opposite. If such measurements are carried out simultaneously on
two spatially separated particles, then locality requires that any disturbance
triggered by the measurement on one side cannot influence the result of the
measurement on the other side. Putting that another way, nonlocality is an
“incompleteness” in quantum theory, and indeed there are some hidden
variables that account for the apparent nonlocality. The only way to ensure
the perfect correlation between the results on the two sides is to have each
particle carry a preexisting determinate value.
This brings us to an important theorem in quantum mechanics: Bell’s
inequality (also called Bell’s theorem). In 1964, John Bell proposed a
method to test for the existence of the proposed hidden variables. To gain an
intuitive understanding of Bell’s inequality, let us consider two photons that
are entangled. Bell realized that the only way to account for the perfect
correlation in quantumly entangled particles, without invoking nonlocality,
was that there must be pre-existing values. Before we delve deeper into
Bell’s theorem, its essence is that it proves quantum physics is incompatible
with the various “hidden variables” theories. This put an end to serious
speculation about hidden variables as an explanation for the perceived
nonlocality.
A basic intuitive understanding of Bell’s inequalities is actually rather
simple: Assuming hidden variables leads to strict limits on the possible
values of the correlation of subsequent measurements that can be obtained
from the pairs of entangled particles. However, experiments simply don’t
show that.
For a bit more in-depth look at Bell’s theorem, let us return now to the
particles in a quantum singlet state that we saw in Equation 7.1. Also, let us
further suppose that these particles are now separated by some substantial
distance. Measuring two particles leads to either they correlate or they
don’t. Using spin as the property of interest, if you measure the spin of the
entangled particles along with anti-parallel directions, the results are always
perfectly correlated. Measuring in perpendicular directions provides a 50%
chance of correlation. These two sets of data account for two situations—
parallel and anti-parallel—as illustrated here:
Pair
Anti-parallel 1 2 3 4 … n
Particle 1, 0° + – + + … –
Particle 2, 180° + – + + … –
Correlation ( +1 +1 +1 +1 … +1 ) l n = +1
Parallel 1 2 3 4 … n
Particle 1, 0° + – – + … +
Particle 2, 0° or 360° − + + − ... −
Correlation ( −1 −1 −1 −1 ... −1 ) l n = −1
But what about other angles? It turns out that the correlation is the negative
cosine of the angle. Note that many sources also discuss orthogonal
situations for the pair, including 90- and 270-degree angles.
Now let us look more rigorously at Bell’s theorem. Consider random
variables Ziα; i=1,2; and α=a,b,c taking only the values ±1. If these random
variables are perfectly anticorrelated (i.e., if Z1α=−Z2α, for all α), then we
have the formula shown in Equation 7.2.
7.2 Interpretation
While one can study quantum computers without considering the
implications of quantum mechanics, that may be a mistake because it
avoids some of the wonders of quantum mechanics. Therefore, in this
section, you will be introduced to some of the more well-known
interpretations.
First, it is important to understand why an interpretation is needed at all.
Consider two main features of quantum mechanics. The first is the issue of
entanglement that we discussed in the last section. As we discussed, the
EPR paradox stems from the issues that entanglement brings out. How can
two particles separated by a substantial distance be synchronized? Many
have posited hidden variables in the two particles, such that the values were
already predetermined, and there was no need to account for the supposed
paradox. However, Bell’s inequality ultimately was used to show such
variables don’t exist. So how do we account for the entanglement?
A second issue is the fact that we only know the outcome of a quantum
measurement with a certain probability, not with certainty. What does this
imply about how the universe fundamentally works? It must be stressed that
we know from innumerable experiments how quantum mechanics works (at
least to a particular level of detail), but we really don’t know why it works.
Thus, various interpretations have been formulated, seeking an explanation.
Another point to these perspectives is to answer a very fundamental
question: How does the classical world emerge from the quantum basis?
Clearly, our normal world does not demonstrate wave-particle duality,
entanglement, or other quantum phenomena, so physicists want to
understand how we have a quantum basis for everything. After all,
everything is made up of atoms that have particles that behave according to
quantum mechanics, but we ultimately derive classical behavior.
This formula is not as daunting as it seems. The first symbol, ĈHi, is just
denoting consistent histories. The P you already know is a proposition that
something is true at some specific time. The T indicates that the factors are
ordered chronologically based on values of ti,j.
Interpretation Description
Copenhagen Quantum systems do not have definite properties until
interpretation measured.
Many-worlds Any time a quantum measurement is made, the various
interpretation possible outcomes all do occur, in some alternate
universe.
Decoherent In this interpretation, the various possibilities for a
histories quantum measurement are assigned to alternative
histories of the system. In this way, each independent
history behaves in an essentially classical manner. This
interpretation does not focus on a wave function
collapse.
Objective The wave function and the collapse of that function do
collapse theory exist independent of the observer/measurement. The
collapse occurs when some particular threshold is
reached or randomly. The observer/measurement has
no special role.
7.3 QKE
Quantum key exchange (QKE), also called quantum key distribution, uses
quantum mechanics to produce a shared secret key. One of the advantages
of using quantum mechanics is the fact that measuring any particle changes
its state. Thus, if two parties are using quantum key distribution, and a third
party attempts to intercept the communication, that interception will be
detected.
So, we have (1 * 3), (1 * 2), (1 * 1), (2 * 3), (2 * 2), (2 * 1), (1 * 3), (1 * 2),
and (1 * 1), but we don’t just add these together; instead, they become a
new vector like what is shown in Equation 7.5.
Now back to the BB84 protocol. Alice first selects one of two basis states:
orthogonal or rectilinear. Alice will then encode the two strings (a and b) as
a tensor product. Together, ai and bi provide an induct to four qubit states,
shown in Equation 7.7.
Alice then prepares a photon polarization state depending on the bit value
and basis state. The basis state can be rectilinear or orthogonal. Thus, as an
example, a 0 is encoded in the rectilinear basis as a vertical polarization
state, and a 1 is encoded in the diagonal basis as a 135° state. Often the +
symbol is used for a rectilinear basis and the X for diagonal basis. Alice
then transmits that photon in the state specified to Bob. This process is then
repeated from the random bit stage, with Alice recording the state, basis,
and time of each photon sent.
According to quantum mechanics, no possible measurement distinguishes
between the four different polarization states, as they are not all orthogonal.
The only possible measurement is between any two orthogonal states (an
orthonormal basis). So, for example, measuring in the rectilinear basis gives
a result of horizontal or vertical. If the photon was created as horizontal or
vertical, then this measures the correct state, but if it was created as 45° or
135°, then the rectilinear measurement instead returns either horizontal or
vertical at random.
Because Alice encoded the bits, there is no way for Bob to know what basis
was used. Therefore, he must select a basis at random to measure in, either
rectilinear or diagonal. This is done for each photon he received, and the
results are recorded along with the time and measurement basis used. After
Bob has measured all the photons, he notifies Alice over a traditional
communication channel. Alice then sends the basis each photon was sent in,
and Bob sends the basis each was measured in. They both discard photon
measurements (bits) where Bob used a different basis. It turns out that on
average, this will be about half the bits. The remaining half of the bits are
now used as a cryptographic key. To check for the presence of an
eavesdropper, Alice and Bob now compare a predetermined subset of their
remaining bits. If any third party has gained any information about the
photons’ polarization, this introduces errors in Bob’s measurements. This is
because the measuring of a photon changes it. A summary of the basic steps
Alice takes are given here:
Step 1. Alice begins with two strings that are n bits in length. The two
strings of bits are encoded as a tensor product of n number of
qubits. This will lead to a new vector space.
Step 2. Alice first selects one of two basis states: orthogonal or rectilinear.
Alice will then encode the two strings (a and b) as a tensor product.
Together, ai and bi provide an induct to four qubit states.
Step 3. Alice then prepares a photon polarization state depending on the bit
value and basis state.
Step 4. Alice then transmits that photon in the state specified to Bob. This
process is then repeated from the random bit stage, with Alice
recording the state, basis, and time of each photon sent.
7.3.2 B92 Protocol
The B92 protocol uses two no-orthogonal states, such as |A> and |B>. This
protocol was developed in 1992 by Charles Bennet, one of the inventors of
the BB84 protocol.
In this case, Alice sends 0 or 1 bits. The 0 is in one basis, and the 1 is in
another basis. Which of the two bases is used is chosen randomly. Bob then
chooses the basis randomly (from the two possibilities). He then measures
the bits received using that basis. Depending on the result he will know if
he chose the correct basis. If his results are inclusive, he throws the results
out. In this protocol, a substantial number of bits get excluded.
7.3.3 SARG04
SARG04 is a protocol derived from BB84. When a message is to be sent,
the sending party begins with two strings of bits that are each n bits long.
These are encoded as a string of n qubits, as shown in Equation 7.8.
7.3.5 E91
Artur Ekert, a professor of quantum physics at the Mathematical Institute,
University of Oxford, implemented a different key exchange protocol
named E91. E91 utilizes entangled pairs of photons. This brings us back to
our previous discussion of quantum entanglement. The entangled states are
correlated, and if any third party intercepts the communication, that
interception will disrupt the state and be detected.
You can learn more about these protocols at these sources:
https://www.cse.wustl.edu/~jain/cse571-07/ftp/quantum/
https://eprint.iacr.org/2020/1074.pdf
https://journals.sagepub.com/doi/10.1177/1550147718778192
https://arxiv.org/abs/quant-ph/0510025
7.3.6 Implementations
There have been a number of successful implementations of quantum key
exchange, and there is a definite trend toward being able to accomplish this
over increasing distances. In 2007, the Los Alamos National Laboratory
was able to perform quantum key exchange over 148.7 kilometers of fiber
optic. In 2015, the University of Geneva and Corning, Inc., were able to
perform QKE over 307 kilometers.
In the United States, the Defense Advanced Research Projects Agency
(DARPA) created a quantum key distribution network consisting of ten
nodes that was able to run uninterrupted for four years. In 2016, China
established a QKE channel between China and Vienna, Austria (a distance
of 7500 kilometers).
7.4 Summary
This chapter explored the quantum physics concept of quantum
entanglement. The essential physics of this phenomenon, along with the
basic math that is needed to understand it, were covered. This is an
essential, though difficult to grasp, aspect of quantum physics. We also
examined quantum key exchange (QKE), also known as quantum key
distribution (QKD). The basic concepts were explored, along with some
specific implementations and protocols.
Review Questions
1. What is the primary point of studying Bell’s inequality? What did it
help to demonstrate?
a. It demonstrated that hidden variables are responsible for
entanglement.
b. It demonstrated that hidden variables are not responsible for
entanglement.
c. It demonstrated a useful quantum gate.
d. It demonstrated how to achieve entanglement.
2. Calculate the tensor product of these two vectors:
3. How many qubit states are used in BB84?
a. 4
b. 2
c. As many as are needed
d. The same as the number of qubits
4. Which QKD protocol is based on using entangled photons?
a. BB84
b. SARG04
c. E91
d. SSP
5. In the ____________________, the various possibilities for a quantum
measurement are assigned to alternative histories of the system. In this
way, each independent history behaves in an essentially classical
manner. This interpretation does not focus on a wave function
collapse.
a. objective collapse theory
b. decoherent histories interpretation
c. many-worlds interpretation
d. Copenhagen interpretation
6. _______________ proposed a method to test for the existence of the
proposed hidden variables.
a. Erwin Schrödinger
b. David Bohm
c. Albert Einstein
d. John Bell
7. ________ states that quantum systems do not have definite properties
until measured.
a. Many-worlds interpretation
b. Bohm’s interpretation
c. Decoherent histories interpretation
d. Copenhagen interpretation
Chapter 8
Quantum Architecture
Chapter Objectives
After reading this chapter and completing the review questions, you
will be able to do the following:
Explain the logical topology of quantum computers
Articulate different qubit storage technologies
Understand quantum gates
Explain quantum annealing
In this chapter we delve deeper into the mechanics of quantum computing.
We will deepen our exploration of qubits and cover quantum gates as well
as quantum circuits. Just as importantly, we will discuss noncircuit
approaches, such as those used by D-Wave. In order to fully grasp
subsequent chapters, such as Chapter 9, “Quantum Hardware,” and Chapter
10, “Quantum Algorithms,” it is critical that you obtain a working
knowledge of quantum gates and circuits. These topics are pivotal for
understanding quantum hardware and algorithms.
Also, recall that the bra-ket notation, also called Dirac notation, is used to
represent vectors. In this case, the two states |0> and |1> are both kets.
These two orthonormal basis states form the computational basis of the
qubit. The two kets span the two-dimensional vector space of the qubit,
which is a Hilbert space.
Recall from Chapter 2, “Complex Numbers,” that a Hilbert space is a vector
space, like you were introduced to in Chapter 1. However, a Hilbert space
extends the two-dimensional Euclidean plane and three-dimensional
Euclidean space you are familiar with to any number of dimensions,
including infinite dimension spaces. The German mathematician David
Hilbert first described the eponymously named Hilbert spaces in his work
on integral equations and Fourier series. A Hilbert space is essentially a
vector space that is generalized to potentially infinite dimensions.
If one wishes to represent two qubits, there are four states to be represented:
Keep in mind that these are the states you will have once you have
measured the qubit. Until such a measurement occurs, the qubit is in a
superposition of possible states. Therefore, to describe a qubit, the
following formula is useful:
|Ψ> = α|0> + β|1>
The values α and β are the probability amplitudes. Usually, these
probabilities are complex numbers. When we measure the qubit, Born’s rule
tells us the probability of outcome |0> with value ‘0’ is |α|2 and the
probability of the outcome being |1> with the value ‘1’ is |β|2. Remember, α
and β are the probability amplitudes and are going to be complex numbers.
Given that probabilities always equal to 1, we can say that
|α|2 + |β|2 = 1
While this might seem a bit new to some readers, it is really fairly standard
probability. With the exception that the reader needs to have some concept
of the Born rule, we will now explore at least the fundamentals of the Born
rule.
The Born rule (sometimes called Born’s postulate or Born’s law) provides
us with the probability that a measurement of a quantum system (such as a
qubit) will yield a particular result. This was formulated by Max Born in
1926. Among other things that Born’s rule teaches us is that it states that the
probability density of finding a particle at a particular point is proportional
to the square of the magnitude of the particle’s wave function at that point.
To understand Born’s law, let us begin with some observable. That
observable corresponds to a self-adjoint operator A. A has a discrete
spectrum measured in a system and the system has a normalized wave
function. Born’s law tells us that given these circumstances, we know some
specific things about this system. However, before we get to what Born’s
rule tells us (note that I have intentionally used both “Born’s rule” and
“Born’s law”), you must understand what a self-adjoint operator is.
To understand self-adjoint operators, first remember that when you are
using linear algebra, matrices are in fact operators. A self-adjoint operation
is a linear map A from the vector space V to itself that is its own adjoint. In
a complex Hilbert space, an operator’s adjoint is often also called a
Hermitian transpose or Hermitian conjugate. Put more simply, an adjoint in
a complex Hilbert space has the same function of a complex conjugate of a
complex number. Recall from Chapter 2 that a complex conjugate has the
same real and imaginary parts, but with an opposite sign. So that the
complex conjugate of 3 – 4i is 3 + 4i.
Now, returning to what Born’s rule tells us:
The result of the measurement will be one of the eigenvalues of the
self-adjoint operator A.
The probability of the measurement resulting in a particular
eigenvalue λi is equal to <Ψ|Pi|Ψ>, where Pi is the projection onto the
eigenspace of A corresponding to λi.
These lead us back to the Bloch sphere discussed previously in this book
and shown in Figure 8.1.
We can now explore the Bloch sphere representation a bit more thoroughly.
First, we need to discuss the concept of degrees of freedom, as it is used in
the physical sciences. A degree of freedom is an independent physical
parameter of the state of a given physical system. All the possible states of a
particular system constitute that system’s phase space. Considered from
another perspective, the dimensions of that phase space are the degrees of
freedom for that specific system.
We have previously discussed the probabilities α and β. Now we can be
more specific. Oftentimes the probabilities are depicted as Hopf
coordinates. Hopf coordinates are part of Hopf fibration. Hopf fibration,
also known as a Hopf map, describes a hypersphere in four-dimensional
spaces in terms of an ordinary sphere. This was developed by the
mathematician Heinz Hopf in 1931. A full discussion of Hopf’s work in
topology is beyond the scope of this current work; however, it is sufficient
for our purposes to know that this is useful for describing locations on a
sphere (like our Bloch sphere) when using complex numbers.
The Hopf fibration (also called a Hopf map) describes hypersphere (i.e., a
sphere in four-dimensional space). The description consists of circles and
an ordinary three-dimensional sphere. Hopf found a many-to-one continual
function from the hypersphere to the normal sphere, such that each distinct
point on the normal sphere is mapped from a distinct circle of the
hypersphere.
Hopf’s work has been important in topology and twistor theory. With that
exceedingly brief description of Hopf coordinates, using them to describe
the α and β is shown here:
The value eiψ is the phase state of the qubit. Sometimes α is chosen to be
real, leaving just two degrees of freedom and yielding this formula:
This gate was briefly discussed in Chapter 4. This matrix is a square matrix
with entries that are either +1 or −1. It is named after the French
mathematician Jacques Hadamard. Note the Hadamard gate multiplies the
Hadamard matrix by . Returning the matrix itself, you may note that the
rows are mutually orthogonal. The Hadamard gate operates on a single
qubit. It is a one-qubit version of the quantum Fourier transform. This, of
course, requires us to discuss the quantum Fourier transform (QFT). For
those readers who just want a general understanding of quantum computing,
this is material you may wish to scan, but not be overly concerned with
having a deep understanding of.
The quantum Fourier transform is a linear transformation on quantum bits.
It is analogous to the classical inverse discrete transform. The quantum
Fourier transform is important for many reasons. Not only is it related to the
Hadamard gate, but it is actually a part of several quantum algorithms. In
fact, Shor’s algorithm uses the quantum Fourier transform.
Let us first review the classical discrete Fourier transform. The classical
discrete Fourier transform acts on a vector (x0, x1, x2, …, xn−1), mapping it
to another vector (y0, y1, y2, …, yn−1), when both vectors are elements of
the complex space. The classical discrete Fourier transform uses the
formula shown in Equation 8.4.
In Equation 8.5, the state on the left is mapped to the state on the right.
Using |x> as a basic state, one can also express the quantum Fourier
transform as the map shown in Equation 8.6.
Much more could be said about the quantum discrete Fourier transform, but
this brief description is adequate for our purposes. Returning now to the
Hadamard gate, it has the property that HH † = I. Put in words, the
Hadamard gate multiplied by its transpose results in the identity matrix.
Phase shift gates are used in many places, but specifically in transmons. A
transmon is a superconducting charged qubit, designed to have reduced
sensitivity to interference. Here are some interesting papers on phase shift
gates:
https://cds.cern.ch/record/684838/files/0311103.pdf
https://arxiv.org/pdf/1110.2998.pdf
https://arxiv.org/pdf/quant-ph/0011013.pdf
Finally, we come to the Pauli-Z gate. You can probably guess that it is the
equivalent of rotating about the z-axis of the Bloch sphere. It is a special
case of a phase shift gate. It leaves the |0> basis state unchanged, but maps
the basis state |1> to −|1>. It is represented by the Pauli-Z matrix:
8.2.4 Swap Gates
Unlike the gates we previously discussed in this section, swap gates operate
on two qubits. As the name suggests, they swap the qubits. It is represented
by the matrix shown in Figure 8.4.
There is also the controlled-U gate. This gate also operates on two qubits,
and the first qubit is a control (thus the name). The mapping of the
controlled-U gate is shown here:
|00> → |00>
|01> → |01>
Note that if the first qubit is zero, nothing is changed.
There are more complex gates, such as this one:
|10> → |1> ⊗ U|0> = |1> ⊗ (u00|0> + u10|1>)
Before continuing, we must examine what this means, because some of it
might seem quite odd. The U stands for one of the Pauli matrices (ΣxΣyΣz).
If it is the Pauli-Z matrix, then it is a controlled Z gate. Thus, u00 means
|00> input into a particular Pauli matrix. Now with that explanation, we can
complete our description.
We now show Pauli matrices used in a more complex gate.
|11> → |1> ⊗ U|1> = |1> ⊗ (u01 |0> + u11 |1>)
As you can see, this is a bit more of a complex gate than some of the others
we have discussed. However, you can view it as a controlled Pauli gate, if
that helps you to understand it.
The quantum CNOT (controlled NOT) gate operates much like what you
see in Figure 8.5.
As you can see, these are all 4×4 matrices. To refresh your memory, e is
Euler’s number, ϕ is the azimuthal angle, and, of course, i is the base
imaginary number. The trigonometric function you are certainly familiar
with already.
That third definition is probably quite daunting for readers who do not have
a strong mathematical background. Fortunately, the more casual reader
doesn’t need to have a deep understanding of what a normalizer is. What is
important is that the Pauli group (sometimes termed a Clifford group) can
be generated using only CNOT, Hadamard, and phase gates. Therefore,
stabilizer circuits can be constructed using only these gates.
What the Gottesman–Knill theorem tells us is that a quantum circuit,
meeting specific criteria, can be simulated on a classical computer in an
efficient manner. This is actually the basis of some current research wherein
quantum problems are explored on classical computers. This is the most
important thing to know about the Gottesman–Knill theorem.
Also recall from Chapter 2 that Hermitian refers to a square matrix that is
equal to its own conjugate transpose. Conjugate transpose means first
taking the transpose of the matrix and then taking the matrix’s complex
conjugate.
Pauli-X
Pauli-Y
Pauli-Z
SWAP
Phase shift
Toffoli
Fredkin
Controlled
Table 8.1 shows the most common gate symbols. Now we can begin to
discuss quantum circuits. Let us begin with a quite simple circuit—one that
does not actually do much other than have a single measurement on an
input, and doesn’t even have any gates. This is shown in Figure 8.6.
Figure 8.6 presents a symbol we have not discussed before. That is the
measurement symbol, which is shown in Figure 8.7.
So, what Figure 8.7 is telling us is that we have a qubit in state |0> that is
measured and remains in state |0>. Next, let us get a bit more complicated.
We have a qubit that is put through a Hadamard gate and then measured to
produce some value. This is shown in Figure 8.8.
The symbol |m0> just means the result of the measurement. It could be |0>
or |1>.
Now we can expand this a bit more. What about circuits with multiple
gates? That is easy to diagram, regardless of where the measurement takes
place. For now, let’s ignore the “why” part, as in why you would want to
combine particular gates, and simply consider how to diagram them. Figure
8.9 shows a simple two-gate diagram.
One can also have gates in parallel. For example, one might have a Pauli-X
gate and a Pauli-Y gate in parallel, as shown in Figure 8.10.
In Figure 8.10, each qubit is put through its gate and then measured,
yielding some value (either |1> or |0>).
8.5.1 SQUID
At the heart of D-Wave’s approach is the superconducting qubit (SQUID).
This is the equivalent of the classical computer transistor. The term SQUID
comes from the full name Superconducting QUantum Interference Device.
SQUIDs use the aforementioned Josephson junction. There are two SQUID
types: the direct current (DC) and radio frequency (RF).
Again, it may be useful to consider D-Wave’s own description of SQUID,
found in this excerpt:
“Quantum computers have similarities to and differences from this
CMOS transistor idea. Figure 1 shows a schematic illustration of
what is known as a superconducting qubit (also called a SQUID),
which is the basic building block of a quantum computer (a quantum
‘transistor’, if you like). The name SQUID comes from the phrase
Superconducting QUantum Interference Device. The term
‘Interference’ refers to the electrons—which behave as waves inside
quantum waves, interference patterns which give rise to the quantum
effects. The reason that quantum effects such as electron waves are
supported in such a structure—allowing it to behave as a qubit—is
due to the properties of the material from which it is made. The large
loop in the diagram is made from a metal called niobium (in contrast
to conventional transistors which are mostly made from silicon).
When this metal is cooled down, it becomes what is known as a
superconductor, and it starts to exhibit quantum mechanical effects.
“A regular transistor allows you to encode 2 different states (using
voltages). The superconducting qubit structure instead encodes 2
states as tiny magnetic fields, which either point up or down. We call
these states +1 and –1, and they correspond to the two states that the
qubit can ‘choose’ between. Using the quantum mechanics that is
accessible with these structures, we can control this object so that we
can put the qubit into a superposition of these two states as described
earlier. So by adjusting a control knob on the quantum computer, you
can put all the qubits into a superposition state where it hasn’t yet
decided which of those +1, −1 states to be.
“In order to go from a single qubit to a multi-qubit processor, the qubits
must be connected together such that they can exchange information.
This is achieved through the use of elements known as couplers. The
couplers are also made from superconducting loops. By putting many
such elements (qubits and couplers) together, we can start to build up
a fabric of quantum devices that are programmable. Figure 2 shows a
schematic of 8 connected qubits. The loop shown in the previous
diagram has now been stretched out to form one of the long gold
rectangles. At the points where the rectangles cross, the couplers have
been shown schematically as blue dots.”
The most important thing to realize about the D-Wave approach is that
while it is radically different from other approaches, it has had remarkable
success in producing stable working systems.
8.6 Summary
In this chapter, we explored the fundamentals of quantum architecture. Our
main focus was on quantum gates and circuits. However, we also explored
quantum annealing and related approaches. The material in this chapter sets
the stage for Chapters 9 and 10. It is important that you be comfortable with
the added details on qubits, as well as have a working knowledge of
quantum gates and circuits, before continuing to the next chapter.
Review Questions
1. _____________ operate on a single qubit and leave the basis state |0>
unchanged but map the basis state |1> to eiφ|>.
a. Hadamard gates
b. Phase shift gates
c. Pauli gates
d. Toffoli gates
2. What property(ies) is/are required for two vectors to be considered
orthonormal?
a. Unit length
b. Use of bra-ket notation
c. Normalized
d. Orthonormal
3. _________ states that the probability density of finding a particle at a
particular point is proportional to the square of the magnitude of the
particle’s wave function at that point.
a. Hilbert space
b. Hilbert rule
c. Schrödinger’s equation
d. Born’s rule
4. ___________states that circuits that consist only of gates from the
normalizer of the qubit Pauli group can be perfectly simulated in
polynomial time on a probabilistic classic computer.
a. Schrödinger’s equation
b. Gottesman–Knill Theorem
c. Born’s rule
d. Phase shifting
5. A ______ gate provides a linear transformation of a complex inner
product space that preserves the Hermitian inner product.
a. Hadamard
b. Pauli
c. Quantum
d. Ising
6. What does the following symbol denote?
a. Hadamard gate
b. Measurement
c. Toffoli gate
d. Phase shift
Chapter 9
Quantum Hardware
Chapter Objectives
After reading this chapter and completing the review questions, you
will be able to do the following:
Articulate different qubit storage technologies
Understand decoherence
Explain methods to mitigate decoherence
Demonstrate a working knowledge of quantum networking
This chapter explores the physical implementation of quantum computers.
In previous chapters we have explored qubits; in this chapter, we will
explore the physical implementation of quantum computers. Decoherence
will also be covered. Understanding the implementation of qubits and the
role of decoherence are the most important topics in this chapter.
In addition to those fundamental aspects of quantum computing, we will
also explore quantum networking and currently theoretical topics such as
topological quantum computing. This chapter should provide you with a
general understanding of the physical elements of quantum computing.
9.1 Qubits
Chapter 8, “Quantum Architecture,” discussed qubits at some length, from a
mathematical perspective; however, it did not address the issue of how the
qubits are actually physically realized. What is needed is any quantum
mechanical system that has two states. The two states will be used to
represent a 1 or a 0. This section addresses a few specific approaches to
physically implementing qubits.
Before we examine specific physical realizations of qubits, a few general
facts about qubits should be discussed. As has been covered in detail
throughout this book, qubits are probabilistic by their very nature. This
means that they are prone to errors in calculations. We will explore error
correction algorithms in Chapter 10, “Quantum Algorithms.” Beyond the
probabilistic nature of qubits, there is their sensitivity to environmental
noise, which we will explore later in this chapter.
An important fact we must address now is how many physical qubits are
needed to implement a logical qubit. You might naturally suppose that it is a
one-to-one relationship; however, that supposition would be inaccurate.
There is not a specific correlation formula; however, it typically takes
several physical qubits to implement one logical qubit. As an example,
Shor’s error correction code works by encoding a single logical qubit in
nine physical qubits. The system is predicated on repetition codes in groups
of three qubits. Equation 9.1 illustrates the general definitions of logical
states.
9.1.2 Electron
Electrons and photons are two of the most obvious ways to implement a
qubit. Electron qubits use some property, such as electron spin, to indicate
the state of the qubit. For example, an up spin can designate state |0> and a
down spin can designate |1>.
There are other variations of using electrons to store qubits. In 1997, David
DiVencenzo and Daniel Loss proposed a type of quantum computer that
uses the spin of freedom of electrons, which are confined to quantum dots,
to physically implement a qubit. This is now called a Loss-DiVincenzo
quantum computer. The term quantum dot actually comes from
nanotechnology. A device that is only of nanometer scale in one dimension
is referred to as a quantum well. A device that is of nanometer scale in two
dimensions is called a quantum wire. A device that is of nanometer scale in
all three dimensions is known as a quantum dot. The Loss-DiVencenzo uses
electrons confined to a three-dimensional nano device to implement qubits.
Other researchers have focused on quantum states of electrons in particular
mediums. For example, the Okinawa Institute of Science and Technology
has worked on using electrons in liquid helium. Data suggests that electron
spin states in liquid helium would maintain coherence longer. Reading the
data in the qubit is based on detecting different Rydberg states. Rydberg
states are excited states that follow the Rydberg formula. This, of course,
requires the understanding of a few additional terms. An excited state is any
quantum state that has a higher energy than the absolute minimum (i.e., the
ground state). The work of Johannes Rydberg, the Rydberg formula,
calculates the wavelengths of a spectral line in a chemical element. This
model was later refined by Neils Bohr.
The details of the Rydberg formula are not absolutely necessary for you to
understand qubits, but for those interested readers, those details are given.
First, the formula depends on the Rydberg constant, symbolized as RH for
hydrogen. Then, the Rydberg formula (again using hydrogen as an
exemplar) is shown here:
In this formula, the values are as follows:
RH is the Rydberg constant.
λ is the wavelength of electromagnetic radiation in a vacuum.
n1 is the principal quantum number of an energy level.
n2 is the principal quantum number of an energy level for atomic
electron transition.
Put in simpler terms, the Rydberg formula predicts the wavelength of light
resulting from an electron changing energy levels in an atom. You may
recall principle quantum numbers from Chapter 3, “Basic Physics for
Quantum Computing.”
In 2020, researchers at the University of New South Wales, working with
colleagues at the Université de Sherbrooke in Quebec and Aalto University
in Finland, announced a rather novel approach to qubits. The researchers
created artificial atoms that have normal electron shells (see Chapter 3 for a
review of electron shells) but no nucleus. Because there is no nucleus, and
thus no positive charge, the team used an electrode to provide the positive
charge. The qubit was implemented in a quantum dot (recall this is a device
that is nanoscale in all three dimensions) of 10 nanometers in diameter. The
researchers postulate that having multiple electrons as the qubit rather than
a single electron will provide a more robust qubit.
9.1.3 Ions
Trapped ions can also be used as the physical implementation of qubits. The
qubit value is stored as an electronic state for each ion. This of course
requires stable ions. Fortunately, there are a number of such stable ions. A
common approach used in trapped ions for quantum computing is the Paul
ion trap, named after Wolfgang Paul. No, for those astute readers, this is not
a misspelling of Wolfgang Pauli. These are two different physicists.
Wolfgang Pauli received his Nobel Prize in Physics for the Pauli Exclusion
Principle in 1945. Wolfgang Paul received his Nobel Prize in Physics in
1989 for the development of methods to isolate atoms and subatomic
particles for study, which is directly related to our current interests.
Trapping ions is a bit more challenging than one might first suspect. One
has to consider Earnshaw’s theorem, proven by Samuel Earnshaw in 1842.
This theorem essentially states that a charged particle cannot be held in a
stable equilibrium by electrostatic forces alone. For those readers who wish
a more rigorous mathematical description, let us put this more formally:
The Laplace has no solution with local minima or maxima in free space.
There are saddle points, which are points in the graph of a function where
the derivatives (i.e., the slopes) in orthogonal directions are all zero but are
not a local extrema of the function. What all that means is that using
electrostatic forces alone, there cannot be a stable equilibrium.
This takes us back to the Paul ion trap. This trap uses an electric field
oscillating at radio frequency. Assuming the frequency has the right
oscillation frequency and field strength, the charged particle is trapped at
the aforementioned saddle point. For those readers who wish a bit more
detail on how Paul ion traps and saddle points work, there is the Mathieu
function. The motion of the ion in the saddle point is described by Mathieu
functions. These functions are solutions to Mathieu’s differential equations,
first introduced by Emile Mathieu. The differential equation is
9.1.4 NMRQC
Nuclear magnetic resonance quantum computing (NMRQC) is a very
interesting approach to physically implementing quantum computers. This
approach uses spin states of nuclei within molecules to represent the qubits.
The states are probed using nuclear magnetic resonances, thus the name.
This system is fundamentally a variation on nuclear magnetic resonance
spectroscopy.
There are two approaches to this process. Originally, the molecules were in
a liquid state, and this was known as liquid state nuclear magnetic
resonance. However, molecules in a solid state are now more commonly
used. This is referred to as solid state nuclear magnetic resonance. One
example is nitrogen in a diamond lattice. The crystalline structure makes it
much easier to localize the individual qubits. This variation depends on
nitrogen vacancy centers. One type of point defect in a diamond occurs
when the nearest neighbor pair of a nitrogen atom substitutes for a carbon
atom, causing a vacancy in the lattice.
Whether using liquid or solid state, the use of nuclear spins for quantum
computing was proposed in 1997. In 2001, IBM was able to implement
Shor’s algorithm on a seven-qubit NMRQC.
In 1998, Bruce Kane proposed a quantum computer that was essentially a
hybrid between the quantum dot (which will be discussed later in this
chapter) and the NMRQC. You can learn more about the Kane quantum
computer at the following sources:
https://www.nature.com/articles/30156
https://permalink.lanl.gov/object/tr?what=info:lanl-repo/lareport/LA-UR-
02-4626
Charged Neutral
Electron Electron neutrino
Muon Muon neutrino
Tau Tau neutrino
Again, the ψ symbol denotes the wave function. The Σ symbol is the
summation of what is after it. The ϕi represents the possible quantum
states. The i is to enumerate through those possible states, such as ϕ3 ϕ2
ϕ3, etc. The ci values (c1, c2, c3, etc.) are probability coefficients. The
letter c is used because the values are represented by complex numbers.
Thus, for an N particle system, there is a wave function for each particle.
The effective dimensionality of a system’s phase space is the number of
degrees of freedom. To better understand degrees of freedom, let us first
consider a very simple example. Consider a system that is, effectively, one
dimensional—a ball in a tube, as illustrated in Figure 9.1. Of course, we
know that the ball and tube are both three-dimensional objects, but the ball
can only move along one dimension.
Now if we replace the ball with a particle, then each particle in a system has
six degrees of freedom. Thus far we have simply considered the “ball” as a
single point. We know that particles are actually wave functions.
When two systems interact, their state vectors are no longer constrained to
their own phase space. Also, note that the environment can itself be a
system. In fact, it is when the environment serves as the second system that
the greatest interference occurs. When a system is interacting with the
external environment, the dimensionality of the joint state vector (that of
both systems) increases substantially. This is when the Wigner distribution
becomes a factor.
Recall from Chapter 6 that the Wigner distribution is used to link the wave
function in Schrödinger’s equation to a probability distribution in phase
space. This is shown in Equation 9.3.
EQUATION 9.3 Wigner Distribution
Also, recall from Chapter 6 the description of this formula. The W simply
represents the Wigner distribution. The x value is usually position and p
momentum, but they could be any pair of values (frequency and time of a
signal, etc.). You know that ψ is the wave function and is the reduced
Planck constant. You should also recall that the ∫ symbol denotes
integration.
What all of this means is that, at some point, decoherence in a quantum
system is inevitable. Recall the two-slit experiment discussed in Chapter 3.
Interference, and thus decoherence, can occur quite easily. This leads to the
very substantial problem of trying to mitigate decoherence. To make
matters even more challenging, in 2020, it was discovered that cosmic rays
can interfere with quantum states, and thus lead to decoherence in at least
some scenarios.
Theoretically, a quantum system could maintain coherence indefinitely if it
were completely isolated from the external environment; however, no
system is perfectly isolated from its environment. It has even been
demonstrated that cosmic rays and background environmental radiation can
contribute to decoherence in quantum computers. Even entanglements can
occur between the quantum computing system and its environment.
In addition to the external environment, the system itself can be an issue.
For example, the physical equipment needed for things like implementing
quantum gates is constructed of atoms and particles that have quantum
properties. In general, many systems are only able to maintain coherence
for a matter of microseconds to a few seconds.
The issue of controlling decoherence is closely related to the issue of
quantum error correction. We will be exploring quantum error correction in
Chapter 10; however, both decoherence and error correction affect the
reliability of quantum computations. The problem is whether quantum
computers can perform lengthy computations without noise (be it from
decoherence or other sources) rendering the output useless. Remember that
qubits are, by their very nature, probabilistic.
The problem of decoherence only increases as quantum computing sizes
increase. The more qubits and quantum gates a system has, the more
susceptible it is to decoherence. That is due to the fact that there are more
components that can interfere with each other. This is why the sizes for
quantum computers, such as IBM announcing a 53-qubit system in October
2019, are so important. The size is only part of the issue, however. How
long those qubits can fend off decoherence is equally important. Clearly, a
quantum computer must maintain coherence long enough to perform
meaningful calculations.
9.3.1 Supercooling
One method used to help combat decoherence is supercooling to just a
fraction of one kelvin. In fact, some systems cool to a few nanokelvins. If
you are not familiar, or don’t recall the kelvin scale, 0 kelvin is the
equivalent to –273.15 Celsius or –459.67 Fahrenheit. This is not arbitrary.
The point 0 kelvin is absolute zero, which implies no thermal energy at all.
Thus, a nanokelvin is literally a fraction of a degree above absolute zero. To
provide some context, temperatures in space are often around 2.7 kelvin.
Obviously, proximity to heat sources such as stars can alter that. The
surface of Pluto plummets to about 40 kelvin. So, quantum computing relies
on temperatures that are much colder than Pluto, and even colder than deep
space.
The reason supercooling is needed is expressed in the following quote:
“At extremely cold temperatures, atoms and molecules simply move
around less. Generally speaking, the lower a temperature is, the more
stable a molecule becomes. Less movement means less energy being
expelled. At a molecular level, that means that less energy is flying
around, and consequently (since voltage and energy are directly
related) less volatility in the voltage. This in turn means there is less
of a chance that something outside of a human’s control will cause a
qubit’s voltage to spike, causing the qubit to flip from one quantum
state to another. Thus, keeping the computer cold introduces less
energy into the system. This minimizes the chances of qubits
incorrectly flipping in between quantum states.”1
1. https://www.qats.com/cms/2019/08/02/quantum-computing-cooling/
During the initial demonstration of this link, the president of the Chinese
Academy of Sciences made several video phone calls over the quantum
link. This is one of many similar projects going on in China.
9.7 Summary
In this chapter, we delved into the physical aspects of quantum computing.
Understanding the physical implementation of qubits is the foundation of
quantum computing. We also delved into decoherence and quantum
networking. These are core concepts in quantum computing that you should
be familiar with as you move forward in your learning of quantum
computing.
Quantum Algorithms
Chapter Objectives
After reading this chapter and completing the review questions, you
will be able to do the following:
Understand basic quantum algorithms
Examine algorithm structure
Explain the purpose and structure of quantum algorithms
The entire point of quantum computing is to execute quantum algorithms. It
should therefore come as no surprise to you that this chapter is rather
important. In Chapter 16, “Working with Q#,” and Chapter 17, “Working
with QASM,” you will explore quantum computer programming, but that is
predicated on some knowledge of quantum algorithms.
In this chapter, we will first explore what an algorithm is. This will be an
expansion of what was presented in Chapter 4, “Fundamental Computer
Science for Quantum Computing.” We will also go through rather detailed
discussions of several prominent quantum algorithms. This should provide
you a reasonably effective understanding of quantum algorithms. Some of
these algorithms are rather complex. You may finish this chapter with only
a generalized understanding of them; however, do not let that concern you.
In Chapters 16 and 17, you will actually program some of these algorithms,
and that should help solidify your understanding.
You may have noticed the line that is quite a bit thicker than the other lines
in the flow chart. This was done to draw your attention to it. This represents
recursion. Recursion, a common technique in algorithms, means to call
oneself again. When a computer function is recursive, it calls itself
repeatedly. A classic example is a function to calculate the factorial of an
integer. This is usually implemented recursively, as shown here:
int fact(int n)
{
if (n < = 1) // base case
return 1;
else
return n*fact(n-1);
}
The functions are traditionally labeled f0, f1, f2, and f3. This leaves us with
the question of what these functions actually do; put another way, what is
Figure 10.2 showing us? What is depicted in Figure 10.2 is that functions f0
and f3 set the output to the same value (either 0,0 or 1,1), no matter what the
input is. Function f1 sets 0 to 0 and 1 to 1. Function f2 sets 0 to 1 and 1 to 0.
Functions f0 and f3 are called constant (i.e., the output is always predictable,
regardless of the input). Functions f1 and f2 are called balanced, as their
output is always a balance of 1 and 0.
So, what is the problem to be solved? If we have a black box that we send
input to and get output from, how do we determine if that particular black
box contains a constant function (f0 or f3) or a balanced function (f1 or f2)?
Using classical computers to answer the question, we have to make two
evaluations. The first evaluation involves inputting a 0 and determining the
output. The second evaluation is to input a 1 and determine the output.
After those two operations, we will know definitively if the black box
contains a balanced or constant function.
Using a quantum algorithm, namely Deutsch’s algorithm, we can determine
what is in the black box in a single step. Deutsch envisioned a quantum
circuit, much like what is depicted in Figure 10.3.
FIGURE 10.3 Deutsch circuit
You may have noticed that we only measure the first output qubit, not the
second. Recall from Chapter 8, “Quantum Architecture,” that the gates
depicted are Hadamard gates. The Fi denotes that we have a function that is
one of the previously discussed F functions, but we don’t know which one.
The qubits |0> ⊗ |1> are input into the circuit, more specifically going
through the Hadamard gates. Equation 10.1 shows a Hadamard gate, if you
need a refresher.
By putting our input qubits through a Hadamard gate, the state is changed
to what’s shown in Equation 10.2.
Next, we will put the qubits into the Fi function. Remember, we don’t know
which of the four F functions this actually is. This changes the state to what
is shown in Equation 10.3.
EQUATION 10.3 State after the Fi Function
The state is either |0> – |1> or |1> – |0>. With a bit of algebra, this can be
rearranged to what you see in Equation 10.4.
However, recall from Figure 10.3 that we are not done. We have another
Hadamard gate followed by a measurement. If the result of our
measurement is 0, the Fi is either F0 or F3, a constant function. If it is 1,
then Fi is either F1 or F2, a balanced function. So, with one measurement,
we discover the nature of the Fi black box, as opposed to two measurements
with a classical computer.
As stated earlier, this might seem like a bit of a contrived example;
however, it is relatively easy to follow, and thus a good place to start
examining quantum algorithms. Make sure you follow this algorithm before
moving on to more complicated algorithms.
The application of the Hadamard transform to each bit will produce the
state depicted in Equation 10.6.
Thus far, this seems not that different from the standard Deutsch’s
algorithm. However, we now have a function, which we will call f(x). This
function maps the state |x>|y| to |x>|y ⊕ f(x)>. In this case, the symbol ⊕
denotes addition modulo 2. For the f(x) function, it has to be a function that
does not decohere x. The function f(x) is a quantum oracle (described
previously). As the values of x are put through the oracle f(x), either a 1 or
0 is produced. Also, keep in mind that each of the Hadamard gates will
affect the state of the qubit. This, the Deutsch-Jozsa algorithm, can be
described as shown in Figure 10.4.
FIGURE 10.4 Deutsch-Jozsa algorithm
The arrow at the bottom represents the states changing from ψ0 to ψ1. The
output will be 0 if f(x) is balanced and 1 if f(x) is constant. For n bits of
input, the final output will be n 0s if f(x) is constant. Any other output (any
combination of 0s and 1s, or all 1s) indicates that f(x) is balanced. Like the
Deutsch algorithm, the problem the Deutsch-Jozsa algorithm solves is a bit
contrived and might not appeal to you. The main point in describing both
algorithms is that they are relatively easy to understand when compared
with the other algorithms we will discuss.
Now we have the quantum oracle Uf. This oracle transforms the input |x>
into (−1)f(x) |x>. Application of this quantum oracle transforms the
superposition, yielding
Just to ensure this is clear to you, let us look at a few of the entries.
Consider x = 4 and a = 2:
fa, N (x) = ax mod N
or
fa, N (x) = 24 mod 15
which leads to
= 16 mod 15
=1
Let us consider one more example, where x = 5 and a = 4:
fa, N (x) = ax mod N
or
fa, N (x) = 45 mod 15
which leads to
= 1024 mod 15
=4
This part requires the second phase of the algorithm. This is the quantum
period-finding algorithm, which is described in the next subsection.
Returning from the period function, we continue the factoring process. If
the value we find for r is odd, then we return to step 1, selecting a different
pseudo-random number a. Also, if
a r / 2 = −1
we return to step 1 and select a different a.
However, if we have succeeded, then gcd (ar/2 + 1, N) and we have found
the factors of N.
The summation notation is used here (i.e., the Σ), but it is the tensor product
being used to combine the individual items x = 0 to Q − 1. The initial state
is a superposition of Q states. This is accomplished by creating q
independent qubits, each in a superposition of 0 and 1 states.
Now that the registers are initialized, we construct a quantum function f(x)
that will produce an entanglement of the input and output bits (see Equation
10.8).
This leads to a situation where the Q input bits and the n output bits are
entangled. The next step is to apply the inverse quantum Fourier transform
to the input register. Again, for the casual reader, this detail is not necessary,
but for the interested reader, a brief description is provided.
The quantum Fourier transform operates on some quantum state |x> and
maps it to a quantum state |y> using the formula shown in Equation 10.9.
Images
EQUATION 10.10 Inverse Quantum Fourier Transform
The inverse quantum Fourier transform is applied to the input register using
a Qth root of unity. For those readers not familiar with it, a root of unity is
any complex number that, when raised to some positive integer power n,
yields 1. This is sometimes called a de Moivre number, named after the
French mathematician Abraham de Moivre.
Now a measurement is performed, and some outcome y is obtained in the
input register and some outcome z in the output register. Our next step is to
perform continued fraction expansion (classical operation) on Images to
find approximations of Images that satisfy two conditions:
1. s < N
2. Images
Review Questions
1. What algorithm is described in the following question: “If we have a
black box that we send input to and get output from, how do we
determine if that particular black box contains a constant function or a
balanced function?”
a. Simon’s algorithm
b. Grover’s algorithm
c. Deutsch’s algorithm
d. Shor’s algorithm
2. Which of the following is a quantum search algorithm?
a. Simon’s algorithm
b. Grover’s algorithm
c. Deutsch’s algorithm
d. Shor’s algorithm
3. How many Hadamard gates are used in the Deutsch-Jozsa algorithm as
described in this chapter?
a. One
b. Two
c. Three
d. Four
4. What part of Shor’s algorithm is quantum?
a. All of it
b. The period-finding portion
c. The congruence portion
d. The modulus portion
Part III: Quantum Computing and
Cryptography
Chapter 11
11.1 RSA
RSA is perhaps the most commonly used asymmetric algorithm today. It is
undoubtedly one of the most well-recognized. This algorithm was first
published in 1977 by Ron Rivest, Adi Shamir, and Leonard Adleman. The
name RSA is taken from the first letter of each mathematician’s surname.
The algorithm is based on the difficulty of factoring a large number into its
prime factors. With current classical computers, the most efficient known
factoring algorithm for large integers is the general number sieve. Recall the
discussion from Chapter 4 on computational complexity and the Big O
notation. The general number sieve has the following complexity:
The important thing to keep in mind, even if that notation seems a bit
daunting, is that it is not an efficient algorithm. This is why RSA is secure
enough for current use. Now let us examine RSA in some depth to better
understand why factoring integers is key to RSA security. For those readers
interested in knowing more about the general number sieve, it is the most
efficient classical algorithm for factoring large integers. For more details
you can consult these resources:
https://citeseerx.ist.psu.edu/viewdoc/download?
doi=10.1.1.219.2389&rep=rep1&type=pdf
https://mathworld.wolfram.com/NumberFieldSieve.html
To examine RSA, let us begin with the key generation. To create the public
and private key pair, the first step is to generate two large random primes, p
and q, of approximately equal size. You will need to select two numbers so
that when multiplied together, the product will be the size you want (i.e.,
2048 bits, 4096 bits, etc.).
The next step is to multiply p and q to get n. This is a rather simple
equation:
n = pq
The third step is to multiply Euler’s totient for each of these primes (p and
q) in order to get the Euler’s totient of n.
If you are not familiar with Euler’s totient, it is a relatively simple concept.
Two numbers are considered co-prime if they have no common factors.
Consider the integers 15 and 8, which are co-prime. The factors of 15 are 3
and 5, and the factors of 8 are 2 and 4. The integers 15 and 8 have no
common factors, so they are considered co-prime. Euler’s totient asks how
many numbers smaller than n are co-prime to n. We call that number
Euler’s totient, or just the totient. It just so happens that for prime numbers,
this is always the number minus 1. As one example, the prime number 11
has 10 integers that are smaller than 11 and are co-prime to 11.
Now that you have a basic understanding of Euler’s totient, we can
continue. When we multiply two primes together, it should be obvious we
get a composite number—and there is no easy way to determine the Euler’s
totient of a composite number. Euler found that if you multiple any two
prime numbers together, the Euler’s totient of that product is the Euler’s
totient of each prime multiplied together. Thus, the next step is
m = (p–1)(q–1)
This leads to m, which is the Euler’s totient of n.
For the fourth step, we are going to select another number, which we will
call e. We want to pick e so that it is co-prime to m. Frequently, a prime
number is chosen for e. That way, if e does not evenly divide m, then we are
confident that e and m are co-prime, as e does not have any factors to
consider.
At this point, we have almost completed generating the key. Now we just
find a number d that when multiplied by e and modulo m would yield a 1:
Find d, such that de mod m ≡ 1
This completes the key generation. We will publish e and n as the public
key and keep d as the secret key. The following steps summarize the key
generation process:
Step 1. Generate two large random primes, p and q, of approximately equal
size.
Step 2. Multiply p and q to get n.
Step 3. Multiply Euler’s totient for each of these primes (p and q) in order
to get the Euler’s totient of n.
Step 4. Select another number, which we will call e. We want to pick e so
that it is co-prime to m.
Step 5. Find d, such that de mod m ≡ 1.
To encrypt, you simply take your message raised to the e power and modulo
n:
C = Me mod n
To decrypt, you take the cipher text and raise it to the d power modulo n:
P = Cd mod n
Next, we’ll look at two examples of RSA using very small integers. These
integers are too small to be effective; however, this should help you to
understand the process involved.
These two RSA examples are relatively simple. The prime numbers used
are so small that the key would easily be cracked, even with low-end
classical computers. However, the small prime numbers make the
mathematics quite manageable, so you can easily master the concepts. If
this is new information to you, you might find it worthwhile to work
through these examples a few times yourself.
11.2 Diffie-Hellman
While some security textbooks state that RSA was the first asymmetric
algorithm, this is not accurate. Developed by Whitfield Diffie and Martin
Hellman in 1976, Diffie-Hellman was the first publicly described
asymmetric algorithm. This is a cryptographic protocol that allows two
entities to exchange a symmetric key through some unsecure medium, such
as the Internet.
The Diffie-Hellman protocol has two parameters, called p and g. Parameter
p is a prime number and parameter g (typically referred to as a generator) is
an integer less than p, with the following property: for every number n
between 1 and p–1 inclusive, there is a power k of g such that n = gk mod p.
Let us continue the standard cryptographic practice of using Alice and Bob
to illustrate this.
Alice generates a random private value a and Bob generates a random
private value b. Both a and b are drawn from the set of integers.
They derive their public values using parameters p and g and their private
values. Alice’s public value is ga mod p and Bob’s public value is gb mod p.
They exchange their public values.
Alice computes gab = (gb)a mod p, and Bob computes gba = (ga)b mod p.
Because gab = gba = k, Alice and Bob now have a shared secret key, k.
Figure 11.1 illustrates this process.
FIGURE 11.1 Diffie-Hellman
If you examine this process, you should note that the security of Diffie-
Hellman is predicated on the difficulty of solving the discrete logarithm
problem. Shor’s algorithm can also be applied to discrete logarithms. This
means that given a quantum computer running Shor’s algorithm, Diffie-
Hellman can be broken in a reasonable time period.
11.2.1 Elgamal
Elgamal is one of many improvements made to Diffie-Hellman. Taher
Elgamal first described it in 1984. Elgamal is based on the Diffie-Hellman
key exchange algorithm.
The Elgamal algorithm has three parts:
Key generator
Encryption algorithm
Decryption algorithm
Continuing with the example of Alice and Bob, we can easily describe the
Elgamal key generation process:
1. Alice generates an efficient description of a multiplicative cyclic
group G of order q with generator g.
2. Alice chooses a random from x from a set of numbers {0, …, q–1).
3. Then Alice computes h = gx. Recall that g is the generator for the
group and x is a random number from within the group.
Also, h, G, q, and g are the public key, and x is the private key.
4. If Bob wishes to encrypt a message m and send it to Alice, he starts
with the public key Alice generated. The process for Bob to encrypt a
message is as follows:
a. Bob generates a random number y chosen from {0, …, q–1}.
Y is often called an ephemeral key.
b. Bob will calculate c1. That calculation is simple: c1 = gy.
c. A shared secret, s = hy, is computed.
d. The message m is converted to m′ of G.
e. Bob must calculate c2. That calculation is relatively easy: c2
= m′ * s.
f. Bob can now send c1 and c2 as the encrypted text.
5. To decrypt a message m with the private key that Alice generated, the
following process is done:
a. The recipient calculates s = c1x.
b. The recipient calculates m′ = c2 * s-1.
c. Finally, m′ is converted back to the plaintext m.
11.2.2 MQV
Much like Diffie-Hellman, Menezes-Qu-Vanstone (MQV) is a protocol for
key agreement and is, in fact, based on Diffie-Hellman. It was first
proposed by Menezes, Qu, and Vanstone in 1995 and then modified in
1998. MQV is incorporated in the public-key standard IEEE P1363. HMQV
(Hash MQV) is an improved version. Like Diffie-Hellman, the security of
MQV is predicated on the difficulty classical computers have solving the
discrete logarithm problem. Quantum computers, as we have seen, have no
such difficulty.
MQV uses elliptic curves, which will be discussed in detail in the next
section; however, the general steps are given here. There are some
preliminary items needed before we start the MQV steps. The two parties
have a public and private key pair. Alice’s is usually designated as A being
her public key and a being her private key. Bob’s keys are similar: B is his
public key and b is his private key. These will be used in the following steps
for Alice and Bob to exchange a new key to use. There is also a value h that
is a cofactor from the elliptic curve they are both using. There is one more
value that you need to know about, and it’s a bit more complex. You will
see it in steps 4 and 5.
Step 1. The person starting the key exchange, traditionally called Alice,
generates a key pair using a randomly chosen value x and then
calculating X = xP, where P is some point on an elliptic curve. The
key pair is (X, x).
Step 2. The other party, usually called Bob, also generates a key pair. His
key pair is (Y, y), which is generated by using a randomly chosen y
and then calculating Y = yP.
Step 3. Alice now calculates a value a modulo n. She then
sends her X to Bob.
Step 4. Bob calculates b mod n and sends the Y to Alice.
Step 5. Alice then calculates while Bob calculates
.
You might wonder why they would go through all this trouble. Don’t Alice
and Bob already have a public and private key? Can they not just simply
use these keys? They could; however, two things are occurring in MQV.
First, the public key of each party is really being used to authenticate that
party, not to encrypt data. Second, a new symmetric key is used every time
they run this algorithm. Therefore, Alice and Bob could potentially have a
different, new symmetric key for every message.
11.3 Elliptic Curve
Elliptic curve cryptography is a bit more mathematically complex than
RSA. Elliptic curves can be used to form groups and thus are suitable for
cryptographic purposes. There are two types of elliptic curve groups. The
two most common (and the ones used in cryptography) are elliptic curve
groups based on Fp, where p is prime, and those based on F2m. F is the field
being used, and m is some integer value. Elliptic curve cryptography is an
approach to public-key cryptography based on elliptic curves over finite
fields.
Elliptic curves applied to cryptography were first described in 1985 by
Victor Miller (of IBM) and Neil Koblitz. The security of elliptic curve
cryptography is based on the fact that finding the discrete logarithm of a
random elliptic curve element with respect to a publicly known base point
is difficult to the point of being impractical to do. An elliptic curve is the set
of points that satisfy a specific mathematical equation. The equation for an
elliptic curve is as follows:
y2 = x3 + Ax + B
Figure 11.2 illustrates a common way to depict the graph of this equation.
FIGURE 11.2 Elliptic curve graph
There are other ways to represent an elliptic curve, but Figure 11.2 is the
most common, and perhaps the easiest to understand. Another way to
describe an elliptic curve is that it is simply the set of points that satisfy an
equation that has two variables in the second degree and one variable in the
third degree. The first thing you should notice from the graph in Figure 11.2
is the horizontal symmetry. Any point on the curve can be reflected about
the x-axis without changing the shape of the curve.
Lawrence Washington of the University of Maryland describes an elliptic
curve a bit more formally: “an elliptic curve E is the graph of an equation of
the form where A and B are constants. This will be referred to as the
Weierstrass equation for an elliptic curve. We will need to specify what set
A, B, x, and y belong to. Usually, they will be taken to be elements of a
field, for example, the real numbers R, the complex numbers C, the rational
numbers Q, one of the finite fields Fp (=Zp) for a prime p, or one of the
finite fields Fq, where q=pk with k1.” These values will make more sense
as we go deeper into ECC.
The operation used with the elliptic curve is addition (recall that a group’s
definition requires a set along with an operation). Thus, elliptic curves form
additive groups.
The members of the elliptic curve field are integer points on the elliptic
curve. You can perform addition with points on an elliptic curve.
Throughout most of the literature on the elliptic curve, we consider two
points, P and Q. The negative of a point P = (xP, yP) is its reflection in the
x-axis: the point –P is (xP, –yP). Notice that for each point P on an elliptic
curve, the point –P is also on the curve. Suppose that P and Q are two
distinct points on an elliptic curve, and assume that P is not merely the
inverse of Q. To add the points P and Q, you draw a line through the two
points. This line will intersect the elliptic curve at exactly one more point,
called –R. The point –R is reflected in the x-axis to the point R. The law for
addition in an elliptic curve group is P + Q = R.
The line through P and –P is a vertical one that does not intersect the elliptic
curve at a third point; therefore, the points P and –P cannot be added as
done previously. For this reason, the elliptic curve group includes the point
at infinity O. By definition, P + (–P) = O. As a result of this equation, P + O
= P in the elliptic curve group. O is called the additive identity of the
elliptic curve group; all elliptic curves have an additive identity. You can
see this in Figure 11.3.
FIGURE 11.3 P + –P
To add a point P to itself, a tangent line to the curve is drawn at the point P.
If yP is not 0, then the tangent line intersects the elliptic curve at exactly
one other point, –R, and –R is reflected in the x-axis to R. This operation is
called “doubling the point P,” as illustrated by Figure 11.4.
FIGURE 11.4 Doubling the point P
11.3.2 ECDSA
The Digital Signature Algorithm was invented specifically for digitally
signing messages. Of course, one can utilize any asymmetric algorithm to
sign a message, but the Digital Signature Algorithm was designed for that
purpose. As you might expect, there is an elliptic curve variant on this
algorithm.
To illustrate how this works, we will consider the fictitious characters Bob
and Alice once again. First, the two parties must agree on some parameters:
the curve, denoted as E, the base point/generator of the elliptic curve,
denoted as G, and the order of G (an integer), denoted by n. Now to sign a
message, Alice takes the following steps:
Step 1. Select a random integer k that is less than n (i.e., K>1; k< n).
Step 2. Compute kG = (x1,y1) and r = x1 mod n. If r = 0, then go to step 1.
Step 3. Compute k−1 mod n.
Step 4. Compute e = SHA-1(m). Most digital signature algorithms use a
hash; in this case, the hash is usually SHA-1. Therefore, this is
stating that Alice computes the SHA-1 hash of the message.
Step 5. Compute s = k−1{e + dA . r} mod n.
Step 6. If s = 0, then go to step 1. In other words, Alice keeps repeating the
process until s ! = 0. This is not usually time consuming and could
happen on the first attempt.
Step 7. Alice’s signature for the message m is (r, s).
In order for Bob to verify Alice’s signature (r,s), he will execute the
following steps:
Step 1. Verify that r and s are integers in [1, n–1].
Step 2. Compute e = SHA-1(m).
Step 3. Compute w = s−1 mod n.
Step 4. Compute u1 = ew mod n and u2 = rw mod n.
Step 5. Compute (x1, y1) = u1G + u2 QA.
Step 6. Compute v = x1 mod n.
Step 7. Accept the signature if and only if v = r.
Figure 11.5 summarizes the process.
A 4 step digital signature algorithm is illustrated.
FIGURE 11.5 ECDSA
This is like the traditional Digital Signature Algorithm, except that it uses
elliptic curve groups. ECDSA is quite secure, at least against classical
computer attacks; however, it is susceptible to attacks by quantum
computers.
11.4 Summary
In this chapter, we examined some classical asymmetric algorithms in use
today. These algorithms are widely used in e-commerce, online banking,
and many other applications. None of these algorithms is resistant to
quantum computing–based attacks. For this reason, it is important that
newer, quantum-resistant algorithms are tested for use. The next four
chapters will explore the issues of quantum computing and cryptography. It
is important that you have an understanding of how current algorithms
function and why they are not resistant to quantum computing–based
attacks.
Review Questions
1. Shor’s algorithm can factor an integer N in what time?
a. N2
b. log(N)
c. ln(N)
d. N!
2. Which of the following equations is most related to elliptic curve
cryptography?
a. Me % n
b. P = Cd % n
c. Ce % n
d. y2 = x3 + Ax + B
3. What is a discrete logarithm?
4. Explain the basic setup of Diffie-Hellman (the basic math, including
key generation).
5. What is the formula for encrypting with RSA?
6. Explain RSA key generation.
Chapter 12
12.2.1 RSA
Chapter 11, “Current Asymmetric Algorithms,” explained the details of
RSA with examples. This was to ensure you understood why Shor’s
algorithm had such a substantial impact on RSA. As discussed in Chapter
10, “Quantum Algorithms,” Shor’s algorithm is able to factor integers in
polynomial time. This means it will be able to derive the RSA private key
from the public key within a practical time period.
12.2.2 Diffie-Hellman
As you learned in Chapter 11, Diffie-Hellman is based on the difficulty of
solving the Discrete Logarithm Problem. There have been numerous
improvements on Diffie-Hellman, such as ElGamal and MQV, but the
security of these algorithms is also predicated on the difficulty of solving
the Discrete Logarithm Problem.
Chapter 10 explored Shor’s algorithm and demonstrated that in addition to
being able to factor integers, the algorithm can be used in solving the
Discrete Logarithm Problem. Thus, Shor’s algorithm alone makes the
Diffie-Hellman family of algorithms insecure to quantum computing–based
attacks.
Shor’s algorithm is not the only threat to algorithms whose security is based
on the difficulty of solving the Discrete Logarithm Problem, however. In
2016, Martin Ekera introduced a modified version of Shor’s algorithm that
was specifically used to solve what is termed the Short Discrete Logarithm
Problem. This problem is used in Diffie-Hellman as implemented in TLS
and IKE protocols, which we will discuss in more detail later in this
chapter. There have been further refinements of Ekera’s work since 2016.
12.2.3 ECC
In the previous section we discussed the discrete logarithm problem. As you
know from Chapter 11, elliptic curve cryptography is based on the Elliptic
Curve Discrete Logarithm Problem (ECDLP). This means that all the
variations of elliptic curve cryptography are not quantum safe.
12.3.2 SSL/TLS
It is not an overstatement to assert that SSL/TLS provided the framework
for the Internet as we know it today. The ability to conduct e-commerce,
have secure communications, and safely send data is, in large part,
contingent upon SSL/TLS. When the web first began, security was not a
concern. Hypertext Transfer Protocol (HTTP) is inherently quite insecure.
As the web grew more popular, it quickly became apparent that security
was needed in order to use the web for sensitive communications such as
financial data. Netscape invented the Secure Sockets Layer (SSL) protocol,
beginning with version 1.0. It was never released due to significant security
flaws; however, version 2.0 was released in 1995 and began to be widely
used. Unfortunately, SSL version 2.0 had security flaws, and it was
subsequently supplanted with SSL version 3.0 in 1996. Version 3.0 was not
just a minor improvement over past versions; it was a complete overhaul. It
was published as RFC 6101.
TLS 1.0 was released in 1999. It was essentially an upgrade to SSL 3.0;
however, it was not compatible with SSL 3.0. TLS 1.02 also added support
for GOST hashing algorithm as an option for message authentication and
integrity. Previous versions supported only MD5 and SHA-1 as hashing
message authentication codes.
2. “What Is TLS/SSL?” Microsoft TechNet article, https://technet.microsoft.com/en-
us/library/cc784450(v=ws.10).aspx.
TLS 1.0 was eventually supplanted by TLS 1.1, released in April 2006. It
had a number of specific cryptographic improvements, including improved
initialization vectors as well as supporting cipher block chaining for AES.
In August of 2008, TLS 1.2 was released as RFC 5246, and it had many
improvements over previous versions, including replacing MD5 and SHAQ
with SHA-256. Then TLS 1.3 was released in August 2018, with additional
improvements, and defined by RFC 8446.
As quantum computers become more stable and widely used, there will
eventually need to be an alteration of the TLS standard to accommodate
quantum-safe cryptography. This will likely include different asymmetric
algorithms than are currently used as well as increased key sizes for
symmetric algorithms. Such a new standard will likely include a larger
digest sized for hashes.
12.3.6 SSH
Secure remote communications to servers is a common need particularly for
network administrators who often need to remotely connect to the servers
they administer. Secure Shell (SSH) is the most common way to securely
connect remotely with a server. As with other applications of cryptography,
quantum computing will require some changes to this protocol.
Unix and Unix-based systems such as Linux utilize SSH to connect to a
target server. The SSH standard uses asymmetric cryptography to
authenticate the remote computer and, when mutual authentication is
required, to authenticate the client. SSH was first released in 1995 and was
developed by Tatu Ylonen, at Helsinki University of Technology. His goal
was to replace insecure protocols such as Telnet, rsh, and rlogin. SSH
version 1 was released as freeware. By 1999, OpenSSH had been released
and is still a very popular version of SSH.
SSH version 2 has an internal architecture with specific layers responsible
for particular functions:
The transport layer handles the key exchange and authentication of the
server. Keys are re-exchanged usually after either one hour of time has
passed or 1 gigabyte of data has been transmitted. This renegotiation
of keys is a significant strength for SSH.
The user authentication layer is responsible for authenticating the
client. There are a few ways this can be done—the two most common
are password and public key. The password method simply checks the
user’s password. The public key method uses either DSA or RSA key
pairs to verify the client’s identity, and can also support X.509
certificates.
Generic Security Service Application Program Interface (GSSAPI)
authentication is variation of SSH authentication to allow for the use
of either Kerberos or NTLM to authenticate. While not all versions of
SSH support GSSAPI, OpenSSH does.
SSH can be used to provide secure file transfer with technologies such as
Secure Copy (SCP), SSH File Transfer Protocol (SFTP), and Files
transferred over SSH (FISH).
SSH can be configured to use several different symmetric algorithms,
including AES, Blowfish, 3DES, CAST-128, and RC4. The specific
algorithm is configured for each SSH implementation. The first issue
quantum computing will alter is the use of particular symmetric algorithms.
I anticipate that 3DES and CAST-128 will no longer be supported. Blowfish
and AES should be supported but with larger key sizes. Of course, the
asymmetric algorithms used in key exchange and authentication will also
need to be changed. Given that SSH is distributed with most Linux
distributions, this will require alterations to Linux for most vendors such as
Red Hat, Mint, Ubuntu, etc.
Summary
This chapter discussed the practical implications of quantum computing on
cryptographic implementations. Specific algorithms were explored,
including the impact that quantum computing will have on the use of those
algorithms. Perhaps most importantly, common applications of
cryptography were explored, and the necessary changes to accommodate
quantum-safe cryptography were discussed.
Test Your Skills
Review Questions
1. Assuming practical, working quantum computers, what change will be
needed for AES?
a. None. It will not be affected.
b. It will need to be replaced.
c. It will need larger key sizes.
d. It will have to be combined with a hashing algorithm.
2. Assuming practical, working quantum computers, what change will be
needed for CAST-128?
a. None. It will not be affected.
b. It will need to be replaced.
c. It will need larger key sizes.
d. It will have to be combined with a hashing algorithm.
3. The ability to solve the Discrete Logarithm Problem impacts which
algorithm(s)?
a. RSA
b. DH
c. ECC
d. AES
4. Once quantum computers become a practical reality, how much change
will the X.509 standard require?
a. None
b. Minimal
c. Substantial overhaul
d. It will need to be replaced.
5. Why are symmetric algorithms less impacted by quantum computing
than asymmetric?
a. Their long key sizes make them quantum safe.
b. Their use of confusion and diffusion makes them quantum safe.
c. They are impacted as much as or more than asymmetric
algorithms.
d. They are not predicated on specific mathematical problems that a
quantum computer can solve.
Chapter 13
Lattice-based Cryptography
Chapter Objectives
After reading this chapter and completing the review questions, you
will be able to do the following:
Understand the basis for lattice-based cryptography
Demonstrate a working knowledge of specific algorithms
Comprehend how these algorithms can be quantum resistant
Appreciate the principles of lattice reduction attacks
In previous chapters, we covered the fundamentals of quantum computing.
Chapter 12, “The Impact of Quantum Computing on Cryptography,”
explored the impact of quantum computing on cryptography and
cybersecurity. This chapter explores a potential answer to the impact of
quantum computing on cryptography. Lattice-based algorithms have been
proposed as quantum-resistant asymmetric algorithms.
Lattice-based algorithms are cryptographic algorithms predicated on
mathematical problems related to lattices. Recall that the security of RSA is
based on the computational difficulty of factoring an integer into its prime
factors. Diffie-Hellman, and its variations, have security based on the
computational difficulty of solving the discrete logarithm problems. The
various elliptic curve–based algorithms depend on the difficulty of solving
the discrete logarithm in reference to an elliptic curve and a point not on the
curve. All of these currently used algorithms have security predicated on
some mathematical problem. Lattice-based algorithms have security based
on mathematical problems related to lattices.
Before we explore specific problems, then algorithms, it is important to
understand lattices. Presumably you recall the material from Chapter 1,
“Introduction to Essential Linear Algebra.” If you are not completely clear
on those topics, you should review that chapter before continuing with this
one. Lattices are matrices and can be any number of dimensions, though for
ease of presentation, most books demonstrate two-dimensional matrices.
Each column represents a vector. The matrices used in lattice-based
cryptography are much larger than the matrices one typically sees in
textbooks; otherwise, solving mathematical problems based on a lattice
would be a trivial task to solve, and encryption based on lattices would be
easily broken.
This chapter explores the mathematical basis for lattice-based cryptography
in more detail, but first a brief introduction. Lattice-based cryptography is
simply cryptographic systems based on some problem in lattice-based
mathematics. One of the most commonly used problems for lattice-based
cryptography is the Shortest Vector Problem (SVP). Essentially, this
problem is, given a particular lattice, how do you find the shortest vector
within the lattice? More specifically, the SVP involves finding the shortest
nonzero vector in the vector space V, as measured by a norm, N. A norm is
a function that assigns a strictly positive length or size to each vector in a
vector space. The SVP is a good choice for post-quantum computing.
Asymmetric cryptography is based on mathematical problems that are
difficult to solve. In fact, the problems are so difficult to solve that no
solution can be found within a practical period of time.
Another mathematical problem for lattices is the Closest Vector Problem
(CVP). This problem is summarized as, given a vector space V, and a metric
M for a lattice L and a vector v that is in the vector space V, but not
necessarily in the lattice L, find the vector in the lattice L that is closest to
the vector v. This problem is related to the previously discussed Shortest
Vector Problem and is also difficult to solve.
In Equation 13.1, the values b1…bn are basis vectors. Alternatively, this
can be expressed as the sum (Σ) of the vectors x that are all elements of the
set of integers (Z).
A lattice consists of vectors. Lattices use linearly independent vectors. A set
of vectors is described as linearly dependent if any one of the vectors in the
set can be defined as a linear combination of the other vectors. Conversely,
if there is no vector in the set that can be defined in this manner, then the
vectors are described as linearly independent. These vectors form the basis
for a lattice.
This is one aspect of the definition of a lattice, but not the only one. Lattices
also appear in geometry and group theory. Consider the real numbers Rn. A
lattice is a subgroup of the group Rn, which is isomorphic to the integer
group Zn. This, of course, requires that we define what a subgroup is. In
group theory, a subgroup is defined as follows: if G is a group under some
operation, and H is a subset of G that also forms a group under that
operation, then H is a subgroup of G. Consider the group of integers under
the operation of addition. This is clearly a subgroup of the group of rational
numbers under the operation of integers.
It is also important that you understand the term isomorphic in this context.
One often sees that term used in connection with graph theory; however, it
has applications in group theory and other areas of mathematics. In any area
of mathematics, an isomorphism is a mapping between two structures that
preserves the structures and can be reversed via an inverse mapping.
Isomorphisms are important because two isomorphic structures will also
have the same properties.
One, somewhat trivial example is the group of real numbers with respect to
addition (R,+). This group is isomorphic with the group of positive real
numbers with multiplication (R+,×).
Now that we have defined the concept of lattices from two different
perspectives, we can explore lattices a bit further. Some of this material is
new and some is a brief review of some concepts in Chapter 1. These are
critical concepts in order for you to understand lattice-based cryptography.
The term vector space is quite central to lattice-based cryptography. First,
consider a vector. A vector is a group of values. The values can be real
numbers, complex numbers, integers, etc. A set of such vectors that is
closed under vector addition and closed under scalar multiplication is a
vector space. Put a bit more formally, consider a set of vectors V, and within
that set select any two vectors, w and v, and a scalar α. The following must
be true for V to be a vector space:
Given v, w ∈ V, v + w ∈ V
Given v ∈ V and a scalar α, αv ∈ V
These are not the only property of vector spaces. There are a number of
associativity and commutativity properties. However, the two properties
just listed are generally the ones that limit some set of vectors to being a
vector space or not. However, in the interest of completeness, here are the
additional properties given vectors v and w in vector space V along with
scalar α:
v + w = w + v (commutativity of addition).
(u + v) + w = u + (w + v) (associativity of addition).
α (v + w) = αv + αw (distributive).
(α + β)v = αv + βv (distributive).
There is a vector z ∈ V such that z + v = v (i.e., a zero vector).
For each v, there is a −v ∈ V such that v + (−v) = z (additive inverse).
Vectors have a number of practical applications, but for our current purpose
we can simply consider them as mathematical objects. The dimension of a
vector space V is the number of vectors over its base field. This is often
called the cardinality of the vector space V. A set of vectors B form a basis
in a vector space V, if every vector in V can be written as a finite linear
combination of the vectors in B. Then B is the set of basis vectors for the
vector space V. It is certainly possible that a vector space V can have more
than one basis set B. However, all such bases must have the same number
of elements, as that is the dimension of the vector space V.
Another concept from linear algebra that is used frequently in lattice-based
cryptography is orthogonality. Two elements in a vector space (u and v) are
said to be orthogonal if their dot product is zero. A dot product is the sum of
the products of the corresponding elements of the two vertices. Essentially,
the dot product is used to produce a single number, a scalar, from two
vertices or two matrices. This is contrasted with the tensor product. In math,
a tensor is an object with multiple indices, such as a vertex or array. The
tensor product of two vector spaces V and W, V ⊗ W, is also a vector
space.
Unimodular matrices are also used in some lattice-based algorithms. A
unimodular matrix is a square matrix of integers with a determinant of +1 or
−1. A determinant is a value that is computed from the elements of a square
matrix. The determinant of a matrix A is denoted by |A|. Here is an example
of a unimodular matrix:
Recall from Chapter 1 that we take three submatrix determinants to get the
determinant of this matrix:
13.2.1 NTRU
NTRU (N-th degree Truncated polynomial Ring Units) was first publicly
described in 1996 by Jeffery Hoffstein, Jill Pipher, and Joseph Silverman.
There have also been additional variants of this algorithm developed since
its initial publication. NTRU can best be defined as a group of related
cryptographic algorithms. This group of algorithms has been one of the
most studied lattice-based cryptosystems. It is a very important group of
algorithms, particularly due to the fact that two variations of NTRU have
made it past round two of the NIST project to find a quantum-resistant
cryptography standard.
NTRU is based on the Shortest Vector Problem in a lattice. The security of
NTRU is predicated on the computational difficulty of factoring certain
polynomials in a given truncated polynomial ring. This requires that we
briefly explore the concept of polynomial rings, for those readers who
might not be familiar with them.
A polynomial ring is a ring formed from the set of polynomials in one or
more indeterminates (i.e., variables) with coefficients in another ring.
Recall the discussion of rings in Chapter 1. A ring is a set with two
operations, an identity element, and the inverse operation of the first
operation. A polynomial is an expression that consists of variables and
coefficients. Another term for the variable is indeterminate, as it was in the
definition of a polynomial ring.
Consider, as an example of a polynomial ring, the ring R[X]. This is a ring
in X over a field r with the coefficients of p. This can be defined as follows:
p = p0 + p1X + p2X2 + … + pn−1Xn−1 + pnXn
A truncated polynomial ring is a ring made up of polynomials only up to
some set degree. Essentially, the degree of the polynomial is limited or
truncated.
For those readers who would like a more rigorous mathematical treatment
of polynomial rings, I recommend the following resources:
https://people.seas.harvard.edu/~salil/am106/fall09/lec16.pdf
http://www.math.umd.edu/~immortal/MATH403/lecturenotes/ch16.pdf
Now with that preliminary mathematical information covered, we can
return to the NTRU algorithm. NTRU specifically utilizes the truncated
polynomial ring shown in Equation 13.3.
R = Z[x]/(xN − 1)
EQUATION 13.3 NTRU’s Truncated Polynomial Ring
h = pfqg(mod q)
EQUATION 13.4 NTRU Key Generation, Step 2
The h is the public key. The polynomials f, fp, and g are the private key.
Now that we have a key, how do we apply it to encryption and decryption?
We will use the traditional Alice and Bob for this discussion. Assume some
message m that is in the form of a polynomial. We already have h and q.
Alice wants to encrypt the message m and send it to Bob. Alice now
chooses some random polynomial r, usually with small coefficients. Now to
encrypt, Alice performs the equation shown in Equation 13.5.
e = r * h + m (mod q)
EQUATION 13.5 NTRU Key Generation, Step 3
When Bob receives this message, he will need to decrypt it. Bob takes the
encrypted message e and uses Equation 13.6 to decrypt.
a = f * e (mod q)
EQUATION 13.6 NTRU Key Generation, Step 4
a = f * (r * h + m ) (mod q)
EQUATION 13.7 NTRU Key Generation, Step 5
The key generation process should tell you that h is really pfqg(mod q), so
we can rewrite Equation 13.7 to what you see in Equation 13.8.
a = f * (r * pfq * g + m) (mod q)
EQUATION 13.8 NTRU Key Generation, Step 6
You don’t have to consider the permutation of the decryption equation. You
can stay with the a = f * e (mod q) version. It was just important that you
fully understand the process. Now Bob will need to calculate a polynomial,
typically called b, that satisfies Equation 13.9.
b = a (mod p)
EQUATION 13.9 NTRU Key Generation, Step 7
Recall Bob’s secret key was f, fp, and g, and we have not used all of those
values yet. Now, using Equation 13.10, Bob will use them to get back the
message m that Alice sent.
m = fp * b (mod p)
EQUATION 13.10 NTRU Key Generation, Step 8
13.2.2 GGH
The GGH algorithm, which is named after the surnames of its inventors,
Oded Goldreich, Shafi Gold-wasser, and Shai Halevi, is a widely studied
lattice-based cryptosystem. It is an asymmetric algorithm that has been
demonstrated to be resistant to cryptanalysis. This algorithm was first
publicly described in 1997. The algorithm was constructed using the
Closest Vector Problem (CVP). The private key is a basis vector B of the
lattice L and a unimodular matrix U (recall the discussion of unimodular
matrices earlier in this chapter).
This basis vector has certain properties, such as vectors that are nearly
orthogonal vectors and a matrix U, which is unimodular. The public key is
another basis of the same lattice of the form B' = UB. The message M is a
message space that consists of the vector (m1, …, mn) in a range of −M <
mi < M.
The message is encrypted by multiplying the message vector by the public
key B'. This is shown mathematically in Equation 13.11.
c=v+e
EQUATION 13.12 GGH, Step 2
The e is an error correcting vector, (1, −1). To decrypt the message, the
cipher text, c, is multiplied by the inverse of B, B−1. Here it is put
mathematically:
M = c B−1
This is a relatively easy-to-understand algorithm. While it is well studied,
there have been successful cryptanalytical attacks. H. Lee and C. Hahn, in
2010, demonstrated that partial information of the plaintext can aid in
decrypting the GGH algorithm ciphertext. While their method was applied
against the highest dimension of GGH being proposed at the time, it also
required coupling with Nguyen’s attack. The Lee and Han method also
required some knowledge of the plaintext; thus, it can be argued this
cryptanalysis of GGH is intriguing but unlikely to represent real-world
cryptanalysis conditions.
The study conducted by Charles de Barros and L. M. Schechter in 2015
suggested enhancements to GGH. The authors began by describing GGH
succinctly, as follows:
“Its main idea is to encode a message into a lattice vector v, add some
small perturbation r and generate the ciphertext c= v+r. The norm of
the vector r must be sufficiently small, so the v is the lattice vector
closest to c.”
They then described the most direct way of attacking GGH, which is to
reduce the public key in order to find a basis to apply Babai’s algorithm. de
Barros and Schechter further stated that even if the private key cannot be
derived, the message may be retrievable.
Zeroizing attacks have been successful against several variations of GGH.
In their 2015 paper “ Crypt-analysis of the Quadratic Zero-Testing of
GGH,” Brakerski et al. described these types of attacks as follows:
“Roughly speaking, Zeroizing attacks proceed by honestly computing
many top-level encoding of zero, then using the prescribed zero-
testing procedure to setup and solve a system of multilinear equations
in the secret parameters of the scheme. These attacks rely crucially on
the linearity of the zero-testing procedure, and so some attempts were
made recently to devise alternative zero-testing procedures which are
non-linear.”
13.2.3 Peikert’s Ring
The Peikert’s Ring algorithm is for key distribution, much like Diffie-
Hellman, which you saw in Chapter 11, “Current Asymmetric Algorithms.”
There are variations, such as the Ring Learning With Errors Key Exchange
algorithm (RLWE-KEX). This algorithm is designed to be secure against
quantum computer attacks.
Ring Learning With Errors (RLWE) works with a ring of polynomials
modulo some polynomial. Recall our discussion of polynomial rings earlier
in this chapter. The polynomial is often represented with the symbol Φ (x).
The coefficients are in the field of integers mod q. Multiplication and
addition are reduced mod Φ (x). The key exchange algorithm can be
generally described as follows:
There is some polynomial often expressed as
a(x) = a0 + a1x + a2x2 + … an−3xn−3 + an−2Xn−2 + an−1Xn−1.
The coefficients of this polynomial are integers mod q. The polynomial
itself is a cyclotomic polynomial. For those readers not familiar with
cyclotomic polynomials, this topic is a bit more rigorous mathematically.
You don’t necessarily need to have a full understanding of it to have a
general working knowledge of RLWE. However, for the sake of
completeness, it will be described here.
The short definition is that cyclotomic polynomials are polynomials whose
complex roots are primitive roots of unity. However, that is only helpful if
one is familiar with roots of unity, and roots in general. The nth root of
unity, where n is a positive integer, is some number x that satisfies the
rather simple equation shown in Equation 13.13.
xn = 1
EQUATION 13.13 Roots of Unity
This explains roots of unity, and I suspect that is rather simpler than you
might have feared. However, it does not explain the primitive roots of unity.
A given root of unity, we will call it n, is said to be primitive if it is not the
mth root of unity for some smaller m. To put this another way, assume you
have found a root of unity (xn = 1). In order to be considered a primitive
root of unity, it must also satisfy the condition shown in Equation 13.14.
xm ≠ 1 for m = 1, 2, 3, 4, …, x−1.
EQUATION 13.14 Primitive Root of Unity
Images
EQUATION 13.15 Nth Cyclotomic Polynomial
Next, the signal function will be used. This function has not yet been
described. The signal function is rather complex. If you don’t fully grasp it,
that won’t be an impediment to following the rest of key generation.
However, again, in the interest of completion, the signal function works as
follows:
First, you define a subset we will call E:
Images
The function is the characteristic function of the complement of E. The term
characteristic function can have different meanings in different contexts. In
this case, it is an indicator function of a subset. The term indicator function
means the function indicates membership in the subset. A 1 is returned if
the value is a member of the subset, and a 0 is returned if the value is not a
member of the subset. The actual signal function (S) is this:
S(v) = 1 if v ∈ E; S(v) = 0 if v ∉ E
Continuing on with key generation, we now use the signal function we just
described by applying it to each coefficient of kR:
w = S(kR)
The respondent’s key stream skR is calculated by
skR = Mod2(kR, w)
Now the respondent will send the w and the pR to the initiator.
The initiator receives those two values and now will take a sample èI from
Xα and compute
KI = pRsI + 2èI
The sKI mod2(KI, w) is the initiator’s key stream.
You might be thinking this is quite a complex series of steps—and you
would be correct. This is clearly more complex than key generation in GGH
or NTRU. It is also more complex than key generation for Diffie-Hellman,
which you saw in Chapter 11.
The security of this key exchange algorithm will depend on the sizes of the
parameters. Frequently, sizes such as n = 1024, q = 40961, and Φ(x) = x1024
+ 1 are suggested (or similar sizes). There has been a substantial amount of
research focusing on variations in parameter sizes in order to achieve an
acceptable level of security, while also preserving an adequate efficiency.
Images
EQUATION 13.16 Gram-Schmidt Process Projection Operator
In Equation 13.16, <u, v> represents the inner product of the vectors u and
v. This projection projects the vector v orthogonally onto the line spanned
by vector u.
The Gram-Schmidt process then goes through a series of projection steps,
the details of which are not critical for us in this discussion. However, the
Gram-Schmidt coefficients are relevant and are shown in Equation 13.17.
Images
EQUATION 13.17 Gram-Schmidt Coefficients
Then the LLL algorithm will reduce the basis B if there is a parameter,
usually denoted by δ, such that
This might seem rather convoluted and not really clear to some readers. So,
let us explore it just a bit. The first issue is the parameter δ. The key to LLL
is finding the correct parameter. Lenstra, Lenstra, and Lovász originally
used δ = 3/4. Others have used δ = 1 and δ = 1/4. Finding the right
parameter is part of the issue of getting LLL to work properly. Next, let us
address B and B*. B is the set of basic vectors for the lattice L. B* is the
Gram-Schmidt process orthogonal basis. The concept is to find reduced
basis vectors so that one can solve the lattice problem and potentially break
a cryptographic algorithm that depends on that lattice problem.
It is also worth noting that lattice reduction in general and LLL in particular
are not guaranteed to work in breaking an algorithm. They simply have a
probability of doing so. And even when these methods do work, they are
not instantaneous. In fact, they can take substantial time. The focus on these
algorithms is that they can break a lattice-based cryptographic algorithm in
less time than would otherwise be required. The key to take away from this
discussion of LLL is that any proposed lattice-based algorithm should be
thoroughly analyzed in light of lattice reduction algorithms. For those
readers familiar with Mathematica, it has a function called LatticeReduce
that uses LLL. There is also a standalone implementation of LLL in fplll
available on GitHub https://github.com/fplll/fplll.
13.4 Summary
This chapter introduced lattice-based problems and lattice-based
cryptographic algorithms. These are important issues to understand, as they
are part of the work to find cryptographic algorithms that are resistant to
quantum computer attacks. While the focus of this book is on quantum
computing itself, quantum-resistant cryptography is part of that topic. You
also saw a brief introduction to lattice reduction methods for attacking
lattice-based cryptography.
Review Questions
1. Which of the following is the most accurate definition of a subgroup?
a. If G is a group under some operation, and H is a subset of G that
also forms a group under that operation, then H is a subgroup of
G.
b. If G is a group under some operation and its inverse, and H is a
subset of G, then H also forms a group under that operation, and
H is a subgroup of G.
c. If G completely contains H, then H is a subgroup of G.
d. If H has the elements all in G and has the same operations as G,
then H is a subgroup of G.
2. Which of the following is a property required for V to be a vector
space?
a. Given v, w ∈ V, v + w ∈ V.
b. Given v, w ∈ V, vw ∈ V.
c. Given v ∈ V and a scalar α, αv ∈ V.
d. Given v ∈ V and w ∉ V, vw ∉ V.
3. A ______ lattice is a lattice that is closed under a rotational ____
operator.
a. unitary, shift
b. unimodular, scalar
c. cyclic, scalar
d. cyclic, shift
4. What does the following describe? Given an m × n lattice A, which is
composed of m uniformly random vectors (which are integers), also
stated as Images, find a nonzero short integer vector v satisfying such
that Ax = 0 mod q.
a. Shortest Vector Problem
b. Closest Vector Problem
c. Shortest Integer Problem
d. Closest Integer Problem
5. _____ was first publicly described in 1996 by Jeffery Hoffstein, Jill
Pipher, and Joseph Silverman. There have also been additional variants
of this algorithm developed since its initial publication.
a. Ajtai
b. NTRU
c. GGH
d. Peikert’s Ring
6. _____ was the first lattice-based cryptographic algorithm published.
a. Ajtai
b. NTRU
c. GGH
d. Peikert’s Ring
7. The equation R = z[x]/(xN − 1) is most closely associated with what
algorithm?
a. Ajtai
b. NTRU
c. GGH
d. Peikert’s Ring
Chapter 14
Multivariate Cryptography
Chapter Objectives
After reading this chapter and completing the review questions, you
will be able to do the following:
Understand the basis for multivariate cryptography
Demonstrate a working knowledge of specific algorithms
Comprehend how these algorithms function
The term multivariate cryptography refers to cryptographic primitives that
are based on multivariate polynomials over a finite field F. These
algorithms have been proposed as quantum resistant. Some of these
algorithms are part of the NIST project seeking a quantum-resistant
standard. You can visit that website at https://csrc.nist.gov/projects/post-
quantum-cryptography.
14.1 Mathematics
The algorithms in this chapter require you to use some mathematics we
have covered in previous chapters as well as some that may be new to some
readers. For this reason, we have this brief section introducing you to
mathematical concepts you will need. We also review briefly the critical
mathematics needed with regard to specific algorithms in the sections on
those algorithms.
Recall from Chapter 1, “Introduction to Essential Linear Algebra,” that a
field is an algebraic system consisting of a set, an identity element for each
operation, two operations, and their respective inverse operations. You can
think of a field as a group that has two operations rather than one, and it has
an inverse for both of those operations. A finite field is just a field that is
limited or finite. Chapter 11, “Current Asymmetric Algorithms,” discussed
finite fields in relationship to elliptic curve cryptography.
One new concept we need to explore is that of an extension field. If we
have a field F, then we have a field E ⊆ F, such that the operations of E are
those of F, and we can say that E is a subfield of F and that F is an extension
field of E.
A polynomial is an expression consisting of variables and coefficients, such
as you see in Equation 14.1.
x2 + 3x − 12
EQUATION 14.1 A Polynomial
x2 + 3y − 12z
EQUATION 14.2 A Polynomial with Multiple Variables
14.2 Matsumoto-Imai
Published by Tsutomu Matsumoto and Hideki Imai in 1988, the
Matsumoto-Imai cryptographic algorithm was one of the first published
multivariate systems, which makes it important to study. This cryptographic
system was later broken, so it is not currently used; however, its importance
in the history of multivariate cryptography warrants a brief examination.
The system begins with a finite field we will call F, with q elements. Then
we have g(X), which is an irreducible polynomial of degree n over the field
F. Then we have a second field, which we will call E. E is an extension of F,
of degree n. Here it is put another way:
E = F[x]/g(x).
Next, we identify an isomorphism between the vector space Fn and the
extension field E. We will designate this isomorphism as ϕ. Equation 14.3
describes this isomorphism.
The value of θ in Equation 14.4 is 0 < θ < n, and the gcd (qn – 1, qθ + 1) =
1.
To be able to invert the map F, the extended Euclidian algorithm is used to
compute an integer h such that h(qθ + 1) = 1 mod (qn − 1). Using the
Euclidean algorithm (discussed in Chapter 10) to invert F (to get F−1), we
have what is shown in Equation 14.5.
w = P(z) ∈ Fn
EQUATION 14.6 Matsumoto-Imai Encryption
To decrypt the process is a bit more involved. There are steps to be taken,
beginning with the ciphertext w:
1. x = S−1(w) ∈ Fn
2. X = ϕ (x)
3. Y = F − 1 (X)
4. y = ϕ−1 (Y)
5. z = T (y)
Figure 14.2 shows the general relationship of the elements in the system.
Next, consider some value h such that h = qθ + 1 for some value of θ and 0
< h < qn. And along with h = qθ + 1, consider the greatest common
denominator, gcd (h, qn −1) = 1. Put in other terms, h and qn − 1 have no
common factor other than 1 and are thus co-prime or relatively prime. This
all leads to a map of u → uh on G that is one to one. The inverse map is u
→ uh’, where h’ is the multiplicative inverse of h mod qn − 1.
The concept of the HFE cryptosystem is to build the secret key, beginning
with a polynomial P in one unknown x over some finite field ⊆. It should
be noted that in actual practice, q = 2 is commonly used, though n can be
any number (preferably quite large). Now that we have this field ⊆ and we
have a polynomial P, one can find solutions to the equation P(x) = y, if such
solutions exist. The polynomial (p1, p2, …, pn) is transformed so that the
public information hides the structure and prevents inverting it. This is
accomplished by using the finite fields ⊆ as a vector space over Fq and
selecting two linear affine transformations.
The values of S, P, and T constitute the private key. Just as a refresher, our
polynomial P, along with our two affine transformations, S and T, are the
private key. The public key is the (p1, …, pn) of a finite field Fq.
X = ϕ (x)
EQUATION 14.10 HFE Decryption, Step 1 (Alternate
Expression)
The next step is to find the solutions Y1, …, Yk of F(Y) = X. This is shown
in Equation 14.11.
y = {Y ∈ E : F (Y) = X}
EQUATION 14.11 HFE Decryption, Step 2
yi = ϕ−1(Yi)
EQUATION 14.12 HFE Decryption, Step 3
The plaintext is then generated by Equation 14.13.
zi = T−1 (yi)
EQUATION 14.13 HFE Decryption, Final Step
There have been several variations of HFE, each of which has its own
strengths and weaknesses; however, the existence of these variations further
illustrates the value of HFE.
P : Fn → Fm
EQUATION 14.14 MQDSS System
The coefficients are chosen randomly. Those coefficients are then fixed for
the users utilizing this particular implementation of MQDSS. Each user
then choses a random vector s from the Fn as his or her private key. Put
more clearly, the users choose an s such that
s ∈ Fn
The public key is computed as follows:
k = P(s) ∈ Fm
To be verified, a user of the system will need to demonstrate he or she
knows a solution of the quadratic system P(x) = v without revealing any
information about his or her private key, s. The specifics of how that is
proved are not really necessary for our current purposes. The issue to
understand is that this system is provably secure.
14.5 SFLASH
The SFLASH algorithm was created for the New European Schemes for
Signatures, Integrity and Encryption (NESSIE) project. NESSIE was a
European project from 2000 to 2003 to identify secure cryptography
algorithms. The project reviewed symmetric, asymmetric, and hashing
algorithms.
SFLASH was designed as a digital signature algorithm. The first item of
note about this algorithm is that it is substantially faster than RSA. It is
important to keep in mind that security is only one aspect of a successful
algorithm. In order to be of practical use, the algorithm must also be
efficient. To better understand this, imagine there is an asymmetric
algorithm that is measurably more secure than RSA, Elliptic Curve
Cryptography, NTRU, and GGH; however, that algorithm requires 30
minutes to encrypt a message. How could such an algorithm be used for
applications like e-commerce? Consumers are unlikely to embrace an e-
commerce website that requires 30 minutes for checkout.
SFLASH is a variant of Matsumoto-Imai. Thus, understanding the
mathematics of that algorithm will aid you in understanding the SFLASH
algorithm. The idea is to remove a small number of equations from the
public key. As with Matsumoto-Imai, we begin with a finite field F that has
q elements. We also have an extension field E of n degrees. Then we define
an isomorphism, ϕ Fn → E. Key generation is very similar to the key
generation of Matsumoto-Imai. There is a parameter θ such that (qn – 1, qθ
+ 1) = 1.
The next step is to define a univariate map shown in Equation 14.15.
F: E → E, F(Y) = Yqθ+1
EQUATION 14.15 SFLASH Univariate Map
S o ϕ−1
EQUATION 14.17 SFLASH Public Key
14.6 Summary
This chapter focused on multivariate cryptography. Some of the
mathematics might have been new for some readers. The algorithms in this
chapter are all viable candidates for quantum resistant cryptography and
thus worthy of study. Combining this chapter with Chapter 13, “Lattice-
based Cryptography,” and Chapter 15, “Other Approaches to Post-Quantum
Cryptography,” will provide you with a solid general understanding of
quantum computing–resistant cryptographic algorithms.
Review Questions
1. Which of the following is the most accurate description of a field?
a. A set, an identity element for one operation, one operation, and
its inverse operation
b. A set, an identity element for each operation, two operations, and
an inverse for one of those operations
c. A set, an identity element for one operation, two operations, and
their respective inverse operations
d. A set, an identity element for each operation, two operations, and
their respective inverse operations
2. A bijective map F: E → E over the extension field E is most closely
associated with which algorithm?
a. Matsumoto-Imai
b. Hidden Field Equations
c. SFLASH
d. MQDSS
3. gcd (h, qn − 1) = 1 is most closely associated with which algorithm?
a. Matsumoto-Imai
b. Hidden Field Equations
c. SFLASH
d. MQDSS
4. Which algorithm has a public key k = P(s) ∈ Fm?
a. Matsumoto-Imai
b. Hidden Field Equations
c. SFLASH
d. MQDSS
5. ________signature algorithm is substantially faster than RSA.
a. Matsumoto-Imai
b. Hidden Field Equations
c. SFLASH
d. MQDSS
Chapter 15
15.1.1 Merkle-Damgaard
Many cryptographic hashing algorithms have at their core a Merkle-
Damgaard construction. First described in Ralph Merkle’s doctoral
dissertation published in 1979, a Merkle-Damgaard function (also called a
Merkle-Damgaard construction) is a method for building hash functions.
Merkle-Damgaard functions form the basis for MD5, SHA-1, SHA-2, and
other hashing algorithms.
The Merkle-Damgaard starts by applying a padding function to create an
output that is of some particular size (256 bits, 512 bits, 1024 bits, etc.). The
specific size will vary between algorithms, but 512 bits is a common size
that many algorithms use. The function then processes blocks, one at a time,
combining the new block of input with the previous round block. As an
example, consider a 1024-bit message that you break into four separate
256-bit blocks. Block 1 will be processed, and then its output is combined
with block 2 before block 2 is processed. Then that output is combined with
block 3 before it is processed. Finally, that output is combined with block 4
before that block is processed. Thus, Merkle-Damgaard is often referred to
as a compression function, as it compresses all the message into a single
output block. The algorithm will start with some initial value or
initialization vector that is specific to the implementation. The final
message block is always padded to the appropriate size (256 bits, 512 bits,
etc.) and includes a 64-bit integer that indicates the size of the original
message.
15.1.2 SWIFFT
Sliding Windowed Infinite Fast Fourier Transform (SWIFFT) is actually
not a single algorithm but rather a collection of functions. These are
provably secure hash functions. The SWIFFT functions are all based on the
fast Fourier transform (FFT). Therefore, a logical place for us to begin is a
brief exploration of the FFT.
An FFT is an algorithm that computes the discrete Fourier transform of a
sequence to a representation in the frequency domain. It is called “fast”
because it reduces the number of computations needed for N points from
2N2 to 2N log2 N.
Now let us walk through this algorithm, step by step.
The first step is to select a polynomial variable. This is often denoted with
the symbol α.
Now you will input the message you wish to encrypt. That message is
frequently denoted with a capital M and has a length of mn. The values of
mn are defined by the length of M, as you will see in the next steps.
The next step is to convert the message M into a collection of m
polynomials. These polynomials are denoted by pi and are polynomials
within some polynomial ring R. Recall the definition of a polynomial ring
from Chapter 13: A polynomial ring is a ring formed from the set of
polynomials in one or more indeterminates with coefficients in another ring.
Recall that we discussed rings in Chapter 1, “Introduction to Essential
Linear Algebra.” A ring is a set with two operations, an identity element,
and the inverse operation of the first operation. A polynomial is an
expression that consists of variables and coefficients. Another term for
variable is indeterminate, as it was in the definition of a polynomial ring.
The next step is to compute the Fourier coefficients of each pi. These
Fourier coefficients are defined as ai and are fixed.
For the next step, you perform pointwise multiplication of the Fourier
coefficients pi with the Fourier coefficients of ai, for each i. This will then
be followed by using an inverse fast Fourier transform to yield m
polynomials fn, each of a degree less than 2n.
For the next step, you will compute the following formula:
Finally, you convert the f to n log(p) bits and output those bits.
The steps are summarized as follows:
STEP 1. Select a polynomial variable.
STEP 2. Input the message you wish to encrypt.
STEP 3. Convert the messages into a collection of m polynomials.
STEP 4. Compute the Fourier coefficients.
STEP 5. Perform pointwise multiplication of the Fourier coefficients pi
with the Fourier coefficients of ai.
15.2.1 McEliece
The McEliece cryptosystem is eponymously named after its inventor,
Robert McEliece. This algorithm was published in 1978. That makes it
perhaps the oldest algorithm being proposed as quantum resistant. Despite
its age, this algorithm has already been shown to be immune to Shor’s
algorithm.
The security of McEliece is based on the difficulty of decoding a general
linear code. For those readers not familiar with the topic, a brief description
of a general linear code is provided. A linear code is used for error
correction. There is a linear combination of codes. Linear codes are
frequently used in forward error correction. Hamming codes are a classic
example of a linear code. Hamming codes can detect errors and correct
them.
The algorithm has some parts that might seem vague. This is because there
is some flexibility in the linear codes one can choose. Thus, the specifics of
the linear code are not delineated in the algorithm. We will begin with key
generation, which is often the most complex part of an asymmetric
algorithm:
1. The person generating the key must select a linear code, which we
will call C. Linear codes often have functions that generate matrices;
we call those generators. So, there will be a generator G for the linear
code C. The C chosen should also give rise to a decoding algorithm
we will call A. The code is able to correct t errors.
2. The person generating the key must select a random k × k binary
nonsingular matrix we will call S. Recall that a nonsingular matrix is
a square matrix that is invertible.
3. The person generating the key chooses a random n × n permutation
matrix, which we will call P. A permutation matrix is a square binary
matrix that has exactly one entry of 1 in each row and each column
and 0s elsewhere.
4. The person generating the key needs to compute a k × n matrix,
which we will call H. This is computed by SGP (i.e., the nonsingular
matrix multiplied by the generator, then that product multiplied by the
permutation matrix).
The public key is (H, t), and the private key is (SPA).
Now to encrypt is relatively simple. The sender takes a message, m, that has
a binary length k. The sender then computes this simple formula:
ć = mH
Next, the sender generates a random n-big vector we will call z that
contains exactly t ones. The cipher text c = ć + z.
The recipient will decrypt with the following steps:
The original message, m, is then decrypted using this rather simple formula:
m = m`S−1
As you can see, the general process is not as complex as some of the
algorithms we have examined, both in this chapter and in Chapters 13 and
14. However, there are issues that we did not define. This is due to the fact
that the McEliece cryptosystem does not define what code C you must
select, and that selection will, in turn, determine the generator matrix G and
the decoding algorithm A. Therefore, when describing McEliece, these
aspects are not explicitly defined.
It is not critical that you have a deep understanding of these codes, but for
the interested reader, let us explore one type of code that is often used in
applications of the McEliece cryptosystem. These are binary Goppa codes.
Binary Goppa codes are a subset of the class of Goppa codes eponymously
named after Valerii Goppa.
A binary Goppa code is defined by a polynomial g(x) of degree t over some
finite field, usually denoted as GF(2m) and a sequence of n distinct elements
from GF(2m) that are not roots of the polynomial.
The McEliece cryptosystem originally used parameters n = 1024, k = 524,
and t = 50. Recent crypt-analyses suggest larger parameters such as n =
2048, k = 1751, t = 27, or even larger. For true resistance against quantum
computers, parameters of n = 6960, k = 5413, and t = 119, or larger, are
suggested. This yields a rather large public key of 8,373,911 bits. The most
important thing to remember about McEliece is that, like NTRU described
in Chapter 13, this algorithm has made it to round three of the NIST
quantum computing standards selection process.
The public key is (Hp, t) and the private key is (S, H, P).
In order to encrypt a message, m, as a binary string, em, that is a string of
length t, the cipher text is generated with this formula:
c = Hp et
While the encryption is a bit simpler than with the McEliece system, the
decryption is quite reminiscent of the McEliece decryption:
1. Compute S−1c from HPmt (i.e., S−1c = HPmt).
2. Use the decoding algorithm for G to recover Pmt.
3. The message m = P−1PmT.
The operation used with the elliptic curve is addition (remember the
definition of a group requires a set along with an operation). Thus, elliptic
curves form additive groups.
Recall from earlier in this book that a group is an algebraic system
consisting of a set, an identity element, one operation, and its inverse
operation. An abelian group or commutative group has an additional axiom:
a + b = b + a if the operation is addition, or ab = ba if the operation is
multiplication. A cyclic group is a group that has elements that are all
powers of one of its elements.
The members of the elliptic curve field are integer points on the elliptic
curve. You can perform addition with points on an elliptic curve.
Throughout this chapter, as well as most of the literature on elliptic curve,
we consider two points: P and Q. The negative of a point P = (xP,yP) is its
reflection in the x-axis: the point −P is (xP,−yP). Notice that for each point
P on an elliptic curve, the point −P is also on the curve. Suppose that P and
Q are two distinct points on an elliptic curve, and assume that P is not
merely the inverse of Q. To add the points P and Q, a line is drawn through
the two points. This line will intersect the elliptic curve in exactly one more
point, called −R. The point −R is reflected in the x-axis to the point R. The
law for addition in an elliptic curve group is P + Q = R (Bos, et al., 2004).
The line through P and −P is a vertical line that does not intersect the
elliptic curve at a third point; thus, the points P and −P cannot be added as
previously. It is for this reason that the elliptic curve group includes the
point at infinity, O. By definition, P + (−P) = O. As a result of this equation,
P + O = P in the elliptic curve group. O is called the additive identity of the
elliptic curve group; all elliptic curves have an additive identity (see Figure
15.3).
FIGURE 15.3 P + (–P)
To add a point P to itself, a tangent line to the curve is drawn at the point P.
If yP is not 0, then the tangent line intersects the elliptic curve at exactly
one other point, −R, which is reflected in the x-axis to R. This operation is
called doubling the point P and can be seen in Figure 15.4.
FIGURE 15.4 Doubling the P
15.3.2 SIDH
Now that you have reviewed the basics of elliptic curves, we can move
forward to discuss supersingular isogeny Diffie Hellman (SIDH). We will
have to add a few additional concepts. First, consider the equation of an
elliptic curve:
y2 = x3 + ax + b
Now we add a new concept: the j-invariant of an elliptic curve. Let us
approach this a bit differently than some texts do. We will start from the
interpretation and then work on the math. Consider a model for an elliptic
curve E ⊂ P2. P is an element of E (i.e., P ∈ E). Recall from our previous
discussions of elliptic curves that one can draw lines through the curve.
There are lines the go through P and are tangent to E. These lines are
invariant.
The j-invariant for an elliptic curve described by the function y2 = x3 + ax +
b is given by this formula:
Images
When curves are isometric, they will have the same j-invariant over a
closed field. In this case, the term isometric means that there is a function
between two groups that establishes a one-to-one correspondence between
the group’s elements. Furthermore, the function respects the given group
operations. In Chapter 11, when we discussed elliptic curve cryptography,
we stated that the elliptic curves from algebraic groups. So, what is being
discussed here is the fact that if two curves are isometric, they will have the
same j-invariant (over a closed field).
This still leaves the term isogeny unexplored. In this context, an isogeny is a
morphism of algebraic groups that is surjective and has a finite kernel.
Kernels are an aspect of algebra we have yet to explore. For our purposes
now, all you need to know is that when you have a homomorphism (and an
isomorphism is a type of homomorphism), then the kernel is the inverse
image of 0. This requires a bit of explanation as to what an inverse image is.
Consider some function f that is a function from X to Y (the particulars of
the function are immaterial for our discussion). Now consider a set S ⊂ Y.
The inverse of S is the subset T, which is defined in the following way:
f−1|S| = {x ∈ T| f (x) ∈ S}
Recall from Chapter 8, “Quantum Architecture,” that surjective refers to a
function that for every element in Y, there is at least one element in X, and
that need not be unique. Figure 15.5, which originally appeared in Chapter
8 (and was also used in Chapter 14), should refresh your memory.
Now both Alice and Bob have exchanged materials, so they can create a
shared secret key.
Alice can use the parts she received from Bob as well as items she
generated, as follows:
Yes, this is a rather long process, with many steps. It also may stretch the
mathematics of some readers. However, it is one of the contenders for a
quantum-computer-resistant key exchange algorithm. Therefore, it is
worthwhile to reread this section a few times, if needed, to ensure you are at
least generally comfortable with the outline of the algorithm.
For those readers who want to delve more into this algorithm, there is an
excellent paper from the International Association of Cryptologic Research
(IACR) that will go into more depth: https://eprint.iacr.org/2019/1321.pdf.
It is often helpful when learning something new, particularly something that
is relatively challenging, to read two or more different explanations.
15.4 Summary
In this chapter, we have examined different types of algorithms that have
been proposed for quantum-resistant solutions. We have examined hash
functions, code-based cryptography, and supersingular isogeny key
exchange. Some of the math in this chapter might have been a bit rigorous
for some readers. Keep in mind that unless you intend to be working in the
field of quantum-resistant cryptography, it is not critical that you have every
nuance of every algorithm clear in your mind. As long as you have a
general understanding, that will be sufficient.
Review Questions
1. At the core of many cryptographic hash functions is a(n) __________.
a. Merkle-Damgaard construction
b. pseudo-random-number generator
c. isogeny
d. error correction code
2. Which of the following algorithms has a private key of (SPA)?
a. SWIFFT
b. SIDH
c. Lamport
d. McEliece
3. The ______ cryptosystem originally used parameters n = 1024, k =
524, and t = 50.
a. SWIFFT
b. SIDH
c. Lamport
d. McEliece
4. The_______ cryptosystem usually uses the binary Goppa code.
a. Niederreiter
b. McEliece
c. Lamport
d. SWIFFT
5. A finite field, also called a _______, is a field with a finite number of
elements.
a. torsion group
b. Galois field
c. abelian group
d. torsion field
6. When curves are _____, they will have the same j-invariant over a
closed field.
a. isomorphic
b. isometric
c. surjective
d. bijective
Part IV: Quantum Programming
Chapter 16
Working with Q#
Chapter Objectives
After reading this chapter and completing the review questions, you
will be able to do the following:
Understand the fundamentals of Q#
Write Q# programs
Create quantum simulations with Q#
Microsoft developed Q# as a relatively easy-to-use quantum programming
language. Microsoft first announced Q# in September 2018, and by
December 2018 it was released. Q# is based on C# for syntax structure but
includes the ability to create quantum logic gates as well as to simulate
entanglement.
If you have no experience in programming, do not be overly concerned. In
the section “Getting Started with Q#,” we will approach a basic Q# program
assuming you have no experience programming at all. There is also a
section titled “Basic Programming Concepts,” which is where we’ll begin.
In this case, you have just allocated 4 bytes of memory (the amount used by
integers), and you are using the variable j to refer to those 4 bytes of
memory. Now whenever you reference j in your code, you are actually
referencing a specific address in memory. Table 16.1 lists and describes the
basic data types available in Q#.
Data Description
Type
Unit Represents a singleton type whose only value is ().
Int Represents a 64-bit (4 byte) signed integer. Values range from
−9,223,372,036,854,775,808 to 9,223,372,036,854,775,807.
BigInt Represents signed integer values of any size.
Double Represents a double-precision 64-bit floating point number.
Values range from −1.79769313486232e308 to
1.79769313486232e308.
Bool Represents Boolean values (true/false).
String Represents text as values that consist of a sequence of UTF-16
(2 byte) code units.
Qubit Represents a qubit. Values of type Qubit are instantiated via
allocation.
Result Represents the result of a projective measurement onto the
eigenspaces of a quantum operator with eigenvalues ±1.
Possible values are 0 and 1.
Pauli Represents a single-qubit Pauli matrix. Possible values are
PauliI, PauliX, PauliY, and PauliZ.
Range Represents an ordered sequence of equally spaced Int values,
in ascending or descending order.
Array Represents values that each contain a sequence of values of the
same type.
Tuple Represents values that each contain a fixed number of items of
different types. Tuples containing a single element are
equivalent to the element they contain.
Each statement performs a different action, but it does perform some action,
and it ends with a semicolon. In many programming languages, the terms
statement and expression are used interchangeably. In Q#, an expression is a
special type of statement. Q# has some very specific statements. Table 16.2
shows the possible statement types.
Statement Description
Type
Variable Defines one or more local variables that will be valid for
declaration the remainder of the current scope, and it binds them to
the specified values. There are also variable reassignment
statements that change a variable’s value.
Expression An expression statement consists of an operation or
statement function call returning a Unit. The invoked callable needs
to satisfy the requirements imposed by the current
context.
Return A return statement terminates the execution within the
statement current callable context and returns control to the caller.
Fail A fail statement aborts the execution of the entire
statement program, collecting information about the current
program state before terminating in an error.
Iteration An iteration is a loop-like statement that during each
iteration assigns the declared loop variables to the next
item in a sequence (a value of Array or Range type) and
executes a specified block of statements.
Repeat Quantum-specific loop that breaks based on a condition.
statement The statement consists of an initial block of statements
that is executed before a specified condition is evaluated.
If the condition evaluates to false, an optional subsequent
fixup-block is executed before entering the next iteration
of the loop.
Conjugation A conjugation is a special quantum-specific statement,
where a block of statements that applies a unitary
transformation to the quantum state is executed, followed
by another statement block, before the transformation
applied by the first block is reverted again. In
mathematical notation, conjugations describe
transformations of the form U†VU to the quantum state.
Qubit Instantiates and initializes qubits and/or arrays of qubits
allocation and then binds them to the declared variables. Executes a
block of statements. The instantiated qubits are available
for the duration of the block and will be automatically
released when the statement terminates.
Note that we have an operation we call Hello. This particular program has
a single function/operation named Hello. Note that there is nothing in the
parentheses. Inside the parentheses is where you place arguments (also
called parameters) for the function. A parameter is what you pass to the
function in order for it to work. For example, in this case, in order to square
a number, we have to give it the number to square. Students often ask me,
what do I need to put as parameters? Do I even need any parameters for this
function? I will tell you the same thing I tell them. Ask yourself this
question: If I wanted some person to do this task for me, would I need to
give them anything? And if so, what? If you wanted a person to square a
number for you, you would have to give them that number; however, if you
just wanted them to say “hi,” you would not have to give them anything.
So, a function that squares a number should take one parameter, and a
function that displays “hi” on the screen might not take any parameters.
This operation has a single statement in it. It simply displays the message
“Hello quantum world!” Note that like all statements, it ends with a
semicolon. Also note there are brackets at the beginning of the operation
and at the end. Any coherent block of code—including functions, if
statements, and loops—begins and ends with brackets {}.
16.1.2 Control Structures
The most common type of decision structure is the if statement. These
statements exist in all programming languages but are implemented slightly
differently. An if statement literally says, “if some condition exists, then
execute this certain code.” Let’s look at how you do that in Q#. Here is a
basic example that we can dissect to help you learn about if statements:
Either example will iterate through the code within the brackets a finite
number of times. The differences are simply in how those iterations are
counted.
Also, using statements are frequently seen in Q#. Concerning using
statements, Microsoft states the following:
“It is used to allocate qubits for use in a block of code. In Q#, all qubits
are dynamically allocated and released, rather than being fixed
resources that are there for the entire lifetime of a complex algorithm.
A using statement allocates a set of qubits at the start, and releases
those qubits at the end of the block.”1
1. https://docs.microsoft.com/en-us/quantum/tutorials/explore-entanglement
SetQubitState(Zero, qubit);
}
Click View > Command Palette and select Q#: Create new project from
the screen shown in Figure 16.2.
Note that the first time you run this, Visual Studio Code will need to
download some items. You might also be prompted to allow Visual Studio
Code to communicate through your firewall.
Click Standalone console application.
Navigate to the location to save the project. Enter the project name and
click Create Project. When the project is successfully created, click Open
new project… in the lower right.
You will be prompted for a new location for your project, as shown in
Figure 16.3.
FIGURE 16.3 Save the program in Visual Studio Code
If you have Visual Studio 2017 or 2019, you can install the Microsoft
Quantum Development Kit for Visual Studio from
https://marketplace.visualstudio.com/items?itemName=quantum.quantum-
devkit-vscode.
You also have the option of using the Quantum Development Kit online for
free at https://www.microsoft.com/en-us/quantum/development-kit. The
Binder option is the free version. When you launch it, you will immediately
see samples, as shown in Figure 16.4. This is a great way to get started.
FIGURE 16.4 QDK Samples
We will assume you have no programming background and explain all of it.
The first line states the namespace and then has the name of your project
(whatever you selected when you created the project). A namespace allows
you to group related classes together.
Next, you see several open statements, as shown in Figure 16.6.
The first thing to note is this operation does not take in any parameters. It
does implement a using statement, which we discussed earlier in this
chapter. It is using a single instance of the Qubit class we simply called a.
The next thing you see is some text preceded by //, and it appears in green
in Visual Studio or Visual Studio Code. This is called a comment.
Comments are text that will be ignored by Visual Studio but are there to
provide information to whoever is reading them. It is a good idea to
comment on your code to indicate what it is you are trying to accomplish.
Also, when you are new to programming, or new to a particular language
such as Q#, a good tip for learning it is to get sample code and heavily
comment it. Go through all the sample code, commenting every line. This
can help you to understand every line. If you don’t understand a given part
of the code, put a comment stating as much. Then make it a point to go
back and seek out answers to all the code you don’t yet understand.
The function QuantumPseudoRandomNumberGenerator is actually
called from the function RandomNumberInRange. Therefore, we should
examine that operation next (note we are using the terms function and
operation interchangeably). You can see this function in Figure 16.8.
We are simply stating that the state |s> is a superposition of all possible
states |x>.
The next step is called the Grover iteration, r, and is executed N times. This
step r is simply to apply the operator Uω and apply the operator Us.
The third step is to perform the measurement of the observable Ω. This
measurement will provide some eigenvalue λω. As we iterate through the
process, we eventually get to the proper answer.
This review should help refresh your memory of Grover’s algorithm. In the
next section, we look at code that implements a simple version of Grover’s
algorithm.
16.3.2 The Code for Grover’s Algorithm
The code will be presented in sections, each described in light of the review
of Grover’s algorithm. Some of this depends on objects that are part of the
Quantum Development Kit. So, the first item to examine is the open
statements, as shown in Figure 16.10.
You might notice that there are more here than were in the random-number
generator discussed earlier in this chapter. Specifically, there are two that
were not in the previous code:
These are included because they contain specific classes we will need in
implementing Grover’s algorithm. The next part of the code is the function
ReflectMarked. As you can see in Figure 16.11, it is preceded by
comments, which are given to help explain what the function is doing.
FIGURE 16.11 ReflectMarked
You can see that this calls two functions: SetAllOnes and
ReflectAboutAllOnes. Both of these are passed an array,
InQubits. We also see something called Adjoint. This is a functor.
Functors (not functions) are something specific to Q#. To quote from
Microsoft:
“Functors are factories that allow to access particular specialization
implementations of a callable. Q# currently supports two functors;
the Adjoint and the Controlled functor, both of which can be applied
to operations that provide the necessary specialization(s).”2
2. https://docs.microsoft.com/en-us/quantum/user-
guide/language/expressions/functorapplication#functor-application
Notice this is the entry point for the program, and it should help
demonstrate for you how the other functions are used. First, we initialize a
uniform superposition, and then we search via reflecting operations. Finally,
we measure each qubit.
There is one more function that will simply tell you how many iterations are
needed to find a single marked item. This function was called in
NumberofIterations and is shown in Figure 16.15.
Much of this you have seen earlier in this chapter. We have the two gates, X
and H. We are also using the ApplyToEach operation. Note that this
function takes in another function, Uf. In this case, that function is one we
name BooleanFunction. That requires the two parameters for
BooleanFunction, and those are shown as well.
There are two other functions in our code: BooleanFunction and a
function named UnitaryOperation. Those are both shown in Figure
16.19.
First notice that this code depends a great deal on gates and measurements.
You see the X operation and the M operation that were discussed previously
in this chapter. Recall that X flips the state, and M measures it. The entry
point is the operation TestState, which tests the state of some qubit.
The function simply takes in a number of iterations to go through and an
initial value. Then it will go through flipping bits and outputting the result.
This is a rather simple program, but it will help you get more comfortable
with Q#.
16.6 Summary
In this chapter, you finally applied the knowledge you have learned to
actual programming tasks. If you worked through the projects in this
chapter, you should now have a basic working knowledge of Q#.
Furthermore, actually programming some of these algorithms should aid
you in understanding those algorithms better. There are also numerous
sources on the Internet you can consult:
Microsoft’s Quantum Computing Foundations:
https://docs.microsoft.com/en-us/learn/paths/quantum-computing-
fundamentals/
Microsoft Quantum Katas: https://docs.microsoft.com/en-
us/quantum/tutorials/intro-to-katas
Microsoft Q# User Guide: https://docs.microsoft.com/en-
us/quantum/user-guide/
Review Questions
1. In Q#, what data type represents the result of a projective measurement
onto the eigenspaces of a quantum operator with eigenvalues ±1?
a. EigenReturn
b. Return
c. Result
d. EigenResult
2. A(n) ___________ is a loop-like statement that during each iteration
assigns the declared loop variables to the next item in a sequence (a
value of Array or Range type) and executes a specified block of
statements.
a. iteration
b. repeat
c. for-next
d. while
3. __________ is the act of taking the data, and the functions that work
on that data, and putting them together in a single class.
a. Abstraction
b. Encapsulation
c. Inheritance
d. Polymorphism
4. What namespace are Pauli gates found in?
a. Microsoft.Quantum.Intrinsic
b. Microsoft.Quantum.Canon
c. Microsoft.Quantum.Gates
d. Microsoft.Quantum.Measurement
5. What does the Quantum Development Kit’s R operation do?
a. Rotate about the x-, y-, or z-axis.
b. Reset a given qubit.
c. Reset a given gate.
d. Rotate about a given Pauli axis.
Chapter 17
17.1.1 Instructions
QASM is based on instructions, and the various instructions are related
specifically to quantum operations and structures. The fact that so much of
what you need for quantum computing is built into the QASM language
makes it an excellent choice for learning quantum computing. For example,
the command qubits n initializes a qubit register of size n. By default,
all qubits are initialized in the |0〉 state.
There are three prep statements. With the prep instruction, qubits will be
explicitly initialized in the |0〉 state of a specific basis:
prep_z
prep_y
prep_x
The Pauli gates are also prearranged for you in QASM. There are three:
Pauli-X
Pauli-Y
Pauli-Z
Several other gates and measurements are available to you. Table 17.1
summarizes the most important ones.
Instruction Meaning
Pauli-X To use the Pauli-X gate on the first qubit, you use this
syntax:
X q[0]
Pauli-Y The Y gate is similar:
Y q[0]
Pauli-Z And here’s the Z gate:
Z q[0]
Hadamard To execute the Hadamard gate against the first qubit
is much like the Pauli gates:
H q[0]
Here’s how to execute the Hadamard (or any other
gate) against the first two qubits:
H q[0,1]
Identity I is the identity matrix/gate.
Rx This is the rotation operator; in this case, rotation
about the x-axis. Then use this on the first qubit:
Rx q[0]
Ry This is the rotation operator; in this case, rotation
about the y-axis. Then use this on the first qubit:
Ry q[0]
Rz This is the rotation operator; in this case, rotation
about the z-axis. Then use this on the first qubit:
Rx Z[0]
T gate Here’s how to execute the T gate on the first qubit:
T q[0]
CNOT gate The CNOT gate is a two-qubit operation, where the
first qubit is usually referred to as the control qubit
and the second qubit as the target qubit. This can be
used to entangle two qubits, as follows:
CNOT q[0], q[1]
SWAP gate The SWAP gate is a two-qubit operation. Expressed
in basis states, the SWAP gate swaps the state of the
two qubits involved in the operation:
SWAP q[0], q[1]
Toffoli gate Recall that this gate is sometimes called the
Controlled-Controlled NOT gate. Here’s an example:
Toffoli q[1], q[2], q[3]
measure_x All measurements measure in some basis. The
measure_x command will measure the qubit in the
x-basis.
measure_y All measurements measure in some basis. The
measure_y command will measure the qubit in the
y-basis.
measure_z All measurements measure in some basis. The
measure_z command will measure the qubit in the
z-basis.
measure_all This command will measure all the qubits in parallel
using the z-basis.
If you start the editor and define two qubits, you see the screen shown in
Figure 17.2.
FIGURE 17.2 Two qubits
Pay attention to the bottom of the screen, where you can see q[0] and q[1],
the two qubits. If you add any gates, you will see they get added at the
bottom. Adding a CNOT gate produces the change you see in Figure 17.3.
You can also execute multiple gates on a single qubit. In Figure 17.5, you
see multiple gates on each qubit and then gates on both. These are not done
to fulfill any particular algorithm, just to represent what you can do with
QASM.
FIGURE 17.5 Multiple gates
This is one of the most powerful aspects of using QASM. You can see the
circuits you are building graphically. That makes it quite easy to visualize
what you are constructing. Also, as you can see, writing the code is very
straightforward. You may find the implementations of algorithms in this
chapter easier to follow than those in Chapter 16.
17.1.2 Commands
QASM does have a number of commands for various tasks. In this section,
we examine some of the more common commands you will need to use.
Table 17.2 describes the commands you will need to know.
Command Definition
display The display outputs writes the current
state of the qubit register.
error_model The depolarizing channel error model
depolarizing_channel, causes a random error between each
0.001 operation on a qubit.
display_binary display_binary obtains the
contents of the binary register.
number of shots Algorithms can be deterministic or
nondeterministic. If they are
deterministic, they are single shot
(number of shots (N=1)) or multi-shot
(number of shots (N>1)).
With these instructions and commands, you will be able to follow along
with the code presented in this chapter. In fact, much of it may be almost
obvious to you. That is the power of QASM.
This will then open the editor with your new project, as shown in Figure
17.7.
FIGURE 17.7 New project editor
Selecting the backend will determine much of what you can do. Only some
backends are available with the free version. Quantum Inspire has two
quantum processors in addition to emulators. There are some restrictions on
what you can do with the actual processors. For more details, it is best to
refer to the documentation on this issue available at https://www.quantum-
inspire.com/kbase/hardware-backends/.
How will you detect errors? That is indeed a serious problem. Now our
solution here is effective, but inelegant. We will simply use two extra bits;
that way, we easily detect if there was a bit-flipping error. So now we use
the equation shown in Equation 17.2.
.Encoding
cnot q[0],q[1]
cnot q[0],q[2]
.Introduce_Error
x q[1]
.Error_Detection
cnot q[0],q[3]
cnot q[1],q[3]
cnot q[0],q[4]
cnot q[2],q[4]
measure q[3,4]
.Error_Correction
# Both b[3]=b[4]=0
#do nothing
# b[3]=b[4]=1
c-x b[3,4], q[0]
# b[3]=1,b[4]=0
not b[4]
c-x b[3,4],q[1]
not b[4]
# b[3]=0,b[4]=1
not b[3]
c-x b[3,4],q[2]
not b[3]
.Measurement
measure q[0:2]
In the editor, this code looks like what you see in Figure 17.8.
FIGURE 17.8 Error correction
The concept again is quite simple, but inefficient. By using three qubits, if
there is no error, we should have all three give the same result. If one has an
error, then we will have a single qubit that does not match. Due to the
obvious inefficiency of this approach, it is not recommended for actual
quantum computing; however, it is an excellent way for you to become
familiar with the concept. It also gives you practice working with QASM.
We are simply stating that the state |s> is a superposition of all possible
states |x>. The next step is called the Grover iteration, r, and is executed N
times. This step r is simply to apply the operator Uω and apply the operator
Us. The third step is to perform the measurement of the observable Ω. This
measurement will provide some eigenvalue λω. As we iterate through the
process, we eventually get to the proper answer. This review should help
refresh your memory of Grover’s algorithm. In the next section, we look at
code that implements a simple version of Grover’s algorithm.
.init
H q[0:2]
.grover(2)
# This is the quantum oracle discussed
{X q[0] | H q[2] }
Toffoli q[0], q[1], q[2]
{H q[2] | X q[0]}
# diffusion
{H q[0] | H q[1] | H q[2]}
{X q[1] | X q[0] | X q[2] }
H q[2]
Toffoli q[0], q[1], q[2]
H q[2]
{X q[1] | X q[0] | X q[2] }
{H q[0] | H q[1] | H q[2]}
This initializes a Hadamard gate. The next sections simply use different
gates: the Hadamard gate, Pauli-X gate, and Toffoli gate.
When shown in the editor, it looks like what you see in Figure 17.9.
This screen allows you to visualize a histogram of the output. Also notice
that at the top you see the number of shots, the execution time, and other
data. You can export your results as well. The online editor for QASM is
quite easy to use and convenient.
qubits 2
# The Deutsch–Jozsa algorithm an oracle is used to
# determine if a given binary function f(x) is constant or
# balanced.
# Constant f(x)=fc1=0 OR f(x)=fc2=1
# Balanced f(x)=fb3=x OR f(x)=fb4=NOT(x)
# The algorithm requires only a single query of that
# function f(x).
.oracle_fc1
# do nothing or I q[0:1]
#.oracle_fc2
# X q[1]
#.oracle_fb3
# CNOT q[0],q[1]
#.oracle_fb4
# CNOT q[0],q[1]
# X q[1]
.measurement
H q[0]
measure q[0]
As with the code we saw previously in this chapter, this is primarily just a
collection of gates operating on qubits—and that is what a great deal of
quantum programming is.
The Deutsch-Jozsa algorithm is relatively easy to implement in QASM. The
visualization of the gates and operations shown at the bottom of the editor is
quite helpful in understanding quantum algorithms.
17.6 Summary
In this chapter, you were introduced to QASM. Using the online tool at
https://www.quantum-inspire.com, you can access both simulators and
actual quantum processors. That makes QASM a very valuable tool for
learning quantum programming. It is best if you work through at least the
algorithms presented in this chapter. For more advanced readers, you may
wish to attempt to implement an algorithm that was not actually coded in
this chapter. Combining the information in Chapter 16 with this chapter,
you should have a comfortable working knowledge of quantum
programming.
Review Questions
1. The syntax T q[0] will do what?
a. Execute the Toffoli gate in the first qubit
b. Execute the Toffoli gate on all qubits
c. Execute the T gate on the first qubit
d. Execute the T gate on all qubits
2. In QASM, what does the command measure_all do?
a. Measure the qubit in the x-, y-, and z-bases.
b. Measure all the qubits in the z-basis.
c. Measure all the qubits in the x-, y-, and z-bases.
d. Nothing. This is an error.
3. What does the following symbol represent in the QASM display?
a. CNOT gate
b. Hadamard gate
c. Measurement
d. Error correction
4. What is the purpose of the error_model
depolarizing_channel?
a. To trap depolarizing errors
b. To trap any quantum error
c. To cause a random error between each operation on a qubit
d. To set up error trapping
Appendix
2. a.
3. b. 10
4. d. 5
5. a. 11
6. b. 17
7. a. 4.12
8. d.
9. a. Yes
10.
Chapter 2
1. 5 + 5i
2. 4 + 12i
3. −10 + 2i
4. 5/2 − i/2, or in decimal form 2.5 − 0.5i
5. = , or in decimal form 2.2361
6. a
7. −1. All Pauli matrices have a determinant of −1.
8. There is no difference.
9. c
10. All Pauli matrices have the eigenvalues +1 and −1.
Chapter 3
1. d. It is both a particle and a wave.
2. a. Particles have specific energy states rather than a continuum of
states.
3. b. No two fermions can occupy the same state within a quantum
system at the same time.
4. d. There can be up to six electrons, in pairs, and each pair has an
opposite spin.
5. a. A sequence that converges to an element in the vector space
6. c. Fourier transforms
7. d. It is an eigenvector corresponding to an operation.
8. a. The ket side of the notation
9. a. Planck’s black body radiation
Chapter 4
1. c. Anywhere
2. a. In a sequential fashion
3. a. Omega
4. c. Theta
5. a. Bubble sort
6. a. NAND
7. b. OR
8. d. NAND
9. c. They can be used to create any Boolean function.
10. d. Instruction Set Architecture
Chapter 5
1. b. .1
2. a. .55
3. c. .475
4. b. 4 ∉ A
5. b. The intersection of A and B
6. b. The sending computer
7. c. Noisy channel theorem
8. a. Adding the two entropies
9. a. Joint entropy
10. d. A density matrix
Chapter 6
1. b. 2 π is 360 degrees in radians.
2. c. The wave function
3. a. Born’s rule
4. d. The superposition of possible eigenstates collapses to a single
eigenstate based on
interaction with the environment.
5. b. 1
6. c. The wave function
7. c. Wigner function
8. d. Klein-Gordon
9. a. A 4 × 4 matrix with complex components
Chapter 7
1. b. It demonstrated that hidden variables are not responsible for
entanglement.
2. Calculate the tensor product of these two vectors:
3. a. 4
4. c. E91
5. b. decoherent histories interpretation
6. d. John Bell
7. d. Copenhagen interpretation
Chapter 8
1. b. Phase shift gates
2. a. Unit length and d. Orthonormal
3. d. Born’s rule
4. b. Gottesman–Knill Theorem
5. c. Quantum
6. b. Measurement
Chapter 9
1. c. To facilitate storing qubits in photons
2. a. State |0>
3. b. The motion of the ion in the saddle point
4. a. 4
5. b. Measurement plan
6. c. A degree or more kelvin above absolute zero
7. b. solid state
Chapter 10
1. c. Deutsch’s algorithm
2. b. Grover’s algorithm
3. c. Three
4. b. The period-finding portion
Chapter 11
1. b. log(N)
2. d. y2 = x3 + Ax + B
3. A discrete logarithm is some integer k that solves the equation
xk=y, where both x and y are elements of a finite group.
4. The system has two parameters called p and g. Parameter p is a
prime number, and parameter g (usually called a generator) is an
integer less than p, with the following property: for every number n
between 1 and p–1 inclusive, there is a power k of g such that n =
gk mod p. One public key is ga and the other is gb.
5. C = Me % n
6. Let n = pq and let m = (p–1)(q–1). Choose a small number, e, that’s
co-prime to m (note: two numbers are co-prime if they have no
common factors). Find d, such that de % m = 1.
Publish e and n as the public key and keep d and n as the secret key.
Chapter 12
1. c. It will need larger key sizes.
2. b. It will need to be replaced.
3. a, b, and c
4. b. Minimal
5. d. They are not predicated on specific mathematical problems that a
quantum computer
can solve.
Chapter 13
1. a. If G is a group under some operation, and H is a subset of G that
also forms a group under that operation, then H is a subgroup of G.
2. a and b
3. d. cyclic, shift
4. c. Shortest Integer Problem
5. b. NTRU
6. a. Ajtai
7. a. Ajtai
Chapter 14
1. d. A set, an identity element for each operation, two operations, and
their respective inverse operations
2. a. Matsumoto-Imai
3. b. Hidden Field Equations
4. d. MQDSS
5. b. Hidden Field Equations
Chapter 15
1. a. Merkle-Damgaard construction
2. d. McEliece
3. d. McEliece
4. a. Niederreiter
5. a. torsion group
6. b. isometric
Chapter 16
1. c. Result
2. a. iteration
3. b. Encapsulation
4. a. Microsoft.Quantum.Intrinsic
5. d. Rotate about a given Pauli axis.
Chapter 17
1. c. Execute the T gate on the first qubit
2. b. Measure all the qubits in the z-basis.
3. a. CNOT gate
4. c. To cause a random error between each operation on a qubit
Index
A
d orbitals, 66–67
data compression, 95
data structures
binary trees, 88
defined, 81
double-linked lists, 87
linked lists, 86–87
lists, 81–83
queues, 83–84
stacks, 85–86
data types in Q#293
Davisson, Clinton, 64
Davisson-Germer experiment, 64
de Barros, Charles, 253
de Broglie, Louis, 64
de Moivre, Abraham, 208
de Moivre number, 160, 208
De Morgan’s laws, 28, 112
decoherence, 129–131, 182–186
mechanics of, 182–184
noise amplification, 185–186
noise filtering, 186
supercooling, 185
decoherent histories interpretation, 145
degrees, radian conversion, 48, 71
degrees of freedom, 125, 156–157, 182–183
dequeuing, 83
derivatives, 124, 129
Descartes, Rene, 69
destinations, 112
determinant
of matrices, 17–19, 247
of Pauli matrices, 52–53
determination, probability versus, 65
Deutsch, David, 197
Deutsch-Jozsa algorithm, 199–200, 308, 326
Q# code for, 308–310
QASM code for, 326–327
Deutsch’s algorithm, 197–199
difference of sets, 26–27, 110
differential entropy, 115
differentiation, 73
Diffie, Whitfield, 216
Diffie-Hellman, 216–217, 231
digital certificates, 233–234
PKI (public key infrastructure), 237–238
revoking, 237
Digital Signature Algorithm, 225
Diophantus, 33
Dirac, Paul, 74, 131
Dirac equation, 132–133
Dirac notation, 74, 123, 155
discrete logarithm problem, 223–224, 231
disjoint sets, 110
distance between points for complex numbers, 41–43
distributed quantum computing, 190
distributivity
defined, 5
of sets, 28, 112
DiVencenzo, David, 177
diversity metrics in information theory, 116–118
division of complex numbers, 36–37
Dominance index, 117
dot products
inner products and, 52, 69, 125–126, 166–167
in lattice-based mathematics, 247
of vectors, 19–20
double complement of sets, 27, 110
double data type, 293
double-linked lists, 82, 87
double-slit experiment, 61–62
D-Wave architecture, 169–171
quantum annealing, 169–170
SQUIDs, 170–171
f orbitals, 67–68
factoring
integers, 213–216
RSA keys, 216
fail statements, 294
fermions, 68, 132, 134, 180
Feynman diagrams, 134–135
FFT (fast Fourier transform), 275
field theory, 131
fields, 10, 262, 282
FIFO (first in, first out), 83, 85
filtering noise, 186
finite fields, 282
first derivatives, 129
Fisher information, 115–116
flux qubits, 169
FOIL method, 35–36
for loops, 295–296
formulas. See equations
Fourier transforms, 71–73, 160–161, 207–208
Fredkin, Edward, 163
Fredkin gates, 163
functions, 295
functors, 306
idempotence, 257
identity elements, 8
identity matrices, 15–16
if statements, 295
imaginary numbers
on Cartesian coordinate system, 39
defined, 6, 33–34
symbol of, 34
Imai, Hideki, 264
immutables, 294
“Incoherent and Coherent Eavesdropping in the 6-state protocol of
Quantum Cryptography”(Bechmann-Pasquinnucc and Gisn), 151
independent event probability, 108
indicator function, 255
information source
defined, 112
Shannon’s source coding theorem, 113
information theory. See also probability
diversity metrics, 116–118
entropy, 113–116
defined, 114
diversity metrics, 116–118
formulas, 116
types of, 114–116
history of, 106
importance of, 106
noisy channel theorem, 113
quantum information theory, 118–119
Shannon’s source coding theorem, 113
terminology, 112
inheritance, 297
inhomogeneous histories, 145
injective, 158–159, 264
inner products, 52, 69, 125–126, 166–167
Instruction Set Architecture (ISA), 100
instructions (in computer architecture), 100
instructions (in QASM), 315–318
instructions per cycle, 102
int data type, 293
integers
as abelian group, 9
as cyclic group, 9
defined, 5–6
factoring, 213–216
greatest common denominator, 92–93
as group, 8
as ring, 9
set of, 7
symbol of, 34
integration, 72–73
Internet Protocol Security (IPsec), 239
interpretations
Copenhagen, 144
decoherent histories, 145
many-worlds, 144–145
objective collapse theory, 145–146
purpose of, 143–144
summary of, 146
intersection of sets, 26, 110
An Introduction to the Analysis of Algorithms, Second Edition
(Sedgewick), 88
inverse images, 285
Inverse Simpson index, 117
invertibility, 8
involutory matrices, 51
ions for physical qubits, 178–179
IPsec (Internet Protocol Security), 239
irrational numbers
defined, 6
history of, 33
symbol of, 34
irreducible polynomials, 263
ISA (Instruction Set Architecture), 100
Ising, Ernst, 164
Ising gates, 164–165
isogeny, 285
isometric, 285
isomorphisms, 246, 264
iterations, 294
Nakashima, Akira, 97
namespaces, 300–302
NAND logic gate, 98–99
natural numbers
defined, 5, 32–33
history of, 32–33
set of, 7
symbol of, 34
negative numbers, history of, 5–6, 33
NESSIE (New European Schemes for Signatures, Integrity and
Encryption) project, 269
networking. See quantum networking
neutrons, 133
Newton, Isaac, 61, 96
Niederreiter, Harald, 280
Niederreiter cryptosystem, 280–281
NMRQC (nuclear magnetic resonance quantum computing), 179
no-cloning theorem, 119
noise
amplification, 185–186
filtering, 186
noisy channel theorem, 113
nonlocality, 139, 140
non-relativistic spacetime, 130
NOR logic gate, 99
norm of vectors, 16, 20, 69, 245, 248
normalizers, 165–166
no-teleportation theory, 118–119
NTRU (N-th degree Truncated polynomial Ring Units), 249–252
key generation process, 250–251
polynomial rings, 249–250
standards, 251–252
nuclear magnetic resonance quantum computing (NMRQC), 179
number systems
history of, 32–34
properties of, 5
symbols of, 34
numbers. See also complex numbers
algebraic, 56
sets of, 6–8
transcendental, 56–57
types of, 5–6, 32–34
vectors as, 23
p orbitals, 66
P vs. NP problem, 93
Pan, Jian-Wei, 189
parallelogram law, 47
parameters, 295
partial derivatives, 124
particles. See also wave-particle duality; names of types of particles
(protons, neutrons, etc.)
defined, 64
entanglement, 75–76, 138–143
Feynman diagrams, 134–135
light as, 61–62
measurement, 127
position versus momentum, 70
quasiparticles, 187
types of, 179–180
wavelengths of, 64
Patarin, Jacques, 266
Paul, Wolfgang, 178
Paul ion traps, 178–179
Pauli, Wolfgang, 50, 68
pauli data type, 293
Pauli equation, 50
Pauli exclusion principle, 68
Pauli gates, 161–162
Pauli groups, 165–166
Pauli matrices
in controlled gates, 164
properties of, 52–56
representation of, 48–52, 161–162
Peano, Giuseppe, 4
Peikert’s Ring, 253–256
period-finding function in Shor’s algorithm, 206–209
phase shift gates, 161
phase space, 129–130
photoelectric effect, 63–64
photons
defined, 63
entanglement, 151
in Feynman diagrams, 134
measurement in BB84 protocol, 148–149
in noise filtering, 186
for physical qubits, 175–177
physical qubits, 174–182
Bose-Einstein condensate quantum computing, 179–180
correlation with logical qubits, 175
electrons for, 177–178
GaAs quantum dots, 181
ions for, 178–179
NMRQC, 179
number needed, 181–182, 230–231
photons for, 175–177
summary of, 181
physics. See also quantum physics
black body radiation, 62–63
entropy in, 113
nature of light, 61–62
photoelectric effect, 63–64
Pipher, Jill, 249
pivot points in quick sorts, 90–91
PKCS (Public-Key Cryptography Standards), 238
PKI (public key infrastructure), 237–238
PKIX (Public-Key Infrastructure X.509), 238
Planck, Max, 62–63, 64
Planck’s constant, 63, 64, 71, 124
Podolsky, Boris, 75, 139
points, distance between, 41–43
polar coordinates, 47–48
polarization of photons, 175–176
Politzer, David, 134
polymorphism, 297
polynomial rings, 249–250, 253–254, 276
polynomial time, 212–213
polynomials, 263, 276
pop (in stacks), 85
position, momentum versus, 70, 73
post-quantum cryptography. See quantum-resistant cryptography
power sets, 27–28, 111
powers in cyclic groups, 9
PP (probabilistically polynomial) problems, 201
primitive elements of groups, 9
primitive roots of unity, 254
principal quantum number, 65
printer buffers, 87
printer queues, 84
probabilistically polynomial (PP) problems, 201
probability
in atomic orbitals, 65–68
in Bell’s inequality, 142
defined, 107
determination versus, 65
Heisenberg uncertainty principle, 70–73
importance of, 106–107
in qubits, 155–157
rules of, 107–108
in wave function collapse, 128
programming languages
concepts in
comments, 302
control structures, 295–296
functions, 295
object-oriented programming, 297
statements, 293–294
variables, 292–293
Q#
bit flipping, 310
data types, 293
Deutsch-Jozsa algorithm code, 308–310
Grover’s algorithm code, 304–307
program structure, 294–295
statement types, 294
with Visual Studio Code, 298–303
QASM (Quantum Assembly Language), 314–315
commands, 319
Deutsch-Jozsa algorithm code, 326–327
error correction, 320–322
Grover’s algorithm code, 324–325
instructions, 315–318
project creation, 319–320
projection operators, 257
properties
of groups, 8
of matrices, 14
of number systems, 5
of Pauli matrices, 52–56
of sets, 28, 111–112
of vector spaces, 246
protons, 133
public key infrastructure (PKI), 237–238
Public-Key Cryptography Standards (PKCS), 238
Public-Key Infrastructure X.509 (PKIX), 238
push (in stacks), 85
Pythagoras, 33
Q# programming language
bit flipping, 310
data types, 293
Deutsch-Jozsa algorithm code, 308–310
Grover’s algorithm code, 304–307
program structure, 294–295
statement types, 294
with Visual Studio Code, 298–303
QASM (Quantum Assembly Language), 314–315
commands, 319
Deutsch-Jozsa algorithm code, 326–327
error correction, 320–322
Grover’s algorithm code, 324–325
instructions, 315–318
project creation, 319–320
QCD (quantum chromodynamics), 133–134
QDK (Quantum Development Kit), 298–300
QED (quantum electrodynamics), 131–133
QFT (quantum field theory), 131
QFT (quantum Fourier transform), 160–161, 207–208
QKE (quantum key exchange)
B92 protocol, 149
BB84 protocol, 146–149
E91 protocol, 151
implementations, 151
purpose of, 146
resources for information, 151
SARG04 protocol, 149–150
six-state protocol, 151
Tokyo QKD, 188
quanta, 62–63
quantum algorithms
Bernstein-Vazirani algorithm, 201–202
defined, 197
Deutsch-Jozsa algorithm, 199–200, 308, 326
Q# code for, 308–310
QASM code for, 326–327
Deutsch’s algorithm, 197–199
Grover’s algorithm, 209–210, 303–304, 322–323
Q# code for, 304–307
QASM code for, 324–325
Shor’s algorithm, 203–209
example of, 205–206
modulus operations in, 204–205
quantum period-finding function in, 206–209
Simon’s algorithm, 202–203
quantum annealing, 169–170
quantum architecture
D-Wave, 169–171
quantum annealing, 169–170
SQUIDs, 170–171
quantum circuits, 167–169
diagrams, 168–169
quantum gate notation, 167–168
reversible, 167
quantum logic gates
controlled, 163–164
Fredkin, 163
Gottesman-Knill theorem, 165–166
Hadamard, 159–161
Ising, 164–165
notation, 167–168
operation of, 166–167
Pauli, 161–162
phase shift, 161
reversible, 158–159
swap, 162–163
Toffoli, 163
qubits
defined, 154
mathematics of, 154–158
measurement, 157
probabilities, 155–157
qubit states, 154–155
Quantum Assembly Language (QASM), 314–315
commands, 319
Deutsch-Jozsa algorithm code, 326–327
error correction, 320–322
Grover’s algorithm code, 324–325
instructions, 315–318
project creation, 319–320
quantum bits. See qubits
quantum chromodynamics (QCD), 133–134
quantum circuits, 167–169
diagrams, 168–169
quantum gate notation, 167–168
reversible, 167
quantum data plane, 187
Quantum Development Kit (QDK), 298–300
quantum dots, 177, 181
quantum electrodynamics (QED), 131–133
quantum error correction
decoherence and, 184
in QASM, 320–322
quantum field theory (QFT), 131
quantum Fourier transform (QFT), 160–161, 207–208
quantum hardware
decoherence mitigation, 182–186
mechanics of decoherence, 182–184
noise amplification, 185–186
noise filtering, 186
supercooling, 185
quantum computer components, 187–188
quantum networking, 188–190
Beijing-Shanghai link, 189
distributed quantum computing, 190
Micius satellite, 189–190
Tokyo QKD, 188
qubits
Bose-Einstein condensate quantum computing, 179–180
correlation of physical and logical qubits, 175
electrons for, 177–178
GaAs quantum dots, 181
ions for, 178–179
NMRQC, 179
number needed, 181–182, 230–231
photons for, 175–177
physical realization of, 174–182
summary of, 181
size of computers, 184
topological quantum computing, 186–187
quantum information theory, 118–119
entropy in, 119
qubits, 118–119
resources for information, 119
quantum key exchange (QKE)
B92 protocol, 149
BB84 protocol, 146–149
E91 protocol, 151
implementations, 151
purpose of, 146
resources for information, 151
SARG04 protocol, 149–150
six-state protocol, 151
Tokyo QKD, 188
quantum logic gates
controlled, 163–164
correlation of physical and logical qubits, 175
Fredkin, 163
Gottesman-Knill theorem, 165–166
Hadamard, 99–100, 159–161
Ising, 164–165
matrix representation, 2
notation, 167–168
operation of, 166–167
Pauli, 161–162
phase shift, 161
in QASM, 316
reversible, 158–159
swap, 162–163
Toffoli, 163
quantum mechanics. See quantum physics
quantum networking, 188–190
Beijing-Shanghai link, 189
distributed quantum computing, 190
Micius satellite, 189–190
Tokyo QKD, 188
quantum oracles, 304
quantum period-finding function in Shor’s algorithm, 206–209
quantum physics
atomic structure, 65–68
Bohr model, 65
orbitals, 65–68
Pauli exclusion principle, 68
books on, 64
bra-ket notation, 74, 123
decoherence, 129–131
entanglement, 75–76, 138–143
Feynman diagrams, 134–135
Fourier transforms, 71–73
Hamiltonian formulation, 124–125
Heisenberg uncertainty principle, 70–73
Hilbert spaces, 68–70
history of
black body radiation, 62–63
nature of light, 61–62
photoelectric effect, 63–64
interpretations
Copenhagen, 144
decoherent histories, 145
many-worlds, 144–145
objective collapse theory, 145–146
purpose of, 143–144
summary of, 146
QCD (quantum chromodynamics), 133–134
QED (quantum electrodynamics), 131–133
QKE (quantum key exchange)
B92 protocol, 149
BB84 protocol, 146–149
E91 protocol, 151
implementations, 151
purpose of, 146
resources for information, 151
SARG04 protocol, 149–150
six-state protocol, 151
quantum states, 73–75
resources for information, 123
Schrödinger’s equation, 128–129
wave function collapse, 125–128
quantum states
coefficients of, 74
vector representation, 2, 46, 73–75, 123
quantum theory
defined, 122
QCD (quantum chromodynamics), 133–134
QED (quantum electrodynamics), 131–133
“The quantum theory of the emission and absorption of radiation”
(Dirac), 131
quantum wells, 177
quantum wires, 177
quantum-resistant cryptography
code-based cryptography, 230, 279
McEliece cryptosystem, 279–280
Niederreiter cryptosystem, 280–281
hash-based algorithms, 230, 232–233
Lamport signature, 277–278
Merkle-Damgaard construction, 275
requirements for, 274–275
SWIFFT, 275–277
lattice-based cryptography
GGH, 252–253
history of, 249
lattice reduction algorithms, 256–258
NTRU, 249–252
Peikert’s Ring, 253–256
problems used in, 230, 245, 248–249
multivariate cryptography, 230
HFE (Hidden Field Equations), 266–268
mathematics of, 262–264
Matsumoto-Imai algorithm, 264–266
MQDSS, 268–269
SFLASH, 269–270
summary of algorithms, 270
standards, 229
super-singular elliptic curve cryptography, 230, 281, 285–288
symmetric cryptography, 232
quantum-safe cryptography. See quantum-resistant cryptography
“Quantum-Theoretical Re-interpretation of Kinematic and Mechanical
Relations” (Heisenberg), 123
quarks, 133–134
quasiparticles, 187
qubit allocations, 294
qubit data type, 293
qubit states
BB84 protocol, 148–149
SARG04 protocol, 150
six-state protocol, 151
vector representation, 154–155
qubits
correlation of physical and logical qubits, 175
defined, 118–119, 154
flux, 169
logic gates. See quantum logic gates
mathematics of, 154–158
measurement, 157
probabilities, 155–157
qubit states, 154–155
no-cloning theorem, 119
no-teleportation theory, 118–119
physical realization of, 174–182
Bose-Einstein condensate quantum computing, 179–180
electrons for, 177–178
GaAs quantum dots, 181
ions for, 178–179
NMRQC, 179
number needed, 181–182, 230–231
photons for, 175–177
summary of, 181
SQUIDs, 170–171
supercooling, 185
queues, 83–84
quick sort algorithm, 90–91
s orbitals, 65–66
sampling problems, 170
SARG04 protocol, 149–150
scalar products. See inner products
scalar values, 17
scalars
defined, 11
eigenvalues, 20–23
matrix multiplication by, 11
vector multiplication by, 23–25
in vector space, 16
scaling vectors, 23–25
Schechter, L. M.253
Schlafi, Ludwig, 69
Schrödinger, Erwin, 128, 143
Schrödinger’s cat, 144
Schrödinger’s equation, 128–129
second derivatives, 129
Secure Shell (SSH), 240
Secure Socket Layer (SSL), 234–236
Sedgewick, Robert, 88
self-adjoint operators, 126, 129–130, 156
set theory, 25–28, 108–112
sets
defined, 25, 108
lists as, 82
notation, 25–26, 109
order in, 27, 110
power sets, 27–28
properties of, 28, 111–112
relationships, 26–27, 109–110
subsets, 27, 110–111
sets of numbers, 6–8
fields, 10
groups
abelian, 9
cyclic, 9
properties of, 8
rings, 9
SFLASH, 269–270
Shamir, Adi, 213
Shannon, Claude, 106, 112, 116
Shannon diversity index, 116–117
Shannon entropy, 114
Shannon’s source coding theorem, 113
Shannon-Weaver index, 116–117
shells, 65
Shor, Peter, 88, 203, 216
Shor’s algorithm, 88, 203–209
Diffie-Hellman and, 217
example of, 205–206
modulus operations in, 204–205
quantum computing impact on, 231
quantum period-finding function in, 206–209
RSA and, 216
Shor’s error correction code, 175
Short Integer Solution (SIS), 248
Shortest Vector Problem (SVP), 230, 245, 248
SIDH (supersingular isogeny Diffie-Hellman), 285–288
signal function, 255
Silverman, Joseph, 249
Simon’s algorithm, 202–203
Simpson index, 117
singlet state, 139
SIS (Short Integer Solution), 248
six-state protocol (SSP), 151
Sliding Windowed Infinite Fast Fourier Transform (SWIFFT), 275–277
sorting algorithms
bubble sort, 91–92
quick sort, 90–91
types of, 90
special relativity, 131
spin number, 132
square matrices
defined, 11
determinant of, 17
Hermitian, 49
unitary, 49
square roots
imaginary numbers and, 6, 33–34
of swap gates, 163
SQUIDs (superconducting qubits), 170–171
SSH (Secure Shell), 240
SSL (Secure Socket Layer), 234–236
SSP (six-state protocol), 151
stacks, 85–86
state space, 68
state vectors, 68
statements
defined, 293–294
in Q#294
Stewart, Balfour, 62
string data type, 293
subgroups, 245–246
submatrices, 14–15
subsets, 27, 110–111
subspaces, 25
subtraction of complex numbers, 35
superconducting qubits (SQUIDs), 170–171
supercooling, 185
super-singular elliptic curve cryptography, 230, 281, 285–288
surjective, 158–159, 264, 285
SVP (Shortest Vector Problem), 230, 245, 248
swap gates, 162–163
SWIFFT (Sliding Windowed Infinite Fast Fourier Transform), 275–277
symbols
of measurement, 168
of number systems, 34
of Pauli matrices, 50–51
of quantum gates, 167–168
symmetric cryptography, 95
quantum computing impact on, 232
unbounded queues, 84
uncertainty
entropy as, 114
Heisenberg uncertainty principle, 70–73, 130–131
unimodular matrices, 20, 247
union
in probability, 107
of sets, 26, 109
unit data type, 293
unit vectors, 16, 20, 68
unitary mapping, 166
unitary matrices
conjugate transpose and, 159
defined, 49
univariate polynomials, 263
universal gates, 99
using statements, 296
Y
Ylonen, Tatu, 240
Young, Thomas, 61