Essential Mathematics for Quantum Computing - Leonard S. Woody III - E-Book

Essential Mathematics for Quantum Computing E-Book

Leonard S. Woody III

0,0
21,59 €

-100%
Sammeln Sie Punkte in unserem Gutscheinprogramm und kaufen Sie E-Books und Hörbücher mit bis zu 100% Rabatt.

Mehr erfahren.
Beschreibung

Quantum computing is an exciting subject that offers hope to solve the world’s most complex problems at a quicker pace. It is being used quite widely in different spheres of technology, including cybersecurity, finance, and many more, but its concepts, such as superposition, are often misunderstood because engineers may not know the math to understand them. This book will teach the requisite math concepts in an intuitive way and connect them to principles in quantum computing.
Starting with the most basic of concepts, 2D vectors that are just line segments in space, you'll move on to tackle matrix multiplication using an instinctive method. Linearity is the major theme throughout the book and since quantum mechanics is a linear theory, you'll see how they go hand in hand. As you advance, you'll understand intrinsically what a vector is and how to transform vectors with matrices and operators. You'll also see how complex numbers make their voices heard and understand the probability behind it all.
It’s all here, in writing you can understand. This is not a stuffy math book with definitions, axioms, theorems, and so on. This book meets you where you’re at and guides you to where you need to be for quantum computing. Already know some of this stuff? No problem! The book is componentized, so you can learn just the parts you want. And with tons of exercises and their answers, you'll get all the practice you need.

Das E-Book können Sie in Legimi-Apps oder einer beliebigen App lesen, die das folgende Format unterstützen:

EPUB
MOBI

Seitenzahl: 192

Veröffentlichungsjahr: 2022

Bewertungen
0,0
0
0
0
0
0
Mehr Informationen
Mehr Informationen
Legimi prüft nicht, ob Rezensionen von Nutzern stammen, die den betreffenden Titel tatsächlich gekauft oder gelesen/gehört haben. Wir entfernen aber gefälschte Rezensionen.



Essential Mathematics for Quantum Computing

A beginner's guide to just the math you need without needless complexities

Leonard S. Woody III

BIRMINGHAM—MUMBAI

Essential Mathematics for Quantum Computing

Copyright © 2022 Packt Publishing

All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.

Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author(s), nor Packt Publishing or its dealers and distributors, will be held liable for any damages caused or alleged to have been caused directly or indirectly by this book.

Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.

Publishing Product Manager: Sunith Shetty

Senior Editor: Nathanya Dias

Content Development Editor: Sean Lobo

Technical Editor: Rahul Limbachiya

Copy Editor: Safis Editing

Project Coordinator: Aishwarya Mohan

Proofreader: Safis Editing

Indexer: Manju Arasan

Production Designer: Nilesh Mohite

Marketing Coordinator: Abeer Dawe

First published: April 2022

Production reference: 1170322

Published by Packt Publishing Ltd.

Livery Place

35 Livery Street

Birmingham

B3 2PB, UK.

ISBN 978-1-80107-314-1

www.packt.com

To my wife Jeanette, I owe you a debt of gratitude that I can only repay by loving you every day for the rest of my life, and fortunately for us, that will be easy.

I dedicate this book to my mom, Georgia Chandler Mapes, and my dad, Leonard Spencer Woody, Jr.

You raised me right!

And to my grammy, Patricia Dana Woody. You were my second mother and I love you and miss you terribly.

Acknowledgements

I would first like to acknowledge my technical reviewer, Emmanuel Knafo, Ph.D. He spent tireless hours reviewing this text and it would not be the book it is without him. Secondly, I would like to thank my close friend Sam Smith, who reviewed many chapters quickly and eagerly. Sam, Robin Smith, Rory Woods, and I came up together at Microsoft. Thank you for your friendship, our many happy hours, and help with the book. My first manager at Microsoft, my friend and mentor Omar Kouatly, allowed me to get started in this venture of quantum computing, encouraged me, and helped with the book as well. Thank you. Delbert Murphy, Darius Zakrzewski, and Jon Skerrett have been my "partners in crime" in exploring, learning, and sharing a passion for quantum computing. Thank you for your inspiration. Finally, my friend Matthew A. Kirsch helped with early copies of this text and earlier parts of my life. I thank you for those immeasurable contributions as well.

In the one year plus that it took to write this book, I needed support and advice. My great friend and spiritual mentor, Art Thompson, provided that in spades. Other close friends such as Graham Eddy, Carmel Maddox, Heather Downey, Patrick Sweet, Eli Rosenblatt, Rich Chetelat, Paul Varela, Benjamin Maddox, Nacho Dave, and Andy Brown have been there every step of the way during this tumultuous year.

No book is written alone and I would like to thank the people at Packt for working with me to make this book a reality. I would especially like to thank Sean Lobo, my editor, for sticking with me all the way through and his many hours spent reviewing this text.

Finally, I would like to thank my family, which includes Brandi Zahir and her children Zachary, Benjamin, and Caitlyn. To my children, you allowed me to write this book and gave up many hours with daddy so that I could finish it. I will always love you and you are the reason I exist. Thank you, Eva-Maria, Sophia, Johnny, and Alex. To my wife Jeanette of 17 years, you are the love of my life, my rock, my person. We have built quite a family together and I can't wait to live the rest of my life with you. And to who made this all possible, thank you, God.

Contributors

About the author

Leonard S. Woody III is a senior consultant with 20 years of experience explaining complex subjects to software development clients. For the last 3 years, he has worked at Microsoft, most currently as a program manager for Azure Quantum. He was awarded a BS in computer science and a BS in physics from the University of Virginia. He attained his MS in software engineering from George Mason University. Woody lives in Northern Virginia with his wife and four children. His biggest love is spending time with his family.

About the reviewers

Emmanuel Knafo, focusing on DevOps innovation and cloud architecture, helps organizations transform how to ideate, plan, execute, and learn from their technology investments. He obtained his Ph.D. in mathematics in number theory at the University of Toronto. He is a published author in various mathematical journals. He has published IT articles on the Microsoft Premier Developer Blog.

I would like to thank the author for this opportunity to re-ignite my passion for mathematics and physics by making me the technical reviewer for this book. It has been a thoroughly enjoyable experience! My passion for math was instilled by my father, Emile, and nurtured by my mother, Evelyne. Finally, I'm grateful to Audrey and the lights of our lives: Ethan and Adam.

Devika Mehra started her programming journey when she was 15 years old, which led to her never-ending zest to explore the boundless field of technology. She has an immense interest in the fields of security and quantum computing. She initially flexed her muscles in different programming languages and then focused on the development of Android applications. She is currently working with Microsoft Sentinel as a software engineer and develops security integration and analysis content for the end customer. She wishes to make the world a better place to live in and believes that technology can be a great catalyst to achieve this.

Srinjoy Ganguly works as a quantum AI research scientist at Fractal Analytics. He has 4+ years of experience in quantum computing, and is an IBM Qiskit advocate and educator. He also teaches quantum computing at Woxsen University as a visiting professor. His research interests include QNLP, category theory with compositionality, variational quantum algorithms and their applications, and machine learning.

Table of Contents

Preface

Section 1: Introduction

Chapter 1: Superposition with Euclid

Vectors

Vector addition

Scalar multiplication

Linear combinations

Superposition

Measurement

Summary

Answers to exercises

Exercise 1

Exercise 2

Chapter 2: The Matrix

Defining a matrix

Notation

Redefining vectors

Simple matrix operations

Addition

Scalar multiplication

Transposing a matrix

Defining matrix multiplication

Multiplying vectors

Matrix-vector multiplication

Matrix multiplication

Properties of matrix multiplication

Special types of matrices

Square matrices

Identity matrices

Quantum gates

Logic gates

Circuit model

Summary

Answers to exercises

Exercise 1

Exercise 2

Exercise 3

Exercise 4

Exercise 5

References

Section 2: Elementary Linear Algebra

Chapter 3: Foundations

Sets

The definition of a set

Notation

Important sets of numbers

Tuples

The Cartesian product

Functions

The definition of a function

Exercise 1

Invertible functions

Binary operations

The definition of a binary operation

Properties

Groups

Fields

Exercise 2

Vector space

Summary

Answers to Exercises

Exercise 1

Exercise 2

Works cited

Chapter 4: Vector Spaces

Subspaces

Definition

Examples

Exercise 1

Linear independence

Linear combination

Linear dependence

Span

Basis

Dimension

Summary

Answers to exercises

Exercise 1

Chapter 5: Using Matrices to Transform Space

Linearity

What is a linear transformation?

Describing linear transformations

Representing linear transformations with matrices

Matrices depend on the bases chosen

Matrix multiplication and multiple transformations

The commutator

Transformations inspired by Euclid

Translation

Rotation

Projection

Exercise two

Linear operators

Linear functionals

A change of basis

Summary

Answers to exercises

Exercise one

Exercise two

Works cited

Section 3: Adding Complexity

Chapter 6: Complex Numbers

Three forms, one number

Definition of complex numbers

Cartesian form

Addition

Multiplication

Exercise 1

Complex conjugate

Absolute value or modulus

Division

Powers of i

Polar form

Polar coordinates

Exercise 3

Defining complex numbers in polar form

Example

Multiplication and division in polar form

Example

De Moivre's theorem

The most beautiful equation in mathematics

Exponential form

Exercise 4

Conjugation

Multiplication

Example

Conjugate transpose of a matrix

Bloch sphere

Summary

Exercises

Exercise 1

Exercise 2

Exercise 3

Exercise 4

References

Chapter 7: EigenStuff

The inverse of a matrix

Determinants

Exercise one

The invertible matrix theorem

Calculating the inverse of a matrix

Exercise two

Eigenvalues and eigenvectors

Definition

Example with a matrix

The characteristic equation

Finding eigenvectors

Multiplicity

Trace

The special properties of eigenvalues

Summary

Answers to exercises

Exercise one

Exercise two

Chapter 8: Our Space in the Universe

The inner product

Orthonormality

The norm

Orthogonality

Orthonormal vectors

The Kronecker delta function

The outer product

Exercise two

Operators

Representing an operator using the outer product

Exercise 3

The completeness relation

The adjoint of an operator

Types of operators

Normal operators

Hermitian operators

Unitary operators

Projection operators

Positive operators

Tensor products

The tensor product of vectors

Exercise four

The basis of tensor product space

Exercise five

The tensor product of operators

Exercise six

The inner product of composite vectors

Exercise seven

Summary

Answers to exercises

Exercise one

Exercise two

Exercise three

Exercise four

Exercise five

Exercise six

Exercise seven

Chapter 9: Advanced Concepts

Gram-Schmidt

Cauchy-Schwarz and triangle inequalities

Spectral decomposition

Diagonal matrices

Spectral theory

Example

Bra-ket notation

Example take two

Singular value decomposition

Polar decomposition

Operator functions and the matrix exponential

Summary

Works cited

Section 4: Appendices

Appendix 1: Bra–ket Notation

Operators

Bras

Appendix 2: Sigma Notation

Sigma

Variations

Summation rules

Appendix 3: Trigonometry

Measuring angles

Degrees

Radians

Trigonometric functions

Formulas

Summary

The trig cheat sheet

Pythagorean identities

Double angle identities

Sum/difference identities

Product-to-sum identities

Works cited

Appendix 4: Probability

Definitions

Random variables

Discrete random variables

The measures of a random variable

Summary

Works cited

Appendix 5: References

Other Books You May Enjoy

Preface

This book is written for software developers and tech enthusiasts that have not learned the math required for quantum computing either in many years or possibly not at all. Quantum computing is based on a combination of quantum mechanics and computer science. These two subjects, quantum mechanics and computer science, are built on a foundation of math, as the following diagram illustrates:

Figure 1 – Diagram of relationship of math to quantum computing

Making sure your foundation is well built as you dive into quantum computing is paramount to your long-term success in the field. Notice that I said "as you dive" instead of "before you dive," because you should do cool quantum computing stuff as you are learning the relevant math. We do that in the very first chapter, Chapter 1, Superposition with Euclid, and almost every chapter after that. It's important that you see how the math connects to actual quantum computing.

How to use this book

Let's answer the question of how you should learn the math of quantum computing using this book. Everyone is different, but the steps we used in school work really well (with a few tweaks):

**READ THIS AWESOME BOOK!**Watch YouTube videos – here are a couple of playlists to get you started:Essence of linear algebra by 3Blue1Brown (https://tinyurl.com/233ruczb)Linear Algebra: An In-Depth Introduction by MathTheBeautiful (https://tinyurl.com/464dvc4b)Exercise – do actual math problems. You don't learn a sport by just reading a book and watching some videos. You have to do it! This book has you covered with exercises in every chapter.

I'd like to add three more steps to make sure you don't lose enthusiasm:

Go do some cool quantum computing stuff with your newfound knowledge.Get stuck.Come back to the book and start again at Step 1 to get unstuck.

Now I'd like to quickly talk about who this book is for.

Who this book is for

I don't assume much in terms of mathematical training. A general high school study of math is all you need and even then, I include appendices to review subjects such as trigonometry if you need it. The most important prerequisite is an enthusiasm for quantum computing.

I'll quickly say this book is not for graduate students, mathematicians, physicists, and rocket scientists in general. You probably know all this stuff already. But it might show you a new way to teach it.

What this book is not

This is not an overall introduction to quantum computing. We will most certainly connect the math to quantum computing and do some actual quantum computing. But in the end, this is a math book. There are great books out there that give a general introduction to quantum computing. A personal favorite of mine is Quantum Computing Explained by David McMahon and there are more included in the appendix of references I have used for the book.

Download the color images

We also provide a PDF file that has color images of the screenshots and diagrams used in this book. You can download it here: https://static.packt-cdn.com/downloads/9781801073141_ColorImages.pdf.

Conventions used

There are a number of text conventions used throughout this book.

Bold: Indicates a new term, an important word, or words that you see onscreen. For instance, words in menus or dialog boxes appear in bold. Here is an example: "Select System info from the Administration panel."

Tips or Important Notes

Appear like this.

Get in touch

Feedback from our readers is always welcome.

General feedback: If you have questions about any aspect of this book, email us at [email protected] and mention the book title in the subject of your message.

Errata: Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you have found a mistake in this book, we would be grateful if you would report this to us. Please visit www.packtpub.com/support/errata and fill in the form.

Piracy: If you come across any illegal copies of our works in any form on the internet, we would be grateful if you would provide us with the location address or website name. Please contact us at [email protected] with a link to the material.

If you are interested in becoming an author: If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, please visit authors.packtpub.com.

Share Your Thoughts

Once you've read Essential Mathematics for Quantum Computing, we'd love to hear your thoughts! Please click here to go straight to the Amazon review page for this book and share your feedback.

Your review is important to us and the tech community and will help us make sure we're delivering excellent quality content.

Section 1: Introduction

This section starts the book off with easy concepts such as vectors and matrices.

The following chapters are included in this section:

Chapter 1, Superposition with EuclidChapter 2, The Matrix

Chapter 1: Superposition with Euclid

Mathematics is the language of physics and the foundation of computer science. Since quantum computing evolved from these two disciplines, it is essential to understand the mathematics behind it. The math you need is linear in nature, and that is where we will start. By the time we are done, you will have the mathematical foundation to fundamentally understand quantum computing. Let's get started!

In this chapter, we are going to cover the following main topics:

VectorsLinear combinationsSuperposition

Vectors

A long time ago in a country far, far away, there lived an ancient Greek mathematician named Euclid. He wrote a book that defined space using only three dimensions. We will use his vector space to define superposition in quantum computing. Don't be fooled—vector spaces have evolved tremendously since Euclid's days, and our definition of them will evolve too as the book progresses. But for now, we will stick to real numbers, and we'll actually only need two out of the three dimensions Euclid proposed.

To start, we will define a Euclidean vector as being a line segment with a length or magnitude and pointing in a certain direction, as shown in the following screenshot:

Figure 1.1 – Euclidean vector

Two vectors are equal if they have the same length and direction, so the following vectors are all equal:

Figure 1.2 – Equal vectors

Vectors can be represented algebraically by their components. The simplest way to do this is to have them start at the origin (the point (0,0)) and use their x and y coordinates, as shown in the following screenshot:

Figure 1.3 – Vectors represented geometrically and algebraically

You should note that I am using a special notation to label the vectors. It is called bra-ket notation. The appendix has more information on this notation, but for now, we will use a vertical bar or pipe, |, followed by the variable name for the vector and then an angle bracket, ⟩, to denote a vector (for example, |a⟩). The coordinates of our vectors will be enclosed in brackets [ ]. The x coordinate will be on top and the y coordinate on the bottom. Vectors are also called "kets" in this notation—for example, ket a, but for now, we will stick with the name vector.

Vector addition

So, it ends up that we can add vectors together both geometrically and algebraically, as shown in the following screenshot:

Figure 1.4 – Vector addition

As you can see, we can take vectors and move them in the XY-plane as long as we preserve their length and direction. We have taken the vector |b⟩ from our first graph and moved its start position to the end of vector |a⟩. Once we do that, we can draw a third vector |c⟩ that connects the start of |a⟩ and the end of |b⟩ to form their sum. If we look at the coordinates of |c⟩, it is four units in the x direction and zero units in the y direction. This corresponds to the answer we see on the right of Figure 1.4.

We can also do this addition without the help of a graph, as shown on the right of Figure 1.4. Just adding the first components (3 and 1) gives 4, and adding the second components of the vectors (2 and -2) gives 0. Thus, vector addition works both geometrically and algebraically in two dimensions. So, let's look at an example.

Example

What is the sum of |m⟩ and |n⟩ here?

The solution is:

Exercise 1

Now, you try. The answers are at the end of this chapter:

What is |m⟩ - |n⟩?What is |n⟩ - |m⟩?Solve the following expression (notice we use three-dimensional (3D) vectors, but everything works the same):

Scalar multiplication

We can also multiply our vectors by numbers or scalars. They are called scalars because they "scale" a vector, as we will see. The following screenshot shows a vector that is multiplied by a number on the left and the same thing algebraically on the right:

Figure 1.5 – Scalar multiplication

The vector |b⟩ is doubled or multiplied by two. Geometrically, we take the vector |b⟩ and scale its length by two while preserving its direction. Algebraically, we can just multiply the components of the vector by the number or scalar two.

Example

What is triple the vector |x⟩ shown here?

The solution is:

Exercise 2

What is 4|x⟩?What is -2|x⟩?

Linear combinations

Once we have established that we can add our vectors and multiply them by scalars, we can start to talk about linear combinations. Linear combinations are just the scaling and addition of vectors to form new vectors. Let's start with our two vectors we have been working with the whole time, |a⟩ and |b⟩. I want to scale my vector |a⟩ by two to get a new vector |c⟩, as shown in the following screenshot:

Figure 1.6 – |a⟩ scaled by two to produce |c⟩

As we have said, we can do this algebraically as well, as the following equation shows:

Then, I want to take my vector |b⟩ and scale it by two to get a new vector, |d⟩, as shown in the following screenshot:

Figure 1.7 – |b⟩ scaled by two to produce |d⟩

So, now, we have a vector |c⟩ that is two times |a⟩, and a vector |d⟩ that is two times |b⟩:

Can I add these two new vectors, |c⟩ and |d⟩? Certainly! I will do that, but I will express |e⟩ as a linear combination of |a⟩ and |b⟩ in the following way:

Vector |e⟩ is a linear combination of vectors |a⟩ and |b⟩! Now, I can show this all geometrically, as follows:

Figure 1.8 – Linear combination

This can also be represented in the following equation:

So, we now have a firm grasp on Euclidean vectors, the algebra you can perform with them, and the concept of a linear combination. We will use that in this next section to describe a quantum phenomenon called superposition.

Superposition

Superposition can be a very imposing term, so before we delve into it, let's take a step back and talk about the computers we use today. In quantum computing, we call these computers "classical computers" to distinguish them from quantum computers. Classical computers use binary digits—or bits, for short—to store ones and zeros. These ones and zeros can represent anything, from truth values to characters to pixel values on a screen! They are physically implemented using any two-state device such as an electrical switch that is either on or off.

A quantum bit, or qubit for short, is the analogous building block of quantum computers. They are implemented by anything that demonstrates quantum phenomena, which means they are very, very small. In the following screenshot, we show how a property of an electron—namely spin—can be used to represent a one or zero of a qubit:

Figure 1.9 – Pair of electrons with a spin labeled 1 and 0

Physicists use mathematics to model quantum phenomena, and guess what they use to model the state of a quantum particle? That's right! Vectors! Quantum computer scientists have taken two of these states and labeled them as the canonical one and zero for qubits. They are shown in the following screenshot:

Figure 1.10 – Zero and one states

As you can see, the zero and one states are just vectors on the x and y axes with a length of one unit each. When you combine a lot of ones and zeros in classical computing, wonderful, complex things can be done. The same is true of the zero and one state of qubits in quantum computing.

Greek Letters

Mathematicians and physicists love Greek letters, and they have found their way into quantum computing in several places. The Greek letter "Psi", ψ, is often used to represent the state of a qubit. The Greek letters "alpha", α, and "beta", β, are used to represent numbers or scalars.

While qubits can represent a one or a zero, they have a superpower in that they can represent a combination of a zero and one as well! "How?" you might ask. Well, this is where superposition comes in. Understanding it is actually quite simple from a mathematical standpoint. In fact, you already know what it is! It's just a fancy way of saying that a qubit is in a linear combination of states.

If you recall, we defined the vector |e⟩ as a linear combination of the aforementioned |a⟩ and |b⟩