Table Of ContentEssential
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
1
Superposition with Euclid
Vectors 3 Measurement 13
Vector addition 5
Summary 13
Scalar multiplication 7
Answers to exercises 15
Linear combinations 8 Exercise 1 15
Superposition 11 Exercise 2 15
2
The Matrix
Defining a matrix 18 Matrix multiplication 29
Notation 19 Properties of matrix multiplication 32
Redefining vectors 19
Special types of matrices 33
Simple matrix operations 20 Square matrices 33
Addition 20 Identity matrices 33
Scalar multiplication 21
Quantum gates 34
Transposing a matrix 22
Logic gates 34
Defining matrix multiplication 23 Circuit model 36
Multiplying vectors 24
Summary 37
Matrix-vector multiplication 26
viii Table of Contents
Answers to exercises 37 Exercise 4 37
Exercise 1 37 Exercise 5 38
Exercise 2 37
References 38
Exercise 3 37
Section 2: Elementary Linear Algebra
3
Foundations
Sets 42 Properties 52
The definition of a set 42
Groups 52
Notation 42
Fields 53
Important sets of numbers 43
Exercise 2 53
Tuples 45
The Cartesian product 45 Vector space 54
Functions 46 Summary 55
The definition of a function 47 Answers to Exercises 55
Exercise 1 48 Exercise 1 55
Invertible functions 48 Exercise 2 55
Binary operations 51 Works cited 56
The definition of a binary operation 51
4
Vector Spaces
Subspaces 58 Span 64
Definition 58 Basis 68
Examples 59 Dimension 71
Exercise 1 61
Summary 71
Linear independence 62 Answers to exercises 72
Linear combination 62 Exercise 1 72
Linear dependence 62
Table of Contents ix
5
Using Matrices to Transform Space
Linearity 74 Rotation 89
What is a linear transformation? 77 Projection 94
Exercise two 95
Describing linear transformations 77
Linear operators 96
Representing linear
transformations with matrices 83 Linear functionals 97
Matrices depend on the bases chosen 84 A change of basis 98
Matrix multiplication and multiple Summary 100
transformations 87
Answers to exercises 101
The commutator 87
Exercise one 101
Transformations inspired Exercise two 101
by Euclid 88
Works cited 101
Translation 88
Section 3: Adding Complexity
6
Complex Numbers
Three forms, one number 106 Defining complex numbers in polar
form 116
Definition of complex numbers 106
Example 117
Cartesian form 107 Multiplication and division in
Addition 108 polar form 118
Multiplication 109 Example 118
Exercise 1 111 De Moivre's theorem 119
Complex conjugate 111
The most beautiful equation
Absolute value or modulus 112
in mathematics 119
Division 112
i 113 Exponential form 120
Powers of
Exercise 4 120
Polar form 114
Conjugation 120
Polar coordinates 114 Multiplication 121
Exercise 3 116 Example 121