Home Data Essential Mathematics for Quantum Computing

Essential Mathematics for Quantum Computing

By Leonard S. Woody III
ai-assist-svg-icon Book + AI Assistant
eBook + AI Assistant $42.99 $29.99
Print $52.99
Subscription $15.99 $10 p/m for three months
ai-assist-svg-icon NEW: AI Assistant (beta) Available with eBook, Print, and Subscription.
ai-assist-svg-icon NEW: AI Assistant (beta) Available with eBook, Print, and Subscription. $10 p/m for first 3 months. $15.99 p/m after that. Cancel Anytime! ai-assist-svg-icon NEW: AI Assistant (beta) Available with eBook, Print, and Subscription.
What do you get with a Packt Subscription?
Gain access to our AI Assistant (beta) for an exclusive selection of 500 books, available during your subscription period. Enjoy a personalized, interactive, and narrative experience to engage with the book content on a deeper level.
This book & 7000+ ebooks & video courses on 1000+ technologies
60+ curated reading lists for various learning paths
50+ new titles added every month on new and emerging tech
Early Access to eBooks as they are being written
Personalised content suggestions
Customised display settings for better reading experience
50+ new titles added every month on new and emerging tech
Playlists, Notes and Bookmarks to easily manage your learning
Mobile App with offline access
What do you get with a Packt Subscription?
This book & 6500+ ebooks & video courses on 1000+ technologies
60+ curated reading lists for various learning paths
50+ new titles added every month on new and emerging tech
Early Access to eBooks as they are being written
Personalised content suggestions
Customised display settings for better reading experience
50+ new titles added every month on new and emerging tech
Playlists, Notes and Bookmarks to easily manage your learning
Mobile App with offline access
What do you get with eBook + Subscription?
Download this book in EPUB and PDF formats, plus a monthly download credit
This book & 6500+ ebooks & video courses on 1000+ technologies
60+ curated reading lists for various learning paths
50+ new titles added every month on new and emerging tech
Early Access to eBooks as they are being written
Personalised content suggestions
Customised display settings for better reading experience
50+ new titles added every month on new and emerging tech
Playlists, Notes and Bookmarks to easily manage your learning
Mobile App with offline access
What do you get with a Packt Subscription?
Gain access to our AI Assistant (beta) for an exclusive selection of 500 books, available during your subscription period. Enjoy a personalized, interactive, and narrative experience to engage with the book content on a deeper level.
This book & 6500+ ebooks & video courses on 1000+ technologies
60+ curated reading lists for various learning paths
50+ new titles added every month on new and emerging tech
Early Access to eBooks as they are being written
Personalised content suggestions
Customised display settings for better reading experience
50+ new titles added every month on new and emerging tech
Playlists, Notes and Bookmarks to easily manage your learning
Mobile App with offline access
What do you get with eBook?
Along with your eBook purchase, enjoy AI Assistant (beta) access in our online reader for a personalized, interactive reading experience.
Download this book in EPUB and PDF formats
Access this title in our online reader
DRM FREE - Read whenever, wherever and however you want
Online reader with customised display settings for better reading experience
What do you get with video?
Download this video in MP4 format
Access this title in our online reader
DRM FREE - Watch whenever, wherever and however you want
Online reader with customised display settings for better learning experience
What do you get with video?
Stream this video
Access this title in our online reader
DRM FREE - Watch whenever, wherever and however you want
Online reader with customised display settings for better learning experience
What do you get with Audiobook?
Download a zip folder consisting of audio files (in MP3 Format) along with supplementary PDF
What do you get with Exam Trainer?
Flashcards, Mock exams, Exam Tips, Practice Questions
Access these resources with our interactive certification platform
Mobile compatible-Practice whenever, wherever, however you want
ai-assist-svg-icon NEW: AI Assistant (beta) Available with eBook, Print, and Subscription. ai-assist-svg-icon NEW: AI Assistant (beta) Available with eBook, Print, and Subscription. BUY NOW $10 p/m for first 3 months. $15.99 p/m after that. Cancel Anytime! ai-assist-svg-icon NEW: AI Assistant (beta) Available with eBook, Print, and Subscription.
eBook + AI Assistant $42.99 $29.99
Print $52.99
Subscription $15.99 $10 p/m for three months
What do you get with a Packt Subscription?
Gain access to our AI Assistant (beta) for an exclusive selection of 500 books, available during your subscription period. Enjoy a personalized, interactive, and narrative experience to engage with the book content on a deeper level.
This book & 7000+ ebooks & video courses on 1000+ technologies
60+ curated reading lists for various learning paths
50+ new titles added every month on new and emerging tech
Early Access to eBooks as they are being written
Personalised content suggestions
Customised display settings for better reading experience
50+ new titles added every month on new and emerging tech
Playlists, Notes and Bookmarks to easily manage your learning
Mobile App with offline access
What do you get with a Packt Subscription?
This book & 6500+ ebooks & video courses on 1000+ technologies
60+ curated reading lists for various learning paths
50+ new titles added every month on new and emerging tech
Early Access to eBooks as they are being written
Personalised content suggestions
Customised display settings for better reading experience
50+ new titles added every month on new and emerging tech
Playlists, Notes and Bookmarks to easily manage your learning
Mobile App with offline access
What do you get with eBook + Subscription?
Download this book in EPUB and PDF formats, plus a monthly download credit
This book & 6500+ ebooks & video courses on 1000+ technologies
60+ curated reading lists for various learning paths
50+ new titles added every month on new and emerging tech
Early Access to eBooks as they are being written
Personalised content suggestions
Customised display settings for better reading experience
50+ new titles added every month on new and emerging tech
Playlists, Notes and Bookmarks to easily manage your learning
Mobile App with offline access
What do you get with a Packt Subscription?
Gain access to our AI Assistant (beta) for an exclusive selection of 500 books, available during your subscription period. Enjoy a personalized, interactive, and narrative experience to engage with the book content on a deeper level.
This book & 6500+ ebooks & video courses on 1000+ technologies
60+ curated reading lists for various learning paths
50+ new titles added every month on new and emerging tech
Early Access to eBooks as they are being written
Personalised content suggestions
Customised display settings for better reading experience
50+ new titles added every month on new and emerging tech
Playlists, Notes and Bookmarks to easily manage your learning
Mobile App with offline access
What do you get with eBook?
Along with your eBook purchase, enjoy AI Assistant (beta) access in our online reader for a personalized, interactive reading experience.
Download this book in EPUB and PDF formats
Access this title in our online reader
DRM FREE - Read whenever, wherever and however you want
Online reader with customised display settings for better reading experience
What do you get with video?
Download this video in MP4 format
Access this title in our online reader
DRM FREE - Watch whenever, wherever and however you want
Online reader with customised display settings for better learning experience
What do you get with video?
Stream this video
Access this title in our online reader
DRM FREE - Watch whenever, wherever and however you want
Online reader with customised display settings for better learning experience
What do you get with Audiobook?
Download a zip folder consisting of audio files (in MP3 Format) along with supplementary PDF
What do you get with Exam Trainer?
Flashcards, Mock exams, Exam Tips, Practice Questions
Access these resources with our interactive certification platform
Mobile compatible-Practice whenever, wherever, however you want
  1. Free Chapter
    Chapter 1: Superposition with Euclid
About this book
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.
Publication date:
April 2022
Publisher
Packt
Pages
252
ISBN
9781801073141

 

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:

  • Vectors
  • Linear combinations
  • Superposition
 

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

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

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

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

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

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⟩

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⟩

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

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

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

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, like so:

Figure 1.11 – Definition of |e⟩

Figure 1.11 – Definition of |e

If we replace those letters and numbers with the Greek letters and the zero and one states we just introduced, we get an equation like this:

Figure 1.12 – Greek letters being transposed onto a linear combination equation

Figure 1.12 – Greek letters being transposed onto a linear combination equation

The bottom equation represents a qubit in the state |ψ, which is a superposition of the states zero and one! You now know what superposition is mathematically! This, by the way, is the only way that counts because math is the language of physics and, therefore, quantum computing.

Measurement

But wait—there's more! With only the simple mathematics you have acquired so far, you also get a look at the weird act of measuring qubits. The scalars α and β shown previously play a crucial role when measuring qubits. In fact, if we were to set this qubit up in the state |ψ an infinite number of times, when we measured it for a zero or a one, |α|2 would give us the probability of getting a zero, and |β|2 would give us the probability of getting a one. Pretty cool, eh!?!

So, here is a question. For the qubit state |ψ in the following equation, what is the probability of getting a zero or a one when we measure it?

Well, if we said |α|2 gives us the probability of getting a zero, then the answer would look like this:

This tells us that one half or 50% of the time when we measure for a zero or a one, we will get a zero. We can do the same exact math for β and derive that the other half of the time when we measure, we will get a one. The state |ψ shown previously represents the proverbial coin being flipped into the air and landing heads for a one and tails for a zero.

 

Summary

In a short amount of time, we have developed enough mathematics to explain superposition and its effects on measurement. We did this by introducing Euclidean vectors and the operations of addition and scalar multiplication upon them. Putting these operations together, we were able to get a definition for a linear combination and then apply that definition to what is termed superposition. In the end, we could use all of this to predict the probability of getting a zero or one when measuring a qubit.

In the next chapter, we will introduce the concept of a matrix and use it to manipulate qubits!

History (Optional)

Euclidean vectors are named after the Greek mathematician Euclid circa 300 BC. In his book, The Elements, he puts together postulates and theories from other Greek mathematicians, including Pythagoras, that defined Euclidean geometry. The book was a required textbook for math students for over 2,000 years.

Figure 1.13 – Euclid with other Greek mathematicians in Raphael's School of Athens

Figure 1.13 – Euclid with other Greek mathematicians in Raphael's School of Athens

 

Answers to exercises

Exercise 1

a)

b)

c)

Exercise 2

a)

b)

About the Author
  • Leonard S. Woody III

    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.

    Browse publications by this author
Latest Reviews (1 reviews total)
Good book for scientist and engineers willing to dive into Quantum computing.
Essential Mathematics for Quantum Computing
Unlock this book and the full library FREE for 7 days
Start now